Dev Guide
Dev GuideUser GuidesLegal TermsGitHubDevCommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

ChannelPreviewResult

OCP App SDK / ChannelPreviewResult

ChannelPreviewResult

Result of 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
preview.

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor()

Signature

new ChannelPreviewResult(previews?: string[]): ChannelPreviewResult;

Parameters

NameTypeDescription
previews?string[]the complete set of HTML previews, if already known

Returns

ChannelPreviewResult

Overrides: FormResult.constructor

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

Properties

errors

Protected object = {}

Index signature

[field: string]: string[]

Type declaration

Inherited from: FormResult.errors

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

toasts

Protected {

`intent`: [`Intent`](app-sdk-api-reference-types-intent);
`message`: `string`;

}[] = []

Inherited from: FormResult.toasts

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

Methods

addError()

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

Signature

addError(
  form: "settings" | "template",
  section: string,
  field: string,
  error: string): ChannelPreviewResult;

Parameters

NameTypeDescription
form"settings" | "template"the type of content form that the error applies to (settings or template)
sectionstringthe section within the form that the error applies to
fieldstringthe field within the section that the error applies to
errorstringmessage to display to the user

Returns

ChannelPreviewResult

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

addPreview()

Add a single HTML preview

Signature

addPreview(preview: string): ChannelPreviewResult;

Parameters

NameTypeDescription
previewstringto add

Returns

ChannelPreviewResult

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

addToast()

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

Signature

addToast(intent: Intent, message: string): ChannelPreviewResult;

Parameters

NameTypeDescription
intentIntentone of the supported intents that will affect how the toast is displayed
messagestringto display in the toast

Returns

ChannelPreviewResult

Inherited from: FormResult.addToast

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

setDisplayOptions()

Set options to control how the preview is displayed

Signature

setDisplayOptions(displayOptions: PreviewDisplayOptions): ChannelPreviewResult;

Parameters

NameTypeDescription
displayOptionsPreviewDisplayOptionsto control the preview

Returns

ChannelPreviewResult

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

setPreviews()

Provide the complete set of HTML previews

Signature

setPreviews(previews: string[]): ChannelPreviewResult;

Parameters

NameTypeDescription
previewsstring[]to provide

Returns

ChannelPreviewResult

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