@veriff/incontext-sdk
Advanced tools
Comparing version 2.2.1 to 2.3.0
@@ -12,14 +12,2 @@ 'use strict'; | ||
(function() { | ||
const env = {"VERSION":"2.2.1"}; | ||
try { | ||
if (process) { | ||
process.env = Object.assign({}, process.env); | ||
Object.assign(process.env, env); | ||
return; | ||
} | ||
} catch (e) {} // avoid ReferenceError: process is not defined | ||
globalThis.process = { env:env }; | ||
})(); | ||
const wrapperStyles = ` | ||
@@ -192,3 +180,3 @@ position: fixed !important; | ||
const frame = document.getElementById(IFRAME_ID); | ||
const version = process.env.VERSION; | ||
const version = "2.3.0"; | ||
if (event.data === IFRAME_MESSAGES.VERIFF_HANDSHAKE) { | ||
@@ -195,0 +183,0 @@ handleHandshakeEvent(frame, { |
import focusLock from 'dom-focus-lock'; | ||
import { lock, unlock } from 'tua-body-scroll-lock'; | ||
(function() { | ||
const env = {"VERSION":"2.2.1"}; | ||
try { | ||
if (process) { | ||
process.env = Object.assign({}, process.env); | ||
Object.assign(process.env, env); | ||
return; | ||
} | ||
} catch (e) {} // avoid ReferenceError: process is not defined | ||
globalThis.process = { env:env }; | ||
})(); | ||
const wrapperStyles = ` | ||
@@ -183,3 +171,3 @@ position: fixed !important; | ||
const frame = document.getElementById(IFRAME_ID); | ||
const version = process.env.VERSION; | ||
const version = "2.3.0"; | ||
if (event.data === IFRAME_MESSAGES.VERIFF_HANDSHAKE) { | ||
@@ -186,0 +174,0 @@ handleHandshakeEvent(frame, { |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).veriffSDK={})}(this,(function(e){"use strict";!function(){const e={VERSION:"2.2.1"};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var n=function(e){for(var n=Array(e.length),t=0;t<e.length;++t)n[t]=e[t];return n},t=function(e){return Array.isArray(e)?e:[e]},o=function(e,n){var t=e.tabIndex-n.tabIndex,o=e.index-n.index;if(t){if(!e.tabIndex)return 1;if(!n.tabIndex)return-1}return t||o},r=function(e,t,r){return n(e).map((function(e,n){return{node:e,index:n,tabIndex:r&&-1===e.tabIndex?(e.dataset||{}).focusGuard?0:-1:e.tabIndex}})).filter((function(e){return!t||e.tabIndex>=0})).sort(o)},i=["button:enabled:not([readonly])","select:enabled:not([readonly])","textarea:enabled:not([readonly])","input:enabled:not([readonly])","a[href]","area[href]","iframe","object","embed","[tabindex]","[contenteditable]","[autofocus]"],u="data-focus-lock",c=i.join(","),a=c+", [data-focus-guard]",d=function(e,t){return e.reduce((function(e,o){return e.concat(n(o.querySelectorAll(t?a:c)),o.parentNode?n(o.parentNode.querySelectorAll(i.join(","))).filter((function(e){return e===o})):[])}),[])},f=function e(n){return!n||n===document||n.nodeType===Node.DOCUMENT_NODE||!((t=window.getComputedStyle(n,null))&&t.getPropertyValue&&("none"===t.getPropertyValue("display")||"hidden"===t.getPropertyValue("visibility")))&&e(n.parentNode);var t},l=function e(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.push(n),n.parentNode&&e(n.parentNode,t),t},s=function(e,n){for(var t=l(e),o=l(n),r=0;r<t.length;r+=1){var i=t[r];if(o.indexOf(i)>=0)return i}return!1},m=function(e){return n(e).filter((function(e){return f(e)})).filter((function(e){return function(e){return!(("INPUT"===e.tagName||"BUTTON"===e.tagName)&&("hidden"===e.type||e.disabled))}(e)}))},E=function(e,n){return r(m(d(e,n)),!0,n)},p=function(e){return m((t=e.querySelectorAll("[data-autofocus-inside]"),n(t).map((function(e){return d([e])})).reduce((function(e,n){return e.concat(n)}),[])));var t},h=function(e){return"INPUT"===e.tagName&&"radio"===e.type},v=function(e,n){return n.filter(h).filter((function(n){return n.name===e.name})).filter((function(e){return e.checked}))[0]||e},g=function(e,n){return e.length>1&&h(e[n])&&e[n].name?e.indexOf(v(e[n],e)):n},y=function(e){return e[0]&&e.length>1&&h(e[0])&&e[0].name?v(e[0],e):e[0]},b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=function e(n){for(var t=n.length,o=0;o<t;o+=1)for(var r=function(t){if(o!==t&&n[o].contains(n[t]))return{v:e(n.filter((function(e){return e!==n[t]})))}},i=0;i<t;i+=1){var u=r(i);if("object"===(void 0===u?"undefined":b(u)))return u.v}return n},R=function e(n){return n.parentNode?e(n.parentNode):n},F=function(e){return t(e).filter(Boolean).reduce((function(e,t){var o=t.getAttribute(u);return e.push.apply(e,o?I(n(R(t).querySelectorAll('[data-focus-lock="'+o+'"]:not([data-focus-lock-disabled="disabled"])'))):[t]),e}),[])},T=function(e){return e&&e.dataset&&e.dataset.focusGuard},S=function(e){return!T(e)},w=function(e,n){var o=document&&document.activeElement,i=F(e).filter(S),u=function(e,n,o){var r=t(e),i=t(n),u=r[0],c=null;return i.filter(Boolean).forEach((function(e){c=s(c||e,e)||c,o.filter(Boolean).forEach((function(e){var n=s(u,e);n&&(c=!c||n.contains(c)?n:s(n,c))}))})),c}(o||e,e,i),c=E(i).filter((function(e){var n=e.node;return S(n)}));if(c[0]||(c=(a=i,r(m(d(a)),!1)).filter((function(e){var n=e.node;return S(n)})))[0]){var a,f,l,h,v,b=E([u]).map((function(e){return e.node})),I=(f=b,l=c,h=new Map,l.forEach((function(e){return h.set(e.node,e)})),f.map((function(e){return h.get(e)})).filter(Boolean)),R=I.map((function(e){return e.node})),w=function(e,n,t,o,r){var i=e.length,u=e[0],c=e[i-1],a=T(t);if(!(e.indexOf(t)>=0)){var d=n.indexOf(t),f=n.indexOf(o||d),l=e.indexOf(o),s=d-f,m=n.indexOf(u),E=n.indexOf(c),p=g(e,0),h=g(e,i-1);return-1===d||-1===l?e.indexOf(r&&r.length?y(r):y(e)):!s&&l>=0?l:d<=m&&a&&Math.abs(s)>1?h:d>=m&&a&&Math.abs(s)>1?p:s&&Math.abs(s)>1?l:d<=m?h:d>E?p:s?Math.abs(s)>1?l:(i+l+s)%i:void 0}}(R,b,o,n,R.filter((v=function(e){return e.reduce((function(e,n){return e.concat(p(n))}),[])}(i),function(e){return!!e.autofocus||e.dataset&&!!e.dataset.autofocus||v.indexOf(e)>=0})));return void 0===w?w:I[w]}},D=function(e){return e===document.activeElement},A=function(e){var t=document&&document.activeElement;return!(!t||t.dataset&&t.dataset.focusGuard)&&F(e).reduce((function(e,o){return e||o.contains(t)||function(e){return t=n(e.querySelectorAll("iframe")),o=D,!!t.filter((function(e){return e===o}))[0];var t,o}(o)}),!1)},x=function(){return document&&n(document.querySelectorAll("[data-no-focus-lock]")).some((function(e){return e.contains(document.activeElement)}))},_=0,N=!1,O=0,V=null,L=function(){return document&&document.activeElement===document.body||x()},C=function(){var e=!1;if(O){var n=O;L()||(n&&!A(n)&&(e=function(e,n){var t,o=w(e,n);if(!N&&o){if(_>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),N=!0,void setTimeout((function(){N=!1}),1);_++,(t=o.node).focus(),t.contentWindow&&t.contentWindow.focus(),_--}}(n,V)),V=document.activeElement)}return e},M=[],U=function(e){return n=M.filter((function(e){return e})).slice(-1)[0],O=n,!!void(n&&C())&&(e&&e.preventDefault(),!0);var n},B=function(e){0===M.length&&document.addEventListener("focusin",U),M.indexOf(e)<0&&(M.push(e),U())},H=function(e){M=M.filter((function(n){return n!==e})),U(),0===M.length&&document.removeEventListener("focusin",U)},k=function(){return"undefined"==typeof window},P=function(e){e=e||navigator.userAgent;var n=/(iPad).*OS\s([\d_]+)/.test(e);return{ios:!n&&/(iPhone\sOS)\s([\d_]+)/.test(e)||n,android:/(Android);?[\s/]+([\d.]+)?/.test(e)}};var j=0,q=0,W=0,K=null,Q=!1,G=[],z=function(e){if(k())return!1;if(!e)throw new Error("options must be provided");var n=!1,t={get passive(){n=!0}},o=function(){},r="__TUA_BSL_TEST_PASSIVE__";window.addEventListener(r,o,t),window.removeEventListener(r,o,t);var i=e.capture;return n?e:void 0!==i&&i}({passive:!1}),X=!k()&&"scrollBehavior"in document.documentElement.style,Y=function(e){e.cancelable&&e.preventDefault()},J=function(e){e||null!==e&&"production"!==process.env.NODE_ENV&&console.warn("If scrolling is also required in the floating layer, the target element must be provided.")},Z=function(e){if(!k()){if(J(e),P().ios){if(e)(Array.isArray(e)?e:[e]).forEach((function(e){e&&-1===G.indexOf(e)&&(e.ontouchstart=function(e){q=e.targetTouches[0].clientY,W=e.targetTouches[0].clientX},e.ontouchmove=function(n){1===n.targetTouches.length&&function(e,n){if(n){var t=n.scrollTop,o=n.scrollLeft,r=n.scrollWidth,i=n.scrollHeight,u=n.clientWidth,c=n.clientHeight,a=e.targetTouches[0].clientX-W,d=e.targetTouches[0].clientY-q,f=Math.abs(d)>Math.abs(a);if(f&&(d>0&&0===t||d<0&&t+c+1>=i)||!f&&(a>0&&0===o||a<0&&o+u+1>=r))return Y(e)}e.stopPropagation()}(n,e)},G.push(e))}));Q||(document.addEventListener("touchmove",Y,z),Q=!0)}else j<=0&&(K=P().android?(n=document.documentElement,t=document.body,o=n.scrollTop||t.scrollTop,r=Object.assign({},n.style),i=Object.assign({},t.style),n.style.height="100%",n.style.overflow="hidden",t.style.top="-".concat(o,"px"),t.style.width="100%",t.style.height="auto",t.style.position="fixed",t.style.overflow="hidden",function(){n.style.height=r.height||"",n.style.overflow=r.overflow||"",["top","width","height","overflow","position"].forEach((function(e){t.style[e]=i[e]||""})),X?window.scrollTo({top:o,behavior:"instant"}):window.scrollTo(0,o)}):function(){var e=document.body,n=Object.assign({},e.style),t=window.innerWidth-e.clientWidth;return e.style.overflow="hidden",e.style.boxSizing="border-box",e.style.paddingRight="".concat(t,"px"),function(){["overflow","boxSizing","paddingRight"].forEach((function(t){e.style[t]=n[t]||""}))}}());var n,t,o,r,i;j+=1}},$=function(e){if(!(k()||(J(e),(j-=1)>0)))if(P().ios||"function"!=typeof K){if(e)(Array.isArray(e)?e:[e]).forEach((function(e){var n=G.indexOf(e);-1!==n&&(e.ontouchmove=null,e.ontouchstart=null,G.splice(n,1))}));Q&&(document.removeEventListener("touchmove",Y,z),Q=!1)}else K()};const ee="\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n z-index: 9999999;\n display: block !important;\n width: 100vw;\n height: 100%;\n margin: 0 !important;\n padding: 0 !important;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n background: rgba(0, 0, 0, 0.6);\n",ne="\n position: absolute !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n width: 100vw;\n height: 100%;\n margin: 0 !important;\n padding: 0 !important;\n background: none;\n border: none\n",te="\n position: static;\n width: 100%;\n height: 100%;\n";let oe=function(e){return e.VERIFF_HANDSHAKE="VERIFF_HANDSHAKE",e.VERIFF_RENDER="VERIFF_RENDER",e.VERIFF_STARTED="VERIFF_STARTED",e.VERIFF_SUBMITTED="VERIFF_SUBMITTED",e.VERIFF_FINISHED="VERIFF_FINISHED",e.VERIFF_CANCELED="VERIFF_CANCELED",e.VERIFF_FORCE_RELOAD="VERIFF_FORCE_RELOAD",e.VERIFF_RELOAD_REQUEST="VERIFF_RELOAD_REQUEST",e}({}),re=function(e){return e.STARTED="STARTED",e.SUBMITTED="SUBMITTED",e.FINISHED="FINISHED",e.CANCELED="CANCELED",e.RELOAD_REQUEST="RELOAD",e}({});const ie="veriffFrame";function ue(e,n,t,o){const r=document.createElement("iframe");if(r.src=e,r.allow="autoplay; camera; microphone; fullscreen; accelerometer; magnetometer; gyroscope; picture-in-picture;",r.id=ie,n)!function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{rootElementID:o}=n;if(t){e.style.cssText=ne;const n=document.createElement("div");n.style.cssText=ee,n.appendChild(e),document.body.appendChild(n),B(e),Z(e)}else{if(!o)throw new Error("rootElementID must be specified in embedded mode");if(!document.getElementById(o))throw new Error("rootElementID must point to an existing DOM element");e.style.cssText=te,document.getElementById(o).appendChild(e)}}(r,t,o);else{r.style.cssText=ne;const e=function(){const e=document.createElement("div");return e.style.cssText=ee,e}();e.appendChild(r),document.body.appendChild(e),B(r),Z(r)}return r}e.MESSAGES=re,e.createVeriffFrame=function(e){let{url:n,lang:t,onEvent:o=(()=>{}),embedded:r=!1,embeddedOptions:i,onReload:u}=e;if(!n)throw new Error("URL is not provided. Please provide a valid Veriff session url.");const c=function(e){if(e)try{return matchMedia("(max-width: 767px), (hover: none)").matches}catch(e){return console.error("Error while checking if iframe is mobile",e),!1}return!1}(r);function a(){const e=document.getElementById(ie);if(e&&e.parentNode){H(e),$(e);let n=e.parentNode.parentNode,t=e.parentNode;r&&!c&&(n=e.parentNode,t=e),n&&n.removeChild(t)}else $();window.removeEventListener("message",d)}function d(e){const n=document.getElementById(ie),t=process.env.VERSION;e.data===oe.VERIFF_HANDSHAKE&&function(e,n){e.contentWindow?.postMessage({name:oe.VERIFF_RENDER,payload:n},"*")}(n,{version:t,isReloadHandled:"function"==typeof u,isVeriffIframeMobile:c,embeddedConfigured:r,embedded:!c&&r}),e.data===oe.VERIFF_STARTED&&o(re.STARTED),e.data===oe.VERIFF_CANCELED&&(a(),o(re.CANCELED)),e.data===oe.VERIFF_SUBMITTED&&o(re.SUBMITTED),e.data===oe.VERIFF_FINISHED&&(a(),o(re.FINISHED)),e.data===oe.VERIFF_FORCE_RELOAD&&window.location.reload(),e.data===oe.VERIFF_RELOAD_REQUEST&&("function"==typeof u&&u(),o(re.RELOAD_REQUEST))}return ue(t&&t.length>0?function(e,n,t){if(t){const o=new URL(e),r=o.searchParams;return r.set(n,t),o.search=r.toString(),o.toString()}return e}(n,"lang",t):n,r,i,c),window.addEventListener("message",d),{close:a}},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).veriffSDK={})}(this,(function(e){"use strict";var t=function(e){for(var t=Array(e.length),n=0;n<e.length;++n)t[n]=e[n];return t},n=function(e){return Array.isArray(e)?e:[e]},o=function(e,t){var n=e.tabIndex-t.tabIndex,o=e.index-t.index;if(n){if(!e.tabIndex)return 1;if(!t.tabIndex)return-1}return n||o},r=function(e,n,r){return t(e).map((function(e,t){return{node:e,index:t,tabIndex:r&&-1===e.tabIndex?(e.dataset||{}).focusGuard?0:-1:e.tabIndex}})).filter((function(e){return!n||e.tabIndex>=0})).sort(o)},i=["button:enabled:not([readonly])","select:enabled:not([readonly])","textarea:enabled:not([readonly])","input:enabled:not([readonly])","a[href]","area[href]","iframe","object","embed","[tabindex]","[contenteditable]","[autofocus]"],u="data-focus-lock",a=i.join(","),c=a+", [data-focus-guard]",d=function(e,n){return e.reduce((function(e,o){return e.concat(t(o.querySelectorAll(n?c:a)),o.parentNode?t(o.parentNode.querySelectorAll(i.join(","))).filter((function(e){return e===o})):[])}),[])},f=function e(t){return!t||t===document||t.nodeType===Node.DOCUMENT_NODE||!((n=window.getComputedStyle(t,null))&&n.getPropertyValue&&("none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility")))&&e(t.parentNode);var n},l=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return n.push(t),t.parentNode&&e(t.parentNode,n),n},s=function(e,t){for(var n=l(e),o=l(t),r=0;r<n.length;r+=1){var i=n[r];if(o.indexOf(i)>=0)return i}return!1},m=function(e){return t(e).filter((function(e){return f(e)})).filter((function(e){return function(e){return!(("INPUT"===e.tagName||"BUTTON"===e.tagName)&&("hidden"===e.type||e.disabled))}(e)}))},E=function(e,t){return r(m(d(e,t)),!0,t)},p=function(e){return m((n=e.querySelectorAll("[data-autofocus-inside]"),t(n).map((function(e){return d([e])})).reduce((function(e,t){return e.concat(t)}),[])));var n},h=function(e){return"INPUT"===e.tagName&&"radio"===e.type},v=function(e,t){return t.filter(h).filter((function(t){return t.name===e.name})).filter((function(e){return e.checked}))[0]||e},g=function(e,t){return e.length>1&&h(e[t])&&e[t].name?e.indexOf(v(e[t],e)):t},y=function(e){return e[0]&&e.length>1&&h(e[0])&&e[0].name?v(e[0],e):e[0]},b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I=function e(t){for(var n=t.length,o=0;o<n;o+=1)for(var r=function(n){if(o!==n&&t[o].contains(t[n]))return{v:e(t.filter((function(e){return e!==t[n]})))}},i=0;i<n;i+=1){var u=r(i);if("object"===(void 0===u?"undefined":b(u)))return u.v}return t},F=function e(t){return t.parentNode?e(t.parentNode):t},R=function(e){return n(e).filter(Boolean).reduce((function(e,n){var o=n.getAttribute(u);return e.push.apply(e,o?I(t(F(n).querySelectorAll('[data-focus-lock="'+o+'"]:not([data-focus-lock-disabled="disabled"])'))):[n]),e}),[])},T=function(e){return e&&e.dataset&&e.dataset.focusGuard},w=function(e){return!T(e)},S=function(e,t){var o=document&&document.activeElement,i=R(e).filter(w),u=function(e,t,o){var r=n(e),i=n(t),u=r[0],a=null;return i.filter(Boolean).forEach((function(e){a=s(a||e,e)||a,o.filter(Boolean).forEach((function(e){var t=s(u,e);t&&(a=!a||t.contains(a)?t:s(t,a))}))})),a}(o||e,e,i),a=E(i).filter((function(e){var t=e.node;return w(t)}));if(a[0]||(a=(c=i,r(m(d(c)),!1)).filter((function(e){var t=e.node;return w(t)})))[0]){var c,f,l,h,v,b=E([u]).map((function(e){return e.node})),I=(f=b,l=a,h=new Map,l.forEach((function(e){return h.set(e.node,e)})),f.map((function(e){return h.get(e)})).filter(Boolean)),F=I.map((function(e){return e.node})),S=function(e,t,n,o,r){var i=e.length,u=e[0],a=e[i-1],c=T(n);if(!(e.indexOf(n)>=0)){var d=t.indexOf(n),f=t.indexOf(o||d),l=e.indexOf(o),s=d-f,m=t.indexOf(u),E=t.indexOf(a),p=g(e,0),h=g(e,i-1);return-1===d||-1===l?e.indexOf(r&&r.length?y(r):y(e)):!s&&l>=0?l:d<=m&&c&&Math.abs(s)>1?h:d>=m&&c&&Math.abs(s)>1?p:s&&Math.abs(s)>1?l:d<=m?h:d>E?p:s?Math.abs(s)>1?l:(i+l+s)%i:void 0}}(F,b,o,t,F.filter((v=function(e){return e.reduce((function(e,t){return e.concat(p(t))}),[])}(i),function(e){return!!e.autofocus||e.dataset&&!!e.dataset.autofocus||v.indexOf(e)>=0})));return void 0===S?S:I[S]}},D=function(e){return e===document.activeElement},A=function(e){var n=document&&document.activeElement;return!(!n||n.dataset&&n.dataset.focusGuard)&&R(e).reduce((function(e,o){return e||o.contains(n)||function(e){return n=t(e.querySelectorAll("iframe")),o=D,!!n.filter((function(e){return e===o}))[0];var n,o}(o)}),!1)},x=function(){return document&&t(document.querySelectorAll("[data-no-focus-lock]")).some((function(e){return e.contains(document.activeElement)}))},_=0,N=!1,O=0,V=null,L=function(){return document&&document.activeElement===document.body||x()},C=function(){var e=!1;if(O){var t=O;L()||(t&&!A(t)&&(e=function(e,t){var n,o=S(e,t);if(!N&&o){if(_>2)return console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),N=!0,void setTimeout((function(){N=!1}),1);_++,(n=o.node).focus(),n.contentWindow&&n.contentWindow.focus(),_--}}(t,V)),V=document.activeElement)}return e},M=[],U=function(e){return t=M.filter((function(e){return e})).slice(-1)[0],O=t,!!void(t&&C())&&(e&&e.preventDefault(),!0);var t},B=function(e){0===M.length&&document.addEventListener("focusin",U),M.indexOf(e)<0&&(M.push(e),U())},H=function(e){M=M.filter((function(t){return t!==e})),U(),0===M.length&&document.removeEventListener("focusin",U)},k=function(){return"undefined"==typeof window},P=function(e){e=e||navigator.userAgent;var t=/(iPad).*OS\s([\d_]+)/.test(e);return{ios:!t&&/(iPhone\sOS)\s([\d_]+)/.test(e)||t,android:/(Android);?[\s/]+([\d.]+)?/.test(e)}};var j=0,q=0,W=0,K=null,Q=!1,G=[],z=function(e){if(k())return!1;if(!e)throw new Error("options must be provided");var t=!1,n={get passive(){t=!0}},o=function(){},r="__TUA_BSL_TEST_PASSIVE__";window.addEventListener(r,o,n),window.removeEventListener(r,o,n);var i=e.capture;return t?e:void 0!==i&&i}({passive:!1}),X=!k()&&"scrollBehavior"in document.documentElement.style,Y=function(e){e.cancelable&&e.preventDefault()},J=function(e){e||null!==e&&"production"!==process.env.NODE_ENV&&console.warn("If scrolling is also required in the floating layer, the target element must be provided.")},Z=function(e){if(!k()){if(J(e),P().ios){if(e)(Array.isArray(e)?e:[e]).forEach((function(e){e&&-1===G.indexOf(e)&&(e.ontouchstart=function(e){q=e.targetTouches[0].clientY,W=e.targetTouches[0].clientX},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){if(t){var n=t.scrollTop,o=t.scrollLeft,r=t.scrollWidth,i=t.scrollHeight,u=t.clientWidth,a=t.clientHeight,c=e.targetTouches[0].clientX-W,d=e.targetTouches[0].clientY-q,f=Math.abs(d)>Math.abs(c);if(f&&(d>0&&0===n||d<0&&n+a+1>=i)||!f&&(c>0&&0===o||c<0&&o+u+1>=r))return Y(e)}e.stopPropagation()}(t,e)},G.push(e))}));Q||(document.addEventListener("touchmove",Y,z),Q=!0)}else j<=0&&(K=P().android?(t=document.documentElement,n=document.body,o=t.scrollTop||n.scrollTop,r=Object.assign({},t.style),i=Object.assign({},n.style),t.style.height="100%",t.style.overflow="hidden",n.style.top="-".concat(o,"px"),n.style.width="100%",n.style.height="auto",n.style.position="fixed",n.style.overflow="hidden",function(){t.style.height=r.height||"",t.style.overflow=r.overflow||"",["top","width","height","overflow","position"].forEach((function(e){n.style[e]=i[e]||""})),X?window.scrollTo({top:o,behavior:"instant"}):window.scrollTo(0,o)}):function(){var e=document.body,t=Object.assign({},e.style),n=window.innerWidth-e.clientWidth;return e.style.overflow="hidden",e.style.boxSizing="border-box",e.style.paddingRight="".concat(n,"px"),function(){["overflow","boxSizing","paddingRight"].forEach((function(n){e.style[n]=t[n]||""}))}}());var t,n,o,r,i;j+=1}},$=function(e){if(!(k()||(J(e),(j-=1)>0)))if(P().ios||"function"!=typeof K){if(e)(Array.isArray(e)?e:[e]).forEach((function(e){var t=G.indexOf(e);-1!==t&&(e.ontouchmove=null,e.ontouchstart=null,G.splice(t,1))}));Q&&(document.removeEventListener("touchmove",Y,z),Q=!1)}else K()};const ee="\n position: fixed !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n z-index: 9999999;\n display: block !important;\n width: 100vw;\n height: 100%;\n margin: 0 !important;\n padding: 0 !important;\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n background: rgba(0, 0, 0, 0.6);\n",te="\n position: absolute !important;\n top: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n left: 0 !important;\n width: 100vw;\n height: 100%;\n margin: 0 !important;\n padding: 0 !important;\n background: none;\n border: none\n",ne="\n position: static;\n width: 100%;\n height: 100%;\n";let oe=function(e){return e.VERIFF_HANDSHAKE="VERIFF_HANDSHAKE",e.VERIFF_RENDER="VERIFF_RENDER",e.VERIFF_STARTED="VERIFF_STARTED",e.VERIFF_SUBMITTED="VERIFF_SUBMITTED",e.VERIFF_FINISHED="VERIFF_FINISHED",e.VERIFF_CANCELED="VERIFF_CANCELED",e.VERIFF_FORCE_RELOAD="VERIFF_FORCE_RELOAD",e.VERIFF_RELOAD_REQUEST="VERIFF_RELOAD_REQUEST",e}({}),re=function(e){return e.STARTED="STARTED",e.SUBMITTED="SUBMITTED",e.FINISHED="FINISHED",e.CANCELED="CANCELED",e.RELOAD_REQUEST="RELOAD",e}({});const ie="veriffFrame";function ue(e,t,n,o){const r=document.createElement("iframe");if(r.src=e,r.allow="autoplay; camera; microphone; fullscreen; accelerometer; magnetometer; gyroscope; picture-in-picture;",r.id=ie,t)!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const{rootElementID:o}=t;if(n){e.style.cssText=te;const t=document.createElement("div");t.style.cssText=ee,t.appendChild(e),document.body.appendChild(t),B(e),Z(e)}else{if(!o)throw new Error("rootElementID must be specified in embedded mode");if(!document.getElementById(o))throw new Error("rootElementID must point to an existing DOM element");e.style.cssText=ne,document.getElementById(o).appendChild(e)}}(r,n,o);else{r.style.cssText=te;const e=function(){const e=document.createElement("div");return e.style.cssText=ee,e}();e.appendChild(r),document.body.appendChild(e),B(r),Z(r)}return r}e.MESSAGES=re,e.createVeriffFrame=function(e){let{url:t,lang:n,onEvent:o=(()=>{}),embedded:r=!1,embeddedOptions:i,onReload:u}=e;if(!t)throw new Error("URL is not provided. Please provide a valid Veriff session url.");const a=function(e){if(e)try{return matchMedia("(max-width: 767px), (hover: none)").matches}catch(e){return console.error("Error while checking if iframe is mobile",e),!1}return!1}(r);function c(){const e=document.getElementById(ie);if(e&&e.parentNode){H(e),$(e);let t=e.parentNode.parentNode,n=e.parentNode;r&&!a&&(t=e.parentNode,n=e),t&&t.removeChild(n)}else $();window.removeEventListener("message",d)}function d(e){const t=document.getElementById(ie);e.data===oe.VERIFF_HANDSHAKE&&function(e,t){e.contentWindow?.postMessage({name:oe.VERIFF_RENDER,payload:t},"*")}(t,{version:"2.3.0",isReloadHandled:"function"==typeof u,isVeriffIframeMobile:a,embeddedConfigured:r,embedded:!a&&r}),e.data===oe.VERIFF_STARTED&&o(re.STARTED),e.data===oe.VERIFF_CANCELED&&(c(),o(re.CANCELED)),e.data===oe.VERIFF_SUBMITTED&&o(re.SUBMITTED),e.data===oe.VERIFF_FINISHED&&(c(),o(re.FINISHED)),e.data===oe.VERIFF_FORCE_RELOAD&&window.location.reload(),e.data===oe.VERIFF_RELOAD_REQUEST&&("function"==typeof u&&u(),o(re.RELOAD_REQUEST))}return ue(n&&n.length>0?function(e,t,n){if(n){const o=new URL(e),r=o.searchParams;return r.set(t,n),o.search=r.toString(),o.toString()}return e}(t,"lang",n):t,r,i,a),window.addEventListener("message",d),{close:c}},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@veriff/incontext-sdk", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
"description": "In-Context Veriff browser integration", | ||
@@ -29,2 +29,3 @@ "main": "dist/index.cjs.js", | ||
"@rollup/plugin-node-resolve": "^13.3.0", | ||
"@rollup/plugin-replace": "^6.0.1", | ||
"@types/jest": "^25.1.1", | ||
@@ -39,3 +40,2 @@ "@typescript-eslint/eslint-plugin": "^8.1.0", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"rollup-plugin-inject-process-env": "^1.3.1", | ||
"rollup-plugin-livereload": "^2.0.5", | ||
@@ -42,0 +42,0 @@ "rollup-plugin-serve": "^2.0.1", |
@@ -65,3 +65,3 @@ ## Installation | ||
```html | ||
<script src="https://cdn.veriff.me/incontext/js/v2.2.1/veriff.js"></script> | ||
<script src="https://cdn.veriff.me/incontext/js/v2.3.0/veriff.js"></script> | ||
``` | ||
@@ -68,0 +68,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
1
43588
536