@checkr/web-sdk
Advanced tools
Comparing version 0.0.30 to 0.0.31
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.30 | ||
* Version: 0.0.31 | ||
*/ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var focusableSelectors = [ | ||
@@ -57,9 +41,15 @@ 'a[href]:not([tabindex^="-"])', | ||
this._openers = $$('[data-a11y-dialog-show="' + this._id + '"]'); | ||
this._openers.forEach(function(opener) { | ||
opener.addEventListener("click", this._show); | ||
}.bind(this)); | ||
this._closers = $$("[data-a11y-dialog-hide]", this.$el).concat($$('[data-a11y-dialog-hide="' + this._id + '"]')); | ||
this._closers.forEach(function(closer) { | ||
closer.addEventListener("click", this._hide); | ||
}.bind(this)); | ||
this._openers.forEach( | ||
function(opener) { | ||
opener.addEventListener("click", this._show); | ||
}.bind(this) | ||
); | ||
this._closers = $$("[data-a11y-dialog-hide]", this.$el).concat( | ||
$$('[data-a11y-dialog-hide="' + this._id + '"]') | ||
); | ||
this._closers.forEach( | ||
function(closer) { | ||
closer.addEventListener("click", this._hide); | ||
}.bind(this) | ||
); | ||
this._fire("create"); | ||
@@ -97,8 +87,12 @@ return this; | ||
this.hide(); | ||
this._openers.forEach(function(opener) { | ||
opener.removeEventListener("click", this._show); | ||
}.bind(this)); | ||
this._closers.forEach(function(closer) { | ||
closer.removeEventListener("click", this._hide); | ||
}.bind(this)); | ||
this._openers.forEach( | ||
function(opener) { | ||
opener.removeEventListener("click", this._show); | ||
}.bind(this) | ||
); | ||
this._closers.forEach( | ||
function(closer) { | ||
closer.removeEventListener("click", this._hide); | ||
}.bind(this) | ||
); | ||
this._fire("destroy"); | ||
@@ -126,5 +120,7 @@ this._listeners = {}; | ||
this.$el.dispatchEvent(domEvent); | ||
listeners.forEach(function(listener) { | ||
listener(this.$el, event); | ||
}.bind(this)); | ||
listeners.forEach( | ||
function(listener) { | ||
listener(this.$el, event); | ||
}.bind(this) | ||
); | ||
}; | ||
@@ -189,3 +185,3 @@ A11yDialog.prototype._bindKeypress = function(event) { | ||
} | ||
var modalStyles = ".checkr-dialog-container {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n display: flex;\n}\n\n.checkr-dialog-container[aria-hidden='true'] {\n display: none;\n}\n\n.checkr-dialog-overlay {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: rgba(43, 46, 56, 0.5);\n animation: checkr-fade-in 100ms both;\n}\n\n.checkr-dialog-content {\n position: relative;\n z-index: 100;\n padding: 2rem;\n margin: auto;\n background-color: rgb(255, 255, 255);\n border-radius: 0.1rem;\n animation: checkr-fade-in 100ms 200ms both, checkr-slide-up 400ms 200ms both;\n}\n\n@keyframes checkr-fade-in {\n from {\n opacity: 0;\n }\n}\n\n@keyframes checkr-slide-up {\n from {\n transform: translateY(10%);\n }\n}\n\n.checkr-dialog-close {\n position: absolute;\n top: 0.5em;\n right: 0.5em;\n width: 1.2em;\n height: 1.2em;\n padding: 0;\n font-size: 1.25em;\n font-weight: bold;\n text-align: center;\n cursor: pointer;\n background-color: transparent;\n border: 0;\n transition: 0.15s;\n}\n\n@media (max-width: 480px) {\n .checkr-dialog-content {\n width: 100%;\n }\n}\n"; | ||
var modalStyles = ".checkr-dialog-container{position:fixed;top:0;right:0;bottom:0;left:0;z-index:100;display:flex}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#2b2e3880;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 (max-width: 480px){.checkr-dialog-content{width:100%}}\n"; | ||
const triggerModal = (onShow, params, nonce) => { | ||
@@ -202,12 +198,12 @@ const modalContainer = document.createElement("div"); | ||
const container = document.querySelector("#checkr-dialog"); | ||
const dialog2 = new A11yDialog(container); | ||
dialog2.on("hide", () => { | ||
const dialog = new A11yDialog(container); | ||
dialog.on("hide", () => { | ||
modalContainer.remove(); | ||
styleElement.remove(); | ||
dialog2.destroy(); | ||
dialog.destroy(); | ||
}); | ||
dialog2.on("show", () => { | ||
dialog.on("show", () => { | ||
onShow(".checkr-dialog-content"); | ||
}); | ||
dialog2.show(); | ||
dialog.show(); | ||
}; | ||
@@ -253,3 +249,5 @@ const html = ` | ||
const parent = document.head || document.body || document.documentElement; | ||
const scriptAlreadyExists = parent.querySelector(`script[src*="${webSDKServicesURL}"]`); | ||
const scriptAlreadyExists = parent.querySelector( | ||
`script[src*="${webSDKServicesURL}"]` | ||
); | ||
const successCallback = () => { | ||
@@ -289,3 +287,3 @@ resolve(window.CheckrEmbedDefinitions); | ||
const headers = sessionTokenRequestHeaders(); | ||
return __spreadValues(__spreadValues({}, presetHeaders), headers); | ||
return { ...presetHeaders, ...headers }; | ||
}; | ||
@@ -297,6 +295,8 @@ const response = await fetch(sessionTokenPath, { | ||
if (!response.ok) { | ||
throw new Error(JSON.stringify({ | ||
status: response.status, | ||
message: await response.json() | ||
})); | ||
throw new Error( | ||
JSON.stringify({ | ||
status: response.status, | ||
message: await response.json() | ||
}) | ||
); | ||
} | ||
@@ -310,3 +310,3 @@ try { | ||
} | ||
const version = "0.0.30"; | ||
const version = "0.0.31"; | ||
function withInternalProps(props) { | ||
@@ -317,3 +317,3 @@ const internalProps = { | ||
const modalStyles2 = document.getElementById("checkr-modal-styles"); | ||
new A11yDialog(document.querySelector("#checkr-dialog")); | ||
const dialog = new A11yDialog(document.querySelector("#checkr-dialog")); | ||
modalContainer.remove(); | ||
@@ -324,6 +324,12 @@ modalStyles2.remove(); | ||
isOpenedAsModal: () => !!document.getElementById("checkr-modal-container"), | ||
onSessionTokenNeed: () => refetchSessionToken(props.sessionTokenPath, props.sessionTokenRequestHeaders), | ||
onSessionTokenNeed: () => refetchSessionToken( | ||
props.sessionTokenPath, | ||
props.sessionTokenRequestHeaders | ||
), | ||
webSdkVersion: version | ||
}; | ||
return __spreadValues(__spreadValues({}, props), internalProps); | ||
return { | ||
...props, | ||
...internalProps | ||
}; | ||
} | ||
@@ -342,5 +348,9 @@ class Embed { | ||
modal(params = { width: "600px" }) { | ||
triggerModal((modalContentSelector) => { | ||
this.render(modalContentSelector); | ||
}, params, this.props.cspNonce); | ||
triggerModal( | ||
(modalContentSelector) => { | ||
this.render(modalContentSelector); | ||
}, | ||
params, | ||
this.props.cspNonce | ||
); | ||
} | ||
@@ -347,0 +357,0 @@ static useReact(React, ReactDOM) { |
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.30 | ||
* Version: 0.0.31 | ||
*/ | ||
var P=Object.defineProperty;var E=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var x=(r,s,d)=>s in r?P(r,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):r[s]=d,f=(r,s)=>{for(var d in s||(s={}))I.call(s,d)&&x(r,d,s[d]);if(E)for(var d of E(s))M.call(s,d)&&x(r,d,s[d]);return r};(function(r,s){typeof exports=="object"&&typeof module!="undefined"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(r=typeof globalThis!="undefined"?globalThis:r||self,s(r.Checkr={}))})(this,function(r){"use strict";var s=['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^="-"])'],d=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,g(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 n=(this._listeners[e]||[]).indexOf(t);return n>-1&&this._listeners[e].splice(n,1),this},a.prototype._fire=function(e,t){var n=this._listeners[e]||[],i=new CustomEvent(e,{detail:t});this.$el.dispatchEvent(i),n.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===d&&C(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]")&&g(this.$el)};function $(e){return Array.prototype.slice.call(e)}function u(e,t){return $((t||document).querySelectorAll(e))}function g(e){var t=e.querySelector("[autofocus]")||e;t.focus()}function A(e){return u(s.join(","),e).filter(function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)})}function C(e,t){var n=A(e),i=n.indexOf(document.activeElement);t.shiftKey&&i===0?(n[n.length-1].focus(),t.preventDefault()):!t.shiftKey&&i===n.length-1&&(n[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 D=`.checkr-dialog-container { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
z-index: 100; | ||
display: flex; | ||
} | ||
.checkr-dialog-container[aria-hidden='true'] { | ||
display: none; | ||
} | ||
.checkr-dialog-overlay { | ||
position: fixed; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
background-color: rgba(43, 46, 56, 0.5); | ||
animation: checkr-fade-in 100ms both; | ||
} | ||
.checkr-dialog-content { | ||
position: relative; | ||
z-index: 100; | ||
padding: 2rem; | ||
margin: auto; | ||
background-color: rgb(255, 255, 255); | ||
border-radius: 0.1rem; | ||
animation: checkr-fade-in 100ms 200ms both, checkr-slide-up 400ms 200ms both; | ||
} | ||
@keyframes checkr-fade-in { | ||
from { | ||
opacity: 0; | ||
} | ||
} | ||
@keyframes checkr-slide-up { | ||
from { | ||
transform: translateY(10%); | ||
} | ||
} | ||
.checkr-dialog-close { | ||
position: absolute; | ||
top: 0.5em; | ||
right: 0.5em; | ||
width: 1.2em; | ||
height: 1.2em; | ||
padding: 0; | ||
font-size: 1.25em; | ||
font-weight: bold; | ||
text-align: center; | ||
cursor: pointer; | ||
background-color: transparent; | ||
border: 0; | ||
transition: 0.15s; | ||
} | ||
@media (max-width: 480px) { | ||
.checkr-dialog-content { | ||
width: 100%; | ||
} | ||
} | ||
`;const T=(e,t,n)=>{const i=document.createElement("div");i.id="checkr-modal-container",i.innerHTML=F,document.body.appendChild(i);const o=document.createElement("style");n&&o.setAttribute("nonce",n),o.innerHTML=`.checkr-dialog-content {width: ${t.width};}`+D,document.getElementsByTagName("head")[0].appendChild(o);const l=document.querySelector("#checkr-dialog"),c=new a(l);c.on("hide",()=>{i.remove(),o.remove(),c.destroy()}),c.on("show",()=>{e(".checkr-dialog-content")}),c.show()},F=` | ||
(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,b(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]")&&b(this.$el)};function E(e){return Array.prototype.slice.call(e)}function h(e,t){return E((t||document).querySelectorAll(e))}function b(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;top:0;right:0;bottom:0;left:0;z-index:100;display:flex}.checkr-dialog-container[aria-hidden=true]{display:none}.checkr-dialog-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#2b2e3880;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 (max-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=` | ||
<div | ||
@@ -92,2 +26,2 @@ class="checkr-dialog-container" | ||
</div> | ||
`;let L="https://web-sdk-services.checkr.com";function w(){const e=window.devWebSDKServicesURL?window.devWebSDKServicesURL:L,t=20,n=300,i=(o,l,c=0)=>{window.CheckrEmbedDefinitions&&o(),c>=t?l():setTimeout(()=>{i(o,l,c+1)},n)};return new Promise((o,l)=>{const c=document.head||document.body||document.documentElement,y=c.querySelector(`script[src*="${e}"]`),m=()=>{o(window.CheckrEmbedDefinitions)},p=()=>{l(new Error(`Failed to load script: ${e}`))};if(y){i(m,p);return}const h=document.createElement("script"),_=()=>{h.onerror=null,h.onload=null};h.onerror=()=>{_(),p()},h.onload=()=>{_(),m()},h.async=!0,h.src=`${e}/lib/checkr-embed-definitions.js`,c.appendChild(h)})}async function K(e,t=()=>({})){const i=await fetch(e,{method:"POST",headers:(()=>{const o={"Content-type":"application/json"},l=t();return f(f({},o),l)})()});if(!i.ok)throw new Error(JSON.stringify({status:i.status,message:await i.json()}));try{return(await i.json()).token}catch{return null}}const N="0.0.30";function v(e){const t={closeModal:()=>{const n=document.getElementById("checkr-modal-container"),i=document.getElementById("checkr-modal-styles");new a(document.querySelector("#checkr-dialog")),n.remove(),i.remove(),dialog.destroy()},isOpenedAsModal:()=>!!document.getElementById("checkr-modal-container"),onSessionTokenNeed:()=>K(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:N};return f(f({},e),t)}class k{constructor(t){this.props=v(t)}render(t){w().then(n=>{const i=Object.getPrototypeOf(this).constructor.embedName();n[i](this.props).render(t)})}modal(t={width:"600px"}){T(n=>{this.render(n)},t,this.props.cspNonce)}static useReact(t,n){return i=>{const o=this.embedName(),[l,c]=t.useState(null),y=v(i);if(t.useEffect(()=>{w().then(m=>{c(m)})},[]),l){const p=l[o].driver("react",{React:t,ReactDOM:n});return t.createElement(p,y,null)}else return t.createElement("div",null)}}}class O extends k{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class j extends k{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}var q={NewInvitation:O,ReportsOverview:j};r.Embeds=q,Object.defineProperty(r,"__esModule",{value:!0}),r[Symbol.toStringTag]="Module"}); | ||
`;let D="https://web-sdk-services.checkr.com";function y(){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,p=r.querySelector(`script[src*="${e}"]`),u=()=>{o(window.CheckrEmbedDefinitions)},f=()=>{d(new Error(`Failed to load script: ${e}`))};if(p){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 T(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 F="0.0.31";function g(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:()=>T(e.sessionTokenPath,e.sessionTokenRequestHeaders),webSdkVersion:F}}}class w{constructor(t){this.props=g(t)}render(t){y().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),p=g(n);if(t.useEffect(()=>{y().then(u=>{r(u)})},[]),d){const f=d[o].driver("react",{React:t,ReactDOM:i});return t.createElement(f,p,null)}else return t.createElement("div",null)}}}class L extends w{constructor(t={}){super(t)}static embedName(){return"NewInvitation"}}class K extends w{constructor(t={}){super(t)}static embedName(){return"ReportsOverview"}}var N={NewInvitation:L,ReportsOverview:K};c.Embeds=N,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "@checkr/web-sdk", | ||
"version": "0.0.30", | ||
"version": "0.0.31", | ||
"files": [ | ||
@@ -25,5 +25,4 @@ "dist" | ||
"lint:style:fix": "stylelint --fix src/**/*.{css,scss}", | ||
"release": "yarn run build:production && yarn publish", | ||
"serve": "vite --port 3000", | ||
"update-prerelease-version": "yarn version --prerelease" | ||
"release": "yarn run build:production && yarn publish --access public --verbose", | ||
"serve": "vite --port 3000" | ||
}, | ||
@@ -34,14 +33,16 @@ "dependencies": { | ||
"devDependencies": { | ||
"eslint": "^7.29.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.2", | ||
"sass": "^1.35.2", | ||
"stylelint": "^13.13.1", | ||
"stylelint-config-recess-order": "^2.1.0", | ||
"stylelint-config-recommended": "^5.0.0", | ||
"stylelint-config-standard": "^22.0.0", | ||
"vite": "^2.9.13", | ||
"vite-plugin-banner": "^0.2.0" | ||
"eslint": "8.32.0", | ||
"eslint-config-prettier": "8.6.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-json": "3.1.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.8.3", | ||
"sass": "1.57.1", | ||
"stylelint": "13.13.1", | ||
"stylelint-config-recess-order": "3.1.0", | ||
"stylelint-config-recommended": "5.0.0", | ||
"stylelint-config-standard": "22.0.0", | ||
"vite": "2.9.15", | ||
"vite-plugin-banner": "0.7.0" | ||
}, | ||
@@ -48,0 +49,0 @@ "resolutions": { |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23467
14
450
3