/*! EdiVerify Checkout Widget v1.0.0 | MIT | https://ediverify.vercel.app */ (function (w, d) { 'use strict'; var script = d.currentScript; var BASE = (script && script.src) ? script.src.replace(/\/widget\.js.*$/, '') : 'https://ediverify.vercel.app'; var API = BASE + '/api/v1/verifications'; var LABELS = { age_over_18: 'Leeftijd 18+', driving_license_b: 'Rijbewijs B', id_verification: 'Identiteit', kyc_sign: 'Identiteit + ondertekening' }; var METHODS = [['nl_wallet', 'NL Wallet (Rijksoverheid)', 'Direct verifiëren zonder gegevensopslag'], ['idin', 'iDIN (Via je eigen bank)', 'ING, Rabobank, ABN AMRO, SNS, ASN'], ['yivi', 'Yivi Wallet', 'Privacy-vriendelijke verificatie']]; var CSS = '.evw-o{position:fixed;inset:0;background:rgba(12,13,14,.45);display:flex;align-items:center;justify-content:center;padding:16px;z-index:2147483000;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif}' + '.evw-m{background:#fff;border-radius:16px;width:100%;max-width:420px;max-height:calc(100vh - 32px);overflow:auto;box-shadow:0 24px 60px -20px rgba(12,13,14,.35);color:#4b5563;font-size:15px;line-height:1.5}' + '.evw-h{display:flex;justify-content:space-between;align-items:center;padding:18px 22px;border-bottom:1px solid #e5e7eb}.evw-h b{color:#0c0d0e;font-size:16px}.evw-x{border:0;background:none;font-size:22px;cursor:pointer;color:#6b7280;width:40px;height:40px}' + '.evw-b{padding:22px}.evw-t{color:#0c0d0e;font-weight:600;margin:0 0 10px}.evw-me{display:flex;gap:12px;align-items:center;border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;margin-bottom:10px;cursor:pointer;min-height:64px}' + '.evw-me.on{border-color:#0052ff;box-shadow:0 0 0 1px #0052ff}.evw-me b{display:block;color:#0c0d0e}.evw-me small{font-size:13px}.evw-r{margin-left:auto;flex:none;width:18px;height:18px;border-radius:50%;border:1.5px solid #d1d5db}.evw-me.on .evw-r{border:5px solid #0052ff}' + '.evw-btn{display:flex;width:100%;justify-content:center;align-items:center;min-height:48px;border-radius:999px;border:0;background:#0c0d0e;color:#fff;font:600 15px inherit;font-family:inherit;cursor:pointer;margin-top:8px}.evw-btn:disabled{opacity:.6}' + '.evw-c{text-align:center}.evw-ok{width:56px;height:56px;border-radius:50%;background:#ecfdf5;color:#059669;display:grid;place-items:center;margin:0 auto 12px;font-size:28px}.evw-f{font-size:12px;text-align:center;margin-top:12px;color:#6b7280}.evw-e{color:#b91c1c;font-size:14px;margin-top:8px}'; function el(h) { var t = d.createElement('div'); t.innerHTML = h; return t.firstChild; } function api(body) { return fetch(API, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.json(); }); } function qr(seed) { var s = '', h = 0, i, j; for (i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0; for (i = 0; i < 21; i++) for (j = 0; j < 21; j++) { var f = (i < 7 && j < 7) || (i < 7 && j > 13) || (i > 13 && j < 7), a = i % 14, b = j % 14; var on = f ? (a === 0 || a === 6 || b === 0 || b === 6 || (a > 1 && a < 5 && b > 1 && b < 5)) : (((i * 7 + j * 13 + i * j + h) % 3) === 0); if (on) s += ''; } return '' + s + ''; } function open(opts) { opts = opts || {}; var check = opts.check || 'age_over_18', sel = 0, ver = null; if (!d.getElementById('evw-css')) { var st = d.createElement('style'); st.id = 'evw-css'; st.textContent = CSS; d.head.appendChild(st); } var o = el(''); var body = o.querySelector('.evw-b'); function close() { o.remove(); if (opts.onClose) opts.onClose(); } o.querySelector('.evw-x').onclick = close; o.onclick = function (e) { if (e.target === o) close(); }; function step1() { body.innerHTML = '

Bevestig: ' + (LABELS[check] || check) + '

' + METHODS.map(function (m, i) { return '
' + m[1] + '' + m[2] + '
'; }).join('') + '

Beveiligd door EdiVerify · Geen opslag van persoonsgegevens

'; [].forEach.call(body.querySelectorAll('.evw-me'), function (n) { n.onclick = function () { sel = +n.getAttribute('data-i'); step1(); }; }); var btn = body.querySelector('.evw-btn'); btn.onclick = function () { btn.disabled = true; btn.textContent = 'Even geduld…'; api({ check: check, methods: [METHODS[sel][0]], reference: opts.reference, merchant: opts.merchant }).then(function (v) { ver = v; step2(); }) .catch(function (e) { btn.disabled = false; btn.textContent = 'Opnieuw proberen'; body.querySelector('.evw-e').textContent = 'Verbinding mislukt (' + e.message + ').'; if (opts.onError) opts.onError(e); }); }; } function step2() { body.innerHTML = '

Scan met je ' + METHODS[sel][1].split(' (')[0] + '

Je deelt alleen: ' + (LABELS[check] || check) + '.

' + qr(ver.id) + '
'; var btn = body.querySelector('.evw-btn'); btn.onclick = function () { btn.disabled = true; btn.textContent = 'Bevestigen…'; api({ action: 'verify', id: ver.id, check: check, method: METHODS[sel][0] }).then(step3) .catch(function (e) { btn.disabled = false; btn.textContent = 'Opnieuw proberen'; body.querySelector('.evw-e').textContent = 'Bevestigen mislukt (' + e.message + ').'; }); }; } function step3(r) { body.innerHTML = '
✓

Verificatie geslaagd

' + (LABELS[check] || check) + ' bevestigd

Referentie ' + r.id + '

'; body.querySelector('.evw-btn').onclick = function () { o.remove(); }; if (opts.onVerified) opts.onVerified(r); } step1(); d.body.appendChild(o); return { close: close }; } w.EdiVerify = { open: open, version: '1.0.0', api: API }; })(window, document);