Closed DaKingKong closed 4 months ago
The reason why the phone numbers can't be found is because of an incorrect country code specified. This c2d library utilizes libphonenumber-js for phone number detection. We can evaluate its functionality by accessing the following demo page: https://catamphetamine.github.io/libphonenumber-js/
Case default country US
, only e164 format phone numbers are found.
Case default country IE
or GB
, more phone numbers are found.
We can configure the c2d functionality through an advanced way to accommodate custom country codes and area codes.
import {
BuiltinWidget,
LibPhoneNumberMatcher,
RangeObserver,
RingCentralC2D,
WidgetEvents,
} from 'ringcentral-c2d';
const countryCode = 'US';
const areaCode = '650';
const observer = new RangeObserver({
node: document.body,
matcher: new LibPhoneNumberMatcher({
countryCode,
areaCode,
}),
});
const widget = new BuiltinWidget();
widget.on(WidgetEvents.call, yourCallHandler);
widget.on(WidgetEvents.text, yourTextHandler);
const clickToDial = new RingCentralC2D({
observer,
widget,
});
@ruleechen Is there any way to somehow include two countries? Our user is using IE numbers and GB number at the same time
@ruleechen Is there any way to somehow include two countries? Our user is using IE numbers and GB number at the same time
Currently, multiple countries are not supported.
@DaKingKong Maybe we can try to add a new matcher such as AggregateMatcher
to combine mulitple matchers.
const observer = new RangeObserver({
node: document.body,
matcher: new AggregateMatcher([
new LibPhoneNumberMatcher({
countryCode: 'IE',
}),
new LibPhoneNumberMatcher({
countryCode: 'GB',
}),
]),
});
One of our users reported that the following cases won't pop up the widget:
Example: number +353 876472469, HTML code = tel:353 876472469 Example: number +447765878876, HTML link = tel:447765878876
I've personally tested it for US numbers and it seems to work. It'd probably be related to Irish number format?