Sites Rendering API for Oracle Content Management

Namespace: SCSRenderAPI (Runtime)

QuickNav

Methods

window.SCSRenderAPI

The SCSRenderAPI singleton.

Methods

addComponentToPageModel(args)

Adds a component to the page model.
Parameters:
Name Type Description
args Object An object containing the following values:
Properties
Name Type Attributes Description
compType String The type of the new component.
compId String The ID of the new component.
initialData String <optional>
The initial content for the component.
Returns:
The ID of the newly added component.

getAudienceAttribute(name) → {String|Array|undefined}

Gets the stored audience attribute value given a name.

Audience attributes are automatically populated via URL query parameters – those that are prefixed with “_attribute.”. Audience attribute items can also be set via setAudienceAttribute. The collection of audience attributes is stored in session storage.
Parameters:
Name Type Description
name String The audience attribute name.
Returns:
The stored audience attribute value(s) or undefined.
Type
String | Array | undefined

getAudienceAttributes() → {Object}

Gets the stored audience attribute values.

Audience attributes are automatically populated via URL query parameters – those that are prefixed with “_attribute.”. Audience attribute items can also be set via setAudienceAttribute. The collection of audience attributes is stored in session storage.
Returns:
The stored audience attribute values. This Object may have no properties.
Type
Object

getAudienceAttributesReady() → {Boolean}

Gets the audience attributes ready flag. Components that depend upon audience attributes being available should delay rendering until this flag is set to true.

The returned ready flag is initially set to true when the page is loaded. This flag can also be controlled with the setAudienceAttributeReady function.
Returns:
The audience attributes ready flag.
Type
Boolean

getCacheKey(keyName) → {String}

Gets the cache key for the given section.
Parameters:
Name Type Description
keyName String The possible values for the keyName are: 'product' | 'site' | 'component' | 'theme' | 'caas'.
Returns:
The cache key for the given section.
Type
String

getCDNPrefix() → {String}

Gets the sitesCloudCDN value, if present.
Returns:
The sitesCloudCDN value, if present.
Type
String

getComponentCatalogUrlPrefix() → {String}

Gets the URL prefix for the catalog of components.
Returns:
The URL prefix for the catalog of components.
Type
String

getComponentInstanceData(componentId) → {Object|undefined}

Gets the component's internal data.
Parameters:
Name Type Description
componentId String
Returns:
Returns the component's internal data object or undefined.
Type
Object | undefined

getContentClient() → {Object}

Returns a ContentClient instance, which can be used to obtain information from CaaS.
Returns:
A ContentClient object
Type
Object

getContentUrl(fileName) → {String}

Uses getContentUrlPrefix to calculate the appropriate URL with the supplied file name.
Parameters:
Name Type Description
fileName String The file name to append to the content URL prefix.
Returns:
The calculated content URL.
Type
String

getContentUrlPrefix() → {String}

Computes and gets the content URL prefix by using site prefix, cache key and '/content'.
Returns:
The content URL prefix.
Type
String

getCustomPageProperty(propertyName, pageIdopt) → {String|undefined}

Gets a page property value given a page ID and property name.
Parameters:
Name Type Attributes Description
propertyName String Property name.
pageId String <optional>
The page ID.
Returns:
The property value.
Type
String | undefined

getCustomSiteProperty(propertyName) → {String|undefined}

Gets a custom site property value given a property name.
Parameters:
Name Type Description
propertyName String Property name.
Returns:
The property value.
Type
String | undefined

getDefaultPageProperty(propertyName) → {String|undefined}

Gets a default page property value given a property name.
Parameters:
Name Type Description
propertyName String Property name.
Returns:
The property value.
Type
String | undefined

getDeviceInfo() → {Object}

Gets info about current device.

Additional values can be populated by custom controller code for runtime. Customizations to the controller code will not take effect in design time.
Returns:
An object with device info.

Default return object: { isMobile: [true | false], isIOS: [true | false] }
Type
Object

