@checktiv/sdk-web 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +181 -0
- package/dist/agents/AGENTS.md +56 -0
- package/dist/agents/manifest.json +101 -0
- package/dist/capture-ui.css +1 -0
- package/dist/capture-ui.d.ts +16 -0
- package/dist/capture-ui.js +6 -0
- package/dist/capture.d.ts +7 -0
- package/dist/capture.js +3 -0
- package/dist/chunk-AIK7CDV6.js +3 -0
- package/dist/chunk-BYTKOKAD.js +7 -0
- package/dist/chunk-C7H2ZVQT.js +7 -0
- package/dist/chunk-CXNPD67Z.js +5 -0
- package/dist/chunk-FGWZZNAN.js +5 -0
- package/dist/chunk-HV2QKVJX.js +5 -0
- package/dist/chunk-QFA3K5ZV.js +3 -0
- package/dist/chunk-TRTAZKYV.js +66 -0
- package/dist/chunk-WQCYRLWP.js +3 -0
- package/dist/chunk-XOGHMNBX.js +3 -0
- package/dist/controller-C4vJ47JI.d.ts +42 -0
- package/dist/copy-DeUly5vr.d.ts +18 -0
- package/dist/cross-device.d.ts +1 -0
- package/dist/cross-device.js +225 -0
- package/dist/custom-form.css +1 -0
- package/dist/custom-form.d.ts +3 -0
- package/dist/custom-form.js +10 -0
- package/dist/fp.esm.min-QD5CJD52.js +5 -0
- package/dist/fraud.d.ts +3 -0
- package/dist/fraud.js +9 -0
- package/dist/idv/cross-device.d.ts +24 -0
- package/dist/idv/cross-device.js +6 -0
- package/dist/idv.css +1 -0
- package/dist/idv.d.ts +3 -0
- package/dist/idv.js +13 -0
- package/dist/index-BtJbU9MC.d.ts +43 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +12 -0
- package/dist/machine--zVZIM4F.d.ts +144 -0
- package/dist/react.d.ts +23 -0
- package/dist/react.js +12 -0
- package/dist/types-CnlkFS7V.d.ts +244 -0
- package/package.json +130 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var ERROR_TABLE={origin_not_allowed:{recoverable:false,recovery:"contact_operator",message:"This origin is not allowed for the publishable key. Add it to the allowed origins list in the Checktiv console."},token_expired:{recoverable:true,recovery:"retry",message:"The session token expired. The SDK is refreshing it; if this persists, mint a new token from your backend."},session_expired:{recoverable:false,recovery:"refresh_session",message:"The verification session is no longer valid. Start a new verification from your backend."},protocol_mismatch:{recoverable:false,recovery:"contact_operator",message:"The SDK version is out of date. Update to the latest published version."},camera_denied:{recoverable:true,recovery:"cross_device",message:"Camera access was blocked. Allow camera access, or continue on another device."},cv_gate_failed:{recoverable:true,recovery:"retry",message:"We could not read the image clearly. Try again with better lighting and a steady hand."},upload_failed:{recoverable:true,recovery:"retry",message:"The upload did not complete. Check the connection and try again."},sdk_load_failed:{recoverable:true,recovery:"cross_device",message:"Verification could not start on this device. Try again, or continue on another device."},biometric_unsupported:{recoverable:false,recovery:"contact_operator",message:"This capture is not supported on this page. Contact the site operator."},isolation_required:{recoverable:false,recovery:"contact_operator",message:"This page configuration is not supported. Contact the site operator."}};Object.keys(ERROR_TABLE).filter(key=>key in ERROR_TABLE);function createChecktivError(code){const entry=ERROR_TABLE[code];return {code,...entry}}function mapHttpStatusToError(status){if(status===401)return "token_expired";if(status===403)return "origin_not_allowed";if(status===429)return "upload_failed";if(status>=500)return "upload_failed";return "session_expired"}
|
|
2
|
+
|
|
3
|
+
export { createChecktivError, mapHttpStatusToError };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var n;var l;var u;var i;var r;var o;var e;var f;var c;var a;var s;var h;var p;var v;var d={};var w=[];var _=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;var g=Array.isArray;function m(n2,l2){for(var u2 in l2)n2[u2]=l2[u2];return n2}function b(n2){n2&&n2.parentNode&&n2.parentNode.removeChild(n2);}function k(l2,u2,t2){var i2,r2,o2,e2={};for(o2 in u2)"key"==o2?i2=u2[o2]:"ref"==o2?r2=u2[o2]:e2[o2]=u2[o2];if(arguments.length>2&&(e2.children=arguments.length>3?n.call(arguments,2):t2),"function"==typeof l2&&null!=l2.defaultProps)for(o2 in l2.defaultProps) void 0===e2[o2]&&(e2[o2]=l2.defaultProps[o2]);return x(l2,e2,i2,r2,null)}function x(n2,t2,i2,r2,o2){var e2={type:n2,props:t2,key:i2,ref:r2,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o2?++u:o2,__i:-1,__u:0};return null==o2&&null!=l.vnode&&l.vnode(e2),e2}function S(n2){return n2.children}function C(n2,l2){this.props=n2,this.context=l2;}function $(n2,l2){if(null==l2)return n2.__?$(n2.__,n2.__i+1):null;for(var u2;l2<n2.__k.length;l2++)if(null!=(u2=n2.__k[l2])&&null!=u2.__e)return u2.__e;return "function"==typeof n2.type?$(n2):null}function I(n2){if(n2.__P&&n2.__d){var u2=n2.__v,t2=u2.__e,i2=[],r2=[],o2=m({},u2);o2.__v=u2.__v+1,l.vnode&&l.vnode(o2),q(n2.__P,o2,u2,n2.__n,n2.__P.namespaceURI,32&u2.__u?[t2]:null,i2,null==t2?$(u2):t2,!!(32&u2.__u),r2),o2.__v=u2.__v,o2.__.__k[o2.__i]=o2,D(i2,o2,r2),u2.__e=u2.__=null,o2.__e!=t2&&P(o2);}}function P(n2){if(null!=(n2=n2.__)&&null!=n2.__c)return n2.__e=n2.__c.base=null,n2.__k.some(function(l2){if(null!=l2&&null!=l2.__e)return n2.__e=n2.__c.base=l2.__e}),P(n2)}function A(n2){(!n2.__d&&(n2.__d=true)&&i.push(n2)&&!H.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)(H);}function H(){try{for(var n2,l2=1;i.length;)i.length>l2&&i.sort(e),n2=i.shift(),l2=i.length,I(n2);}finally{i.length=H.__r=0;}}function L(n2,l2,u2,t2,i2,r2,o2,e2,f2,c2,a2){var s2,h2,p2,v2,y2,_2,g2,m2=t2&&t2.__k||w,b2=l2.length;for(f2=T(u2,l2,m2,f2,b2),s2=0;s2<b2;s2++)null!=(p2=u2.__k[s2])&&(h2=-1!=p2.__i&&m2[p2.__i]||d,p2.__i=s2,_2=q(n2,p2,h2,i2,r2,o2,e2,f2,c2,a2),v2=p2.__e,p2.ref&&h2.ref!=p2.ref&&(h2.ref&&J(h2.ref,null,p2),a2.push(p2.ref,p2.__c||v2,p2)),null==y2&&null!=v2&&(y2=v2),(g2=!!(4&p2.__u))||h2.__k===p2.__k?(f2=j(p2,f2,n2,g2),g2&&h2.__e&&(h2.__e=null)):"function"==typeof p2.type&&void 0!==_2?f2=_2:v2&&(f2=v2.nextSibling),p2.__u&=-7);return u2.__e=y2,f2}function T(n2,l2,u2,t2,i2){var r2,o2,e2,f2,c2,a2=u2.length,s2=a2,h2=0;for(n2.__k=new Array(i2),r2=0;r2<i2;r2++)null!=(o2=l2[r2])&&"boolean"!=typeof o2&&"function"!=typeof o2?("string"==typeof o2||"number"==typeof o2||"bigint"==typeof o2||o2.constructor==String?o2=n2.__k[r2]=x(null,o2,null,null,null):g(o2)?o2=n2.__k[r2]=x(S,{children:o2},null,null,null):void 0===o2.constructor&&o2.__b>0?o2=n2.__k[r2]=x(o2.type,o2.props,o2.key,o2.ref?o2.ref:null,o2.__v):n2.__k[r2]=o2,f2=r2+h2,o2.__=n2,o2.__b=n2.__b+1,e2=null,-1!=(c2=o2.__i=O(o2,u2,f2,s2))&&(s2--,(e2=u2[c2])&&(e2.__u|=2)),null==e2||null==e2.__v?(-1==c2&&(i2>a2?h2--:i2<a2&&h2++),"function"!=typeof o2.type&&(o2.__u|=4)):c2!=f2&&(c2==f2-1?h2--:c2==f2+1?h2++:(c2>f2?h2--:h2++,o2.__u|=4))):n2.__k[r2]=null;if(s2)for(r2=0;r2<a2;r2++)null!=(e2=u2[r2])&&0==(2&e2.__u)&&(e2.__e==t2&&(t2=$(e2)),K(e2,e2));return t2}function j(n2,l2,u2,t2){var i2,r2;if("function"==typeof n2.type){for(i2=n2.__k,r2=0;i2&&r2<i2.length;r2++)i2[r2]&&(i2[r2].__=n2,l2=j(i2[r2],l2,u2,t2));return l2}n2.__e!=l2&&(t2&&(l2&&n2.type&&!l2.parentNode&&(l2=$(n2)),u2.insertBefore(n2.__e,l2||null)),l2=n2.__e);do{l2=l2&&l2.nextSibling;}while(null!=l2&&8==l2.nodeType);return l2}function O(n2,l2,u2,t2){var i2,r2,o2,e2=n2.key,f2=n2.type,c2=l2[u2],a2=null!=c2&&0==(2&c2.__u);if(null===c2&&null==e2||a2&&e2==c2.key&&f2==c2.type)return u2;if(t2>(a2?1:0)){for(i2=u2-1,r2=u2+1;i2>=0||r2<l2.length;)if(null!=(c2=l2[o2=i2>=0?i2--:r2++])&&0==(2&c2.__u)&&e2==c2.key&&f2==c2.type)return o2}return -1}function z(n2,l2,u2){"-"==l2[0]?n2.setProperty(l2,null==u2?"":u2):n2[l2]=null==u2?"":"number"!=typeof u2||_.test(l2)?u2:u2+"px";}function N(n2,l2,u2,t2,i2){var r2,o2;n:if("style"==l2)if("string"==typeof u2)n2.style.cssText=u2;else {if("string"==typeof t2&&(n2.style.cssText=t2=""),t2)for(l2 in t2)u2&&l2 in u2||z(n2.style,l2,"");if(u2)for(l2 in u2)t2&&u2[l2]==t2[l2]||z(n2.style,l2,u2[l2]);}else if("o"==l2[0]&&"n"==l2[1])r2=l2!=(l2=l2.replace(s,"$1")),o2=l2.toLowerCase(),l2=o2 in n2||"onFocusOut"==l2||"onFocusIn"==l2?o2.slice(2):l2.slice(2),n2.l||(n2.l={}),n2.l[l2+r2]=u2,u2?t2?u2[a]=t2[a]:(u2[a]=h,n2.addEventListener(l2,r2?v:p,r2)):n2.removeEventListener(l2,r2?v:p,r2);else {if("http://www.w3.org/2000/svg"==i2)l2=l2.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l2&&"height"!=l2&&"href"!=l2&&"list"!=l2&&"form"!=l2&&"tabIndex"!=l2&&"download"!=l2&&"rowSpan"!=l2&&"colSpan"!=l2&&"role"!=l2&&"popover"!=l2&&l2 in n2)try{n2[l2]=null==u2?"":u2;break n}catch(n3){}"function"==typeof u2||(null==u2||false===u2&&"-"!=l2[4]?n2.removeAttribute(l2):n2.setAttribute(l2,"popover"==l2&&1==u2?"":u2));}}function V(n2){return function(u2){if(this.l){var t2=this.l[u2.type+n2];if(null==u2[c])u2[c]=h++;else if(u2[c]<t2[a])return;return t2(l.event?l.event(u2):u2)}}}function q(n2,u2,t2,i2,r2,o2,e2,f2,c2,a2){var s2,h2,p2,v2,y2,d2,_2,k2,x2,M,$2,I2,P2,A2,H2,T2=u2.type;if(void 0!==u2.constructor)return null;128&t2.__u&&(c2=!!(32&t2.__u),o2=[f2=u2.__e=t2.__e]),(s2=l.__b)&&s2(u2);n:if("function"==typeof T2)try{if(k2=u2.props,x2=T2.prototype&&T2.prototype.render,M=(s2=T2.contextType)&&i2[s2.__c],$2=s2?M?M.props.value:s2.__:i2,t2.__c?_2=(h2=u2.__c=t2.__c).__=h2.__E:(x2?u2.__c=h2=new T2(k2,$2):(u2.__c=h2=new C(k2,$2),h2.constructor=T2,h2.render=Q),M&&M.sub(h2),h2.state||(h2.state={}),h2.__n=i2,p2=h2.__d=true,h2.__h=[],h2._sb=[]),x2&&null==h2.__s&&(h2.__s=h2.state),x2&&null!=T2.getDerivedStateFromProps&&(h2.__s==h2.state&&(h2.__s=m({},h2.__s)),m(h2.__s,T2.getDerivedStateFromProps(k2,h2.__s))),v2=h2.props,y2=h2.state,h2.__v=u2,p2)x2&&null==T2.getDerivedStateFromProps&&null!=h2.componentWillMount&&h2.componentWillMount(),x2&&null!=h2.componentDidMount&&h2.__h.push(h2.componentDidMount);else {if(x2&&null==T2.getDerivedStateFromProps&&k2!==v2&&null!=h2.componentWillReceiveProps&&h2.componentWillReceiveProps(k2,$2),u2.__v==t2.__v||!h2.__e&&null!=h2.shouldComponentUpdate&&false===h2.shouldComponentUpdate(k2,h2.__s,$2)){u2.__v!=t2.__v&&(h2.props=k2,h2.state=h2.__s,h2.__d=false),u2.__e=t2.__e,u2.__k=t2.__k,u2.__k.some(function(n3){n3&&(n3.__=u2);}),w.push.apply(h2.__h,h2._sb),h2._sb=[],h2.__h.length&&e2.push(h2);break n}null!=h2.componentWillUpdate&&h2.componentWillUpdate(k2,h2.__s,$2),x2&&null!=h2.componentDidUpdate&&h2.__h.push(function(){h2.componentDidUpdate(v2,y2,d2);});}if(h2.context=$2,h2.props=k2,h2.__P=n2,h2.__e=false,I2=l.__r,P2=0,x2)h2.state=h2.__s,h2.__d=false,I2&&I2(u2),s2=h2.render(h2.props,h2.state,h2.context),w.push.apply(h2.__h,h2._sb),h2._sb=[];else do{h2.__d=false,I2&&I2(u2),s2=h2.render(h2.props,h2.state,h2.context),h2.state=h2.__s;}while(h2.__d&&++P2<25);h2.state=h2.__s,null!=h2.getChildContext&&(i2=m(m({},i2),h2.getChildContext())),x2&&!p2&&null!=h2.getSnapshotBeforeUpdate&&(d2=h2.getSnapshotBeforeUpdate(v2,y2)),A2=null!=s2&&s2.type===S&&null==s2.key?E(s2.props.children):s2,f2=L(n2,g(A2)?A2:[A2],u2,t2,i2,r2,o2,e2,f2,c2,a2),h2.base=u2.__e,u2.__u&=-161,h2.__h.length&&e2.push(h2),_2&&(h2.__E=h2.__=null);}catch(n3){if(u2.__v=null,c2||null!=o2)if(n3.then){for(u2.__u|=c2?160:128;f2&&8==f2.nodeType&&f2.nextSibling;)f2=f2.nextSibling;o2[o2.indexOf(f2)]=null,u2.__e=f2;}else {for(H2=o2.length;H2--;)b(o2[H2]);B(u2);}else u2.__e=t2.__e,u2.__k=t2.__k,n3.then||B(u2);l.__e(n3,u2,t2);}else null==o2&&u2.__v==t2.__v?(u2.__k=t2.__k,u2.__e=t2.__e):f2=u2.__e=G(t2.__e,u2,t2,i2,r2,o2,e2,c2,a2);return (s2=l.diffed)&&s2(u2),128&u2.__u?void 0:f2}function B(n2){n2&&(n2.__c&&(n2.__c.__e=true),n2.__k&&n2.__k.some(B));}function D(n2,u2,t2){for(var i2=0;i2<t2.length;i2++)J(t2[i2],t2[++i2],t2[++i2]);l.__c&&l.__c(u2,n2),n2.some(function(u3){try{n2=u3.__h,u3.__h=[],n2.some(function(n3){n3.call(u3);});}catch(n3){l.__e(n3,u3.__v);}});}function E(n2){return "object"!=typeof n2||null==n2||n2.__b>0?n2:g(n2)?n2.map(E):void 0!==n2.constructor?null:m({},n2)}function G(u2,t2,i2,r2,o2,e2,f2,c2,a2){var s2,h2,p2,v2,y2,w2,_2,m2=i2.props||d,k2=t2.props,x2=t2.type;if("svg"==x2?o2="http://www.w3.org/2000/svg":"math"==x2?o2="http://www.w3.org/1998/Math/MathML":o2||(o2="http://www.w3.org/1999/xhtml"),null!=e2){for(s2=0;s2<e2.length;s2++)if((y2=e2[s2])&&"setAttribute"in y2==!!x2&&(x2?y2.localName==x2:3==y2.nodeType)){u2=y2,e2[s2]=null;break}}if(null==u2){if(null==x2)return document.createTextNode(k2);u2=document.createElementNS(o2,x2,k2.is&&k2),c2&&(l.__m&&l.__m(t2,e2),c2=false),e2=null;}if(null==x2)m2===k2||c2&&u2.data==k2||(u2.data=k2);else {if(e2="textarea"==x2&&null!=k2.defaultValue?null:e2&&n.call(u2.childNodes),!c2&&null!=e2)for(m2={},s2=0;s2<u2.attributes.length;s2++)m2[(y2=u2.attributes[s2]).name]=y2.value;for(s2 in m2)y2=m2[s2],"dangerouslySetInnerHTML"==s2?p2=y2:"children"==s2||s2 in k2||"value"==s2&&"defaultValue"in k2||"checked"==s2&&"defaultChecked"in k2||N(u2,s2,null,y2,o2);for(s2 in k2)y2=k2[s2],"children"==s2?v2=y2:"dangerouslySetInnerHTML"==s2?h2=y2:"value"==s2?w2=y2:"checked"==s2?_2=y2:c2&&"function"!=typeof y2||m2[s2]===y2||N(u2,s2,y2,m2[s2],o2);if(h2)c2||p2&&(h2.__html==p2.__html||h2.__html==u2.innerHTML)||(u2.innerHTML=h2.__html),t2.__k=[];else if(p2&&(u2.innerHTML=""),L("template"==t2.type?u2.content:u2,g(v2)?v2:[v2],t2,i2,r2,"foreignObject"==x2?"http://www.w3.org/1999/xhtml":o2,e2,f2,e2?e2[0]:i2.__k&&$(i2,0),c2,a2),null!=e2)for(s2=e2.length;s2--;)b(e2[s2]);c2&&"textarea"!=x2||(s2="value","progress"==x2&&null==w2?u2.removeAttribute("value"):null!=w2&&(w2!==u2[s2]||"progress"==x2&&!w2||"option"==x2&&w2!=m2[s2])&&N(u2,s2,w2,m2[s2],o2),s2="checked",null!=_2&&_2!=u2[s2]&&N(u2,s2,_2,m2[s2],o2));}return u2}function J(n2,u2,t2){try{if("function"==typeof n2){var i2="function"==typeof n2.__u;i2&&n2.__u(),i2&&null==u2||(n2.__u=n2(u2));}else n2.current=u2;}catch(n3){l.__e(n3,t2);}}function K(n2,u2,t2){var i2,r2;if(l.unmount&&l.unmount(n2),(i2=n2.ref)&&(i2.current&&i2.current!=n2.__e||J(i2,null,u2)),null!=(i2=n2.__c)){if(i2.componentWillUnmount)try{i2.componentWillUnmount();}catch(n3){l.__e(n3,u2);}i2.base=i2.__P=null;}if(i2=n2.__k)for(r2=0;r2<i2.length;r2++)i2[r2]&&K(i2[r2],u2,t2||"function"!=typeof n2.type);t2||b(n2.__e),n2.__c=n2.__=n2.__e=void 0;}function Q(n2,l2,u2){return this.constructor(n2,u2)}function R(u2,t2,i2){var r2,o2,e2,f2;t2==document&&(t2=document.documentElement),l.__&&l.__(u2,t2),o2=(r2="function"==typeof i2)?null:i2&&i2.__k||t2.__k,e2=[],f2=[],q(t2,u2=(!r2&&i2||t2).__k=k(S,null,[u2]),o2||d,d,t2.namespaceURI,!r2&&i2?[i2]:o2?null:t2.firstChild?n.call(t2.childNodes):null,e2,!r2&&i2?i2:o2?o2.__e:t2.firstChild,r2,f2),D(e2,u2,f2);}n=w.slice,l={__e:function(n2,l2,u2,t2){for(var i2,r2,o2;l2=l2.__;)if((i2=l2.__c)&&!i2.__)try{if((r2=i2.constructor)&&null!=r2.getDerivedStateFromError&&(i2.setState(r2.getDerivedStateFromError(n2)),o2=i2.__d),null!=i2.componentDidCatch&&(i2.componentDidCatch(n2,t2||{}),o2=i2.__d),o2)return i2.__E=i2}catch(l3){n2=l3;}throw n2}},u=0,C.prototype.setState=function(n2,l2){var u2;u2=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m({},this.state),"function"==typeof n2&&(n2=n2(m({},u2),this.props)),n2&&m(u2,n2),null!=n2&&this.__v&&(l2&&this._sb.push(l2),A(this));},C.prototype.forceUpdate=function(n2){this.__v&&(this.__e=true,n2&&this.__h.push(n2),A(this));},C.prototype.render=S,i=[],o="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n2,l2){return n2.__v.__b-l2.__v.__b},H.__r=0,f=Math.random().toString(8),c="__d"+f,a="__a"+f,s=/(PointerCapture)$|Capture$/i,h=0,p=V(false),v=V(true);
|
|
2
|
+
|
|
3
|
+
export { R, S, k, l };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { e as CaptureState, I as IdvR2Keys, f as CaptureInitMessage, C as CaptureBehaviorMessage } from './machine--zVZIM4F.js';
|
|
2
|
+
|
|
3
|
+
type CaptureEvent = {
|
|
4
|
+
type: 'selfie-cv-reject';
|
|
5
|
+
attemptIndex: number;
|
|
6
|
+
reason: string | null;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'all-complete';
|
|
9
|
+
runIndex: number;
|
|
10
|
+
};
|
|
11
|
+
type CaptureEventType = CaptureEvent['type'];
|
|
12
|
+
|
|
13
|
+
type SubmitResult = {
|
|
14
|
+
ok: true;
|
|
15
|
+
} | {
|
|
16
|
+
ok: false;
|
|
17
|
+
reason: 'token_expired' | 'failed' | 'signal_pending' | (string & {});
|
|
18
|
+
};
|
|
19
|
+
interface CaptureControllerDeps {
|
|
20
|
+
getIframe: () => HTMLIFrameElement | null;
|
|
21
|
+
mintToken: () => Promise<{
|
|
22
|
+
captureToken: string;
|
|
23
|
+
embedOrigin: string;
|
|
24
|
+
runIndex: number;
|
|
25
|
+
}>;
|
|
26
|
+
submit: (runIndex: number, r2Keys: IdvR2Keys) => Promise<SubmitResult>;
|
|
27
|
+
getEmbedSrc: (embedOrigin: string) => string;
|
|
28
|
+
initPayload: () => Omit<CaptureInitMessage, 'type' | 'captureToken'>;
|
|
29
|
+
onBehaviorSegment?: (segment: Pick<CaptureBehaviorMessage, 'steps' | 'traits'>) => void;
|
|
30
|
+
onBeforeSubmit?: () => Promise<void>;
|
|
31
|
+
onCoaching?: (rawState: string, attemptIndex: number) => void;
|
|
32
|
+
}
|
|
33
|
+
interface CaptureController {
|
|
34
|
+
start(): void;
|
|
35
|
+
on(type: CaptureEventType, cb: (event: CaptureEvent) => void): () => void;
|
|
36
|
+
subscribe(cb: (state: CaptureState) => void): () => void;
|
|
37
|
+
handleReady(): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}
|
|
40
|
+
declare function createCaptureController(deps: CaptureControllerDeps): CaptureController;
|
|
41
|
+
|
|
42
|
+
export { type CaptureController as C, type SubmitResult as S, type CaptureControllerDeps as a, type CaptureEvent as b, type CaptureEventType as c, createCaptureController as d };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as CoachingKind, c as CaptureErrorKind, d as CapturePhase } from './machine--zVZIM4F.js';
|
|
2
|
+
|
|
3
|
+
type TerminalKind = 'mint_error' | 'submit_error' | 'token_expired';
|
|
4
|
+
interface MountCopy {
|
|
5
|
+
cvReject?: (attemptIndex: number, kind: CoachingKind) => string;
|
|
6
|
+
error?: (kind: CaptureErrorKind) => string;
|
|
7
|
+
status?: (phase: CapturePhase) => string;
|
|
8
|
+
coaching?: (kind: CoachingKind) => string;
|
|
9
|
+
terminal?: (kind: TerminalKind) => string;
|
|
10
|
+
tryAgain?: string;
|
|
11
|
+
frameTitle?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const fallbackCopy: Required<Pick<MountCopy, 'cvReject' | 'error' | 'status' | 'coaching' | 'terminal'>> & {
|
|
14
|
+
tryAgain: () => string;
|
|
15
|
+
frameTitle: () => string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { type MountCopy as M, type TerminalKind as T, fallbackCopy as f };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { C as CrossDeviceCopy, a as CrossDeviceHandle, b as CrossDevicePanelProps, m as mountCrossDevice } from './index-BtJbU9MC.js';
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { l, R, k } from './chunk-XOGHMNBX.js';
|
|
2
|
+
import './chunk-AIK7CDV6.js';
|
|
3
|
+
import qrcode from 'qrcode-generator';
|
|
4
|
+
|
|
5
|
+
var t;var r;var u;var i;var o=0;var f=[];var c=l;var e=c.__b;var a=c.__r;var v=c.diffed;var l2=c.__c;var m=c.unmount;var s=c.__;function p(n,t2){c.__h&&c.__h(r,n,o||t2),o=0;var u2=r.__H||(r.__H={__:[],__h:[]});return n>=u2.__.length&&u2.__.push({}),u2.__[n]}function d(n){return o=1,h(D,n)}function h(n,u2,i2){var o2=p(t++,2);if(o2.t=n,!o2.__c&&(o2.__=[D(void 0,u2),function(n2){var t2=o2.__N?o2.__N[0]:o2.__[0],r2=o2.t(t2,n2);t2!==r2&&(o2.__N=[r2,o2.__[1]],o2.__c.setState({}));}],o2.__c=r,!r.__f)){var f2=function(n2,t2,r2){if(!o2.__c.__H)return true;var u3=o2.__c.__H.__.filter(function(n3){return n3.__c});if(u3.every(function(n3){return !n3.__N}))return !c2||c2.call(this,n2,t2,r2);var i3=o2.__c.props!==n2;return u3.some(function(n3){if(n3.__N){var t3=n3.__[0];n3.__=n3.__N,n3.__N=void 0,t3!==n3.__[0]&&(i3=true);}}),c2&&c2.call(this,n2,t2,r2)||i3};r.__f=true;var c2=r.shouldComponentUpdate,e2=r.componentWillUpdate;r.componentWillUpdate=function(n2,t2,r2){if(this.__e){var u3=c2;c2=void 0,f2(n2,t2,r2),c2=u3;}e2&&e2.call(this,n2,t2,r2);},r.shouldComponentUpdate=f2;}return o2.__N||o2.__}function A(n){return o=5,T(function(){return {current:n}},[])}function T(n,r2){var u2=p(t++,7);return C(u2.__H,r2)&&(u2.__=n(),u2.__H=r2,u2.__h=n),u2.__}function j(){for(var n;n=f.shift();){var t2=n.__H;if(n.__P&&t2)try{t2.__h.some(z),t2.__h.some(B),t2.__h=[];}catch(r2){t2.__h=[],c.__e(r2,n.__v);}}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t2){n&&t2.__k&&t2.__k.__m&&(n.__m=t2.__k.__m),s&&s(n,t2);},c.__r=function(n){a&&a(n),t=0;var i2=(r=n.__c).__H;i2&&(u===r?(i2.__h=[],r.__h=[],i2.__.some(function(n2){n2.__N&&(n2.__=n2.__N),n2.u=n2.__N=void 0;})):(i2.__h.some(z),i2.__h.some(B),i2.__h=[],t=0)),u=r;},c.diffed=function(n){v&&v(n);var t2=n.__c;t2&&t2.__H&&(t2.__H.__h.length&&(1!==f.push(t2)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t2.__H.__.some(function(n2){n2.u&&(n2.__H=n2.u),n2.u=void 0;})),u=r=null;},c.__c=function(n,t2){t2.some(function(n2){try{n2.__h.some(z),n2.__h=n2.__h.filter(function(n3){return !n3.__||B(n3)});}catch(r2){t2.some(function(n3){n3.__h&&(n3.__h=[]);}),t2=[],c.__e(r2,n2.__v);}}),l2&&l2(n,t2);},c.unmount=function(n){m&&m(n);var t2,r2=n.__c;r2&&r2.__H&&(r2.__H.__.some(function(n2){try{z(n2);}catch(n3){t2=n3;}}),r2.__H=void 0,t2&&c.__e(t2,r2.__v));};var k2="function"==typeof requestAnimationFrame;function w(n){var t2,r2=function(){clearTimeout(u2),k2&&cancelAnimationFrame(t2),setTimeout(n);},u2=setTimeout(r2,35);k2&&(t2=requestAnimationFrame(r2));}function z(n){var t2=r,u2=n.__c;"function"==typeof u2&&(n.__c=void 0,u2()),r=t2;}function B(n){var t2=r;n.__c=n.__(),r=t2;}function C(n,t2){return !n||n.length!==t2.length||t2.some(function(t3,r2){return t3!==n[r2]})}function D(n,t2){return "function"==typeof t2?t2(n):t2}var CELL_SIZE=4;var MARGIN=4;function QrCodeSvg({url,alt,size}){const qr=qrcode(0,"M");qr.addData(url);qr.make();const count=qr.getModuleCount();const totalCells=count+MARGIN*2;const targetSize=size??totalCells*CELL_SIZE;const cellPx=Math.max(1,Math.floor(targetSize/totalCells));const svgSize=cellPx*totalCells;const marginPx=MARGIN*cellPx;const rects=[];for(let row=0;row<count;row++){for(let col=0;col<count;col++){if(qr.isDark(row,col)){rects.push(k("rect",{key:`${row}-${col}`,x:marginPx+col*cellPx,y:marginPx+row*cellPx,width:cellPx,height:cellPx,fill:"currentColor"}));}}}return k("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:`0 0 ${svgSize} ${svgSize}`,width:svgSize,height:svgSize,role:"img","aria-label":alt??"QR code",style:{color:"#000",background:"#fff"}},...rects)}var STYLE_ELEMENT_ID="ctv-xdev-styles";var STYLESHEET=`
|
|
6
|
+
.ctv-xdev {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 1rem;
|
|
11
|
+
width: 100%;
|
|
12
|
+
max-width: 22rem;
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
padding: 1.5rem 1.25rem;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
text-align: center;
|
|
17
|
+
color: var(--theme-on-surface-1, #16181d);
|
|
18
|
+
background: var(--theme-surface-1, #ffffff);
|
|
19
|
+
border: 1px solid var(--theme-border, rgba(18, 19, 22, 0.1));
|
|
20
|
+
border-radius: var(--theme-shape-radius, 0.75rem);
|
|
21
|
+
font-family: var(
|
|
22
|
+
--theme-font-family-sans,
|
|
23
|
+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.ctv-xdev-heading {
|
|
28
|
+
margin: 0;
|
|
29
|
+
font-size: 1.0625rem;
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
line-height: 1.3;
|
|
32
|
+
color: var(--theme-on-surface-1, #16181d);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.ctv-xdev-instruction {
|
|
36
|
+
margin: 0;
|
|
37
|
+
font-size: 0.875rem;
|
|
38
|
+
line-height: 1.45;
|
|
39
|
+
color: var(--theme-on-surface-1-muted, rgba(18, 19, 22, 0.62));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* QR hero card. Stays white-on-dark in BOTH themes - scanners need a
|
|
44
|
+
* dark-on-light QR, so the card background and the QR foreground are fixed
|
|
45
|
+
* (NOT themed). The padding preserves the QR spec's 4-module quiet zone visually.
|
|
46
|
+
*/
|
|
47
|
+
.ctv-xdev-qr-card {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
padding: 1rem;
|
|
52
|
+
background: #ffffff;
|
|
53
|
+
border-radius: 0.75rem;
|
|
54
|
+
box-shadow: 0 1px 3px rgba(18, 19, 22, 0.12), 0 4px 12px rgba(18, 19, 22, 0.08);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ctv-xdev-qr-card svg {
|
|
58
|
+
display: block;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Controls cluster below the QR - vertical stack, clearly separated. */
|
|
62
|
+
.ctv-xdev-controls {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
65
|
+
align-items: stretch;
|
|
66
|
+
gap: 0.5rem;
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
* Copy-link cluster: a selectable readonly URL field stacked above the copy
|
|
72
|
+
* button. The field is the recovery guarantee - the handoff URL stays accessible
|
|
73
|
+
* (long-press / select-copy) even where no programmatic copy mechanism works.
|
|
74
|
+
*/
|
|
75
|
+
.ctv-xdev-copy {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: 0.4rem;
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ctv-xdev-url-field {
|
|
83
|
+
width: 100%;
|
|
84
|
+
min-height: 2.25rem;
|
|
85
|
+
padding: 0.4rem 0.6rem;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
font-size: 0.8125rem;
|
|
88
|
+
font-family: inherit;
|
|
89
|
+
text-align: center;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
color: var(--theme-on-surface-1, #16181d);
|
|
92
|
+
background: var(--theme-surface-2, #f2f2ee);
|
|
93
|
+
border: 1px solid var(--theme-border, rgba(18, 19, 22, 0.1));
|
|
94
|
+
border-radius: var(--theme-button-border-radius, 0.4rem);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ctv-xdev-url-field:focus {
|
|
98
|
+
outline: 2px solid var(--theme-primary, #2563eb);
|
|
99
|
+
outline-offset: 1px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Secondary (bordered) button - the "Copy link" affordance. Full-width so it
|
|
104
|
+
* reads as the primary control in the cluster.
|
|
105
|
+
*/
|
|
106
|
+
.ctv-xdev-btn-secondary {
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
gap: 0.4rem;
|
|
111
|
+
min-height: 2.5rem;
|
|
112
|
+
padding: 0.55rem 1rem;
|
|
113
|
+
font-size: 0.875rem;
|
|
114
|
+
font-weight: 600;
|
|
115
|
+
font-family: inherit;
|
|
116
|
+
color: var(--theme-on-surface-1, #16181d);
|
|
117
|
+
background: var(--theme-surface-2, #f2f2ee);
|
|
118
|
+
border: 1px solid var(--theme-border-strong, rgba(18, 19, 22, 0.18));
|
|
119
|
+
border-radius: var(--theme-button-border-radius, 0.4rem);
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
transition: background-color var(--theme-transition, 0.2s ease-in-out),
|
|
122
|
+
border-color var(--theme-transition, 0.2s ease-in-out);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ctv-xdev-btn-secondary:hover {
|
|
126
|
+
border-color: var(--theme-primary, #2563eb);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/*
|
|
130
|
+
* Subtle text-buttons - "Refresh code" / "Back to camera". Spaced on their own
|
|
131
|
+
* row so they never run together with the secondary button or each other.
|
|
132
|
+
*/
|
|
133
|
+
.ctv-xdev-text-row {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
flex-wrap: wrap;
|
|
138
|
+
gap: 0.25rem 1.25rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ctv-xdev-btn-text {
|
|
142
|
+
padding: 0.4rem 0.25rem;
|
|
143
|
+
font-size: 0.8125rem;
|
|
144
|
+
font-weight: 500;
|
|
145
|
+
font-family: inherit;
|
|
146
|
+
color: var(--theme-primary, #2563eb);
|
|
147
|
+
background: transparent;
|
|
148
|
+
border: 0;
|
|
149
|
+
border-radius: var(--theme-button-border-radius, 0.4rem);
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
transition: color var(--theme-transition, 0.2s ease-in-out);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.ctv-xdev-btn-text:hover {
|
|
155
|
+
color: var(--theme-primary-hover, #1d4ed8);
|
|
156
|
+
text-decoration: underline;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/*
|
|
160
|
+
* Primary button - the mobile "Try again" CTA. Uses the brand primary so the
|
|
161
|
+
* recovery action reads as the obvious next step.
|
|
162
|
+
*/
|
|
163
|
+
.ctv-xdev-btn-primary {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
gap: 0.4rem;
|
|
168
|
+
min-height: 2.5rem;
|
|
169
|
+
padding: 0.55rem 1.1rem;
|
|
170
|
+
font-size: 0.9375rem;
|
|
171
|
+
font-weight: 600;
|
|
172
|
+
font-family: inherit;
|
|
173
|
+
color: var(--theme-on-primary, #ffffff);
|
|
174
|
+
background: var(--theme-primary, #2563eb);
|
|
175
|
+
border: 1px solid transparent;
|
|
176
|
+
border-radius: var(--theme-button-border-radius, 0.4rem);
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
transition: background-color var(--theme-transition, 0.2s ease-in-out);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.ctv-xdev-btn-primary:hover {
|
|
182
|
+
background: var(--theme-primary-hover, #1d4ed8);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* A quieter helper line - open-in-browser hint, camera-settings note. */
|
|
186
|
+
.ctv-xdev-note {
|
|
187
|
+
margin: 0;
|
|
188
|
+
font-size: 0.8125rem;
|
|
189
|
+
line-height: 1.45;
|
|
190
|
+
color: var(--theme-on-surface-1-muted, rgba(18, 19, 22, 0.62));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* The "completing" waiting state - inline spinner + label. */
|
|
194
|
+
.ctv-xdev-waiting {
|
|
195
|
+
display: inline-flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: 0.5rem;
|
|
198
|
+
font-size: 0.875rem;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
color: var(--theme-on-surface-1, #16181d);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.ctv-xdev-spinner {
|
|
204
|
+
width: 1rem;
|
|
205
|
+
height: 1rem;
|
|
206
|
+
border: 2px solid var(--theme-border-strong, rgba(18, 19, 22, 0.18));
|
|
207
|
+
border-top-color: var(--theme-primary, #2563eb);
|
|
208
|
+
border-radius: 50%;
|
|
209
|
+
animation: ctv-xdev-spin 0.7s linear infinite;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@keyframes ctv-xdev-spin {
|
|
213
|
+
to {
|
|
214
|
+
transform: rotate(360deg);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@media (prefers-reduced-motion: reduce) {
|
|
219
|
+
.ctv-xdev-spinner {
|
|
220
|
+
animation-duration: 1.8s;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;var STYLE_MARKER_ATTR="data-ctv-xdev-styles";var adoptedSheet=null;function supportsConstructableStyleSheets(){return typeof CSSStyleSheet==="function"&&typeof CSSStyleSheet.prototype.replaceSync==="function"&&"adoptedStyleSheets"in Document.prototype}function adoptConstructableStyleSheet(){try{if(adoptedSheet===null){adoptedSheet=new CSSStyleSheet;adoptedSheet.replaceSync(STYLESHEET);}if(!document.adoptedStyleSheets.includes(adoptedSheet)){document.adoptedStyleSheets=[...document.adoptedStyleSheets,adoptedSheet];}return true}catch{return false}}function injectLegacyStyleElement(){if(document.getElementById(STYLE_ELEMENT_ID)!==null)return;const style=document.createElement("style");style.id=STYLE_ELEMENT_ID;style.setAttribute(STYLE_MARKER_ATTR,"");style.textContent=STYLESHEET;document.head.appendChild(style);}function ensureCrossDeviceStyles(){if(typeof document==="undefined")return;if(supportsConstructableStyleSheets()&&adoptConstructableStyleSheet())return;injectLegacyStyleElement();}function validateHttpsUrl(raw){let parsed;try{parsed=new URL(raw);}catch{console.warn("[Checktiv] cross-device: received an invalid URL; falling back to unavailable state.");return null}if(parsed.protocol!=="https:"){console.warn(`[Checktiv] cross-device: URL scheme "${parsed.protocol}" is not allowed (only https:). Falling back to unavailable state.`);return null}return parsed.href}function copyViaExecCommand(input){if(input===null||typeof document==="undefined")return false;try{input.focus();input.select();input.setSelectionRange(0,input.value.length);return document.execCommand("copy")}catch{return false}}function CopyLinkButton({url,label,copiedLabel}){const[copied,setCopied]=d(false);const inputRef=A(null);if(!label)return null;const confirmCopied=()=>{setCopied(true);setTimeout(()=>setCopied(false),2e3);};const handleCopy=()=>{if(navigator?.clipboard?.writeText){void navigator.clipboard.writeText(url).then(confirmCopied).catch(err=>{console.warn("[Checktiv] cross-device: clipboard write failed, trying fallback.",err);if(copyViaExecCommand(inputRef.current))confirmCopied();});return}if(copyViaExecCommand(inputRef.current))confirmCopied();};return k("div",{class:"ctv-xdev-copy"},k("input",{ref:inputRef,type:"text",class:"ctv-xdev-url-field",value:url,readOnly:true,"aria-label":label,onFocus:e2=>e2.currentTarget.select(),"data-testid":"cross-device-url-field"}),k("button",{type:"button",class:"ctv-xdev-btn-secondary",onClick:handleCopy,"data-testid":"cross-device-copy-link"},copied&&copiedLabel?copiedLabel:label))}function WaitingState({label}){return k("div",{class:"ctv-xdev-waiting","data-testid":"cross-device-waiting"},k("span",{class:"ctv-xdev-spinner","aria-hidden":"true"}),k("span",null,label))}function DesktopArm({url,copy,completing,onBack,onRefreshLink}){const textButtons=[onRefreshLink&©.refreshLinkLabel?k("button",{type:"button",class:"ctv-xdev-btn-text",onClick:onRefreshLink,"data-testid":"cross-device-refresh-link"},copy.refreshLinkLabel):null,onBack&©.backLabel?k("button",{type:"button",class:"ctv-xdev-btn-text",onClick:onBack,"data-testid":"cross-device-back"},copy.backLabel):null].filter(Boolean);return k("div",{class:"ctv-xdev","data-testid":"cross-device-desktop"},copy.desktopPrompt?k("p",{class:"ctv-xdev-heading","data-testid":"cross-device-desktop-prompt"},copy.desktopPrompt):null,copy.desktopSubtext&&!completing?k("p",{class:"ctv-xdev-instruction","data-testid":"cross-device-subtext"},copy.desktopSubtext):null,completing&©.waitingLabel?k(WaitingState,{label:copy.waitingLabel}):null,k("div",{class:"ctv-xdev-qr-card"},k(QrCodeSvg,{url,alt:copy.qrAlt,size:200})),k("div",{class:"ctv-xdev-controls"},k(CopyLinkButton,{url,label:copy.copyLinkLabel,copiedLabel:copy.linkCopiedLabel}),textButtons.length>0?k("div",{class:"ctv-xdev-text-row"},...textButtons):null))}function MobileArm({url,copy,onRetry}){return k("div",{class:"ctv-xdev","data-testid":"cross-device-mobile"},copy.mobilePrompt?k("p",{class:"ctv-xdev-heading","data-testid":"cross-device-mobile-prompt"},copy.mobilePrompt):null,k("div",{class:"ctv-xdev-controls"},onRetry&©.mobileTryAgainLabel?k("button",{type:"button",class:"ctv-xdev-btn-primary",onClick:onRetry,"data-testid":"cross-device-try-again"},copy.mobileTryAgainLabel):null,k(CopyLinkButton,{url,label:copy.mobileCopyLinkLabel,copiedLabel:copy.mobileLinkCopiedLabel})),copy.mobileOpenBrowserHint?k("p",{class:"ctv-xdev-note","data-testid":"cross-device-open-browser-hint"},copy.mobileOpenBrowserHint):null,copy.mobileCameraSettingsNote?k("p",{class:"ctv-xdev-note","data-testid":"cross-device-camera-settings"},copy.mobileCameraSettingsNote):null)}function UnavailableArm({copy}){return k("div",{class:"ctv-xdev","data-testid":"cross-device-unavailable"},copy.unavailableMessage?k("p",{class:"ctv-xdev-instruction"},copy.unavailableMessage):null)}function CrossDevicePanel({url,copy,isMobile,completing=false,onBack,onRefreshLink,onRetry}){ensureCrossDeviceStyles();const validUrl=validateHttpsUrl(url);if(validUrl===null){return k(UnavailableArm,{copy})}if(isMobile){return k(MobileArm,{url:validUrl,copy,onRetry})}return k(DesktopArm,{url:validUrl,copy,completing,onBack,onRefreshLink})}function mountCrossDevice(target,props){R(k(CrossDevicePanel,props),target);return {update(next){R(k(CrossDevicePanel,next),target);},destroy(){R(null,target);}}}
|
|
224
|
+
|
|
225
|
+
export { mountCrossDevice };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.checktiv-cf-field{display:flex;flex-direction:column;gap:0.375rem;margin-bottom:1rem}.checktiv-cf-label{font-size:0.875rem;font-weight:500;color:var(--theme-on-surface-1, #16181d)}.checktiv-cf-help{margin:0;font-size:0.8125rem;color:var(--theme-on-surface-1-muted, rgba(22, 24, 29, 0.62))}.checktiv-cf-input,.checktiv-cf-select{width:100%;box-sizing:border-box;padding:0.5rem 0.75rem;font-size:0.9375rem;font-family:inherit;line-height:1.5;color:var(--theme-on-surface-1, #16181d);background-color:var(--theme-surface-1, #ffffff);border:1px solid var(--theme-border-strong, rgba(22, 24, 29, 0.18));border-radius:var(--theme-button-border-radius, 0.4rem);outline:none;transition:border-color 0.15s ease,box-shadow 0.15s ease}.checktiv-cf-input::placeholder{color:var(--theme-on-surface-1-muted, rgba(22, 24, 29, 0.62))}textarea.checktiv-cf-input{min-height:6rem;resize:vertical}.checktiv-cf-input:focus,.checktiv-cf-select:focus{border-color:var(--theme-primary, #2563eb);box-shadow:0 0 0 3px var(--theme-ring, rgba(37, 99, 235, 0.35))}.checktiv-cf-multiselect input[type=checkbox],.checktiv-cf-radio{width:1rem;height:1rem;accent-color:var(--theme-primary, #2563eb)}.checktiv-cf-radiogroup{display:flex;flex-direction:row;gap:1.25rem;margin:0;padding:0;border:0}.checktiv-cf-radio-option{display:inline-flex;align-items:center;gap:0.5rem;font-size:0.9375rem;color:var(--theme-on-surface-1, #16181d);cursor:pointer}.checktiv-cf-multiselect{display:flex;flex-direction:column;gap:0.375rem}.checktiv-cf-option{display:flex;align-items:center;gap:0.5rem;font-size:0.9375rem;color:var(--theme-on-surface-1, #16181d)}.checktiv-cf-file{width:100%;box-sizing:border-box;padding:0.5rem 0.75rem;font-size:0.9375rem;font-family:inherit;color:var(--theme-on-surface-1, #16181d);background-color:var(--theme-surface-1, #ffffff);border:1px dashed var(--theme-border-strong, rgba(22, 24, 29, 0.18));border-radius:var(--theme-button-border-radius, 0.4rem)}.checktiv-cf-heading{margin:1rem 0 0.5rem;font-size:1.125rem;font-weight:600;color:var(--theme-on-surface-1, #16181d)}.checktiv-cf-paragraph{margin:0 0 1rem;font-size:0.9375rem;line-height:1.6;color:var(--theme-on-surface-1-muted, rgba(22, 24, 29, 0.62))}.checktiv-cf-submit{display:inline-flex;align-items:center;justify-content:center;padding:0.5rem 1.25rem;font-size:0.9375rem;font-weight:600;font-family:inherit;color:var(--theme-on-primary, #ffffff);background-color:var(--theme-primary, #2563eb);border:none;border-radius:var(--theme-button-border-radius, 0.4rem);cursor:pointer;transition:background-color 0.15s ease}.checktiv-cf-submit:hover:not(:disabled){background-color:var(--theme-primary-hover, #1d4ed8)}.checktiv-cf-submit:disabled{opacity:0.55;cursor:not-allowed}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { registerModule, withTokenRetry, SESSIONS_ME_PATH, dataPlaneHeaders, stepSubmitPath, formUploadUrlPath } from './chunk-FGWZZNAN.js';
|
|
2
|
+
import { u } from './chunk-HV2QKVJX.js';
|
|
3
|
+
import { R, k, S } from './chunk-XOGHMNBX.js';
|
|
4
|
+
import './chunk-QFA3K5ZV.js';
|
|
5
|
+
import { createChecktivError, mapHttpStatusToError } from './chunk-WQCYRLWP.js';
|
|
6
|
+
import './chunk-AIK7CDV6.js';
|
|
7
|
+
|
|
8
|
+
function labelText(props){return props.copy?.label??props.field.id}function labelIdFor(controlId){return `${controlId}-label`}function FieldShell(props,control){const help=props.copy?.helpText;return u("div",{class:"checktiv-cf-field",children:[u("label",{id:labelIdFor(props.id),for:props.id,class:"checktiv-cf-label",children:labelText(props)}),help!==void 0?u("p",{id:`${props.id}-help`,class:"checktiv-cf-help",children:help}):null,control]})}function asText(value){return typeof value==="string"?value:""}function asInputValue(value){return typeof value==="number"?String(value):asText(value)}function inputTypeFor(type){switch(type){case "email":return "email";case "phone":return "tel";case "date":return "date";case "number":return "number";default:return "text"}}function renderTextLike(props){const{field}=props;const onInput=e=>{const target=e.target;if(field.type==="number"){const input=target;props.onChange(input.value===""||Number.isNaN(input.valueAsNumber)?void 0:input.valueAsNumber);return}props.onChange(target.value);};if(field.type==="long_text"){return FieldShell(props,u("textarea",{id:props.id,name:field.id,required:field.required,class:"checktiv-cf-input",value:asInputValue(props.value),onInput}))}return FieldShell(props,u("input",{id:props.id,name:field.id,type:inputTypeFor(field.type),required:field.required,class:"checktiv-cf-input",value:asInputValue(props.value),onInput}))}function renderBoolean(props){const yesId=`${props.id}-yes`;const noId=`${props.id}-no`;return FieldShell(props,u("fieldset",{class:"checktiv-cf-radiogroup",role:"radiogroup","aria-labelledby":labelIdFor(props.id),"aria-required":props.field.required?"true":void 0,children:[u("label",{for:yesId,class:"checktiv-cf-radio-option",children:[u("input",{id:yesId,name:props.field.id,type:"radio",class:"checktiv-cf-radio",checked:props.value===true,onChange:e=>{if(e.target.checked)props.onChange(true);}}),props.booleanYes]}),u("label",{for:noId,class:"checktiv-cf-radio-option",children:[u("input",{id:noId,name:props.field.id,type:"radio",class:"checktiv-cf-radio",checked:props.value===false,onChange:e=>{if(e.target.checked)props.onChange(false);}}),props.booleanNo]})]}))}function optionLabel(props,value){return props.copy?.options?.[value]??value}function renderSingleSelect(props){const options=props.field.options??[];return FieldShell(props,u("select",{id:props.id,name:props.field.id,required:props.field.required,class:"checktiv-cf-select",value:asText(props.value),onChange:e=>props.onChange(e.target.value),children:[u("option",{value:"",children:""}),options.map(o=>u("option",{value:o.value,children:optionLabel(props,o.value)}))]}))}function renderMultiSelect(props){const options=props.field.options??[];const selected=Array.isArray(props.value)?props.value:[];const toggle=(value,checked)=>{const next=checked?[...selected,value]:selected.filter(v=>v!==value);props.onChange(next);};return FieldShell(props,u("div",{class:"checktiv-cf-multiselect",role:"group","aria-labelledby":labelIdFor(props.id),children:options.map(o=>u("label",{class:"checktiv-cf-option",children:[u("input",{type:"checkbox",name:props.field.id,value:o.value,checked:selected.includes(o.value),onChange:e=>toggle(o.value,e.target.checked)}),optionLabel(props,o.value)]}))}))}function renderFileUpload(props){return FieldShell(props,u("input",{id:props.id,name:props.field.id,type:"file",class:"checktiv-cf-file",required:props.field.required,onChange:e=>{const files=e.target.files;props.onFile(files&&files.length>0?files[0]:null);}}))}function renderContent(props){const text=props.copy?.label??props.field.id;return props.field.type==="content_heading"?u("h2",{class:"checktiv-cf-heading",children:text}):u("p",{class:"checktiv-cf-paragraph",children:text})}function renderField(props){switch(props.field.type){case "short_text":case "long_text":case "email":case "phone":case "date":case "number":return renderTextLike(props);case "boolean":return renderBoolean(props);case "single_select":return renderSingleSelect(props);case "multi_select":return renderMultiSelect(props);case "file_upload":return renderFileUpload(props);case "content_heading":case "content_paragraph":return renderContent(props);default:{const _exhaustive=props.field.type;return _exhaustive}}}function collectAnswers(answers){const blob={};for(const[fieldId,value]of answers){if(value===void 0)continue;if(typeof value==="string"&&value.length===0)continue;blob[fieldId]=value;}return blob}function isRecord(v){return typeof v==="object"&&v!==null}function parseUploadTarget(body){if(!isRecord(body)||!isRecord(body.data))return null;const d=body.data;const uploadUrl=d.upload_url;const r2Key=d.r2_key;if(typeof uploadUrl!=="string"||uploadUrl.length===0)return null;if(typeof r2Key!=="string"||r2Key.length===0)return null;return {uploadUrl,r2Key}}function extensionOf(fileName){const dot=fileName.lastIndexOf(".");if(dot<0||dot===fileName.length-1)return "";return fileName.slice(dot+1).toLowerCase()}async function uploadFormFile(ctx,fetchImpl,stepId,fieldId,file){const origin=ctx.apiBaseOrigin;let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(origin+formUploadUrlPath(stepId),{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify({fieldId,ext:extensionOf(file.name),contentLength:file.size})}),result=>result?.status===401);}catch{return null}if(!res.ok)return null;let body;try{body=await res.json();}catch{return null}const target=parseUploadTarget(body);if(target===null)return null;let putRes;try{putRes=await fetchImpl(target.uploadUrl,{method:"PUT",headers:{"content-type":file.type||"application/octet-stream"},body:file});}catch{return null}if(!putRes.ok)return null;return target.r2Key}var FALLBACK={submit:"Continue",requiredError:"This field is required.",uploadError:"That file could not be uploaded. Choose the file and try again.",submitError:"Something went wrong submitting the form. Please try again.",booleanYes:"Yes",booleanNo:"No"};function resolveCopy(copy){return {submit:copy?.submit??FALLBACK.submit,requiredError:copy?.requiredError??FALLBACK.requiredError,uploadError:copy?.uploadError??FALLBACK.uploadError,submitError:copy?.submitError??FALLBACK.submitError,booleanYes:copy?.booleanYes??FALLBACK.booleanYes,booleanNo:copy?.booleanNo??FALLBACK.booleanNo}}function createCustomFormErrorEvent(code){return {type:"checktiv.custom_form.error",error:createChecktivError(code)}}function resolveTarget(target){if(typeof target!=="string")return target;if(typeof document==="undefined")return null;return document.querySelector(target)}async function resolveSessionIdentity(ctx,fetchImpl){let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(ctx.apiBaseOrigin+SESSIONS_ME_PATH,{method:"GET",headers:dataPlaneHeaders(ctx,token)}),result=>result?.status===401);}catch{return null}if(!res.ok)return null;let body;try{body=await res.json();}catch{return null}if(typeof body!=="object"||body===null)return null;const data=body.data;if(typeof data!=="object"||data===null)return null;const record=data;const sessionId=record.session_id;const stepId=record.step_id;if(typeof sessionId!=="string"||sessionId.length===0)return null;if(typeof stepId!=="string"||stepId.length===0)return null;ctx.setSessionId(sessionId);return {sessionId,stepId}}function noopHandle(){return {destroy:()=>void 0}}function createCustomForm(ctx,opts){const element=resolveTarget(opts.target);if(element===null){console.warn('[Checktiv] mount("custom_form"): no target element found. Pass an element or a selector that resolves.');return noopHandle()}const emit=e=>opts.onEvent?.(e);const fetchImpl=opts.fetchImpl??fetch;const chrome=resolveCopy(opts.copy);const answers=new Map;const pendingFiles=new Map;let identity=null;let submitting=false;let cancelled=false;const paint=()=>{if(cancelled)return;R(k(S,null,[...opts.config.fields.map(field=>renderField({field,copy:opts.copy?.fields?.[field.id],value:answers.get(field.id),id:`checktiv-cf-${field.id}`,booleanYes:chrome.booleanYes,booleanNo:chrome.booleanNo,onChange:next=>{answers.set(field.id,next);if(field.type==="multi_select")paint();},onFile:file=>{if(file===null){pendingFiles.delete(field.id);answers.delete(field.id);}else {pendingFiles.set(field.id,file);}}})),k("button",{type:"submit",class:"checktiv-cf-submit",disabled:opts.preview===true,onClick:e=>{e.preventDefault();if(opts.preview===true)return;void onSubmit();}},chrome.submit)]),element);};async function onSubmit(){if(submitting||cancelled)return;if(identity===null){emit(createCustomFormErrorEvent("session_expired"));return}const session=identity;submitting=true;for(const[fieldId,file]of pendingFiles){const key=await uploadFormFile(ctx,fetchImpl,session.stepId,fieldId,file);if(cancelled)return;if(key===null){emit(createCustomFormErrorEvent("upload_failed"));submitting=false;return}answers.set(fieldId,key);}pendingFiles.clear();const blob=collectAnswers(answers);let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(ctx.apiBaseOrigin+stepSubmitPath(session.sessionId,session.stepId),{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify(blob)}),result=>result?.status===401);}catch(err){console.warn("[Checktiv] custom_form submit request failed.",err);submitting=false;return}if(cancelled)return;if(!res.ok){emit(createCustomFormErrorEvent(mapHttpStatusToError(res.status)));submitting=false;return}emit({type:"checktiv.custom_form.submitted",sessionId:session.sessionId});}if(opts.preview===true){paint();emit({type:"checktiv.custom_form.ready"});return {destroy(){if(cancelled)return;cancelled=true;R(null,element);}}}void(async()=>{try{const resolved=opts.session??await resolveSessionIdentity(ctx,fetchImpl);if(cancelled)return;if(resolved===null){emit(createCustomFormErrorEvent("session_expired"));return}identity=resolved;paint();emit({type:"checktiv.custom_form.ready"});}catch(err){if(cancelled)return;console.warn('[Checktiv] mount("custom_form") setup failed.',err);emit(createCustomFormErrorEvent("sdk_load_failed"));}})();return {destroy(){if(cancelled)return;cancelled=true;R(null,element);}}}registerModule("custom_form",createCustomForm);
|
|
9
|
+
|
|
10
|
+
export { createCustomForm };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import './chunk-AIK7CDV6.js';
|
|
2
|
+
|
|
3
|
+
var t="client_timeout";var n="network_connection";var e="network_abort";var r="csp_block";var o="invalid_endpoint";var i="handle_agent_data";var c="script_load_fail";var a="bad_response_format";var s="api_key_missing";var u="api_key_invalid";var l="cache_misconfigured";var f="endpoints_misconfigured";var d="wrong_worker_option";var h="worker_initialization_failed";var p="sandboxed_iframe";var w="bundle_not_defined";var m={[t]:"Client timeout",[n]:"Network connection error",[e]:"Network request aborted",[r]:"Blocked by CSP",[o]:'The provided endpoint in "endpoints" parameter is not a valid URL',[i]:"Handle on demand agent data error",[c]:"Failed to load the JS script of the agent",[w]:"9319",[a]:"Can't parse the backend response. Make sure the proper endpoints are used.",[s]:"The `apiKey` option is not provided",[u]:"The `apiKey` option is not a string",[l]:"The `cache` option is misconfigured",[f]:"The `endpoints` option is misconfigured",[d]:"Wrong `worker` option, it should be a Worker instance",[h]:"Web Worker initialization failed",[p]:"Running inside sandboxed iframes is not supported"};var y=class extends Error{constructor(t2,n2){super(t2),this.name="FingerprintError",this.event_id=null,this.code=n2;}};function g(t2,n2){return new Promise((e2,r2)=>{let o2=false;null==n2||n2.then(()=>o2=true,()=>o2=true);("function"==typeof t2?g(Promise.resolve(),n2).then(t2):t2).then(t3=>{o2||e2(t3);},t3=>{o2||r2(t3);});})}function v(t2){if(!t2||"object"!=typeof t2)return false;const n2=t2;return "string"==typeof n2.__type__&&694409711===(function(t3){const n3=Et(t3);x=x||(function(){let t4;const n4=new Uint32Array(256);for(let e3=0;e3<256;e3++){t4=e3;for(let n5=0;n5<8;n5++)t4=1&t4?3988292384^t4>>>1:t4>>>1;n4[e3]=t4;}return n4})();let e2=-1;for(let t4=0;t4<n3.length;t4++)e2=e2>>>8^x[255&(e2^n3[t4])];return (-1^e2)>>>0})(X(n2.__type__))&&((void 0===n2.script||k(n2.script))&&(void 0===n2.helper||k(n2.helper))&&(void 0===n2.ingress||k(n2.ingress)))}function b(t2,n2){try{document.cookie;}catch(t3){if((function(t4){if(!(t4 instanceof DOMException))return false;const n3=t4.message;return G.test(n3)||Q.test(n3)||Y.test(n3)})(t3))return n2;throw t3}return t2()}function _(t2,n2,...e2){t2&&(async function(t3,n3){try{return await t3()}catch(t4){return console.error(t4),n3}})(()=>{const r2=n2(...e2);void 0!==r2&&t2(r2);});}function k(t2){return S(t2)?Z(t2.value):Z(t2)}function A(t2=V){return function(n2){let e2,i2;const{picked:a2,rest:l2}=(function(t3,n3){const e3={},r2={};for(const[o2,i3]of Object.entries(t3))n3.includes(o2)?e3[o2]=i3:r2[o2]=i3;return {picked:e3,rest:r2}})(n2,["apiKey"]),{apiKey:d2}=a2;if(!d2)throw new y(m[s],s);if("string"!=typeof d2)throw new y(m[u],u);const h2=(function(t3,n3){return Object.prototype.hasOwnProperty.call(t3,n3)})(p2=n2,g2="endpoints")?p2[g2]:void 0;var p2,g2;const v2=(function(t3,n3,e3){const r2=t3.prepareScriptEndpoints(n3,"https://fpnpmcdn.net/");if(null===r2)throw new y(m[f],f);return r2.map(t4=>(function(t5,n4){const e4=new URL(t5,window.location.href),r3=e4.pathname;return e4.pathname=`${r3}${r3.endsWith("/")?"":"/"}v4/${encodeURIComponent(n4)}`,e4.search=`?ci=jsl/${encodeURIComponent(F)}`,e4.href})(t4,e3))})(t2,h2,d2),[b2,_2]=(function(){const t3=[],n3=()=>{t3.push({time:new Date,state:document.visibilityState});},e3=(function(t4,n4,e4,r2){return t4.addEventListener(n4,e4,r2),()=>t4.removeEventListener(n4,e4,r2)})(document,"visibilitychange",n3);return n3(),[t3,e3]})();const k2=(async function(){try{const[n3,i3]=await(function(t3,n4){if(0===t3.length)return Promise.reject(new TypeError("The list of script URL patterns is empty"));const e3=[],r2=(function(t4,n5,e4,r3,o2={}){const{maxAttemptCount:i4=5,backoffBase:c2=200,backoffCap:a4=1e4,abort:s2}=o2,u2={failedAttempts:[]},[l3,f2]=(function(t5,n6,e5,r4){const o3=(function(t6){const n7=[...t6];return {current:()=>n7[0],postpone(){const t7=n7.shift();void 0!==t7&&n7.push(t7);},exclude(){n7.shift();}}})(t5),i5=(function(t6,n7){let e6=0;return ()=>Math.random()*Math.min(n7,t6*Math.pow(2,e6++))})(e5,r4),c3=new Set;return [o3.current(),(t6,e6,r5)=>{const a5=n6(t6,e6,r5);"exclude"===a5.action?o3.exclude():o3.postpone();const s3=()=>Math.max(0,t6.getTime()+i5()-Date.now());let u3;u3="number"==typeof a5.delay?a5.delay:s3();const l4=o3.current();if(0===u3&&l4){Date.now()-t6.getTime()<50&&(c3.has(l4)?u3=s3():c3.add(l4));}return void 0===l4?void 0:[l4,u3]}]})(t4,r3,c2,a4),d3=(h3=[null==s2?void 0:s2.then(t5=>u2.aborted={resolve:true,value:t5},t5=>u2.aborted={resolve:false,error:t5}),z(l3,i4,n5,e4,f2,u2,s2)],Promise.race(h3.filter(t5=>!!t5))).then(()=>u2);var h3;return {then:d3.then.bind(d3),current:u2}})(t3,async t4=>{const r3=new Date;try{const o2=await n4(t4);return e3.push({url:t4,startedAt:r3,finishedAt:new Date,error:void 0}),o2}catch(n5){throw e3.push({url:t4,startedAt:r3,finishedAt:new Date,error:n5}),n5}},t4=>({result:t4}),$,{maxAttemptCount:5,backoffBase:100,backoffCap:3e3});return new Promise((t4,n5)=>{Promise.resolve(r2).then(r3=>{if(void 0!==r3.result)t4([r3.result,e3]);else {const t5=r3.failedAttempts[0];n5(t5?t5.error:new Error("No attempts were made"));}}).catch(n5);})})(v2,n4=>(function(t3,n5){return t3.withCspViolationWatch(n5,async()=>{if((function(t4){if(!URL.prototype)return;try{return new URL(t4,location.href),false}catch(t5){if(R(t5))return true;throw t5}})(n5))throw new y(m[o],o);try{return await import(n5)}catch(t4){throw new y(m[c],c)}},()=>{throw new y(m[r],r)}).then(t4=>{if("function"!=typeof(null==t4?void 0:t4.start))throw new y(m[w],w);return t4})})(t2,n4)),a3=await n3.start({...l2,ldi:{attempts:i3,visibilityStates:b2}});return e2=a3,a3}catch(t3){throw i2=(function(t4){if(t4 instanceof y&&t4.code===w)return new y(m[c],c);return t4})(t3),i2}finally{_2();}})();return {async get(t3){if(e2)return e2.get(t3);if(i2)throw i2;return (await k2).get(t3)},async collect(t3){if(e2)return e2.collect(t3);if(i2)throw i2;return (await k2).collect(t3)}}}}var x;function C(t2,n2){return (function(t3,n3,e2){const r2=()=>{throw new Error("Invalid data")},o2=Et(t3);o2.length<n3.length+2&&r2();for(let t4=0;t4<n3.length;++t4)K(o2[1+t4],o2[0])!==n3[t4]&&r2();const i2=1+n3.length,c2=K(o2[i2],o2[0]);o2.length<i2+1+c2+e2&&r2();const a2=i2+1+c2,s2=a2+e2,u2=new ArrayBuffer(o2.length-s2),l2=new Uint8Array(u2);for(let t4=0;t4<l2.length;++t4)l2[t4]=o2[s2+t4]^o2[a2+t4%e2];return u2})(t2,St,$t)}function U(t2,n2){!(function(t3,n3,e2){if(J(n4=>{!(function(t4,n5){B(t4,"",-1,n5);})(t3,n4);}),e2<0);J(r2=>(B(t3,n3,e2,r2),(function(t4){return b(()=>{const n4=`${t4}=`;for(const t5 of document.cookie.split(";")){let e3=0;for(;" "===t5[e3]&&e3<t5.length;)++e3;if(t5.indexOf(n4)===e3)return t5.slice(e3+n4.length)}},void 0)})(t3)===n3));})(n2,t2,365),(function(t3,n3){var e2;try{null===(e2=null===localStorage||void 0===localStorage?void 0:localStorage.setItem)||void 0===e2||e2.call(localStorage,t3,n3);}catch(t4){}})(n2,t2);}function E(){return (function(){var t2,n2;const e2=window;return r2=["buildID"in navigator,"MozAppearance"in(null!==(n2=null===(t2=document.documentElement)||void 0===t2?void 0:t2.style)&&void 0!==n2?n2:{}),"onmozfullscreenchange"in e2,"mozInnerScreenX"in e2,"CSSMozDocumentRule"in e2,"CanvasCaptureMediaStream"in e2],r2.reduce((t3,n3)=>t3+(n3?1:0),0)>=4;var r2;})()}var D=Array.isArray;function S(t2){return !!t2&&t2.__type__===L}function T(t2){return {__type__:L,value:t2}}function $(t2,n2,e2){const i2=e2 instanceof y?e2.code:null;if(i2===r||i2===o)return {action:"exclude",delay:0};if(i2===w)return {action:"exclude",delay:"backoff"};if(i2===c){return {action:"postpone",delay:Date.now()-t2.getTime()<50?0:"backoff"}}return {action:"postpone",delay:"backoff"}}var L="withoutDefault";var P="_vid_";function R(t2){return t2 instanceof Error&&"TypeError"===t2.name}function M(t2){return t2>=lt&&t2<lt+10||t2===wt}function I(t2,n2){Dt(t2,t2.len+1),t2.arr[t2.len++]=n2;}function j(t2){return null!==t2&&"object"==typeof t2&&"name"in t2&&"FingerprintError"===t2.name&&"code"in t2}function O(t2,n2){try{return new window.URL(t2,window.location.href)}catch(e2){if(R(e2))return console.warn(`Ignoring an invalid '${n2}' value: "${t2}"`),null;throw e2}}function W(t2){return `${t2.origin}${t2.pathname.endsWith("/")?t2.pathname:`${t2.pathname}/`}web/`}async function z(t2,n2,e2,r2,o2,i2,c2){if(void 0===t2)return;let a2=t2;for(let t3=0;t3<n2;++t3){const n3=new Date;let s2,u2;try{s2=await g(()=>e2(a2,t3,c2),c2);}catch(t4){u2=t4,i2.failedAttempts.push({level:0,endpoint:a2,error:t4});}if(s2){const t4=r2(s2);if("result"in t4){i2.result=t4.result;break}if(i2.failedAttempts.push({level:1,endpoint:a2,error:t4.error}),t4.stop)break}const l2=o2(n3,s2,u2);if(!l2)break;await g(nt(l2[1]),c2),a2=l2[0];}}var F="4.1.0";function B(t2,n2,e2,r2){b(()=>{const o2=`${t2}=${n2}`,i2=`expires=${new Date(Date.now()+24*e2*60*60*1e3).toUTCString()}`,c2=r2?`domain=${r2}`:"";document.cookie=[o2,"path=/",i2,c2,"SameSite=Lax"].join("; ");},void 0);}function K(t2,n2){return (t2-n2+256)%256}function N(t2,n2){Dt(t2,t2.len+n2.length),t2.arr.set(n2,t2.len),t2.len+=n2.length;}var V={prepareScriptEndpoints:function(t2,n2){if(void 0===t2)return [n2];if(k(t2))return (function(t3,n3){let e2,r2=false;S(t3)?(r2=true,e2=tt(t3.value)):e2=tt(t3);const o2=[];for(const t4 of e2){const n4=O(t4,"endpoints");n4&&o2.push(W(n4));}r2||o2.push(n3);return o2})(t2,n2);if(v(t2))return (function(t3,n3,e2){if(void 0===t3)return [n3];let r2,o2=false;S(t3)?(o2=true,r2=tt(t3.value)):r2=tt(t3);const i2=[];for(const t4 of r2){const n4=O(t4,e2);n4&&i2.push(n4.href);}o2||i2.push(n3);return i2})(t2.script,n2,"script");return null},withCspViolationWatch:function(t2,n2,e2,r2){const o2=document,i2="securitypolicyviolation";let c2;const a2=n3=>{const e3=new URL(t2,location.href),{blockedURI:r3}=n3;r3!==e3.href&&r3!==e3.protocol.slice(0,-1)&&r3!==e3.origin||(c2=n3,s2());};o2.addEventListener(i2,a2);const s2=()=>o2.removeEventListener(i2,a2);return null==r2||r2.then(s2,s2),Promise.resolve().then(n2).then(t3=>(s2(),t3),t3=>new Promise(t4=>{const n3=new MessageChannel;n3.port1.onmessage=()=>t4(),n3.port2.postMessage(null);}).then(()=>{if(s2(),c2)return e2(c2);throw t3}))}};function q({level:t2,message:n2}){"error"===t2?console.error(n2):"warning"===t2?console.warn(n2):console.log(n2);}var H=A();function J(t2){const n2=location.hostname,e2=E();(function(t3,n3){let e3=t3.length-("."===t3.slice(-1)?1:0);do{if(e3=e3>0?t3.lastIndexOf(".",e3-1):-1,true===n3(t3.slice(e3+1)))return true}while(e3>=0);return false})(n2,r2=>{if(!e2||!/^([^.]{1,3}\.)*[^.]+\.?$/.test(r2)||r2===n2)return t2(r2)})||t2();}function X(t2){const n2=new Uint8Array(t2.length);for(let e2=0;e2<t2.length;e2++){const r2=t2.charCodeAt(e2);if(r2>127)return new TextEncoder().encode(t2);n2[e2]=r2;}return n2}var G=/The document is sandboxed and lacks the 'allow-same-origin' flag/;var Q=/The operation is insecure/;var Y=/Forbidden in a sandboxed document without the 'allow-same-origin' flag/;function Z(t2){return "string"==typeof t2||Array.isArray(t2)&&t2.every(t3=>"string"==typeof t3)}function tt(t2){return D(t2)?t2:[t2]}function nt(t2,n2){return new Promise(e2=>(function(t3,n3,...e3){const r2=Date.now()+n3;let o2=0;const i2=()=>{o2=setTimeout(()=>{Date.now()<r2?i2():t3(...e3);},r2-Date.now());};return i2(),()=>clearTimeout(o2)})(e2,t2,n2))}var et=34;var rt=44;var ot=58;var it=32;var ct=9;var at=13;var st=10;var ut=92;var lt=48;var ft=101;var dt=117;var ht=69;var pt=43;var wt=45;var mt=46;var yt=91;var gt=93;var vt=123;var bt=125;var _t=new Uint8Array([110,dt,108,108]);var kt=new Uint8Array([116,114,dt,ft]);var At=new Uint8Array([102,97,108,115,ft]);var xt={'"':'"',"\\":"\\","\b":"b","\f":"f","\n":"n","\r":"r"," ":"t"};var Ct=(()=>{const t2=new Uint8Array(128);for(const[n2,e2]of Object.entries(xt))t2[e2.charCodeAt(0)]=n2.charCodeAt(0);return t2})();function Ut(t2){if("function"==typeof TextDecoder){const n3=new TextDecoder().decode(t2);if(n3)return n3}const n2=Et(t2);return decodeURIComponent(escape(String.fromCharCode.apply(null,n2)))}function Et(t2){return t2 instanceof ArrayBuffer?new Uint8Array(t2):new Uint8Array(t2.buffer,t2.byteOffset,t2.byteLength)}function Dt(t2,n2){if(t2.arr.length<n2){const e2=new Uint8Array(Math.max(2*t2.arr.length,n2));e2.set(t2.arr),t2.arr=e2;}}var St=[3,13];var $t=9;var Lt=function(t2,n2={}){const{storageKeyPrefix:e2=P,do:r2}=n2;try{const n3=(function(t3){const n4=(function(t4){const n5=atob(t4),e4=n5.length,r3=new Uint8Array(e4);for(let t5=0;t5<e4;t5++)r3[t5]=n5.charCodeAt(t5);return r3})(t3);let e3=n4;try{e3=C(n4,false);}catch(t4){}try{return (function(t4){const n5={len:0,arr:new Uint8Array(128)},e4=Et(t4);let r3=0;const o2=()=>(u2(),e4[r3]===et?i2():M(e4[r3])?c2():l2(_t)?(r3+=_t.length,null):l2(kt)?(r3+=kt.length,true):l2(At)?(r3+=At.length,false):e4[r3]===yt?a2():e4[r3]===vt?s2():f2()),i2=()=>{for(n5.len=0;r3++,e4[r3]!==et;){if(e4[r3]===ut){if(r3++,e4[r3]===dt){const t6=parseInt(Ut(e4.subarray(r3+1,r3+5)),16);N(n5,X(String.fromCharCode(t6))),r3+=4;continue}const t5=Ct[e4[r3]];if(t5){I(n5,t5);continue}return f2()}if(void 0===e4[r3])return f2();I(n5,e4[r3]);}return r3++,Ut((function(t5){return t5.arr.subarray(0,t5.len)})(n5))},c2=()=>{const t5=r3;for(;e4[r3]===mt||e4[r3]===ft||e4[r3]===ht||e4[r3]===pt||M(e4[r3]);)r3++;return Number(Ut(e4.subarray(t5,r3)))},a2=()=>{const t5=[];for(r3++;;){if(u2(),e4[r3]===gt){r3++;break}if(t5.length){if(e4[r3]!==rt)return f2();r3++;}t5.push(o2());}return t5},s2=()=>{const t5={};let n6=true;for(r3++;;){if(u2(),e4[r3]===bt){r3++;break}if(!n6){if(e4[r3]!==rt)return f2();r3++,u2();}if(e4[r3]!==et)return f2();const c3=i2();if(u2(),e4[r3]!==ot)return f2();r3++,Object.defineProperty(t5,c3,{value:o2(),configurable:true,enumerable:true,writable:true}),n6=false;}return t5},u2=()=>{for(;e4[r3]===it||e4[r3]===st||e4[r3]===at||e4[r3]===ct;)r3++;},l2=t5=>{for(let n6=0;n6<t5.length;n6++)if(e4[r3+n6]!==t5[n6])return false;return true},f2=()=>{throw new SyntaxError("Unexpected "+(r3<e4.length?`byte ${r3}`:"end"))},d2=o2();u2(),void 0!==e4[r3]&&f2();return d2})(e3)}catch(t4){}return null})(t2);null!==n3?(n3.visitorToken&&U(n3.visitorToken,`${e2}t`),n3.notifications.forEach(q),_(r2,()=>({e:25,result:{response:n3}}))):_(r2,()=>({e:25,result:{error:new Error("Failed to decode response")}}));}catch(t3){throw _(r2,()=>({e:25,result:{error:t3 instanceof Error?t3:new Error(String(t3))}})),new y(m[i],i)}};var Pt={start:H,handleAgentData:Lt,isFingerprintError:j,withoutDefault:T};
|
|
4
|
+
|
|
5
|
+
export { Pt as default, Lt as handleAgentData, j as isFingerprintError, H as start, T as withoutDefault };
|
package/dist/fraud.d.ts
ADDED
package/dist/fraud.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { resolveSession } from './chunk-CXNPD67Z.js';
|
|
2
|
+
import { registerModule, TELEMETRY_PATH, withTokenRetry, dataPlaneHeaders } from './chunk-FGWZZNAN.js';
|
|
3
|
+
import './chunk-QFA3K5ZV.js';
|
|
4
|
+
import { createChecktivError } from './chunk-WQCYRLWP.js';
|
|
5
|
+
import { __publicField } from './chunk-AIK7CDV6.js';
|
|
6
|
+
|
|
7
|
+
var MAX_STEPS=50;var MAX_STEP_SECONDS=86400;var MAX_STEP_PASTE_COUNT=1e4;var MAX_STEP_ID_LEN=80;function defaultNow(){return typeof performance!=="undefined"&&typeof performance.now==="function"?performance.now():Date.now()}var BehavioralTracker=class{constructor(now=defaultNow){__publicField(this,"steps",new Map);__publicField(this,"activeStepId",null);__publicField(this,"now");this.now=now;}get currentStepId(){return this.activeStepId}enter(rawStepId){const stepId=this.boundStepId(rawStepId);if(stepId===null)return;this.closeActiveInterval();const existing=this.steps.get(stepId);if(existing){existing.enteredAtMs=this.now();}else {this.steps.set(stepId,{stepId,enteredAtMs:this.now(),accumulatedMs:0,pasteCount:0});}this.activeStepId=stepId;}recordPaste(rawStepId){const target=rawStepId===void 0?this.activeStepId:this.boundStepId(rawStepId);if(target===null)return;const existing=this.steps.get(target);if(existing){if(existing.pasteCount<MAX_STEP_PASTE_COUNT)existing.pasteCount+=1;return}this.steps.set(target,{stepId:target,enteredAtMs:null,accumulatedMs:0,pasteCount:1});}snapshot(){this.closeActiveInterval();if(this.activeStepId!==null){const active=this.steps.get(this.activeStepId);if(active)active.enteredAtMs=this.now();}const out=[];for(const acc of this.steps.values()){if(out.length>=MAX_STEPS)break;out.push({stepId:acc.stepId,seconds:this.boundSeconds(acc.accumulatedMs),pasteCount:acc.pasteCount});}return out}closeActiveInterval(){if(this.activeStepId===null)return;const active=this.steps.get(this.activeStepId);if(!active||active.enteredAtMs===null)return;const delta=this.now()-active.enteredAtMs;if(delta>0)active.accumulatedMs+=delta;active.enteredAtMs=null;}boundStepId(rawStepId){if(typeof rawStepId!=="string")return null;const trimmed=rawStepId.trim();if(trimmed.length===0)return null;return trimmed.length>MAX_STEP_ID_LEN?trimmed.slice(0,MAX_STEP_ID_LEN):trimmed}boundSeconds(ms){const seconds=ms/1e3;if(!Number.isFinite(seconds)||seconds<0)return 0;return seconds>MAX_STEP_SECONDS?MAX_STEP_SECONDS:seconds}};var DEVICE_MODEL_HINT_MAX=120;function readBoundedString(value,max){if(typeof value!=="string")return null;const trimmed=value.trim();if(trimmed.length===0)return null;return trimmed.length>max?trimmed.slice(0,max):trimmed}function readTimezone(){try{const tz=Intl.DateTimeFormat().resolvedOptions().timeZone;return readBoundedString(tz,64)}catch{return null}}function readMaxTouchPoints(nav){const raw=nav.maxTouchPoints;if(typeof raw!=="number"||!Number.isFinite(raw))return 0;const floored=Math.floor(raw);if(floored<0)return 0;return floored>512?512:floored}function readPluginCount(nav){const plugins=nav.plugins;const len=plugins&&typeof plugins.length==="number"?plugins.length:0;if(!Number.isFinite(len)||len<0)return 0;return len>256?256:Math.floor(len)}function readDeviceModelHint(nav){const uaData=nav.userAgentData;if(typeof uaData!=="object"||uaData===null)return null;return readBoundedString(uaData.platform,DEVICE_MODEL_HINT_MAX)}function readBehaviorTraits(nav=navigator){return {webdriver:nav.webdriver===true,maxTouchPoints:readMaxTouchPoints(nav),timezone:readTimezone(),pluginCount:readPluginCount(nav),deviceModelHint:readDeviceModelHint(nav)}}var BEHAVIOR_CAPTURED_EVENT="kyc.fraud.behavior_captured";var MAX_SEGMENTS=4;var MAX_SEGMENT_STEPS=50;var DEFAULT_SUBMIT_TIMEOUT_MS=2500;function defaultSleep(ms){return new Promise(resolve=>setTimeout(resolve,ms))}function createGatedTransport(inner,opts){const sleep=opts.sleep??defaultSleep;return {async postTelemetry(events){for(let attempt=0;attempt<=opts.maxRetries;attempt+=1){if(attempt>0)await sleep(opts.retryDelayMs).catch(()=>{});try{const res=await inner.postTelemetry(events);if(res.ok)return}catch{}}console.warn("[fraud-agent] flush failed");}}}function withTimeout(promise,ms){return new Promise(resolve=>{let settled=false;const done=()=>{if(settled)return;settled=true;resolve();};const timer=setTimeout(done,ms);void promise.finally(()=>{clearTimeout(timer);done();});})}function boundSegmentSteps(steps){return steps.length>MAX_SEGMENT_STEPS?steps.slice(0,MAX_SEGMENT_STEPS):steps}function createFraudAgent(options){const{transport,sessionId,pasteListenerTarget,now,submitTimeoutMs=DEFAULT_SUBMIT_TIMEOUT_MS}=options;const tracker=new BehavioralTracker(now);let parentTraits=null;const traits=()=>parentTraits??(parentTraits=readBehaviorTraits());const embedSegments=[];const pasteTarget=pasteListenerTarget===void 0?typeof document!=="undefined"?document:null:pasteListenerTarget;const onPasteEvent=()=>{tracker.recordPaste();};if(pasteTarget){pasteTarget.addEventListener("paste",onPasteEvent,{capture:true,passive:true});}function buildPayload(){const steps=tracker.snapshot();const parentTraitsValue=traits();const payload={steps,traits:parentTraitsValue};if(embedSegments.length>0){payload.segments=[{surface:"parent",steps,traits:parentTraitsValue},...embedSegments.slice(0,MAX_SEGMENTS-1).map(seg=>({surface:"embed",steps:boundSegmentSteps(seg.steps),traits:seg.traits}))];}return payload}return {onStepEnter(stepId){tracker.enter(stepId);},onPaste(stepId){tracker.recordPaste(stepId);},mergeEmbedSegment(segment){if(embedSegments.length>=MAX_SEGMENTS-1)return;embedSegments.push({steps:boundSegmentSteps(segment.steps),traits:segment.traits});},async onSubmit(){if(sessionId===void 0)return;const payload=buildPayload();const activeStepId=tracker.currentStepId;const post=(async()=>{try{await transport.postTelemetry([{event:BEHAVIOR_CAPTURED_EVENT,sessionId,...activeStepId!==null?{stepId:activeStepId}:{},ts:Date.now(),payload}]);}catch{}})();await withTimeout(post,submitTimeoutMs);},dispose(){if(pasteTarget){pasteTarget.removeEventListener("paste",onPasteEvent,{capture:true});}}}}var TELEMETRY_FLUSH_MAX_RETRIES=1;var TELEMETRY_FLUSH_RETRY_DELAY_MS=400;function createTelemetryTransport(ctx,fetchImpl){const url=ctx.apiBaseOrigin+TELEMETRY_PATH;return {postTelemetry(events){return withTokenRetry(ctx.tokens,token=>fetchImpl(url,{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify({events})}),result=>result?.status===401)}}}function createFraud(ctx,opts){const fetchImpl=opts.fetchImpl??fetch;const transport=createGatedTransport(createTelemetryTransport(ctx,fetchImpl),{maxRetries:TELEMETRY_FLUSH_MAX_RETRIES,retryDelayMs:TELEMETRY_FLUSH_RETRY_DELAY_MS});let destroyed=false;let agent=null;void Promise.resolve().then(async()=>{const granted=await opts.onConsent();if(destroyed||!granted)return;const session=await resolveSession(ctx,fetchImpl);if(destroyed)return;if(session===null){opts.onEvent?.({type:"checktiv.fraud.error",error:createChecktivError("session_expired")});return}agent=createFraudAgent({transport,sessionId:session.sessionId});opts.onEvent?.({type:"checktiv.fraud.started"});}).catch(()=>{});return {destroy(){destroyed=true;agent?.dispose();agent=null;}}}registerModule("fraud",createFraud);
|
|
8
|
+
|
|
9
|
+
export { createFraud };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { _ as ___cross_device_index_js, C as CrossDeviceCopy } from '../index-BtJbU9MC.js';
|
|
2
|
+
import { g as CrossDeviceHandoffHook, f as ChecktivIdvEvent } from '../types-CnlkFS7V.js';
|
|
3
|
+
import '../machine--zVZIM4F.js';
|
|
4
|
+
import '../copy-DeUly5vr.js';
|
|
5
|
+
|
|
6
|
+
declare const CROSS_DEVICE_REMINT_CAP = 3;
|
|
7
|
+
type CrossDeviceChunkImporter = () => Promise<typeof ___cross_device_index_js>;
|
|
8
|
+
declare function preloadCrossDeviceChunk(importer?: CrossDeviceChunkImporter): void;
|
|
9
|
+
interface CrossDeviceOverlayOptions {
|
|
10
|
+
target: HTMLElement;
|
|
11
|
+
onOpenCrossDevice: CrossDeviceHandoffHook;
|
|
12
|
+
copy: CrossDeviceCopy;
|
|
13
|
+
isMobile: boolean;
|
|
14
|
+
emit: (e: ChecktivIdvEvent) => void;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
chunkImporter?: CrossDeviceChunkImporter;
|
|
17
|
+
}
|
|
18
|
+
interface CrossDeviceOverlayHandle {
|
|
19
|
+
setCompleting(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
}
|
|
22
|
+
declare function openCrossDeviceOverlay(opts: CrossDeviceOverlayOptions): CrossDeviceOverlayHandle;
|
|
23
|
+
|
|
24
|
+
export { CROSS_DEVICE_REMINT_CAP, type CrossDeviceChunkImporter, type CrossDeviceOverlayHandle, type CrossDeviceOverlayOptions, openCrossDeviceOverlay, preloadCrossDeviceChunk };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createChecktivError } from '../chunk-WQCYRLWP.js';
|
|
2
|
+
import '../chunk-AIK7CDV6.js';
|
|
3
|
+
|
|
4
|
+
var CROSS_DEVICE_REMINT_CAP=3;var defaultChunkImporter=()=>import('../cross-device.js');function preloadCrossDeviceChunk(importer=defaultChunkImporter){try{void importer().catch(()=>{});}catch{}}function openCrossDeviceOverlay(opts){const{target,onOpenCrossDevice,copy,isMobile,emit,onClose,chunkImporter=defaultChunkImporter}=opts;const childContainer=document.createElement("div");target.appendChild(childContainer);let destroyed=false;let remintCount=0;let onCloseFired=false;const invokeOnClose=()=>{if(onCloseFired)return;onCloseFired=true;onClose?.();};const panelOnClose=onClose?invokeOnClose:void 0;let chunkHandle=null;let isCompleting=false;let currentUrl=null;const renderUnavailable=()=>{emit({type:"checktiv.idv.cross_device_unavailable"});chunkHandle?.update({url:"",copy,isMobile,completing:false,onBack:panelOnClose,onRetry:panelOnClose});};const rerender=url=>{if(typeof url!=="string"||url.length===0){renderUnavailable();return}currentUrl=url;chunkHandle?.update({url,copy,isMobile,completing:isCompleting,onBack:panelOnClose,onRefreshLink:makeRefreshHandler(),onRetry:panelOnClose});};function makeRefreshHandler(currentUrl2){if(remintCount>=CROSS_DEVICE_REMINT_CAP){return void 0}return ()=>{if(destroyed)return;if(remintCount>=CROSS_DEVICE_REMINT_CAP)return;void(async()=>{remintCount+=1;let result;try{result=await onOpenCrossDevice();}catch(err){console.warn("[Checktiv] cross-device: refresh hook rejected unexpectedly.",err);if(destroyed)return;renderUnavailable();return}if(destroyed)return;if(result.kind==="unavailable"){renderUnavailable();return}rerender(result.url);})();}}function mountPanel(chunkModule,mintResult){if(destroyed)return;const okUrl=mintResult.kind==="ok"?mintResult.url:void 0;if(mintResult.kind==="unavailable"||typeof okUrl!=="string"||okUrl.length===0){emit({type:"checktiv.idv.cross_device_unavailable"});chunkHandle=chunkModule.mountCrossDevice(childContainer,{url:"",copy,isMobile,completing:false,onBack:panelOnClose,onRetry:panelOnClose});return}emit({type:"checktiv.idv.cross_device_opened"});currentUrl=okUrl;chunkHandle=chunkModule.mountCrossDevice(childContainer,{url:okUrl,copy,isMobile,completing:isCompleting,onBack:panelOnClose,onRefreshLink:makeRefreshHandler(),onRetry:panelOnClose});}function renderDoubleFaultFallback(){if(destroyed)return;childContainer.textContent="";const msg=document.createElement("div");msg.setAttribute("data-testid","cross-device-double-fault");const text=copy.unavailableMessage;if(text){const p=document.createElement("p");p.textContent=text;msg.appendChild(p);}if(onClose){const btn=document.createElement("button");btn.type="button";btn.setAttribute("data-testid","cross-device-double-fault-retry");const retryLabel=copy.mobileTryAgainLabel??"Try again";btn.textContent=retryLabel;btn.addEventListener("click",invokeOnClose);msg.appendChild(btn);}childContainer.appendChild(msg);}void(async()=>{let chunkResult;try{chunkResult=await chunkImporter();}catch(err){console.warn("[Checktiv] cross-device: failed to load the cross-device chunk.",err);emit(createErrorEvent("sdk_load_failed"));renderDoubleFaultFallback();return}if(destroyed)return;const mintResult=await onOpenCrossDevice().catch(err=>{console.warn("[Checktiv] cross-device: onOpenCrossDevice hook threw unexpectedly.",err);return {kind:"unavailable"}});if(destroyed)return;try{mountPanel(chunkResult,mintResult);}catch(err){console.warn("[Checktiv] cross-device: failed to mount the cross-device panel.",err);emit(createErrorEvent("sdk_load_failed"));renderDoubleFaultFallback();}})();return {setCompleting(){if(destroyed)return;isCompleting=true;if(chunkHandle!==null&¤tUrl!==null){chunkHandle.update({url:currentUrl,copy,isMobile,completing:true,onBack:panelOnClose,onRefreshLink:void 0,onRetry:panelOnClose});}},destroy(){if(destroyed)return;destroyed=true;invokeOnClose();if(chunkHandle!==null){chunkHandle.destroy();chunkHandle=null;}childContainer.remove();}}}function createErrorEvent(code){return {type:"checktiv.idv.error",error:createChecktivError(code)}}
|
|
5
|
+
|
|
6
|
+
export { CROSS_DEVICE_REMINT_CAP, openCrossDeviceOverlay, preloadCrossDeviceChunk };
|
package/dist/idv.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.idv-capture-frame{display:block;width:100%;max-width:28rem;aspect-ratio:3 / 4;margin:0 auto;border:0;border-radius:0.5rem;background:transparent}.idv-capture-frame--biometric{aspect-ratio:auto;height:min(70dvh,520px)}@media(orientation:landscape){.idv-capture-frame,.idv-capture-frame--biometric{aspect-ratio:auto;height:min(55dvh,380px);width:auto}}.idv-capture-active{position:relative}.idv-capture-skeleton{position:absolute;top:0;left:50%;transform:translateX(-50%);z-index:1;width:100%;max-width:28rem;height:min(70dvh,520px);border-radius:0.5rem;overflow:hidden;background:#e5e7eb}.idv-capture-skeleton[data-color-mode=dark]{background:#1f2937}.idv-capture-skeleton::before{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,rgba(255,255,255,0.22) 50%,transparent 70%);background-size:200% 100%;animation:idv-capture-skeleton-sweep 1.4s ease-in-out infinite}@keyframes idv-capture-skeleton-sweep{from{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.idv-capture-skeleton::before{animation:none}}@media(orientation:landscape){.idv-capture-skeleton{height:min(55dvh,380px)}}
|
package/dist/idv.d.ts
ADDED
package/dist/idv.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { resolveSession } from './chunk-CXNPD67Z.js';
|
|
2
|
+
import { registerModule, withTokenRetry, stepSubmitPath, dataPlaneHeaders, CAPTURE_TOKEN_MINT_PATH, isCanonicalOrigin } from './chunk-FGWZZNAN.js';
|
|
3
|
+
import { mount } from './chunk-C7H2ZVQT.js';
|
|
4
|
+
import './chunk-HV2QKVJX.js';
|
|
5
|
+
import './chunk-XOGHMNBX.js';
|
|
6
|
+
import { CURRENT_PROTOCOL_VERSION } from './chunk-TRTAZKYV.js';
|
|
7
|
+
import './chunk-QFA3K5ZV.js';
|
|
8
|
+
import { createChecktivError, mapHttpStatusToError } from './chunk-WQCYRLWP.js';
|
|
9
|
+
import './chunk-AIK7CDV6.js';
|
|
10
|
+
|
|
11
|
+
var PLATFORM_BRAND_DEFAULT={primaryColor:"#2563eb",secondaryColor:"#ff5e4d",colorMode:"auto"};function createChecktivErrorEvent(code){return {type:"checktiv.idv.error",error:createChecktivError(code)}}var CAPTURE_ERROR_CODE={cv_gate_failed:"cv_gate_failed",upload_failed:"upload_failed",sdk_load_failed:"sdk_load_failed",biometric_unsupported:"biometric_unsupported",selfie_camera_denied:"camera_denied",liveness_camera_denied:"camera_denied",liveness_runtime_error:"sdk_load_failed",liveness_timeout:"sdk_load_failed",liveness_server_error:"sdk_load_failed",liveness_cancelled:"sdk_load_failed",protocol_mismatch:"protocol_mismatch"};function mapStateToEvent(state,ctx){switch(state.kind){case "minting":case "waiting_for_init":case "submitting":return null;case "ready":return {type:"checktiv.idv.ready",config:ctx.config};case "capturing":if(state.phase==="coaching"&&state.coaching!==null){return {type:"checktiv.idv.coaching",hint:state.coaching}}return {type:"checktiv.idv.phase",phase:state.phase};case "mint_error":return createChecktivErrorEvent("session_expired");case "submit_error":return createChecktivErrorEvent("upload_failed");case "submit_pending":return {type:"checktiv.idv.processing"};case "token_expired":return createChecktivErrorEvent("token_expired");case "capture_error":return createChecktivErrorEvent(CAPTURE_ERROR_CODE[state.errorKind]);default:return null}}var SURFACE={light:{bg:"#fafaf7",surface1:"#ffffff"},dark:{bg:"#0b0c0f",surface1:"#15171c"}};var WHITE="#ffffff";var NEAR_BLACK="#0b0c0f";var ACCENT_TARGET=3;var ADAPT_STEP=.04;var ADAPT_MAX_ITERS=24;var HOVER_DELTA=.08;var SECONDARY_HUE_SHIFT=150;var HEX_RE=/^#[0-9a-fA-F]{6}$/;function toHex(r,g,b){const ch=v=>Math.max(0,Math.min(255,Math.round(v))).toString(16).padStart(2,"0");return `#${ch(r)}${ch(g)}${ch(b)}`}function parseHex(hex){if(typeof hex!=="string"||!HEX_RE.test(hex))return null;const n=Number.parseInt(hex.slice(1),16);return {r:n>>16&255,g:n>>8&255,b:n&255}}function linearize(channel){const s=channel/255;return s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4)}function relativeLuminance(rgb){return .2126*linearize(rgb.r)+.7152*linearize(rgb.g)+.0722*linearize(rgb.b)}function assessContrast(fg,bg){const f=parseHex(fg);const b=parseHex(bg);if(!f||!b)return 1;const l1=relativeLuminance(f);const l2=relativeLuminance(b);const hi=Math.max(l1,l2);const lo=Math.min(l1,l2);return (hi+.05)/(lo+.05)}function rgbToHsl({r,g,b}){const rn=r/255;const gn=g/255;const bn=b/255;const max=Math.max(rn,gn,bn);const min=Math.min(rn,gn,bn);const l=(max+min)/2;let h=0;let s=0;if(max!==min){const d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case rn:h=(gn-bn)/d+(gn<bn?6:0);break;case gn:h=(bn-rn)/d+2;break;default:h=(rn-gn)/d+4;break}h/=6;}return {h:h*360,s,l}}function hueToRgb(p,q,tRaw){let t=tRaw;if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p}function hslToRgb({h,s,l}){const hn=(h%360+360)%360/360;let r;let g;let b;if(s===0){r=g=b=l;}else {const q=l<.5?l*(1+s):l+s-l*s;const p=2*l-q;r=hueToRgb(p,q,hn+1/3);g=hueToRgb(p,q,hn);b=hueToRgb(p,q,hn-1/3);}return {r:Math.round(r*255),g:Math.round(g*255),b:Math.round(b*255)}}function deriveSecondaryHue(hex){const rgb=parseHex(hex);if(!rgb)return PLATFORM_BRAND_DEFAULT.secondaryColor;const hsl=rgbToHsl(rgb);const out=hslToRgb({...hsl,h:(hsl.h+SECONDARY_HUE_SHIFT)%360});return toHex(out.r,out.g,out.b)}function shiftLightness(hex,delta){const rgb=parseHex(hex);if(!rgb)return toHex(0,0,0);const hsl=rgbToHsl(rgb);const out=hslToRgb({...hsl,l:Math.max(0,Math.min(1,hsl.l+delta))});return toHex(out.r,out.g,out.b)}function onColorFor(bg){const white=assessContrast(WHITE,bg);const dark=assessContrast(NEAR_BLACK,bg);return white>=dark?WHITE:NEAR_BLACK}function adaptAccent(hex,surface,target,warnings,field,mode){const rgb=parseHex(hex);if(!rgb){return toHex(0,0,0)}const hsl=rgbToHsl(rgb);const lighten=relativeLuminance(parseHex(surface)??{r:255,g:255,b:255})<.5;const rawRatio=assessContrast(hex,surface);let l=hsl.l;let out=toHex(rgb.r,rgb.g,rgb.b);for(let i=0;i<ADAPT_MAX_ITERS;i+=1){if(assessContrast(out,surface)>=target)break;l=Math.max(0,Math.min(1,l+(lighten?ADAPT_STEP:-ADAPT_STEP)));const o=hslToRgb({h:hsl.h,s:hsl.s,l});out=toHex(o.r,o.g,o.b);}const finalRatio=assessContrast(out,surface);if(rawRatio<target||finalRatio<target){warnings.push({field,mode,ratio:Number(rawRatio.toFixed(2))});}return out}function deriveMode(input,mode,warnings){const surf=SURFACE[mode];const primary=adaptAccent(input.primaryColor,surf.bg,ACCENT_TARGET,warnings,"primary",mode);const rawSecondary=input.secondaryColor??deriveSecondaryHue(input.primaryColor);const secondary=adaptAccent(rawSecondary,surf.bg,ACCENT_TARGET,warnings,"secondary",mode);const primaryHover=shiftLightness(primary,mode==="light"?-HOVER_DELTA:HOVER_DELTA);const onPrimary=onColorFor(primary);const onSecondary=onColorFor(secondary);const ring=primary;return {primary,primaryHover,onPrimary,secondary,onSecondary,ring}}function toSafeBrandColors(input){if(!input||parseHex(input.primaryColor)===null){return {primaryColor:PLATFORM_BRAND_DEFAULT.primaryColor,secondaryColor:PLATFORM_BRAND_DEFAULT.secondaryColor,colorMode:PLATFORM_BRAND_DEFAULT.colorMode}}const secondaryColor=typeof input.secondaryColor==="string"&&parseHex(input.secondaryColor)!==null?input.secondaryColor:null;const colorMode="auto";return {primaryColor:input.primaryColor,secondaryColor,colorMode}}function deriveBrandTokens(input){const safe=toSafeBrandColors(input);const warnings=[];return {light:deriveMode(safe,"light",warnings),dark:deriveMode(safe,"dark",warnings),warnings}}function defaultPrefersDark(){if(typeof window==="undefined"||typeof window.matchMedia!=="function"){return false}try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function defaultForcedMode(){if(typeof document==="undefined")return null;const dataTheme=document.documentElement.dataset.theme;return dataTheme==="light"||dataTheme==="dark"?dataTheme:null}function brandColorsFrom(primaryColor){return {primaryColor,secondaryColor:PLATFORM_BRAND_DEFAULT.secondaryColor,colorMode:"auto"}}function resolveCaptureTheme(ctxTheme,opts={}){const prefersDark=opts.prefersDark??defaultPrefersDark;const forcedMode=opts.forcedMode??defaultForcedMode;const colorMode=forcedMode()??(prefersDark()?"dark":"light");const primaryColor=ctxTheme?.primaryColor;if(typeof primaryColor!=="string"||primaryColor.length===0){return {colorMode,brandTokens:null}}const brandTokens=deriveBrandTokens(brandColorsFrom(primaryColor))[colorMode];return {colorMode,brandTokens}}var MAX_REMINTS=3;function isRecord(v){return typeof v==="object"&&v!==null}function asMode(value){return value==="live"||value==="test"?value:null}function asTestHint(value){return value==="pass"||value==="review"||value==="fail"?value:null}function parseMintBody(body){if(!isRecord(body)||!isRecord(body.data))return null;const d=body.data;const captureToken=d.capture_token;const embedOrigin=d.embed_origin;const runIndex=d.run_index;const embedContextToken=d.embed_context_token;if(typeof captureToken!=="string"||captureToken.length===0)return null;if(!isCanonicalOrigin(embedOrigin))return null;if(typeof runIndex!=="number"||!Number.isInteger(runIndex)||runIndex<0)return null;if(typeof embedContextToken!=="string"||embedContextToken.length===0)return null;const mode=asMode(d.mode);const testHint=asTestHint(d.test_hint);return {captureToken,embedOrigin,runIndex,embedContextToken,...mode!==null?{mode}:{},...testHint!==null?{testHint}:{}}}function createIdvTransport(ctx,opts){const fetchImpl=opts.fetchImpl??fetch;const origin=ctx.apiBaseOrigin;let embedContextToken=null;let mintMode;let mintTestHint;let remintCount=0;async function mintToken(){const res=await withTokenRetry(ctx.tokens,token=>fetchImpl(origin+CAPTURE_TOKEN_MINT_PATH,{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify({stepId:opts.stepId})}),result=>result?.status===401);if(!res.ok){throw createChecktivError(mapHttpStatusToError(res.status))}let body;try{body=await res.json();}catch{opts.onError?.(createChecktivErrorEvent("sdk_load_failed"));throw createChecktivError("sdk_load_failed")}const parsed=parseMintBody(body);if(parsed===null){opts.onError?.(createChecktivErrorEvent("sdk_load_failed"));throw createChecktivError("sdk_load_failed")}embedContextToken=parsed.embedContextToken;mintMode=parsed.mode;mintTestHint=parsed.testHint;return {captureToken:parsed.captureToken,embedOrigin:parsed.embedOrigin,runIndex:parsed.runIndex}}function getEmbedSrc(embedOrigin){if(embedContextToken===null){opts.onError?.(createChecktivErrorEvent("sdk_load_failed"));throw createChecktivError("sdk_load_failed")}return `${embedOrigin}/idv/capture?ctx=${encodeURIComponent(embedContextToken)}`}async function submit(runIndex,r2Keys){let res;try{res=await withTokenRetry(ctx.tokens,token=>fetchImpl(origin+stepSubmitPath(opts.sessionId,opts.stepId??""),{method:"POST",headers:dataPlaneHeaders(ctx,token,{withJsonBody:true}),body:JSON.stringify({runIndex,r2Keys})}),result=>result?.status===401);}catch{return {ok:false,reason:"failed"}}if(res.ok)return {ok:true};if(res.status===401)return {ok:false,reason:"token_expired"};if(res.status===503&&res.headers.has("Retry-After")){return {ok:false,reason:"signal_pending"}}return {ok:false,reason:"failed"}}function initPayload(){return {config:opts.config(),locale:ctx.locale,theme:resolveCaptureTheme(ctx.theme),protocolVersion:CURRENT_PROTOCOL_VERSION,...mintMode!==void 0?{mode:mintMode}:{},...mintTestHint!==void 0?{testHint:mintTestHint}:{},...ctx.selfiePromptMap!==void 0?{selfiePromptMap:ctx.selfiePromptMap}:{}}}async function remint(){if(remintCount>=MAX_REMINTS){opts.onError?.(createChecktivErrorEvent("session_expired"));return null}remintCount+=1;try{return await mintToken()}catch{return null}}function failProtocolMismatch(){opts.onError?.(createChecktivErrorEvent("protocol_mismatch"));}return {mintToken,submit,getEmbedSrc,initPayload,remint,failProtocolMismatch}}function after(delayMs,fn){return setTimeout(fn,delayMs)}function createSyntheticIdv(opts,config,sessionId,script){const emit=e=>opts.onEvent?.(e);const delayMs=script?.stepDelayMs??0;const timers=[];let destroyed=false;function step(offsetMs,fn){timers.push(after(offsetMs,()=>{if(!destroyed)fn();}));}step(delayMs*0,()=>{emit({type:"checktiv.idv.ready",config});});if(script?.injectError!==void 0){const code=script.injectError;step(delayMs*1,()=>{emit(createChecktivErrorEvent(code));});}else {step(delayMs*1,()=>{emit({type:"checktiv.idv.phase",phase:"document_front"});});step(delayMs*2,()=>{emit({type:"checktiv.idv.submitted",sessionId});});}const destroy=()=>{if(destroyed)return;destroyed=true;for(const id of timers)clearTimeout(id);};return {destroy,unmount:destroy}}function resolveTarget(target){if(typeof target!=="string")return target;if(typeof document==="undefined")return null;return document.querySelector(target)}function toCaptureConfig(config){return {documentTypes:config.documentTypes,biometricMode:config.biometricMode,requireMrzMatch:false,requireExpiryValid:false,requireNameMatch:false,documentAuthenticity:false,...config.minAge!==void 0?{minAge:config.minAge}:{}}}var REMINT_READY_TIMEOUT_MS=15e3;function noopHandle(){return {destroy(){},unmount(){}}}function createIdv(ctx,opts){const element=resolveTarget(opts.target);if(element===null){console.warn('[Checktiv] mount("idv"): no target element found. Pass an element or a selector that resolves.');return noopHandle()}const emit=e=>opts.onEvent?.(e);const fetchImpl=opts.fetchImpl??fetch;let teardown=null;let cancelled=false;void(async()=>{try{await setupCapture(element);}catch(err){if(cancelled)return;console.warn('[Checktiv] mount("idv") setup failed.',err);emit(createChecktivErrorEvent("sdk_load_failed"));}})();async function setupCapture(element2){const session=await resolveSession(ctx,fetchImpl);if(cancelled)return;if(session===null){emit(createChecktivErrorEvent("session_expired"));return}const idvConfig=session.config;if(idvConfig===null){emit(createChecktivErrorEvent("session_expired"));return}const readyConfig={documentTypes:idvConfig.documentTypes,biometricMode:idvConfig.biometricMode};if(ctx.mode==="test"&&opts.synthetic!==void 0){const synthHandle=createSyntheticIdv(opts,readyConfig,session.sessionId,opts.synthetic);teardown=()=>synthHandle.destroy();return}const captureConfig=toCaptureConfig(idvConfig);const transport=createIdvTransport(ctx,{fetchImpl,sessionId:session.sessionId,stepId:session.stepId,config:()=>captureConfig,onError:emit});let pinnedOrigin=null;let everReady=false;const onState=state=>{if(state.kind==="ready"){pinnedOrigin=state.embedOrigin;everReady=true;}if(state.kind==="capture_error"&&state.errorKind==="protocol_mismatch"){transport.failProtocolMismatch();return}const event=mapStateToEvent(state,{config:readyConfig,sessionId:session.sessionId});if(event!==null)emit(event);};const onControllerEvent=event=>{if(event.type==="all-complete"){emit({type:"checktiv.idv.submitted",sessionId:session.sessionId});}};const handle=mount(element2,{mintToken:transport.mintToken,submit:transport.submit,getEmbedSrc:transport.getEmbedSrc,initPayload:transport.initPayload,copy:opts.copy??{},onBeforeSubmit:opts.onBeforeSubmit,onBehaviorSegment:opts.onBehaviorSegment,onState,onControllerEvent});let reminting=false;let awaitingRemintReady=false;let remintReadyTimeoutHandle=null;const clearRemintReadyTimeout=()=>{if(remintReadyTimeoutHandle!==null){clearTimeout(remintReadyTimeoutHandle);remintReadyTimeoutHandle=null;}};const armRemintReadyTimeout=()=>{clearRemintReadyTimeout();remintReadyTimeoutHandle=setTimeout(()=>{remintReadyTimeoutHandle=null;if(!awaitingRemintReady)return;if(cancelled)return;void(async()=>{const minted=await transport.remint();if(cancelled||minted===null){awaitingRemintReady=false;reminting=false;return}if(!awaitingRemintReady){reminting=false;return}const frame=element2.querySelector("iframe.idv-capture-frame");if(frame===null){awaitingRemintReady=false;reminting=false;return}armRemintReadyTimeout();frame.src=transport.getEmbedSrc(minted.embedOrigin);})();},REMINT_READY_TIMEOUT_MS);};const isCaptureReady=data=>typeof data==="object"&&data!==null&&"type"in data&&data.type==="capture:ready";const onReloadMessage=mev=>{if(pinnedOrigin===null||mev.origin!==pinnedOrigin)return;if(!everReady)return;if(!isCaptureReady(mev.data))return;const pinnedFrame=element2.querySelector("iframe.idv-capture-frame");if(pinnedFrame===null)return;if(mev.source!==null&&mev.source!==pinnedFrame.contentWindow)return;if(reminting){if(awaitingRemintReady){clearRemintReadyTimeout();awaitingRemintReady=false;reminting=false;}return}reminting=true;void(async()=>{const minted=await transport.remint();if(cancelled||minted===null){reminting=false;return}const frame=element2.querySelector("iframe.idv-capture-frame");if(frame===null){reminting=false;return}awaitingRemintReady=true;armRemintReadyTimeout();frame.src=transport.getEmbedSrc(minted.embedOrigin);})();};if(typeof window!=="undefined"){window.addEventListener("message",onReloadMessage);}teardown=()=>{clearRemintReadyTimeout();if(typeof window!=="undefined"){window.removeEventListener("message",onReloadMessage);}handle.destroy();};}const destroy=()=>{cancelled=true;if(teardown!==null){teardown();teardown=null;}};return {destroy,unmount:destroy}}registerModule("idv",createIdv);
|
|
12
|
+
|
|
13
|
+
export { REMINT_READY_TIMEOUT_MS, createIdv };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
interface CrossDeviceCopy {
|
|
2
|
+
readonly desktopPrompt?: string;
|
|
3
|
+
readonly desktopSubtext?: string;
|
|
4
|
+
readonly waitingLabel?: string;
|
|
5
|
+
readonly copyLinkLabel?: string;
|
|
6
|
+
readonly linkCopiedLabel?: string;
|
|
7
|
+
readonly backLabel?: string;
|
|
8
|
+
readonly refreshLinkLabel?: string;
|
|
9
|
+
readonly qrAlt?: string;
|
|
10
|
+
readonly mobilePrompt?: string;
|
|
11
|
+
readonly mobileOpenBrowserHint?: string;
|
|
12
|
+
readonly mobileCopyLinkLabel?: string;
|
|
13
|
+
readonly mobileLinkCopiedLabel?: string;
|
|
14
|
+
readonly mobileTryAgainLabel?: string;
|
|
15
|
+
readonly mobileCameraSettingsNote?: string;
|
|
16
|
+
readonly unavailableMessage: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface CrossDevicePanelProps {
|
|
20
|
+
url: string;
|
|
21
|
+
copy: CrossDeviceCopy;
|
|
22
|
+
isMobile: boolean;
|
|
23
|
+
completing?: boolean;
|
|
24
|
+
onBack?: () => void;
|
|
25
|
+
onRefreshLink?: () => void;
|
|
26
|
+
onRetry?: () => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface CrossDeviceHandle {
|
|
30
|
+
update(next: CrossDevicePanelProps): void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
declare function mountCrossDevice(target: HTMLElement, props: CrossDevicePanelProps): CrossDeviceHandle;
|
|
34
|
+
|
|
35
|
+
type ___cross_device_index_js_CrossDeviceCopy = CrossDeviceCopy;
|
|
36
|
+
type ___cross_device_index_js_CrossDeviceHandle = CrossDeviceHandle;
|
|
37
|
+
type ___cross_device_index_js_CrossDevicePanelProps = CrossDevicePanelProps;
|
|
38
|
+
declare const ___cross_device_index_js_mountCrossDevice: typeof mountCrossDevice;
|
|
39
|
+
declare namespace ___cross_device_index_js {
|
|
40
|
+
export { type ___cross_device_index_js_CrossDeviceCopy as CrossDeviceCopy, type ___cross_device_index_js_CrossDeviceHandle as CrossDeviceHandle, type ___cross_device_index_js_CrossDevicePanelProps as CrossDevicePanelProps, ___cross_device_index_js_mountCrossDevice as mountCrossDevice };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { type CrossDeviceCopy as C, ___cross_device_index_js as _, type CrossDeviceHandle as a, type CrossDevicePanelProps as b, mountCrossDevice as m };
|