typescript-typenfehler behoben.. npm run lint läuft nun fehlerfrei durch.
This commit is contained in:
@@ -10,7 +10,9 @@ export type MatomoConfig = {
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
_paq?: any[];
|
||||
_paq?: Array<[string, ...unknown[]]>;
|
||||
__matomoInitialized?: boolean;
|
||||
__CSP_NONCE?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +21,7 @@ interface MatomoTrackerProps {
|
||||
}
|
||||
|
||||
const MatomoTracker: React.FC<MatomoTrackerProps> = ({ config }) => {
|
||||
const page = usePage();
|
||||
const page = usePage<{ security?: { csp?: { scriptNonce?: string } } }>();
|
||||
const { hasConsent } = useConsent();
|
||||
const scriptNonce = (page.props.security as { csp?: { scriptNonce?: string } } | undefined)?.csp?.scriptNonce;
|
||||
const analyticsConsent = hasConsent('analytics');
|
||||
@@ -38,14 +40,14 @@ const MatomoTracker: React.FC<MatomoTrackerProps> = ({ config }) => {
|
||||
if (window._paq) {
|
||||
window._paq.length = 0;
|
||||
}
|
||||
delete (window as any).__matomoInitialized;
|
||||
delete window.__matomoInitialized;
|
||||
return;
|
||||
}
|
||||
|
||||
window._paq = window._paq || [];
|
||||
const { _paq } = window;
|
||||
|
||||
if (!(window as any).__matomoInitialized) {
|
||||
if (!window.__matomoInitialized) {
|
||||
_paq.push(['setTrackerUrl', `${base}/matomo.php`]);
|
||||
_paq.push(['setSiteId', config.siteId]);
|
||||
_paq.push(['disableCookies']);
|
||||
@@ -58,8 +60,8 @@ const MatomoTracker: React.FC<MatomoTrackerProps> = ({ config }) => {
|
||||
script.dataset.matomo = base;
|
||||
if (scriptNonce) {
|
||||
script.setAttribute('nonce', scriptNonce);
|
||||
} else if (typeof window !== 'undefined' && (window as any).__CSP_NONCE) {
|
||||
script.setAttribute('nonce', (window as any).__CSP_NONCE);
|
||||
} else if (typeof window !== 'undefined' && window.__CSP_NONCE) {
|
||||
script.setAttribute('nonce', window.__CSP_NONCE);
|
||||
} else {
|
||||
const metaNonce = document
|
||||
.querySelector('meta[name="csp-nonce"]')
|
||||
@@ -72,9 +74,9 @@ const MatomoTracker: React.FC<MatomoTrackerProps> = ({ config }) => {
|
||||
document.body.appendChild(script);
|
||||
}
|
||||
|
||||
(window as any).__matomoInitialized = true;
|
||||
window.__matomoInitialized = true;
|
||||
}
|
||||
}, [config, analyticsConsent]);
|
||||
}, [config, analyticsConsent, scriptNonce]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import * as React from "react"
|
||||
import { ChevronLeft, ChevronRight } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button } from "@/components/ui/button"
|
||||
|
||||
interface Step {
|
||||
id: string
|
||||
@@ -66,4 +64,4 @@ const Steps = React.forwardRef<HTMLDivElement, StepsProps>(
|
||||
)
|
||||
Steps.displayName = "Steps"
|
||||
|
||||
export { Steps }
|
||||
export { Steps }
|
||||
|
||||
@@ -10,7 +10,7 @@ import useEmblaCarousel from "embla-carousel-react"
|
||||
|
||||
interface CarouselApi {
|
||||
slideNodes(): HTMLElement[]
|
||||
on(event: string, listener: (...args: any[]) => void): void
|
||||
on(event: string, listener: (...args: unknown[]) => void): void
|
||||
scrollPrev(): void
|
||||
scrollNext(): void
|
||||
reInit(): void
|
||||
@@ -18,21 +18,24 @@ interface CarouselApi {
|
||||
|
||||
const CarouselContext = React.createContext<CarouselApi | null>(null)
|
||||
|
||||
interface CarouselProps {
|
||||
type CarouselProps = React.HTMLAttributes<HTMLDivElement> & {
|
||||
opts?: {
|
||||
align?: "start" | "center" | "end"
|
||||
loop?: boolean
|
||||
}
|
||||
plugins?: any[]
|
||||
plugins?: unknown[]
|
||||
setApi?: (api: CarouselApi) => void
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
|
||||
({ opts, plugins = [Autoplay()], setApi, className, children, ...props }, ref) => {
|
||||
const [api, setApiInternal] = React.useState<CarouselApi | null>(null)
|
||||
|
||||
const [emblaRef] = useEmblaCarousel(opts, plugins)
|
||||
const [emblaRef, emblaApi] = useEmblaCarousel(opts, plugins)
|
||||
|
||||
React.useEffect(() => {
|
||||
setApiInternal(emblaApi ?? null)
|
||||
}, [emblaApi])
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!api) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}
|
||||
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>
|
||||
|
||||
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className, ...props }, ref) => {
|
||||
|
||||
Reference in New Issue
Block a user