@checkr/web-sdk
Advanced tools
Comparing version 0.0.49 to 0.0.50
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.49 | ||
* Version: 0.0.50 | ||
*/ | ||
@@ -182,3 +182,3 @@ var focusableSelectors = [ | ||
} | ||
var modalStyles = ".checkr-dialog-container{position:fixed;inset:0;z-index:100;display:flex}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;inset:0;background-color:#2b2e387f;animation:checkr-fade-in .1s both}.checkr-dialog-content{position:relative;z-index:100;padding:2rem;margin:auto;background-color:#fff;border-radius:.1rem;animation:checkr-fade-in .1s .2s both,checkr-slide-up .4s .2s both}@keyframes checkr-fade-in{0%{opacity:0}}@keyframes checkr-slide-up{0%{transform:translateY(10%)}}.checkr-dialog-close{position:absolute;top:.5em;right:.5em;width:1.2em;height:1.2em;padding:0;font-size:1.25em;font-weight:700;text-align:center;cursor:pointer;background-color:transparent;border:0;transition:.15s}@media screen and (width <= 480px){.checkr-dialog-content{width:100%}}\n"; | ||
var modalStyles = ".checkr-dialog-container{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;overflow:auto}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;inset:0;background-color:#2b2e387f;animation:checkr-fade-in .1s both}.checkr-dialog-content{position:relative;z-index:100;width:80%;max-width:800px;max-height:80vh;padding:2rem;margin:auto;overflow-y:auto;background-color:#fff;border-radius:.1rem;animation:checkr-fade-in .1s .2s both,checkr-slide-up .4s .2s both}@keyframes checkr-fade-in{0%{opacity:0}}@keyframes checkr-slide-up{0%{transform:translateY(10%)}}.checkr-dialog-close{position:absolute;top:.5em;right:.5em;width:1.2em;height:1.2em;padding:0;font-size:1.25em;font-weight:700;text-align:center;cursor:pointer;background-color:transparent;border:0;transition:.15s}@media screen and (width <= 480px){.checkr-dialog-content{width:100%}}\n"; | ||
const triggerModal = (onShow, params, nonce) => { | ||
@@ -303,3 +303,21 @@ const modalContainer = document.createElement("div"); | ||
} | ||
const version = "0.0.49"; | ||
async function sendOauthToken(oauthTokenPath, oauthToken) { | ||
const response = await fetch(oauthTokenPath, { | ||
method: "POST", | ||
headers: { | ||
"Content-type": "application/json" | ||
}, | ||
body: JSON.stringify({ code: oauthToken }) | ||
}); | ||
if (!response.ok) { | ||
throw new Error( | ||
JSON.stringify({ | ||
status: response.status, | ||
message: await response.json() | ||
}) | ||
); | ||
} | ||
return true; | ||
} | ||
const version = "0.0.50"; | ||
function withInternalProps(props) { | ||
@@ -316,2 +334,3 @@ const internalProps = { | ||
isOpenedAsModal: () => !!document.getElementById("checkr-modal-container"), | ||
callbackOauthToken: (oauthToken) => sendOauthToken(props.oauthTokenPath, oauthToken), | ||
onSessionTokenNeed: () => refetchSessionToken( | ||
@@ -318,0 +337,0 @@ props.sessionTokenPath, |
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.49 | ||
* Version: 0.0.50 | ||
*/ | ||
(function(c,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis!="undefined"?globalThis:c||self,l(c.Checkr={}))})(this,function(c){"use strict";var l=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],k=9,_=27;function s(e){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=e,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}s.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=h('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(e){e.addEventListener("click",this._show)}.bind(this)),this._closers=h("[data-a11y-dialog-hide]",this.$el).concat(h('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(e){e.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},s.prototype.show=function(e){return this.shown?this:(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,y(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",e),this)},s.prototype.hide=function(e){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",e),this):this},s.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(e){e.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(e){e.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},s.prototype.on=function(e,t){return typeof this._listeners[e]=="undefined"&&(this._listeners[e]=[]),this._listeners[e].push(t),this},s.prototype.off=function(e,t){var i=(this._listeners[e]||[]).indexOf(t);return i>-1&&this._listeners[e].splice(i,1),this},s.prototype._fire=function(e,t){var i=this._listeners[e]||[],n=new CustomEvent(e,{detail:t});this.$el.dispatchEvent(n),i.forEach(function(o){o(this.$el,t)}.bind(this))},s.prototype._bindKeypress=function(e){!this.$el.contains(document.activeElement)||(this.shown&&e.which===_&&this.$el.getAttribute("role")!=="alertdialog"&&(e.preventDefault(),this.hide(e)),this.shown&&e.which===k&&S(this.$el,e))},s.prototype._maintainFocus=function(e){this.shown&&!e.target.closest('[aria-modal="true"]')&&!e.target.closest("[data-a11y-dialog-ignore-focus-trap]")&&y(this.$el)};function E(e){return Array.prototype.slice.call(e)}function h(e,t){return E((t||document).querySelectorAll(e))}function y(e){var t=e.querySelector("[autofocus]")||e;t.focus()}function x(e){return h(l.join(","),e).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)})}function S(e,t){var i=x(e),n=i.indexOf(document.activeElement);t.shiftKey&&n===0?(i[i.length-1].focus(),t.preventDefault()):!t.shiftKey&&n===i.length-1&&(i[0].focus(),t.preventDefault())}function m(){h("[data-a11y-dialog]").forEach(function(e){new s(e)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16));var $=`.checkr-dialog-container{position:fixed;inset:0;z-index:100;display:flex}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;inset:0;background-color:#2b2e387f;animation:checkr-fade-in .1s both}.checkr-dialog-content{position:relative;z-index:100;padding:2rem;margin:auto;background-color:#fff;border-radius:.1rem;animation:checkr-fade-in .1s .2s both,checkr-slide-up .4s .2s both}@keyframes checkr-fade-in{0%{opacity:0}}@keyframes checkr-slide-up{0%{transform:translateY(10%)}}.checkr-dialog-close{position:absolute;top:.5em;right:.5em;width:1.2em;height:1.2em;padding:0;font-size:1.25em;font-weight:700;text-align:center;cursor:pointer;background-color:transparent;border:0;transition:.15s}@media screen and (width <= 480px){.checkr-dialog-content{width:100%}} | ||
`;const A=(e,t,i)=>{const n=document.createElement("div");n.id="checkr-modal-container",n.innerHTML=C,document.body.appendChild(n);const o=document.createElement("style");i&&o.setAttribute("nonce",i),o.innerHTML=`.checkr-dialog-content {width: ${t.width};}`+$,document.getElementsByTagName("head")[0].appendChild(o);const d=document.querySelector("#checkr-dialog"),r=new s(d);r.on("hide",()=>{n.remove(),o.remove(),r.destroy()}),r.on("show",()=>{e(".checkr-dialog-content")}),r.show()},C=` | ||
(function(c,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(c=typeof globalThis!="undefined"?globalThis:c||self,l(c.Checkr={}))})(this,function(c){"use strict";var l=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'],k=9,E=27;function s(e){this._show=this.show.bind(this),this._hide=this.hide.bind(this),this._maintainFocus=this._maintainFocus.bind(this),this._bindKeypress=this._bindKeypress.bind(this),this.$el=e,this.shown=!1,this._id=this.$el.getAttribute("data-a11y-dialog")||this.$el.id,this._previouslyFocused=null,this._listeners={},this.create()}s.prototype.create=function(){return this.$el.setAttribute("aria-hidden",!0),this.$el.setAttribute("aria-modal",!0),this.$el.setAttribute("tabindex",-1),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),this._openers=h('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(e){e.addEventListener("click",this._show)}.bind(this)),this._closers=h("[data-a11y-dialog-hide]",this.$el).concat(h('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(e){e.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},s.prototype.show=function(e){return this.shown?this:(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,y(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",e),this)},s.prototype.hide=function(e){return this.shown?(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this._previouslyFocused&&this._previouslyFocused.focus&&this._previouslyFocused.focus(),document.body.removeEventListener("focus",this._maintainFocus,!0),document.removeEventListener("keydown",this._bindKeypress),this._fire("hide",e),this):this},s.prototype.destroy=function(){return this.hide(),this._openers.forEach(function(e){e.removeEventListener("click",this._show)}.bind(this)),this._closers.forEach(function(e){e.removeEventListener("click",this._hide)}.bind(this)),this._fire("destroy"),this._listeners={},this},s.prototype.on=function(e,t){return typeof this._listeners[e]=="undefined"&&(this._listeners[e]=[]),this._listeners[e].push(t),this},s.prototype.off=function(e,t){var i=(this._listeners[e]||[]).indexOf(t);return i>-1&&this._listeners[e].splice(i,1),this},s.prototype._fire=function(e,t){var i=this._listeners[e]||[],n=new CustomEvent(e,{detail:t});this.$el.dispatchEvent(n),i.forEach(function(o){o(this.$el,t)}.bind(this))},s.prototype._bindKeypress=function(e){!this.$el.contains(document.activeElement)||(this.shown&&e.which===E&&this.$el.getAttribute("role")!=="alertdialog"&&(e.preventDefault(),this.hide(e)),this.shown&&e.which===k&&S(this.$el,e))},s.prototype._maintainFocus=function(e){this.shown&&!e.target.closest('[aria-modal="true"]')&&!e.target.closest("[data-a11y-dialog-ignore-focus-trap]")&&y(this.$el)};function _(e){return Array.prototype.slice.call(e)}function h(e,t){return _((t||document).querySelectorAll(e))}function y(e){var t=e.querySelector("[autofocus]")||e;t.focus()}function x(e){return h(l.join(","),e).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)})}function S(e,t){var i=x(e),n=i.indexOf(document.activeElement);t.shiftKey&&n===0?(i[i.length-1].focus(),t.preventDefault()):!t.shiftKey&&n===i.length-1&&(i[0].focus(),t.preventDefault())}function m(){h("[data-a11y-dialog]").forEach(function(e){new s(e)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m):window.requestAnimationFrame?window.requestAnimationFrame(m):window.setTimeout(m,16));var $=`.checkr-dialog-container{position:fixed;inset:0;z-index:100;display:flex;align-items:center;justify-content:center;overflow:auto}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;inset:0;background-color:#2b2e387f;animation:checkr-fade-in .1s both}.checkr-dialog-content{position:relative;z-index:100;width:80%;max-width:800px;max-height:80vh;padding:2rem;margin:auto;overflow-y:auto;background-color:#fff;border-radius:.1rem;animation:checkr-fade-in .1s .2s both,checkr-slide-up .4s .2s both}@keyframes checkr-fade-in{0%{opacity:0}}@keyframes checkr-slide-up{0%{transform:translateY(10%)}}.checkr-dialog-close{position:absolute;top:.5em;right:.5em;width:1.2em;height:1.2em;padding:0;font-size:1.25em;font-weight:700;text-align:center;cursor:pointer;background-color:transparent;border:0;transition:.15s}@media screen and (width <= 480px){.checkr-dialog-content{width:100%}} | ||
`;const A=(e,t,i)=>{const n=document.createElement("div");n.id="checkr-modal-container",n.innerHTML=T,document.body.appendChild(n);const o=document.createElement("style");i&&o.setAttribute("nonce",i),o.innerHTML=`.checkr-dialog-content {width: ${t.width};}`+$,document.getElementsByTagName("head")[0].appendChild(o);const a=document.querySelector("#checkr-dialog"),r=new s(a);r.on("hide",()=>{n.remove(),o.remove(),r.destroy()}),r.on("show",()=>{e(".checkr-dialog-content")}),r.show()},T=` | ||
<div | ||
@@ -26,2 +26,2 @@ class="checkr-dialog-container" | ||
</div> | ||
`;let D="https://web-sdk-services.checkr.com";function g(){const e=window.devWebSDKServicesURL?window.devWebSDKServicesURL:D,t=20,i=300,n=(o,d,r=0)=>{window.CheckrEmbedDefinitions&&o(),r>=t?d():setTimeout(()=>{n(o,d,r+1)},i)};return new Promise((o,d)=>{const r=document.head||document.body||document.documentElement,b=r.querySelector(`script[src*="${e}"]`),u=()=>{o(window.CheckrEmbedDefinitions)},f=()=>{d(new Error(`Failed to load script: ${e}`))};if(b){n(u,f);return}const a=document.createElement("script"),v=()=>{a.onerror=null,a.onload=null};a.onerror=()=>{v(),f()},a.onload=()=>{v(),u()},a.async=!0,a.src=`${e}/lib/checkr-embed-definitions.js`,r.appendChild(a)})}async function F(e,t=()=>({})){const n=await fetch(e,{method:"POST",headers:(()=>{const o={"Content-type":"application/json"},d=t();return{...o,...d}})()});if(!n.ok)throw new Error(JSON.stringify({status:n.status,message:await n.json()}));try{return(await n.json()).token}catch{return null}}const T="0.0.49";function w(e){return{...e,...{closeModal:()=>{const i=document.getElementById("checkr-modal-container"),n=document.getElementById("checkr-modal-styles"),o=new s(document.querySelector("#checkr-dialog"));i.remove(),n.remove(),o.destroy()},isOpenedAsModal:()=>!!document.getElementById("checkr-modal-container"),onSessionTokenNeed:()=>F(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:T}}}class p{constructor(t){this.props=w(t)}render(t){g().then(i=>{const n=Object.getPrototypeOf(this).constructor.embedName();i[n](this.props).render(t)})}modal(t={width:"600px"}){A(i=>{this.render(i)},t,this.props.cspNonce)}static useReact(t,i){return n=>{const o=this.embedName(),[d,r]=t.useState(null),b=w(n);if(t.useEffect(()=>{g().then(u=>{r(u)})},[]),d){const f=d[o].driver("react",{React:t,ReactDOM:i});return t.createElement(f,b,null)}else return t.createElement("div",null)}}}class L extends p{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class K extends p{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}class N extends p{constructor(t={}){super(t)}static embedName(){return"SignupFlow"}}var O={NewInvitation:L,ReportsOverview:K,SignupFlow:N};c.Embeds=O,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
`;let C="https://web-sdk-services.checkr.com";function g(){const e=window.devWebSDKServicesURL?window.devWebSDKServicesURL:C,t=20,i=300,n=(o,a,r=0)=>{window.CheckrEmbedDefinitions&&o(),r>=t?a():setTimeout(()=>{n(o,a,r+1)},i)};return new Promise((o,a)=>{const r=document.head||document.body||document.documentElement,b=r.querySelector(`script[src*="${e}"]`),u=()=>{o(window.CheckrEmbedDefinitions)},f=()=>{a(new Error(`Failed to load script: ${e}`))};if(b){n(u,f);return}const d=document.createElement("script"),v=()=>{d.onerror=null,d.onload=null};d.onerror=()=>{v(),f()},d.onload=()=>{v(),u()},d.async=!0,d.src=`${e}/lib/checkr-embed-definitions.js`,r.appendChild(d)})}async function D(e,t=()=>({})){const n=await fetch(e,{method:"POST",headers:(()=>{const o={"Content-type":"application/json"},a=t();return{...o,...a}})()});if(!n.ok)throw new Error(JSON.stringify({status:n.status,message:await n.json()}));try{return(await n.json()).token}catch{return null}}async function F(e,t){const i=await fetch(e,{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({code:t})});if(!i.ok)throw new Error(JSON.stringify({status:i.status,message:await i.json()}));return!0}const O="0.0.50";function w(e){return{...e,...{closeModal:()=>{const i=document.getElementById("checkr-modal-container"),n=document.getElementById("checkr-modal-styles"),o=new s(document.querySelector("#checkr-dialog"));i.remove(),n.remove(),o.destroy()},isOpenedAsModal:()=>!!document.getElementById("checkr-modal-container"),callbackOauthToken:i=>F(e.oauthTokenPath,i),onSessionTokenNeed:()=>D(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:O}}}class p{constructor(t){this.props=w(t)}render(t){g().then(i=>{const n=Object.getPrototypeOf(this).constructor.embedName();i[n](this.props).render(t)})}modal(t={width:"600px"}){A(i=>{this.render(i)},t,this.props.cspNonce)}static useReact(t,i){return n=>{const o=this.embedName(),[a,r]=t.useState(null),b=w(n);if(t.useEffect(()=>{g().then(u=>{r(u)})},[]),a){const f=a[o].driver("react",{React:t,ReactDOM:i});return t.createElement(f,b,null)}else return t.createElement("div",null)}}}class L extends p{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class N extends p{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}class j extends p{constructor(t={}){super(t)}static embedName(){return"SignupFlow"}}var K={NewInvitation:L,ReportsOverview:N,SignupFlow:j};c.Embeds=K,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "@checkr/web-sdk", | ||
"version": "0.0.49", | ||
"version": "0.0.50", | ||
"files": [ | ||
@@ -5,0 +5,0 @@ "dist" |
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
24733
479
0
4