Bug/template and sandbox (#589)
* Enhance booking template functionality and add sandbox extraction checks * Implement Recapt integration for feedback submission and user identification * Add Recapt identification component and bank sync status chip; update crontab entries * Update .gitignore to ignore the entire scripts directory * Refactor Recapt integration: add loader component, update privacy policy, and enhance bank sync status messages * Fix .gitignore to correctly ignore the scripts directory
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export function RecaptIdentify({
|
||||
userId,
|
||||
email,
|
||||
displayName,
|
||||
}: {
|
||||
userId: string
|
||||
email?: string
|
||||
displayName?: string
|
||||
}) {
|
||||
useEffect(() => {
|
||||
let attempts = 0
|
||||
const maxAttempts = 50
|
||||
const interval = setInterval(() => {
|
||||
if (typeof window.recapt === 'function') {
|
||||
window.recapt('identify', {
|
||||
uid: userId,
|
||||
email,
|
||||
nickname: displayName,
|
||||
})
|
||||
clearInterval(interval)
|
||||
return
|
||||
}
|
||||
attempts++
|
||||
if (attempts >= maxAttempts) {
|
||||
clearInterval(interval)
|
||||
}
|
||||
}, 100)
|
||||
|
||||
return () => clearInterval(interval)
|
||||
}, [userId, email, displayName])
|
||||
|
||||
return null
|
||||
}
|
||||
Reference in New Issue
Block a user