src/rpiWebClient.ts
RpiWebClient is a Javascript library that encapsulates RedPoint's Realtime capabilities for web-based consumption
Properties |
Methods |
|
Public
constructor()
|
|
Constructor for RpiWebClient. |
| Public config |
Type : RpiWebClientConfig
|
Default value : {}
|
|
The current RpiWebClient configuration parameters. |
| Public visitor |
Type : VisitorCookie
|
Default value : { profile: { VisitorID: "", IsMasterKey: false, HasAlternativeKey: false, Keys: [] }, geolocationExpiry: 0 }
|
|
The Realtime visitor profile for the current web visitor. |
| Public flushRealtimeParameters | ||||||||
flushRealtimeParameters(callback?: (data?: string) => void)
|
||||||||
|
Flushes queued visitor parameters to the Realtime visitor cache.
Parameters :
Returns :
void
void |
| Public getCachedVisitor | ||||||||
getCachedVisitor(callback: (data: string) => void)
|
||||||||
|
Gets the cached visitor from the RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getContextDecision | ||||||||||||||||
getContextDecision(contextPath: string, callback: (data: Array
|
||||||||||||||||
|
Gets decision results for the specified context path from RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getContextDecisions | ||||||||||||||||
getContextDecisions(contextPaths: Array
|
||||||||||||||||
|
Gets decision results for the specified array of context paths from RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getDecision | ||||||||||||||||
| since version 6.3 | ||||||||||||||||
getDecision(publishId: string, isMasterMessage: boolean, callback: (data: Array
|
||||||||||||||||
|
Gets the decision result for a specified content id from the RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getDecisionContent | ||||||||||||||||
getDecisionContent(result: ApiDecisionResult, callback: (content: string) => void, lookupRequest?: string)
|
||||||||||||||||
|
Gets the decision content from an ApiDecisionResult object. Retrieves the content from the returned content path for decisions published using the "web publish site" option in RPI.
Parameters :
Returns :
void
|
| Public getDecisions | ||||||||||||
| since version 6.3 | ||||||||||||
getDecisions(publishIds: Array
|
||||||||||||
|
Gets decision results for the specified publish ids from RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getSmartAssetDecisions | ||||||||||||||||
getSmartAssetDecisions(smartAssetDecisions: Array<SmartAssetDecision>, callback: (data: SmartAssetResponse) => void, isMasterMessage?: boolean)
|
||||||||||||||||
|
Gets decision results for the specified array of SmartAssetDecision from RPI Realtime services.
Parameters :
Returns :
void
void |
| Public getVisitorView | ||||||||||||
getVisitorView(viewName: string, callback: (data: ApiVisitorView) => void)
|
||||||||||||
|
Gets the visitor view for a specified view name from the RPI Realtime services.
Parameters :
Returns :
void
void |
| Public init | ||||||||||||
init(opts?: RpiWebClientConfig, callback?: () => void)
|
||||||||||||
|
Initializes the RpiWebClient. The initialization process includes registering page to collect link click events; submits any Realtime parameters for the current page visit to the RPI Realtime visitor cache; parses the returning Realtime visitor profile details; submits the pageVisit event; renders content for any specified contexts and/or smartAssetDecisions. Triggers rpiWebClientInit event.
Parameters :
Returns :
void
void |
| Public pushRealtimeParameter | ||||||||||||||||||||
pushRealtimeParameter(name: string, value: string, isListParam?: boolean, listOperator?: string)
|
||||||||||||||||||||
|
Queues a visitor parameter to be submit to the RPI Realtime visitor cache
Parameters :
Returns :
void
|
| Public pushWebEvent | ||||||||||||||||||||||||
pushWebEvent(state: string, stateValue: string | null, extraParam?: string | null, contentId?: string | null, metadata?: Array
|
||||||||||||||||||||||||
|
Pushes event data to RPI Realtime web events or queues the event until an visitor id is present.
Parameters :
Returns :
void
void |
| Public renderContextDecision | ||||||||
renderContextDecision(contextPath: string)
|
||||||||
|
Renders decision results for a decision context path. Triggers rpiWebClientContextDecisionRender event.
Parameters :
Returns :
void
void |
| Public renderContextDecisions | ||||||||
renderContextDecisions(contextPaths: Array
|
||||||||
|
Renders decision results for an array of decision context paths. Triggers rpiWebClientContextDecisionRender event for each context.
Parameters :
Returns :
void
void |
| Public renderDecision | ||||||||||||
| since version 6.3 | ||||||||||||
renderDecision(contentId: string, elementId: string)
|
||||||||||||
|
Renders decision results for a specified content id and element (DOM) id. Triggers rpiWebClientDecisionRender event.
Parameters :
Returns :
void
void |
| Public renderDecisionContent | ||||||||||||||||
renderDecisionContent(result: ApiDecisionResult, elementId?: string | null, lookupRequest?: string)
|
||||||||||||||||
|
Renders decision content by replacing the inner HTML of the element (DOM) id specified in the decision result or by optionally specifying an elementId.
Parameters :
Returns :
void
void |
| Public renderDecisions | ||||||||
| since version 6.3 | ||||||||
renderDecisions(contentDecisions: Array<ContentDecision>)
|
||||||||
|
Renders multiple decisions as defined by an array of ContentDecision (content id and element id) objects. Triggers rpiWebClientDecisionRender event for each ContentDecision.
Parameters :
Returns :
void
void |
| Public renderSmartAssetDecisions | ||||||||||||
renderSmartAssetDecisions(smartAssetDecisions: Array<SmartAssetDecision>, callback?: (data?: SmartAssetResponse) => void)
|
||||||||||||
|
Renders decision results for an array of decision SmartAssetDecision. Triggers rpiWebClientSmartAssetDecisionRender event for each result.
Parameters :
Returns :
void
void |
| Public submitVisitorDetails | ||||||||
submitVisitorDetails(callback?: (data?: string) => void)
|
||||||||
|
Submits any Realtime parameters for the current page visit to the RPI Realtime visitor cache. This function also submits a pageVisit event and flushes any queued (pending Realtime visitor id) events to RPI Realtime web events.
Parameters :
Returns :
void
void |