- Add some missing semicolons - Better null checking for iframe - Better iOS check - Correct icon for successful dropdown input
21 lines
No EOL
684 B
JavaScript
21 lines
No EOL
684 B
JavaScript
export function supportsApplePay() {
|
|
var iOSversion = getiOSversion();
|
|
var isMacOS = navigator.platform.indexOf("Mac") !== -1;
|
|
if (isMacOS || (iOSversion && iOSversion[0] >= 17)) {
|
|
if (window.ApplePaySession && window.ApplePaySession.canMakePayments()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function getiOSversion() {
|
|
if (/iP(hone|od|ad)/.test(navigator.platform)) {
|
|
// supports iOS 2.0 and later:
|
|
var v = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
|
|
if (!v) {
|
|
return null;
|
|
}
|
|
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
|
}
|
|
return null;
|
|
} |