Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@checkr/web-sdk

Package Overview
Dependencies
Maintainers
4
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@checkr/web-sdk - npm Package Compare versions

Comparing version 0.0.54 to 0.0.58

25

dist/web-sdk.es.js
/**
* Name: @checkr/web-sdk
* Version: 0.0.54
* Version: 0.0.58
*/

@@ -341,4 +341,5 @@ var focusableSelectors = [

}
const version = "0.0.54";
const version = "0.0.58";
function withInternalProps(props) {
var _a;
const internalProps = {

@@ -359,3 +360,4 @@ closeModal: () => {

),
webSdkVersion: version
webSdkVersion: version,
parentHost: (_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname
};

@@ -391,9 +393,14 @@ return {

const [embedDefinitions, setEmbedDefinitions] = React.useState(null);
const embedProps = withInternalProps(props);
const [embedProps, setEmbedProps] = React.useState(null);
React.useEffect(() => {
loadEmbedDefinitions(embedProps.env).then((embedDefinitions2) => {
setEmbedDefinitions(embedDefinitions2);
});
}, []);
if (embedDefinitions) {
setEmbedProps(withInternalProps(props));
}, [props]);
React.useEffect(() => {
if (embedProps) {
loadEmbedDefinitions(embedProps == null ? void 0 : embedProps.env).then((embedDefinitions2) => {
setEmbedDefinitions(embedDefinitions2);
});
}
}, [embedProps]);
if (embedProps && embedDefinitions) {
const embedDefinition = embedDefinitions[embedName];

@@ -400,0 +407,0 @@ const Component = embedDefinition.driver("react", { React, ReactDOM });

/**
* Name: @checkr/web-sdk
* Version: 0.0.54
* Version: 0.0.58
*/
(function(h,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(h=typeof globalThis!="undefined"?globalThis:h||self,l(h.Checkr={}))})(this,function(h){"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^="-"])'],x=9,S=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=u('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(e){e.addEventListener("click",this._show)}.bind(this)),this._closers=u("[data-a11y-dialog-hide]",this.$el).concat(u('[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===S&&this.$el.getAttribute("role")!=="alertdialog"&&(e.preventDefault(),this.hide(e)),this.shown&&e.which===x&&A(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 L(e){return Array.prototype.slice.call(e)}function u(e,t){return L((t||document).querySelectorAll(e))}function y(e){var t=e.querySelector("[autofocus]")||e;t.focus()}function C(e){return u(l.join(","),e).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)})}function A(e,t){var i=C(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 b(){u("[data-a11y-dialog]").forEach(function(e){new s(e)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):window.requestAnimationFrame?window.requestAnimationFrame(b):window.setTimeout(b,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 T=(e,t,i)=>{const n=document.createElement("div");n.id="checkr-modal-container",n.innerHTML=D,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 r=document.querySelector("#checkr-dialog"),a=new s(r);a.on("hide",()=>{n.remove(),o.remove(),a.destroy()}),a.on("show",()=>{e(".checkr-dialog-content")}),a.show()},D=`
(function(h,l){typeof exports=="object"&&typeof module!="undefined"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(h=typeof globalThis!="undefined"?globalThis:h||self,l(h.Checkr={}))})(this,function(h){"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^="-"])'],x=9,S=27;function a(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()}a.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=u('[data-a11y-dialog-show="'+this._id+'"]'),this._openers.forEach(function(e){e.addEventListener("click",this._show)}.bind(this)),this._closers=u("[data-a11y-dialog-hide]",this.$el).concat(u('[data-a11y-dialog-hide="'+this._id+'"]')),this._closers.forEach(function(e){e.addEventListener("click",this._hide)}.bind(this)),this._fire("create"),this},a.prototype.show=function(e){return this.shown?this:(this._previouslyFocused=document.activeElement,this.$el.removeAttribute("aria-hidden"),this.shown=!0,w(this.$el),document.body.addEventListener("focus",this._maintainFocus,!0),document.addEventListener("keydown",this._bindKeypress),this._fire("show",e),this)},a.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},a.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},a.prototype.on=function(e,t){return typeof this._listeners[e]=="undefined"&&(this._listeners[e]=[]),this._listeners[e].push(t),this},a.prototype.off=function(e,t){var i=(this._listeners[e]||[]).indexOf(t);return i>-1&&this._listeners[e].splice(i,1),this},a.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))},a.prototype._bindKeypress=function(e){!this.$el.contains(document.activeElement)||(this.shown&&e.which===S&&this.$el.getAttribute("role")!=="alertdialog"&&(e.preventDefault(),this.hide(e)),this.shown&&e.which===x&&A(this.$el,e))},a.prototype._maintainFocus=function(e){this.shown&&!e.target.closest('[aria-modal="true"]')&&!e.target.closest("[data-a11y-dialog-ignore-focus-trap]")&&w(this.$el)};function L(e){return Array.prototype.slice.call(e)}function u(e,t){return L((t||document).querySelectorAll(e))}function w(e){var t=e.querySelector("[autofocus]")||e;t.focus()}function C(e){return u(l.join(","),e).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)})}function A(e,t){var i=C(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 b(){u("[data-a11y-dialog]").forEach(function(e){new a(e)})}typeof document!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",b):window.requestAnimationFrame?window.requestAnimationFrame(b):window.setTimeout(b,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 T=(e,t,i)=>{const n=document.createElement("div");n.id="checkr-modal-container",n.innerHTML=D,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 s=document.querySelector("#checkr-dialog"),c=new a(s);c.on("hide",()=>{n.remove(),o.remove(),c.destroy()}),c.on("show",()=>{e(".checkr-dialog-content")}),c.show()},D=`
<div

@@ -26,2 +26,2 @@ class="checkr-dialog-container"

</div>
`,w="https://web-sdk-services.checkr.com",O="https://web-sdk-services.checkr-staging.com",F="https://web-sdk-services.checkr-sandbox.com",N="https://mr-x-web-sdk-services.checkr-sandbox.com",R="https://web-sdk-services.checkr.localhost",g=w,j=e=>e?e.toLowerCase().startsWith("prod")?w:e.toLowerCase().startsWith("staging")?O:e.toLowerCase().startsWith("sandbox")?F:e.toLowerCase().startsWith("mr")?N.replace("mr-x",e.toLowerCase()):e.toLowerCase().startsWith("local")?R:g:g;function v(e){const t=window.devWebSDKServicesURL?window.devWebSDKServicesURL:j(e),i=20,n=300,o=(r,a,c=0)=>{window.CheckrEmbedDefinitions&&r(),c>=i?a():setTimeout(()=>{o(r,a,c+1)},n)};return new Promise((r,a)=>{const c=document.head||document.body||document.documentElement,m=c.querySelector(`script[src*="${t}"]`),p=()=>{r(window.CheckrEmbedDefinitions)},_=()=>{a(new Error(`Failed to load script: ${t}`))};if(m){o(p,_);return}const d=document.createElement("script"),E=()=>{d.onerror=null,d.onload=null};d.onerror=()=>{E(),_()},d.onload=()=>{E(),p()},d.async=!0,d.src=`${t}/lib/checkr-embed-definitions.js`,c.appendChild(d)})}async function K(e,t=()=>({})){const n=await fetch(e,{method:"POST",headers:(()=>{const o={"Content-type":"application/json"},r=t();return{...o,...r}})()});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 P(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 U="0.0.54";function k(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=>P(e.oauthTokenPath,i),onSessionTokenNeed:()=>K(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:U}}}class f{constructor(t){this.props=k(t)}render(t){v(this.props.env).then(i=>{const n=Object.getPrototypeOf(this).constructor.embedName();i[n](this.props).render(t)})}modal(t={width:"600px"}){T(i=>{this.render(i)},t,this.props.cspNonce)}static useReact(t,i){return n=>{const o=this.embedName(),[r,a]=t.useState(null),c=k(n);if(t.useEffect(()=>{v(c.env).then(m=>{a(m)})},[]),r){const p=r[o].driver("react",{React:t,ReactDOM:i});return t.createElement(p,c,null)}else return t.createElement("div",null)}}}class q extends f{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class I extends f{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}class M extends f{constructor(t={}){super(t)}static embedName(){return"DisclosureConsent"}}class B extends f{constructor(t={}){super(t)}static embedName(){return"SignUpFlow"}}var W={NewInvitation:q,ReportsOverview:I,DisclosureConsent:M,SignUpFlow:B};h.Embeds=W,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
`,g="https://web-sdk-services.checkr.com",O="https://web-sdk-services.checkr-staging.com",F="https://web-sdk-services.checkr-sandbox.com",N="https://mr-x-web-sdk-services.checkr-sandbox.com",j="https://web-sdk-services.checkr.localhost",v=g,K=e=>e?e.toLowerCase().startsWith("prod")?g:e.toLowerCase().startsWith("staging")?O:e.toLowerCase().startsWith("sandbox")?F:e.toLowerCase().startsWith("mr")?N.replace("mr-x",e.toLowerCase()):e.toLowerCase().startsWith("local")?j:v:v;function k(e){const t=window.devWebSDKServicesURL?window.devWebSDKServicesURL:K(e),i=20,n=300,o=(s,c,r=0)=>{window.CheckrEmbedDefinitions&&s(),r>=i?c():setTimeout(()=>{o(s,c,r+1)},n)};return new Promise((s,c)=>{const r=document.head||document.body||document.documentElement,y=r.querySelector(`script[src*="${t}"]`),f=()=>{s(window.CheckrEmbedDefinitions)},p=()=>{c(new Error(`Failed to load script: ${t}`))};if(y){o(f,p);return}const d=document.createElement("script"),E=()=>{d.onerror=null,d.onload=null};d.onerror=()=>{E(),p()},d.onload=()=>{E(),f()},d.async=!0,d.src=`${t}/lib/checkr-embed-definitions.js`,r.appendChild(d)})}async function U(e,t=()=>({})){const n=await fetch(e,{method:"POST",headers:(()=>{const o={"Content-type":"application/json"},s=t();return{...o,...s}})()});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 R(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 P="0.0.58";function _(e){var i;const t={closeModal:()=>{const n=document.getElementById("checkr-modal-container"),o=document.getElementById("checkr-modal-styles"),s=new a(document.querySelector("#checkr-dialog"));n.remove(),o.remove(),s.destroy()},isOpenedAsModal:()=>!!document.getElementById("checkr-modal-container"),callbackOauthToken:n=>R(e.oauthTokenPath,n),onSessionTokenNeed:()=>U(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:P,parentHost:(i=window==null?void 0:window.location)==null?void 0:i.hostname};return{...e,...t}}class m{constructor(t){this.props=_(t)}render(t){k(this.props.env).then(i=>{const n=Object.getPrototypeOf(this).constructor.embedName();i[n](this.props).render(t)})}modal(t={width:"600px"}){T(i=>{this.render(i)},t,this.props.cspNonce)}static useReact(t,i){return n=>{const o=this.embedName(),[s,c]=t.useState(null),[r,y]=t.useState(null);if(t.useEffect(()=>{y(_(n))},[n]),t.useEffect(()=>{r&&k(r==null?void 0:r.env).then(f=>{c(f)})},[r]),r&&s){const p=s[o].driver("react",{React:t,ReactDOM:i});return t.createElement(p,r,null)}else return t.createElement("div",null)}}}class q extends m{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class I extends m{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}class M extends m{constructor(t={}){super(t)}static embedName(){return"DisclosureConsent"}}class B extends m{constructor(t={}){super(t)}static embedName(){return"SignUpFlow"}}var H={NewInvitation:q,ReportsOverview:I,DisclosureConsent:M,SignUpFlow:B};h.Embeds=H,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
{
"name": "@checkr/web-sdk",
"version": "0.0.54",
"version": "0.0.58",
"files": [

@@ -18,3 +18,3 @@ "dist"

"build:dev": "vite build -m development --watch",
"build:production": "vite build",
"build:production": "rimraf ./dist && vite build",
"dev": "run-p build:dev dev-server",

@@ -32,7 +32,8 @@ "start-with-sandbox": "run-p build:dev dev-server:sandbox",

"dev-server:staging": "VITE_ENV=staging npm run dev-server",
"build:playground": "npm run build:production && vite build -c vite-playground.config.js",
"build:playground": "npm run build:production && rimraf ./build && vite build -c vite-playground.config.js",
"artifactory-login": "npm config set -- '//arti.checkrhq.net/artifactory/api/npm/npm/:_authToken'"
},
"dependencies": {
"a11y-dialog": "^7.3.0"
"a11y-dialog": "^7.3.0",
"rimraf": "^5.0.5"
},

@@ -39,0 +40,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc