From Bright Pattern Documentation
Jump to: navigation, search
(Created page with "<translate> =onWebScreenPopCustom= This callback allows you to customize the web screen pop handler and override the default web screen pop behavior with a browser popup. If...")
 
(Updated via BpDeleteTranslateTags script)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
<translate>
+
 
 
=onWebScreenPopCustom=
 
=onWebScreenPopCustom=
  
 
This callback allows you to customize the web screen pop handler and override the default web screen pop behavior with a browser popup. If your listener returns ''true'', then default behavior will be prevented. If your listener returns ''false'', the default handler will process the data after you.
 
This callback allows you to customize the web screen pop handler and override the default web screen pop behavior with a browser popup. If your listener returns ''true'', then default behavior will be prevented. If your listener returns ''false'', the default handler will process the data after you.
  
=Request==
+
==Request==
  
 
''Syntax''
 
''Syntax''
Line 17: Line 17:
  
 
    action: 'OPEN_WEB_PAGE' | 'DISPLAY_TEXT'
 
    action: 'OPEN_WEB_PAGE' | 'DISPLAY_TEXT'
 
 
    url: string
 
    url: string
 
 
    content: string
 
    content: string
 
 
    label: string
 
    label: string
 
 
    popUponAnswer: boolean
 
    popUponAnswer: boolean
 
 
    keepPopupOpenAfterFinish: boolean
 
    keepPopupOpenAfterFinish: boolean
 
 
    popup: boolean
 
    popup: boolean
 
 
    secondaryUrls?: {
 
    secondaryUrls?: {
  
Line 42: Line 35:
  
 
    label?: string
 
    label?: string
 
 
    url?: string
 
    url?: string
  
 
}
 
}
 
|}
 
|}
 +
  
 
''Parameters''
 
''Parameters''
Line 121: Line 114:
  
 
==Example Request==
 
==Example Request==
 
+
<syntaxhighlight lang="Javascript">
 
function webScreenPopCustomHandler(itemId: string, screenPopData: WebScreenPop) {
 
function webScreenPopCustomHandler(itemId: string, screenPopData: WebScreenPop) {
  
Line 127: Line 120:
  
 
return true;
 
return true;
 
 
}
 
}
 
 
}
 
}
 
 
adApi.on("ON_WEB_SCREEN_POP_CUSTOM", webScreenPopCustomHandler);
 
adApi.on("ON_WEB_SCREEN_POP_CUSTOM", webScreenPopCustomHandler);
 
+
</syntaxhighlight>
 
==Return Value==
 
==Return Value==
  
 
Returns a Boolean value of ''true'' or ''false'', depending on whether you want to prevent default handler behavior or not.
 
Returns a Boolean value of ''true'' or ''false'', depending on whether you want to prevent default handler behavior or not.
 
 
 
 
</translate>
 

Latest revision as of 04:01, 29 May 2024

• 5.19


onWebScreenPopCustom

This callback allows you to customize the web screen pop handler and override the default web screen pop behavior with a browser popup. If your listener returns true, then default behavior will be prevented. If your listener returns false, the default handler will process the data after you.

Request

Syntax

on('ON_WEB_SCREEN_POP_CUSTOM', handler: OnWebScreenPopCustomHandler): void


type OnWebScreenPopCustomHandler = (itemId: string, webScreenPop: WebScreenPop) => SyncAsyncResult<boolean>


type WebScreenPop = {

    action: 'OPEN_WEB_PAGE' | 'DISPLAY_TEXT'     url: string     content: string     label: string     popUponAnswer: boolean     keepPopupOpenAfterFinish: boolean     popup: boolean     secondaryUrls?: {

        [key: number]: WebScreenPopSecondaryUrl

    }

}


type WebScreenPopSecondaryUrl = {

    label?: string     url?: string

}


Parameters

Parameter Parameter Values Data Type Optional/Required Description
itemId String Required The ID of the item originating this screen pop
webScreenPop
action String Required The type of screen pop; options are as follows:
  • ‘OPEN_WEB_PAGE’
  • ‘DISPLAY_TEXT’
url String Required The main url; used only for the action option ‘OPEN_WEB_PAGE’
content String Required The text to display; used only for the action option ‘DISPLAY_TEXT’
label String Required The heading for this screen pop
popUponAnswer Boolean Required If set to true, the screen pop will pop when the interaction is routed to the agent; if set to false, the screen will pop only after the agent has accepted the interaction.
keepPopupOpenAfterFinish Boolean Required If set to true, the screen pop will remain open after the interaction is finished; if set to false, the screen pop will close when the interaction is finished.
popup Boolean Required If set to true, the screen pop is a pop-up window; if set to false, the screen pop is an inline screen pop.
secondaryUrls Optional The object with values of additional URLs for multiple, simultaneous screen pops

Example Request

function webScreenPopCustomHandler(itemId: string, screenPopData: WebScreenPop) {

window.open(screenPopData.url, "_blank");

return true;	
}
}
adApi.on("ON_WEB_SCREEN_POP_CUSTOM", webScreenPopCustomHandler);

Return Value

Returns a Boolean value of true or false, depending on whether you want to prevent default handler behavior or not.

< Previous