getDistDirUrlPrefix(allowCDN) → {String}

Gets the distribution directory prefix.
Parameters:
Name Type Description
allowCDN Boolean Switch that adds a CDN prefix when applicable.
Returns:
The distribution directory prefix.
Type
String

getJQuery() → {Object}

Returns the renderer's JQuery object.
Returns:
A JQuery object reference.
Type
Object

getMarked() → {Object}

Returns the renderer's marked object.
Returns:
A marked object reference.
Type
Object

getMustache() → {Object}

Returns the renderer's Mustache object.
Returns:
A Mustache object reference.
Type
Object

getPageId() → {Number}

Gets the ID of the current page.
Returns:
The ID of the current page.
Type
Number

getPageInformation() → {Object}

Get the information about whether the page is a regular dynamic page or if it’s a compiled static page.
Returns:
An object with the state. Design time is always 'dynamic'. Runtime is either 'dynamic' or 'compiled'.
Type
Object

getPageLanguageCode() → {String}

Returns the language code for the current page.
Returns:
The language code for the current page.
Type
String

getPageLinkData(pageId, optionsopt) → {Object}

Gets the link data for a given page.
Parameters:
Name Type Attributes Description
pageId String The target page ID.
options Object <optional>
The options object.
Properties
Name Type Attributes Description
contentType String The target content type.
contentId String <optional>
The target content ID.
contentName String <optional>
The target content name.
contentSlug String <optional>
The target content slug.
Returns:
The link data, including href, target, and hideInNavigation properties.
Type
Object

getPageLinkInfo(pageId, optionsopt) → {Object}

