@descope/flow-scripts 1.0.2 → 1.0.4
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/dist/fingerprint.js +1 -1
- package/dist/fingerprintDescope.js +2 -2
- package/dist/forter.js +1 -1
- package/dist/grecaptcha.js +2 -2
- package/package.json +1 -1
- package/rollup.config.mjs +15 -12
package/dist/fingerprint.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.fingerprint=
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.fingerprint={}))}(this,(function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};function t(e,n,t,r){return new(t||(t=Promise))((function(o,i){function u(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(u,c)}a((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var r={default:"endpoint"},o="Blocked by CSP",i="The endpoint parameter is not a valid URL",u="Failed to load the JS script of the agent",c="9319";function a(e,n){var t,r,a,f,l,s=[],p=(t=function(e){var n=function(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}([],e,!0);return{current:function(){return n[0]},postpone:function(){var e=n.shift();void 0!==e&&n.push(e)},exclude:function(){n.shift()}}}(e),f=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,f++))},a=new Set,[t.current(),function(e,n){var f,l=n instanceof Error?n.message:"";if(l===o||l===i)t.exclude(),f=0;else if(l===c)t.exclude();else if(l===u){var s=Date.now()-e.getTime()<50,p=t.current();p&&s&&!a.has(p)&&(a.add(p),f=0),t.postpone()}else t.postpone();var d=t.current();return void 0===d?void 0:[d,null!=f?f:e.getTime()+r()-Date.now()]}]),d=p[0],v=p[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var h=function(e){var t=new Date,r=function(n){return s.push({url:e,startedAt:t,finishedAt:new Date,error:n})},o=n(e);return o.then((function(){return r()}),r),o.catch((function(e){if(null!=l||(l=e),s.length>=5)throw l;var n=v(t,e);if(!n)throw l;var r,o=n[0],i=n[1];return(r=i,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return h(o)}))}))};return h(d).then((function(e){return[e,s]}))}var f="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",l=f;function s(e){var t;e.scriptUrlPattern;var r=e.token,o=e.apiKey,i=void 0===o?r:o,l=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,n){return function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}(e,n)?e[n]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:f,d=function(){var e=[],n=function(){e.push({time:new Date,state:document.visibilityState})},t=function(e,n,t,r){return e.addEventListener(n,t,r),function(){return e.removeEventListener(n,t,r)}}(document,"visibilitychange",n);return n(),[e,t]}(),v=d[0],h=d[1];return Promise.resolve().then((function(){if(!i||"string"!=typeof i)throw new Error("API key required");return a(function(e,n){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,n){var t=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?t(n):"<loaderVersion>"===e?t("3.11.8"):e}))}(String(e),n)}))}(s,i),p)})).catch((function(e){throw h(),function(e){return e instanceof Error&&e.message===c?new Error(u):e}(e)})).then((function(e){var t=e[0],r=e[1];return h(),t.load(n(n({},l),{ldi:{attempts:r,visibilityStates:v}}))}))}function p(e){return function(e,n,t){var r,o=document,i="securitypolicyviolation",u=function(n){var t=new URL(e,location.href),o=n.blockedURI;o!==t.href&&o!==t.protocol.slice(0,-1)&&o!==t.origin||(r=n,c())};o.addEventListener(i,u);var c=function(){return o.removeEventListener(i,u)};return Promise.resolve().then(n).then((function(e){return c(),e}),(function(e){return new Promise((function(e){var n=new MessageChannel;n.port1.onmessage=function(){return e()},n.port2.postMessage(null)})).then((function(){if(c(),r)return t(r);throw e}))}))}(e,(function(){return function(e){return new Promise((function(n,t){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(i);var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},c=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),n()},r.onerror=function(){o(),t(new Error(u))},r.async=!0,r.src=e,c.appendChild(r)}))}(e)}),(function(){throw new Error(o)})).then(d)}function d(){var e=window,n="__fpjs_p_l_b",t=e[n];if(function(e,n){var t,r=null===(t=Object.getOwnPropertyDescriptor)||void 0===t?void 0:t.call(Object,e,n);(null==r?void 0:r.configurable)?delete e[n]:r&&!r.writable||(e[n]=void 0)}(e,n),"function"!=typeof(null==t?void 0:t.load))throw new Error(c);return t}
|
|
2
2
|
/*! Source: (c) FingerprintJS and other contributors | https://dev.fingerprint.com/ */const v=(e,n,o)=>t(void 0,void 0,void 0,(function*(){try{const{publicApiKey:n,useCloudflareIntegration:t,cloudflareScriptUrl:i,cloudflareEndpointUrl:u}=e;let c=[];c=t&&u?[u,r]:[r];let a=[];if(t&&i){const e=new URL(i);a=[`${e.toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,l]}else a=[l];const f=s({apiKey:n,endpoint:c,scriptUrlPattern:a}),p=yield f,{requestId:d}=yield p.get();o(d)}catch(e){console.warn("Could not load fingerprint",e)}}));e.default=v,e.loadFingerprint=v,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.fingerprintDescope=
|
|
2
|
-
/*! Source: (c) FingerprintJS and other contributors | https://dev.fingerprint.com/ */const v=(e,n,o)=>t(void 0,void 0,void 0,(function*(){try{const{customDomain:t,publicApiKey:i,cloudflareEndpointPath:c,cloudflareScriptPath:u}=e,{baseUrl:a}=n;let
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.fingerprintDescope={}))}(this,(function(e){"use strict";var n=function(){return n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};function t(e,n,t,r){return new(t||(t=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function u(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(c,u)}a((r=r.apply(e,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var r={default:"endpoint"},o="Blocked by CSP",i="The endpoint parameter is not a valid URL",c="Failed to load the JS script of the agent",u="9319";function a(e,n){var t,r,a,f,s,l=[],p=(t=function(e){var n=function(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}([],e,!0);return{current:function(){return n[0]},postpone:function(){var e=n.shift();void 0!==e&&n.push(e)},exclude:function(){n.shift()}}}(e),f=0,r=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,f++))},a=new Set,[t.current(),function(e,n){var f,s=n instanceof Error?n.message:"";if(s===o||s===i)t.exclude(),f=0;else if(s===u)t.exclude();else if(s===c){var l=Date.now()-e.getTime()<50,p=t.current();p&&l&&!a.has(p)&&(a.add(p),f=0),t.postpone()}else t.postpone();var d=t.current();return void 0===d?void 0:[d,null!=f?f:e.getTime()+r()-Date.now()]}]),d=p[0],v=p[1];if(void 0===d)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var h=function(e){var t=new Date,r=function(n){return l.push({url:e,startedAt:t,finishedAt:new Date,error:n})},o=n(e);return o.then((function(){return r()}),r),o.catch((function(e){if(null!=s||(s=e),l.length>=5)throw s;var n=v(t,e);if(!n)throw s;var r,o=n[0],i=n[1];return(r=i,new Promise((function(e){return setTimeout(e,r)}))).then((function(){return h(o)}))}))};return h(d).then((function(e){return[e,l]}))}var f="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",s=f;function l(e){var t;e.scriptUrlPattern;var r=e.token,o=e.apiKey,i=void 0===o?r:o,s=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["scriptUrlPattern","token","apiKey"]),l=null!==(t=function(e,n){return function(e,n){return Object.prototype.hasOwnProperty.call(e,n)}(e,n)?e[n]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:f,d=function(){var e=[],n=function(){e.push({time:new Date,state:document.visibilityState})},t=function(e,n,t,r){return e.addEventListener(n,t,r),function(){return e.removeEventListener(n,t,r)}}(document,"visibilitychange",n);return n(),[e,t]}(),v=d[0],h=d[1];return Promise.resolve().then((function(){if(!i||"string"!=typeof i)throw new Error("API key required");return a(function(e,n){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,n){var t=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?t(n):"<loaderVersion>"===e?t("3.11.8"):e}))}(String(e),n)}))}(l,i),p)})).catch((function(e){throw h(),function(e){return e instanceof Error&&e.message===u?new Error(c):e}(e)})).then((function(e){var t=e[0],r=e[1];return h(),t.load(n(n({},s),{ldi:{attempts:r,visibilityStates:v}}))}))}function p(e){return function(e,n,t){var r,o=document,i="securitypolicyviolation",c=function(n){var t=new URL(e,location.href),o=n.blockedURI;o!==t.href&&o!==t.protocol.slice(0,-1)&&o!==t.origin||(r=n,u())};o.addEventListener(i,c);var u=function(){return o.removeEventListener(i,c)};return Promise.resolve().then(n).then((function(e){return u(),e}),(function(e){return new Promise((function(e){var n=new MessageChannel;n.port1.onmessage=function(){return e()},n.port2.postMessage(null)})).then((function(){if(u(),r)return t(r);throw e}))}))}(e,(function(){return function(e){return new Promise((function(n,t){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(i);var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},u=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),n()},r.onerror=function(){o(),t(new Error(c))},r.async=!0,r.src=e,u.appendChild(r)}))}(e)}),(function(){throw new Error(o)})).then(d)}function d(){var e=window,n="__fpjs_p_l_b",t=e[n];if(function(e,n){var t,r=null===(t=Object.getOwnPropertyDescriptor)||void 0===t?void 0:t.call(Object,e,n);(null==r?void 0:r.configurable)?delete e[n]:r&&!r.writable||(e[n]=void 0)}(e,n),"function"!=typeof(null==t?void 0:t.load))throw new Error(u);return t}
|
|
2
|
+
/*! Source: (c) FingerprintJS and other contributors | https://dev.fingerprint.com/ */const v=(e,n,o)=>t(void 0,void 0,void 0,(function*(){try{const{customDomain:t,publicApiKey:i,cloudflareEndpointPath:c,cloudflareScriptPath:u}=e,{baseUrl:a}=n;let f;f=t?`https://${t}`:a||"https://api.descope.com";const p=new URL(f);p.pathname=c;const d=new URL(f);d.pathname=u;const v=`${d.toString()}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,h=l({apiKey:i,endpoint:[p.toString(),r],scriptUrlPattern:[v,s]}),y=yield h,{requestId:m}=yield y.get();o(m)}catch(e){console.warn("Could not load descope fingerprint",e)}}));e.default=v,e.loadFingerprint=v,Object.defineProperty(e,"__esModule",{value:!0})}));
|
package/dist/forter.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((t="undefined"!=typeof globalThis?globalThis:t||self).descope=t.descope||{},t.descope.forter=
|
|
1
|
+
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((t="undefined"!=typeof globalThis?globalThis:t||self).descope=t.descope||{},t.descope.forter=n())}(this,(function(){"use strict";function t(t,n,e,r){return new(e||(e=Promise))((function(o,i){function c(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(c,a)}u((r=r.apply(t,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/*! Source: (c) forter and other contributors | https://www.forter.com */
|
|
3
3
|
const n='\n(function () {\nvar merchantConfig = {\n csp: false\n};\n\nvar siteId = "{{SITE_ID}}";\nfunction t(t,n){for(var e=t.split(""),r=0;r<e.length;++r)e[r]=String.fromCharCode(e[r].charCodeAt(0)+n);return e.join("")}function n(n){return t(n,-L).replace(/%SN%/g,siteId)}function e(){var t="no"+"op"+"fn",n="g"+"a",e="n"+"ame";return window[n]&&window[n][e]===t}function r(){return!(!navigator.brave||"function"!=typeof navigator.brave.isBrave)}function o(){return document.currentScript&&document.currentScript.src}function i(t){try{if("number"==typeof t&&window.location&&window.location.pathname){for(var n=window.location.pathname.split("/"),e=[],r=0;r<=Math.min(n.length-1,Math.abs(t));r++)e.push(n[r]);return e.join("/")||"/"}}catch(t){}return"/"}function c(t){try{G.ex=t,e()&&-1===G.ex.indexOf(B.uB)&&(G.ex+=B.uB),r()&&-1===G.ex.indexOf(B.uBr)&&(G.ex+=B.uBr),o()&&-1===G.ex.indexOf(B.nIL)&&(G.ex+=B.nIL),window.ftr__snp_cwc||(G.ex+=B.s),M(G)}catch(t){}}function a(t,n){function e(o){try{o.blockedURI===t&&(n(),document.removeEventListener(r,e))}catch(t){document.removeEventListener(r,e)}}var r="securitypolicyviolation";document.addEventListener(r,e),setTimeout(function(){document.removeEventListener(r,e)},2*60*1e3)}function u(t,n,e,r){var o=!1;t="https://"+t,a(t,function(){r(!0),o=!0});var i=document.createElement("script");i.onerror=function(){if(!o)try{r(!1),o=!0}catch(t){}},i.onload=e,i.type="text/javascript",i.id="ftr__script",i.async=!0,i.src=t;var c=document.getElementsByTagName("script")[0];c.parentNode.insertBefore(i,c)}function f(){J(B.uDF),setTimeout(h,I,B.uDF)}function d(t,n,e,r){var o=!1,i=new XMLHttpRequest;if(a("https:"+t,function(){e(new Error("CSP Violation"),!0),o=!0}),"//"===t.slice(0,2)&&(t="https:"+t),"withCredentials"in i)i.open("GET",t,!0);else{if("undefined"==typeof XDomainRequest)return;i=new XDomainRequest,i.open("GET",t)}Object.keys(r).forEach(function(t){i.setRequestHeader(t,r[t])}),i.onload=function(){"function"==typeof n&&n(i)},i.onerror=function(t){if("function"==typeof e&&!o)try{e(t,!1),o=!0}catch(t){}},i.onprogress=function(){},i.ontimeout=function(){"function"==typeof e&&e("tim"+"eo"+"ut",!1)},setTimeout(function(){i.send()},0)}function s(t,siteId,n){function e(t){var n=t.toString(16);return n.length%2?"0"+n:n}function r(t){if(t<=0)return"";for(var n="0123456789abcdef",e="",r=0;r<t;r++)e+=n[Math.floor(Math.random()*n.length)];return e}function o(t){for(var n="",r=0;r<t.length;r++)n+=e(t.charCodeAt(r));return n}function i(t){for(var n=t.split(""),e=0;e<n.length;++e)n[e]=String.fromCharCode(255^n[e].charCodeAt(0));return n.join("")}n=n?"1":"0";var c=[];return c.push(t),c.push(siteId),c.push(n),function(t){var n=40,e="";return t.length<n/2&&(e=","+r(n/2-t.length-1)),o(i(t+e))}(c.join(","))}function w(){function t(){D&&(J(B.dUAL),setTimeout(h,I,B.dUAL))}function n(t,n){c(n?B.uAS+B.uF+B.cP:B.uAS+B.uF)}window.ftr__fdad(t,n)}function h(t){try{var n;switch(t){case B.uFP:n=q;break;case B.uDF:n=E;break;default:n=D}if(!n)return;u(n,void 0,function(){try{K(),c(t+B.uS)}catch(t){}},function(n){try{K(),G.td=1*new Date-G.ts,c(n?t+B.uF+B.cP:t+B.uF),t===B.uFP&&f(),t===B.uDF&&w()}catch(t){c(B.eUoe)}})}catch(n){c(t+B.eTlu)}}var m="22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv",v="fort",l="erTo",p="ken";window.ftr__config={m:merchantConfig,s:"23",si:siteId};var g=!1,_=v+l+p,y=400*24*60,T=10,k={write:function(t,n,e,r){void 0===r&&(r=!0);var o=0;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.ckDepth&&(o=window.ftr__config.m.ckDepth);var c,a,u=i(o);if(e?(c=new Date,c.setTime(c.getTime()+60*e*1e3),a="; expires="+c.toGMTString()):a="",!r)return void(document.cookie=escape(t)+"="+escape(n)+a+"; path="+u);for(var f=1,d=document.domain.split("."),s=T,w=!0;w&&d.length>=f&&s>0;){var h=d.slice(-f).join(".");document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h;var m=k.read(t);null!=m&&m==n||(h="."+h,document.cookie=escape(t)+"="+escape(n)+a+"; path="+u+"; domain="+h),w=-1===document.cookie.indexOf(t+"="+n),f++,s--}},read:function(t){var n=null;try{for(var e=escape(t)+"=",r=document.cookie.split(";"),o=32,i=0;i<r.length;i++){for(var c=r[i];c.charCodeAt(0)===o;)c=c.substring(1,c.length);0===c.indexOf(e)&&(n=unescape(c.substring(e.length,c.length)))}}finally{return n}}},S=window.ftr__config.s;S+="ck";var x=function(t){var n=!1,e=null,r=function(){try{if(!e||!n)return;e.remove&&"function"==typeof e.remove?e.remove():document.head.removeChild(e),n=!1}catch(t){}};document.head&&(!function(){e=document.createElement("link"),e.setAttribute("rel","pre"+"con"+"nect"),e.setAttribute("cros"+"sori"+"gin","anonymous"),e.onload=r,e.onerror=r,e.setAttribute("href",t),document.head.appendChild(e),n=!0}(),setTimeout(r,3e3))},L=3,A=n(m||"22ge:t7mj8unkn;1forxgiurqw1qhw2vwdwxv"),F=t("[0Uhtxhvw0LG",-L),U=t("[0Fruuhodwlrq0LG",-L),b=t("Li0Qrqh0Pdwfk",-L),D,C="fgq71iruwhu1frp",E=n("(VQ(1"+C+"2vq2(VQ(2vfulsw1mv"),V=n("(VQ(1"+C+"2vqV2(VQ(2vfulsw1mv"),q;window.ftr__config&&window.ftr__config.m&&window.ftr__config.m.fpi&&(q=window.ftr__config.m.fpi+n("2vq2(VQ(2vfulsw1mv"));var I=10;window.ftr__startScriptLoad=1*new Date;var R=function(t){var n="ft"+"r:tok"+"enR"+"eady";window.ftr__tt&&clearTimeout(window.ftr__tt),window.ftr__tt=setTimeout(function(){try{delete window.ftr__tt,t+="_tt";var e=document.createEvent("Event");e.initEvent(n,!1,!1),e.detail=t,document.dispatchEvent(e)}catch(t){}},1e3)},M=function(t){var n=function(t){return t||""},e=n(t.id)+"_"+n(t.ts)+"_"+n(t.td)+"_"+n(t.ex)+"_"+n(S),r=y;!isNaN(window.ftr__config.m.ckTTL)&&window.ftr__config.m.ckTTL&&(r=window.ftr__config.m.ckTTL),k.write(_,e,r,!0),R(e),window.ftr__gt=e},P=function(){var t=k.read(_)||"",n=t.split("_"),e=function(t){return n[t]||void 0};return{id:e(0),ts:e(1),td:e(2),ex:e(3),vr:e(4)}},j=function(){for(var t={},n="fgu",e=[],r=0;r<256;r++)e[r]=(r<16?"0":"")+r.toString(16);var o=function(t,n,r,o,i){var c=i?"-":"";return e[255&t]+e[t>>8&255]+e[t>>16&255]+e[t>>24&255]+c+e[255&n]+e[n>>8&255]+c+e[n>>16&15|64]+e[n>>24&255]+c+e[63&r|128]+e[r>>8&255]+c+e[r>>16&255]+e[r>>24&255]+e[255&o]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255]},i=function(){if(window.Uint32Array&&window.crypto&&window.crypto.getRandomValues){var t=new window.Uint32Array(4);return window.crypto.getRandomValues(t),{d0:t[0],d1:t[1],d2:t[2],d3:t[3]}}return{d0:4294967296*Math.random()>>>0,d1:4294967296*Math.random()>>>0,d2:4294967296*Math.random()>>>0,d3:4294967296*Math.random()>>>0}},c=function(){var t="",n=function(t,n){for(var e="",r=t;r>0;--r)e+=n.charAt(1e3*Math.random()%n.length);return e};return t+=n(2,"0123456789"),t+=n(1,"123456789"),t+=n(8,"0123456789")};return t.safeGenerateNoDash=function(){try{var t=i();return o(t.d0,t.d1,t.d2,t.d3,!1)}catch(t){try{return n+c()}catch(t){}}},t.isValidNumericalToken=function(t){return t&&t.toString().length<=11&&t.length>=9&&parseInt(t,10).toString().length<=11&&parseInt(t,10).toString().length>=9},t.isValidUUIDToken=function(t){return t&&32===t.toString().length&&/^[a-z0-9]+$/.test(t)},t.isValidFGUToken=function(t){return 0==t.indexOf(n)&&t.length>=12},t}(),B={uDF:"UDF",dUAL:"dUAL",uAS:"UAS",uFP:"UFP",mLd:"1",eTlu:"2",eUoe:"3",uS:"4",uF:"9",tmos:["T5","T10","T15","T30","T60"],tmosSecs:[5,10,15,30,60],bIR:"43",uB:"u",uBr:"b",cP:"c",nIL:"i",s:"s"};try{var G=P();try{G.id&&(j.isValidNumericalToken(G.id)||j.isValidUUIDToken(G.id)||j.isValidFGUToken(G.id))?window.ftr__ncd=!1:(G.id=j.safeGenerateNoDash(),window.ftr__ncd=!0),G.ts=window.ftr__startScriptLoad,M(G),window.ftr__snp_cwc=!!k.read(_),window.ftr__snp_cwc||(E=V);for(var N="for"+"ter"+".co"+"m",O="ht"+"tps://c"+"dn9."+N,Q="ht"+"tps://"+G.id+"-"+siteId+".cd"+"n."+N,H="http"+"s://cd"+"n3."+N,X=[O,Q,H],z=0;z<X.length;z++)x(X[z]);var $=new Array(B.tmosSecs.length),J=function(t){for(var n=0;n<B.tmosSecs.length;n++)$[n]=setTimeout(c,1e3*B.tmosSecs[n],t+B.tmos[n])},K=function(){for(var t=0;t<B.tmosSecs.length;t++)clearTimeout($[t])};window.ftr__fdad=function(n,e){if(!g){g=!0;var r={};r[b]=s(window.ftr__config.s,siteId,window.ftr__config.m.csp),d(A,function(e){try{var r=e.getAllResponseHeaders().toLowerCase();if(r.indexOf(U.toLowerCase())>=0){var o=e.getResponseHeader(U);window.ftr__altd2=t(atob(o),-L-1)}if(r.indexOf(F.toLowerCase())<0)return;var i=e.getResponseHeader(F),c=t(atob(i),-L-1);if(c){var a=c.split(":");if(a&&2===a.length){for(var u=a[0],f=a[1],d="",s=0,w=0;s<20;++s)d+=s%3>0&&w<12?siteId.charAt(w++):G.id.charAt(s);var h=f.split(",");if(h.length>1){var m=h[0],v=h[1];D=u+"/"+m+"."+d+"."+v}}}n()}catch(t){}},function(t,n){e&&e(t,n)},r)}};var W=q?B.uFP:B.uDF;J(W),setTimeout(h,I,W)}catch(t){c(B.mLd)}}catch(t){}})();\n';return(e,r,o)=>t(void 0,void 0,void 0,(function*(){const{siteId:t}=e,r=n.replace(/{{SITE_ID}}/g,t),i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("id",t),i.text=r,document.body.appendChild(i),document.addEventListener("ftr:tokenReady",(t=>{o(t.detail)}))}))}));
|
package/dist/grecaptcha.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.grecaptcha=
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e="undefined"!=typeof globalThis?globalThis:e||self).descope=e.descope||{},e.descope.grecaptcha=t())}(this,(function(){"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(r,c){function i(e){try{s(o.next(e))}catch(e){c(e)}}function a(e){try{s(o.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,a)}s((o=o.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/*! Source: (c) google and other contributors | https://developers.google.com/recaptcha/docs/v3 */
|
|
3
|
-
const t=105e3;return(n,o,r)=>{let c=(new Date).getTime();const
|
|
3
|
+
const t=105e3;return(n,o,r)=>{let c=(new Date).getTime();const i=()=>{var e;return n.enterprise?null===(e=window.grecaptcha)||void 0===e?void 0:e.enterprise:window.grecaptcha};let a,s;const d=(e,o)=>{e.ready((()=>{n.siteKey&&(null==e||e.execute(s,{action:"load"}).then(((n,o)=>{o?console.warn("could not execute recaptcha",o):(r(n),c=(new Date).getTime(),a=setTimeout((()=>{d(e)}),t))})))}))},p=()=>{clearTimeout(a)},u=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})(),l=()=>{const e=i();e&&d(e)};return window.onRecaptchaLoadCallback=()=>{const e=u;if(e.hasChildNodes())return;const t=i();t&&setTimeout((()=>{s=t.render(e,{sitekey:n.siteKey,badge:"inline",size:"invisible"}),d(t)}),0)},(()=>{const e=document.createElement("script");e.src=(()=>{const e=new URL("https://www.google.com/recaptcha/");return e.pathname+=(n.enterprise?"enterprise":"api")+".js",e.searchParams.append("onload","onRecaptchaLoadCallback"),e.searchParams.append("render","explicit"),e.toString()})(),e.async=!0,e.id="recaptcha-script",e.defer=!0,document.body.appendChild(e)})(),{stop:p,start:l,refresh:()=>e(void 0,void 0,void 0,(function*(){if(Date.now()-c>t){p();const e=c;return l(),new Promise((t=>{const n=setTimeout((()=>{console.warn("reCAPTCHA token refresh timed out"),t()}),5e3),o=()=>{c!==e?(clearTimeout(n),t()):setTimeout(o,150)};o()}))}return Promise.resolve()}))}}}));
|
package/package.json
CHANGED
package/rollup.config.mjs
CHANGED
|
@@ -5,15 +5,18 @@ import commonjs from '@rollup/plugin-commonjs';
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
|
|
7
7
|
const scriptFiles = fs.readdirSync("./src").filter(f => !f.includes('spec'));
|
|
8
|
-
export default scriptFiles.map(name =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
export default scriptFiles.map(name => {
|
|
9
|
+
const nameWithoutExt = name.replace('.ts', '');
|
|
10
|
+
return ({
|
|
11
|
+
input: `src/${name}`,
|
|
12
|
+
output: {
|
|
13
|
+
preserveModules: false,
|
|
14
|
+
dir: 'dist',
|
|
15
|
+
format: 'umd',
|
|
16
|
+
name: `descope.${nameWithoutExt}`,
|
|
17
|
+
inlineDynamicImports: true,
|
|
18
|
+
},
|
|
19
|
+
external: [],
|
|
20
|
+
plugins: [typescript({ sourceMap: true }), nodeResolve(), commonjs({ ignore: ['worker_threads'] }), terser({ format: { comments: 'some' } })]
|
|
21
|
+
});
|
|
22
|
+
});
|