@checkr/web-sdk
Advanced tools
Comparing version 0.0.29 to 0.0.30
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.29 | ||
* Version: 0.0.30 | ||
*/ | ||
@@ -302,3 +302,3 @@ var __defProp = Object.defineProperty; | ||
} | ||
const version = "0.0.29"; | ||
const version = "0.0.30"; | ||
function withInternalProps(props) { | ||
@@ -305,0 +305,0 @@ const internalProps = { |
/** | ||
* Name: @checkr/web-sdk | ||
* Version: 0.0.29 | ||
* Version: 0.0.30 | ||
*/ | ||
@@ -92,2 +92,2 @@ 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 { | ||
</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.29";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 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"}); |
{ | ||
"name": "@checkr/web-sdk", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"files": [ | ||
@@ -43,5 +43,8 @@ "dist" | ||
"stylelint-config-standard": "^22.0.0", | ||
"vite": "^2.7.13", | ||
"vite": "^2.9.13", | ||
"vite-plugin-banner": "^0.2.0" | ||
}, | ||
"resolutions": { | ||
"minimist": ">=1.2.7" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
24965