SDK Documentation

Software Development Kit v4


AbstractCerosSDK



Class

Parameters

  • eventHandler EventHandler
  • experienceTracker EmbeddedExperienceTracker

findExperience

Find an experience object on the page.

Parameters
  • experienceId string The experience’s ID, taken from the SDK panel.


CerosComponent



A component object on the canvas.

Parameters

  • componentData object
  • messenger CrossFrameMessenger
  • eventHandler EventHandler
  • experienceId string
  • page CerosPage

getPayload

Returns any payload you have configured for the component in the Studio. Returns string The payload of the component

getTags

Get the tags assigned to this layer in the studio. Returns Array<string> An array of tags that were assigned to this layer.

getWidth

Returns the unscaled width of this component (the width as seen in the Ceros Studio) Returns int

getHeight

Returns the unscaled height of this component (the height as seen in the Ceros Studio) Returns int

getX

Returns the x position of this component after any entry animations have completed Returns int

getY

Returns the y position of this component after any entry animations have completed Returns int

getText

Returns the text content of this component. If the component is not of type ‘text’, this will return undefined. Returns (string | undefined)

getFullResolutionUrl

Returns the URL of the full-resolution version of this image. If this component is not an image, this will return undefined. Returns (string | undefined)

getPage

Returns the CerosPage that this component belongs to. Returns CerosPage

isVideoComponent

Is this a video? Returns boolean

isImageComponent

Is this an image? Returns boolean

isTextComponent

Is this text? Returns boolean

startVideo

If this component is a video, this will start video playback.

stopVideo

If this component is a video, this will stop video playback.

setText

If this component is a text component, this will set the text content on it. Parameters
  • textContent string The text to display in the text component

setUrl

If this component is an image component, this will set the src of that image to the url provided. Parameters

reset

If this is a text component, this resets the text content back to the original text provided in the Studio. If this is an image component, this resets the image src back to the original url.

click

Simulates the user clicking on this component. Any click interactions that have been configured for this component in the studio will be triggered.

show

Makes this component visible, and runs any entry animations that have been configured for this component in the studio. If the component is already visible, this will only have the effect of running entry animations.

hide

Hides the component. If the component is already hidden, this will have no effect.

subscribe

Subscribes to events fired on this specific component. Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosComponentCollection



A collection of component objects from the canvas, allowing them to be manipulated in bulk.

Parameters

findComponentsByTag

Retrieve all components with the given tag from the collection. Parameters
  • tag string The name of the tag to search with.
Returns CerosComponentCollection

click

Simulates the user clicking on all components in this collection. Any interactions that have been configured in the Studio for these components will be triggered.

startVideo

If any of these components are videos, this will start video playback on them.

stopVideo

If any of these components are videos, this will stop video playback on them.

setText

If any of these components are text components, this will set the text content on them. Parameters
  • textContent string The text to display in the text component

show

Makes these components visible, and runs any entry animations that have been configured for these components in the studio. If a component is already visible, this will only have the effect of running entry animations on that component.

hide

Hides the components. If a component is already hidden, this will have no effect on that component.

reset

Resets any text or image components in the collection back to their original text content or url, respectively.

subscribe

Subscribes to events fired on these specific components. Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosExperience



A component object on the canvas.

Parameters

  • componentData object
  • messenger CrossFrameMessenger
  • eventHandler EventHandler
  • experienceId string
  • page CerosPage

getPayload

Returns any payload you have configured for the component in the Studio. Returns string The payload of the component

getTags

Get the tags assigned to this layer in the studio. Returns Array<string> An array of tags that were assigned to this layer.

getWidth

Returns the unscaled width of this component (the width as seen in the Ceros Studio) Returns int

getHeight

Returns the unscaled height of this component (the height as seen in the Ceros Studio) Returns int

getX

Returns the x position of this component after any entry animations have completed Returns int

getY

Returns the y position of this component after any entry animations have completed Returns int

getText

Returns the text content of this component. If the component is not of type ‘text’, this will return undefined. Returns (string | undefined)

getFullResolutionUrl

Returns the URL of the full-resolution version of this image. If this component is not an image, this will return undefined. Returns (string | undefined)

getPage

Returns the CerosPage that this component belongs to. Returns CerosPage

isVideoComponent

Is this a video? Returns boolean

isImageComponent

Is this an image? Returns boolean

isTextComponent

