Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev Guide
Dev GuideUser GuidesGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

ChannelPreviewResult

OCP App SDK


OCP App SDK / ChannelPreviewResult

Class: ChannelPreviewResult

Defined in: src/app/lib/ChannelPreviewResult.ts:26

Result of Channel.preview. All previews must be a full HTML page. There must be exactly one preview per
recipient, and they must be added to this result in the same order as the recipients were given to
Channel.preview.

Extends

Constructors

Constructor

new ChannelPreviewResult(previews?): ChannelPreviewResult

Defined in: src/app/lib/ChannelPreviewResult.ts:33

Parameters

previews?

string[]

the complete set of HTML previews, if already known

Returns

ChannelPreviewResult

Overrides

FormResult.constructor

Properties

errors

protected errors: object = {}

Defined in: src/app/lib/FormResult.ts:4

Index Signature

[field: string]: string[]

Inherited from

FormResult.errors


toasts

protected toasts: object[] = []

Defined in: src/app/lib/FormResult.ts:5

intent

intent: Intent

message

message: string

Inherited from

FormResult.toasts

Methods

addError()

addError(form, section, field, error): this

Defined in: src/app/lib/ChannelPreviewResult.ts:72

Add an error to display to the user for a particular form field

Parameters

form

the type of content form that the error applies to (settings or template)

"settings" | "template"

section

string

the section within the form that the error applies to

field

string

the field within the section that the error applies to

error

string

message to display to the user

Returns

this


addPreview()

addPreview(preview): this

Defined in: src/app/lib/ChannelPreviewResult.ts:42

Add a single HTML preview

Parameters

preview

string

to add

Returns

this


addToast()

addToast(intent, message): this

Defined in: src/app/lib/FormResult.ts:13

Display a toast to user, such as, "Successfully authenticated with " or
"Authentication failed, please check your credentials and try again."

Parameters

intent

Intent

one of the supported intents that will affect how the toast is displayed

message

string

to display in the toast

Returns

this

Inherited from

FormResult.addToast


setDisplayOptions()

setDisplayOptions(displayOptions): this

Defined in: src/app/lib/ChannelPreviewResult.ts:60

Set options to control how the preview is displayed

Parameters

displayOptions

PreviewDisplayOptions

to control the preview

Returns

this


setPreviews()

setPreviews(previews): this

Defined in: src/app/lib/ChannelPreviewResult.ts:51

Provide the complete set of HTML previews

Parameters

previews

string[]

to provide

Returns

this