@descope/flow-scripts 1.0.13 → 1.0.14
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/grecaptcha.js +1 -1
- package/package.json +1 -1
- package/src/grecaptcha.ts +2 -1
package/dist/grecaptcha.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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;const t=105e3;return(n,o,r,c)=>{let i=(new Date).getTime();const a=()=>{var e;return n.enterprise?null===(e=window.grecaptcha)||void 0===e?void 0:e.enterprise:window.grecaptcha};let s,d;const p=(e,o)=>{e.ready((()=>{n.siteKey&&(null==e||e.execute(d,{action:"load"}).then(((n,o)=>{o?c.warn("could not execute recaptcha",o):(r(n),i=(new Date).getTime(),s=setTimeout((()=>{p(e)}),t))})))}))},u=()=>{clearTimeout(s)},l=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})(),f=()=>{const e=a();e&&p(e)};return window.onRecaptchaLoadCallback=()=>{const e=l;if(e.hasChildNodes())return;const t=a();t&&setTimeout((()=>{d=t.render(e,{sitekey:n.siteKey,badge:"inline",size:"invisible"}),p(t)}),0)},(()=>{const e=document.createElement("script");e.src=(()=>{const e=new URL(`${n.baseUrl||"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)})(),{id:"grecaptcha",stop:u,start:f,refresh:()=>e(void 0,void 0,void 0,(function*(){if(Date.now()-i>t){u();const e=i;return f(),new Promise((t=>{const n=setTimeout((()=>{c.warn("reCAPTCHA token refresh timed out"),t()}),5e3),o=()=>{i!==e?(clearTimeout(n),t()):setTimeout(o,150)};o()}))}return Promise.resolve()}))}}}));
|
|
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;const t=105e3;return(n,o,r,c)=>{let i=(new Date).getTime();const a=()=>{var e;return n.enterprise?null===(e=window.grecaptcha)||void 0===e?void 0:e.enterprise:window.grecaptcha};let s,d;const p=(e,o)=>{e.ready((()=>{n.siteKey&&(null==e||e.execute(d,{action:n.action||"load"}).then(((n,o)=>{o?c.warn("could not execute recaptcha",o):(r(n),i=(new Date).getTime(),s=setTimeout((()=>{p(e)}),t))})))}))},u=()=>{clearTimeout(s)},l=(()=>{const e=document.createElement("div");return e.style.display="none",e.id="recaptcha",document.body.appendChild(e)})(),f=()=>{const e=a();e&&p(e)};return window.onRecaptchaLoadCallback=()=>{const e=l;if(e.hasChildNodes())return;const t=a();t&&setTimeout((()=>{d=t.render(e,{sitekey:n.siteKey,badge:"inline",size:"invisible"}),p(t)}),0)},(()=>{const e=document.createElement("script");e.src=(()=>{const e=new URL(`${n.baseUrl||"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)})(),{id:"grecaptcha",stop:u,start:f,refresh:()=>e(void 0,void 0,void 0,(function*(){if(Date.now()-i>t){u();const e=i;return f(),new Promise((t=>{const n=setTimeout((()=>{c.warn("reCAPTCHA token refresh timed out"),t()}),5e3),o=()=>{i!==e?(clearTimeout(n),t()):setTimeout(o,150)};o()}))}return Promise.resolve()}))}}}));
|
package/package.json
CHANGED
package/src/grecaptcha.ts
CHANGED
|
@@ -23,6 +23,7 @@ const loadGRecaptcha = (
|
|
|
23
23
|
enterprise: boolean;
|
|
24
24
|
siteKey: string;
|
|
25
25
|
baseUrl?: string;
|
|
26
|
+
action?: string;
|
|
26
27
|
},
|
|
27
28
|
_inputs: { baseUrl?: string },
|
|
28
29
|
onTokenReady: (token: string) => void,
|
|
@@ -59,7 +60,7 @@ const loadGRecaptcha = (
|
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
grecaptchaInstance
|
|
62
|
-
?.execute(recaptchaWidgetId, { action: 'load' })
|
|
63
|
+
?.execute(recaptchaWidgetId, { action: initArgs.action || 'load' })
|
|
63
64
|
.then((token: string, e: any) => {
|
|
64
65
|
if (e) {
|
|
65
66
|
logger.warn('could not execute recaptcha', e);
|