Embeddable widget mostly not loaded the telephone number, when clicking the CRM contact tp number

  • 1
  • Idea
  • Updated 5 days ago
When click on the phone number anywhere on the website should load the tp number in the widget. But it works for some time and often not working, then need a refresh to make workable
Photo of sharmilan A

sharmilan A

  • 518 Points 500 badge 2x thumb

Posted 2 months ago

  • 1
Photo of Embbnux Ji

Embbnux Ji, Employee

  • 1,168 Points 1k badge 2x thumb
Hi, Sharmilan Do we mean `Dial API` fail to work? https://github.com/ringcentral/ringcentral-embeddable/blob/master/docs/control-widget.md#go-to-dial-...  The widget will prevent duplicate call from dial api.
Photo of sharmilan A

sharmilan A

  • 518 Points 500 badge 2x thumb
Hi Embbunx Ji,
Yes, I am have using click href event for tp numbers, it works fine but some time not gives any response.
I got it from https://github.com/ringcentral/ringcentral-embeddable/blob/master/src/lib/Adapter/index.js#L55

happening mac high sierra chrome.
(Edited)
Photo of Embbnux Ji

Embbnux Ji, Employee

  • 1,158 Points 1k badge 2x thumb
Hi, Sharmilan Can you provide more details to reproduce no response issue. For `a[href^="tel:"] default event listener, it will fail to work if `a[href^="tel:"]`  tag created after event listener created.
Photo of sharmilan A

sharmilan A

  • 518 Points 500 badge 2x thumb
Hi, Embbunx Ji,
I didn't fully check your code base, it is not handled within the widget, how can be used in the Single page application. I can add functionality as follows but feels bit painful.

const phoneCallTags = window.document.querySelectorAll('a[href^="tel:"]');
for (let i = 0; i < phoneCallTags.length; ++i) {
const phoneTag = phoneCallTags[i];
phoneTag.addEventListener('click', () => {
  window.RCAdapter.setMinimized(false)
  const hrefStr = phoneTag.getAttribute('href');
  const phoneNumber = hrefStr.replace(/[^\d+*-]/g, '');
  
  document.querySelector("#rc-widget-adapter-frame").contentWindow.postMessage({
      type: 'rc-adapter-new-call',
      phoneNumber,
      toCall: true
  }, '*');
}); }
(Edited)
Photo of Embbnux Ji

Embbnux Ji, Employee

  • 1,158 Points 1k badge 2x thumb
Hi, Sharmilan, we will update widget adapter js codes to listen for DOM update and rebuild click listener. https://github.com/ringcentral/ringcentral-embeddable/issues/172
Photo of sharmilan A

sharmilan A

  • 518 Points 500 badge 2x thumb
thanks