Fix typescript errors on astro check
This commit is contained in:
@@ -158,17 +158,23 @@ const {
|
|||||||
// We'd want to only do this for in-viewport or near-viewport ones: https://github.com/ampproject/amphtml/pull/5003
|
// We'd want to only do this for in-viewport or near-viewport ones: https://github.com/ampproject/amphtml/pull/5003
|
||||||
this.addEventListener('click', this.addIframe);
|
this.addEventListener('click', this.addIframe);
|
||||||
|
|
||||||
|
// Detect Safari
|
||||||
|
const isSafari = navigator.userAgent.includes('Safari') && !navigator.userAgent.includes('Chrome');
|
||||||
|
|
||||||
|
// Detect mobile browser
|
||||||
|
const isMobile = navigator.userAgent.includes('Mobi') || navigator.userAgent.includes('Android');
|
||||||
|
|
||||||
// Chrome & Edge desktop have no problem with the basic YouTube Embed with ?autoplay=1
|
// Chrome & Edge desktop have no problem with the basic YouTube Embed with ?autoplay=1
|
||||||
// However Safari desktop and most/all mobile browsers do not successfully track the user gesture of clicking through the creation/loading of the iframe,
|
// However Safari desktop and most/all mobile browsers do not successfully track the user gesture of clicking through the creation/loading of the iframe,
|
||||||
// so they don't autoplay automatically. Instead we must load an additional 2 sequential JS files (1KB + 165KB) (un-br) for the YT Player API
|
// so they don't autoplay automatically. Instead we must load an additional 2 sequential JS files (1KB + 165KB) (un-br) for the YT Player API
|
||||||
// TODO: Try loading the the YT API in parallel with our iframe and then attaching/playing it. #82
|
// TODO: Try loading the the YT API in parallel with our iframe and then attaching/playing it. #82
|
||||||
this.needsYTApiForAutoplay = navigator.vendor.includes('Apple') || navigator.userAgent.includes('Mobi');
|
this.needsYTApiForAutoplay = isSafari || isMobile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a <link rel={preload | preconnect} ...> to the head
|
* Add a <link rel={preload | preconnect} ...> to the head
|
||||||
*/
|
*/
|
||||||
static addPrefetch(kind, url, as) {
|
static addPrefetch(kind: string, url: string, as: string | undefined) {
|
||||||
const linkEl = document.createElement('link');
|
const linkEl = document.createElement('link');
|
||||||
linkEl.rel = kind;
|
linkEl.rel = kind;
|
||||||
linkEl.href = url;
|
linkEl.href = url;
|
||||||
@@ -217,7 +223,7 @@ const {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async addYTPlayerIframe(params) {
|
async addYTPlayerIframe(params: any[] | URLSearchParams) {
|
||||||
this.fetchYTPlayerApi();
|
this.fetchYTPlayerApi();
|
||||||
await this.ytApiPromise;
|
await this.ytApiPromise;
|
||||||
|
|
||||||
@@ -231,7 +237,7 @@ const {
|
|||||||
videoId: this.videoId,
|
videoId: this.videoId,
|
||||||
playerVars: paramsObj,
|
playerVars: paramsObj,
|
||||||
events: {
|
events: {
|
||||||
onReady: (event) => {
|
onReady: (event: { target: { playVideo: () => void; }; }) => {
|
||||||
event.target.playVideo();
|
event.target.playVideo();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -34,7 +34,7 @@ const posts = APP_BLOG.isEnabled ? await findPostsByIds(postIds) : [];
|
|||||||
|
|
||||||
{
|
{
|
||||||
APP_BLOG.isEnabled ? (
|
APP_BLOG.isEnabled ? (
|
||||||
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container} bg={bg}>
|
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container as string} bg={bg}>
|
||||||
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
|
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
|
||||||
{title && (
|
{title && (
|
||||||
<div class="md:max-w-sm">
|
<div class="md:max-w-sm">
|
||||||
|
@@ -35,7 +35,7 @@ const posts = APP_BLOG.isEnabled ? await findLatestPosts({ count }) : [];
|
|||||||
|
|
||||||
{
|
{
|
||||||
APP_BLOG.isEnabled ? (
|
APP_BLOG.isEnabled ? (
|
||||||
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container} bg={bg}>
|
<WidgetWrapper id={id} isDark={isDark} containerClass={classes?.container as string} bg={bg}>
|
||||||
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
|
<div class="flex flex-col lg:justify-between lg:flex-row mb-8">
|
||||||
{title && (
|
{title && (
|
||||||
<div class="md:max-w-sm">
|
<div class="md:max-w-sm">
|
||||||
|
@@ -30,7 +30,7 @@ const {
|
|||||||
title={title}
|
title={title}
|
||||||
subtitle={subtitle}
|
subtitle={subtitle}
|
||||||
tagline={tagline}
|
tagline={tagline}
|
||||||
classes={classes?.headline}
|
classes={classes?.headline as Record<string, string>}
|
||||||
/>
|
/>
|
||||||
<ItemGrid
|
<ItemGrid
|
||||||
items={items}
|
items={items}
|
||||||
|
@@ -29,7 +29,7 @@ const {
|
|||||||
title={title}
|
title={title}
|
||||||
subtitle={subtitle}
|
subtitle={subtitle}
|
||||||
tagline={tagline}
|
tagline={tagline}
|
||||||
classes={classes?.headline}
|
classes={classes?.headline as Record<string, string>}
|
||||||
/>
|
/>
|
||||||
<ItemGrid2
|
<ItemGrid2
|
||||||
items={items}
|
items={items}
|
||||||
|
@@ -31,7 +31,7 @@ const {
|
|||||||
}`}
|
}`}
|
||||||
bg={bg}
|
bg={bg}
|
||||||
>
|
>
|
||||||
<Headline title={title} subtitle={subtitle} tagline={tagline} classes={classes?.headline} />
|
<Headline title={title} subtitle={subtitle} tagline={tagline} classes={classes?.headline as Record<string, string>} />
|
||||||
|
|
||||||
<div aria-hidden="true" class="aspect-w-16 aspect-h-7">
|
<div aria-hidden="true" class="aspect-w-16 aspect-h-7">
|
||||||
{
|
{
|
||||||
|
24
src/types.d.ts
vendored
24
src/types.d.ts
vendored
@@ -97,7 +97,7 @@ export interface Widget {
|
|||||||
id?: string;
|
id?: string;
|
||||||
isDark?: boolean;
|
isDark?: boolean;
|
||||||
bg?: string;
|
bg?: string;
|
||||||
classes?: Record<string, string>;
|
classes?: Record<string, string | Record<string, string>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Headline {
|
export interface Headline {
|
||||||
@@ -208,7 +208,7 @@ export interface Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WIDGETS
|
// WIDGETS
|
||||||
export interface Hero extends Headline, Widget {
|
export interface Hero extends Omit<Headline,"classes">, Widget {
|
||||||
content?: string;
|
content?: string;
|
||||||
image?: string | unknown;
|
image?: string | unknown;
|
||||||
callToAction1?: CallToAction;
|
callToAction1?: CallToAction;
|
||||||
@@ -216,29 +216,29 @@ export interface Hero extends Headline, Widget {
|
|||||||
isReversed?: boolean;
|
isReversed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Team extends Headline, Widget {
|
export interface Team extends Omit<Headline,"classes">, Widget {
|
||||||
team?: Array<TeamMember>;
|
team?: Array<TeamMember>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Stats extends Headline, Widget {
|
export interface Stats extends Omit<Headline,"classes">, Widget {
|
||||||
stats?: Array<Stat>;
|
stats?: Array<Stat>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Pricing extends Headline, Widget {
|
export interface Pricing extends Omit<Headline,"classes">, Widget {
|
||||||
prices?: Array<Price>;
|
prices?: Array<Price>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Testimonials extends Headline, Widget {
|
export interface Testimonials extends Omit<Headline,"classes">, Widget {
|
||||||
testimonials?: Array<Testimonial>;
|
testimonials?: Array<Testimonial>;
|
||||||
callToAction?: CallToAction;
|
callToAction?: CallToAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Brands extends Headline, Widget {
|
export interface Brands extends Omit<Headline,"classes">, Widget {
|
||||||
icons?: Array<string>;
|
icons?: Array<string>;
|
||||||
images?: Array<Image>;
|
images?: Array<Image>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Features extends Headline, Widget {
|
export interface Features extends Omit<Headline,"classes">, Widget {
|
||||||
image?: string | unknown;
|
image?: string | unknown;
|
||||||
video?: Video;
|
video?: Video;
|
||||||
items?: Array<Item>;
|
items?: Array<Item>;
|
||||||
@@ -251,14 +251,14 @@ export interface Features extends Headline, Widget {
|
|||||||
isAfterContent?: boolean;
|
isAfterContent?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Faqs extends Headline, Widget {
|
export interface Faqs extends Omit<Headline,"classes">, Widget {
|
||||||
iconUp?: string;
|
iconUp?: string;
|
||||||
iconDown?: string;
|
iconDown?: string;
|
||||||
items?: Array<Item>;
|
items?: Array<Item>;
|
||||||
columns?: number;
|
columns?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Steps extends Headline, Widget {
|
export interface Steps extends Omit<Headline,"classes">, Widget {
|
||||||
items: Array<{
|
items: Array<{
|
||||||
title: string;
|
title: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
@@ -270,7 +270,7 @@ export interface Steps extends Headline, Widget {
|
|||||||
isReversed?: boolean;
|
isReversed?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Content extends Headline, Widget {
|
export interface Content extends Omit<Headline,"classes">, Widget {
|
||||||
content?: string;
|
content?: string;
|
||||||
image?: string | unknown;
|
image?: string | unknown;
|
||||||
items?: Array<Item>;
|
items?: Array<Item>;
|
||||||
@@ -280,4 +280,4 @@ export interface Content extends Headline, Widget {
|
|||||||
callToAction?: CallToAction;
|
callToAction?: CallToAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Contact extends Headline, Form, Widget {}
|
export interface Contact extends Omit<Headline,"classes">, Form, Widget {}
|
||||||
|
Reference in New Issue
Block a user