Gets the link data for a given page.
Parameters:
Name Type Attributes Description
pageId String The target page ID.
options Object <optional>
The options object.
Properties
Name Type Attributes Description
contentItem Object <optional>
The target Content Item.
Properties
Name Type Attributes Description
type String <optional>
The type of the target Content Item.
id String <optional>
The ID of the target Content Item.
name String <optional>
The name of the target Content Item.
slug String <optional>
The slug of the target Content Item.
queryParams String | Object <optional>
Query parameters to append to the URL. A String value will be appended without encoding. Object Property names and values will be URI encoded.
fragment String <optional>
A fragment to append to the URL (#fragment).
Returns:
The link data, including href, target, and hideInNavigation properties.
Type
Object

getPageLinkUrl()

Deprecated. Use getPageLinkData(...) instead.

getPageLocaleAlias() → {String|undefined}

Returns the language code alias for the current page.
Returns:
The language code alias for the current page, or undefined.
Type
String | undefined

getPageMetadata(property) → {String|undefined}

Gets the value of the requested page property.
Parameters:
Name Type Description
property String The property key.
Returns:
The property value.
Type
String | undefined

getPlaceholderContent() → {Object|undefined}

Retrieves details about the content in a detail page.
Returns:
An object containing contentType, contentId, contentSlug. Returns undefined for a non-detail page.
Type
Object | undefined

getRenderMetrics(isDebug) → {Object}

Gets timing information on events that occur during rendering.
Parameters:
Name Type Description
isDebug Boolean Flag to include extra data in the returned metrics.
Returns:
Metrics object.
Type
Object

getRenderMode() → {String}

Gets the current rendering mode.
Returns:
The current rendering mode.
Type
String
Example
window.SCSRenderAPI.getRenderMode();
// => 'view'
// Possible return values: SCSRenderAPI.RENDER_MODE_PREVIEW | SCSRenderAPI.RENDER_MODE_VIEW

getSiteId() → {String}

Gets the site ID.
Returns:
The site ID.
Type
String

getSitePathPrefix() → {String}

Computes and gets the site path prefix. This will include a cache key if appropriate. In RENDER_MODE_PREVIEW the site path prefix will not contain a cache key. Trailing slashes will be removed.
Returns:
The site path prefix without a trailing slash.
Type
String

getSitePrefix() → {String}

Gets the site prefix.
Returns:
The site prefix.
Type
String

getSiteProperty(propertyName) → {String|undefined}

Gets a site property value given a property name.
Parameters:
Name Type Description
propertyName String Property name.
Returns:
The property value.
Type
String | undefined

getThemeDesignUrlPrefix() → {String}

Gets the theme's design URL prefix.
Returns:
The theme's design URL prefix.
Type
String

getThemeUrlPrefix() → {String}

Gets the theme URL prefix.
Returns:
The theme URL prefix.
Type
String

onComponentRenderComplete(componentId)

Announces and stores when a specified component's rendering is complete.

Components should call this function when they complete rendering in order to allow operations that happen following the page rendering to complete in a timely fashion.
Parameters:
Name Type Description
componentId String The ID of the component that finished rendering.
Fires:

recordAssetOperation(assetId, operation) → {Boolean}

Records an asset operation in the analytics system.

Components should call this function when they need to indicate that an asset operation has happened.
Parameters:
Name Type Description
assetId String The ID of the asset, a Content Item or Digital Asset.
operation String The operation that occurred for the asset. Operation values include: load, view, download, and play.
Returns:
A Boolean value indicating if the operation was accepted for processing.
Type
Boolean

removeComponentFromPageModel(componentId)

Removes a component from the page model given a component ID.
Parameters:
Name Type Description
componentId String The component ID.

renderComponent(componentId, slotId, optionsopt)

Renders the specified component.
Parameters:
Name Type Attributes Description
componentId String The component ID.
slotId String The slot ID.
options Object <optional>
The options object.
Properties
Name Type Attributes Description
position Object <optional>
The position object.
isEditMode Boolean <optional>
Flag for whether or not to render a given component in edit mode.
columnNode String <optional>
The column node within which to render a given component.
renderStyles Boolean <optional>
Flag for whether or not to render component styles.
parentContentItemId String <optional>
The parent container ID.
componentRenderMode String <optional>
The mode the component should render in.
callback function <optional>
This callback function is called with the given component is finished rendering. Note: Not all components support this parameter.

setAudienceAttribute(name, value, optionsopt) → {Boolean}

Sets an audience attribute value given a name and value. Audience attributes set on the URL will take precedence over values set by JavaScript unless options.force equals true.
Parameters:
Name Type Attributes Description
name String The key to store the value under.
value String | Array The value to set. If an Array is provided, it must contain one or more Strings.
options Object <optional>
Properties
Name Type Attributes Description
force Boolean <optional>
Set to true to override values set by URL.
Returns:
Returns true if the value was set. False, otherwise.
Type
Boolean

setAudienceAttributesReady(ready)

Sets the audience attributes ready flag.
Parameters:
Name Type Description
ready Boolean The value to set.
Fires:

Events

AUDIENCE_ATTRIBUTES_READY

An event designating if audience attributes are available. This event is used to indicate when recommendation lists should render.

AUDIENCE_ATTRIBUTES_READY ("scsaudienceattributesready")
Type:
  • object
Properties:
Name Type Description
ready boolean Flag indicating if audience attributes are available.

COMPONENT_RENDER_COMPLETE_EVENT

An event designating when a given component rendering is complete.

COMPONENT_RENDER_COMPLETE_EVENT ("scscomponentrendercomplete")
Type:
  • object
Properties:
Name Type Description
componentId String The component ID.
timestamp Number The time the given component finished rendering.
isATF Boolean Flag indicating if the given component is marked as Above The Fold.

RENDER_COMPLETE_EVENT

An event designating the end of page rendering along with any asynchronous component rendering.

RENDER_COMPLETE_EVENT ("scsrendercomplete")

RENDER_END_EVENT

An event designating the end of page rendering.

RENDER_END_EVENT ("scsrenderend")

RENDER_START_EVENT

An event designating the start of page rendering.

RENDER_START_EVENT ("scsrenderstart")