@@ -44,8 +44,6 @@ <h1>WebChat iframe RPC Test</h1>
4444 < div class ="controls ">
4545 < h3 > RPC Controls</ h3 >
4646 < button onclick ="focusWebChatSendBox() "> Focus Send Box</ button >
47- < button onclick ="focusWebChatSendBoxWithoutKeyboard() "> Focus Send Box (No Keyboard)</ button >
48- < button onclick ="focusWebChatTranscript() "> Focus Transcript</ button >
4947
5048 < div class ="status " id ="status "> Ready to test RPC calls</ div >
5149 </ div >
@@ -57,7 +55,6 @@ <h3>WebChat iframe</h3>
5755 </ div >
5856
5957 < script >
60- // RPC functions for communicating with WebChat in iframe
6158 function updateStatus ( message ) {
6259 document . getElementById ( 'status' ) . textContent = message ;
6360 console . log ( 'RPC:' , message ) ;
@@ -66,59 +63,22 @@ <h3>WebChat iframe</h3>
6663 function focusWebChatSendBox ( ) {
6764 const webChatIframe = document . getElementById ( 'webchat-iframe' ) ;
6865 if ( webChatIframe && webChatIframe . contentWindow ) {
69- webChatIframe . contentWindow . postMessage (
70- {
71- type : 'WEBCHAT_FOCUS' ,
72- target : 'sendBox'
73- } ,
74- '*'
75- ) ;
66+ webChatIframe . contentWindow . postMessage ( {
67+ type : 'WEBCHAT_FOCUS' ,
68+ target : 'sendBox'
69+ } ) ;
7670 updateStatus ( 'Sent focus sendBox command' ) ;
7771 } else {
7872 updateStatus ( 'Error: iframe not found or not loaded' ) ;
7973 }
8074 }
8175
82- function focusWebChatSendBoxWithoutKeyboard ( ) {
83- const webChatIframe = document . getElementById ( 'webchat-iframe' ) ;
84- if ( webChatIframe && webChatIframe . contentWindow ) {
85- webChatIframe . contentWindow . postMessage (
86- {
87- type : 'WEBCHAT_FOCUS' ,
88- target : 'sendBoxWithoutKeyboard'
89- } ,
90- '*'
91- ) ;
92- updateStatus ( 'Sent focus sendBox (no keyboard) command' ) ;
93- } else {
94- updateStatus ( 'Error: iframe not found or not loaded' ) ;
95- }
96- }
97-
98- function focusWebChatTranscript ( ) {
99- const webChatIframe = document . getElementById ( 'webchat-iframe' ) ;
100- if ( webChatIframe && webChatIframe . contentWindow ) {
101- webChatIframe . contentWindow . postMessage (
102- {
103- type : 'WEBCHAT_FOCUS' ,
104- target : 'main'
105- } ,
106- '*'
107- ) ;
108- updateStatus ( 'Sent focus transcript command' ) ;
109- } else {
110- updateStatus ( 'Error: iframe not found or not loaded' ) ;
111- }
112- }
113-
114- // Listen for responses from iframe
11576 window . addEventListener ( 'message' , function ( event ) {
11677 if ( event . data && event . data . type === 'WEBCHAT_READY' ) {
11778 updateStatus ( 'WebChat iframe is ready for RPC commands' ) ;
11879 }
11980 } ) ;
12081
121- // Initialize
12282 document . addEventListener ( 'DOMContentLoaded' , function ( ) {
12383 updateStatus ( 'Loading WebChat iframe...' ) ;
12484 } ) ;
0 commit comments