-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-v1.0.8' into update/console
- Loading branch information
Showing
8 changed files
with
123 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
declare global { | ||
interface Window { | ||
grecaptcha: { | ||
enterprise: { | ||
ready: (callback: () => Promise<void>) => void; | ||
execute: ( | ||
sitekey: string, | ||
action: { | ||
action: string; | ||
}, | ||
) => Promise<string>; | ||
}; | ||
}; | ||
} | ||
} | ||
|
||
export const onReady = (callback: () => Promise<void>) => { | ||
if ( | ||
!window.grecaptcha || | ||
!window.grecaptcha.enterprise || | ||
!window.grecaptcha.enterprise.ready | ||
) { | ||
console.warn('window.grecaptcha.enterprise.ready is not defined.'); | ||
return; | ||
} | ||
const ready = window.grecaptcha.enterprise.ready; | ||
ready(callback); | ||
}; | ||
|
||
export const execute = async ( | ||
sitekey: string, | ||
action: { | ||
action: string; | ||
}, | ||
) => { | ||
if ( | ||
!window.grecaptcha || | ||
!window.grecaptcha.enterprise || | ||
!window.grecaptcha.enterprise.ready | ||
) { | ||
console.warn('window.grecaptcha.enterprises.ready is not defined.'); | ||
return; | ||
} | ||
const exec = window.grecaptcha.enterprise.execute; | ||
return exec(sitekey, action); | ||
}; | ||
|
||
const grecaptcha = { | ||
onReady, | ||
execute, | ||
}; | ||
|
||
export default grecaptcha; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const mainUrl = 'https://kloudlite.io'; | ||
export const RECAPTCHA_SITE_KEY = '6LcxXUIqAAAAABtRW-S7Bov6z9PgUHhbNWjTLhND'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters