fix: linting cleanup, TS errors, mobile cookie banner and hero max-width
This commit is contained in:
@@ -46,7 +46,7 @@ export const useConsentStore = create<ConsentState>((set) => ({
|
||||
stored = JSON.stringify(newData);
|
||||
localStorage.setItem(CONSENT_KEY, stored);
|
||||
localStorage.removeItem(OLD_CONSENT_KEY);
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Ignore if parse fails
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export const useConsentStore = create<ConsentState>((set) => ({
|
||||
marketing: !!parsed.marketing,
|
||||
advertising: !!parsed.advertising,
|
||||
});
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// If parsing fails, show banner
|
||||
set({ isInitialized: true, isOpen: true });
|
||||
}
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
'use client';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
grecaptcha: {
|
||||
ready: (cb: () => void) => void;
|
||||
execute: (siteKey: string, options: { action: string }) => Promise<string>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function getRecaptchaToken(action: string = 'submit'): Promise<string | null> {
|
||||
return new Promise((resolve) => {
|
||||
const siteKey = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY;
|
||||
if (typeof window === 'undefined' || !siteKey || !(window as any).grecaptcha) {
|
||||
if (typeof window === 'undefined' || !siteKey || !window.grecaptcha) {
|
||||
resolve(null);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
(window as any).grecaptcha.ready(() => {
|
||||
(window as any).grecaptcha
|
||||
window.grecaptcha.ready(() => {
|
||||
window.grecaptcha
|
||||
.execute(siteKey, { action })
|
||||
.then((token: string) => resolve(token))
|
||||
.catch(() => resolve(null));
|
||||
|
||||
Reference in New Issue
Block a user