File "wc-intl-tel.js"
Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/swedbank-pay-payments/assets/js/wc-intl-tel.js
File size: 1.17 KB
MIME-type: text/plain
Charset: utf-8
jQuery(document).ready(function ($) {
$(document.body).on('update_checkout', function () {
initTelInput();
});
initTelInput();
function initTelInput() {
const telInput = document.querySelector("#billing_phone");
var iti = window.intlTelInput(telInput, {
utilsScript: WC_Gateway_Swedbank_Pay_Intl_Tel.utils_script,
preferredCountries: ['SE', 'NO', 'FI', 'DK'],
nationalMode: false,
formatOnDisplay: true,
customContainer: 'form-row-wide'
}
);
telInput.addEventListener('keyup', formatIntlTelInput);
telInput.addEventListener('change', formatIntlTelInput);
function formatIntlTelInput() {
if (typeof intlTelInputUtils !== 'undefined') { // utils are lazy loaded, so must check
var currentText = iti.getNumber(intlTelInputUtils.numberFormat.E164);
if (typeof currentText === 'string') { // sometimes the currentText is an object :)
iti.setNumber(currentText); // will autoformat because of formatOnDisplay=true
}
}
}
}
});