Is this text? Returns boolean

startVideo

If this component is a video, this will start video playback.

stopVideo

If this component is a video, this will stop video playback.

setText

If this component is a text component, this will set the text content on it. Parameters
  • textContent string The text to display in the text component

setUrl

If this component is an image component, this will set the src of that image to the url provided. Parameters

reset

If this is a text component, this resets the text content back to the original text provided in the Studio. If this is an image component, this resets the image src back to the original url.

click

Simulates the user clicking on this component. Any click interactions that have been configured for this component in the studio will be triggered.

show

Makes this component visible, and runs any entry animations that have been configured for this component in the studio. If the component is already visible, this will only have the effect of running entry animations.

hide

Hides the component. If the component is already hidden, this will have no effect.

subscribe

Subscribes to events fired on this specific component. Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosLayer



A canvas layer containing components. Represents a layer on a page of the experience.

Parameters

  • layerData object
  • messenger CrossFrameMessenger
  • eventHandler EventHandler
  • experienceId string
  • page CerosPage

getPayload

Retrieves any payload that has been configured for this layer in the Studio. Returns string The payload of the layer

getTags

Get the tags assigned to this layer in the studio. Returns Array<string> An array of tags that were assigned to this layer.

getPage

Returns the CerosPage that this layer belongs to. Returns CerosPage

show

Makes this layer visible.

hide

Hides this layer.

findAllComponents

Retrieves all components in the layer. Returns CerosComponentCollection

subscribe

Subscribes to events fired on this specific layer.

Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosLayerCollection



A collection of Layers, not necessarily from the same page. Allows them to be manipulated in bulk.

Parameters

show

Makes all layers in this collection visible.

hide

Hides all layers in this collection.

subscribe

Subscribes to events fired on these specific layers.

Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosPage



Object for manipulating pages.

Parameters

getPayload

Retrieves any payload that has been configured for this page in the Studio. Returns string The payload that has been configured in the Studio.

getTags

Retrieve all tags that have been applied to this page. Returns Array<string> An array of string tag names applied to this page.

getWidth

Returns the width of this page as configured in the Ceros Studio. Returns int

getHeight

Returns the height of this page as configured in the Ceros Studio. Returns int

getPageNumber

Returns the 1-based index of this page as configured in the Ceros Studio. Returns int

disable

Disables this page. A disabled page will not be able to be navigated to until re-enabled.

enable

Enables this page if it has been previously disabled.

findAllComponents

Retrieves all components on the page Returns CerosComponentCollection

findAllLayers

Retrieves all layers on this page Returns CerosLayerCollection The collection of layers on this page.

findAllSmartgroups

Retrieves all smartgroups on this page Returns CerosSmartgroupCollection The collection of smartgroups on this page.

startAnimations

Starts all entry animations that have been configured on this page

pauseAnimations

Pauses any running animations on this page.

getPageState

Returns a value representing whether this page is enabled or disabled. Returns string The state of this page.


CerosPageCollection





Parameters

disable

Disables all pages in this collection. A disabled page can not be navigated to.

enable

Enables all pages in this collection that have been previously disabled.

findAllComponents

Retrieves all components that exist on the pages in this collection Returns CerosComponentCollection


CerosSmartgroup



Represents a smartgroup instance. Commands on and events from this object act on the instance BUT findAllLayers returns the definition layers.

Parameters

  • instanceData object
  • definitionData object
  • messenger CrossFrameMessenger
  • eventHandler
  • experience

getPayload

Retrieves any payload that has been configured for this layer in the Studio. Returns string The payload of the layer

findAllLayers

Returns all layers in the smartgroup definition

show

Makes this smartgroup visible.

hide

Hides this smartgroup

click

Simulates the user clicking on this smartgropu. Any click interactions that have been configured for this component in the studio will be triggered.

subscribe

Subscribes to events fired on this specific layer.

Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.


CerosSmartgroupCollection





Parameters

findAllLayers

Returns all layers in all smartgroups in the collection

show

Makes all smartgroups in this collection visible.

hide

Hides all smartgroups in this collection.

click

Simulates the user clicking on all smartgroups in this collection. Any interactions that have been configured in the Studio for these smartgroups will be triggered.

subscribe

Subscribes to events fired on these specific smartgroups.

Parameters
  • event CerosSDK.EVENTS The event to subscribe to.
  • callback function A callback function to be called when the event is fired.