@social-embed/lib
Version:
URL detection and parsing for embed providers (YouTube, other OEmbed compatible providers),
54 lines • 1.9 kB
TypeScript
import { EmbedProvider } from '../provider';
/**
* Detecting and parsing for Wistia URLs.
*
* [Wistia's Official embed documentation](https://wistia.com/support/embed-and-share/video-on-your-website)
* [Wistia's Embed building documentation](https://wistia.com/support/developers/construct-an-embed-code)
*
* @module providers/wistia
*/
/**
* Regex pattern to match Wistia media IDs from URL formats such as:
*
* - `https://support.wistia.com/medias/26sk4lmiix`
* - `https://support.wistia.com/embed/26sk4lmiix`
*
* @remarks
* While the library doesn’t explicitly handle them, [Wistia's embed docs](https://wistia.com/support/developers/construct-an-embed-code)
* also mention variants like:
* - `https://support.wi.st/embed/26sk4lmiix`
* - `https://support.wi.st/medias/26sk4lmiix`
*/
export declare const wistiaUrlRegex: RegExp;
/**
* Extracts the Wistia media ID from a given URL string.
*
* @param url - The shared Wistia link (can be `undefined`).
* @returns The extracted Wistia media ID, or an empty string if none found.
* @throws If `url` length is >1000 (a safeguard).
*
* @example
* ```ts
* const wistiaId = getWistiaIdFromUrl("https://support.wistia.com/medias/26sk4lmiix");
* console.log(wistiaId); // "26sk4lmiix"
* ```
*/
export declare const getWistiaIdFromUrl: (url: string | undefined) => string;
/**
* Constructs a Wistia embed URL from a media ID.
*
* @param wistiaId - The Wistia ID.
* @returns A URL suitable for embedding in an `<iframe>`.
*
* @example
* ```ts
* console.log(getWistiaEmbedUrlFromId("26sk4lmiix"));
* // "https://fast.wistia.net/embed/iframe/26sk4lmiix"
* ```
*/
export declare const getWistiaEmbedUrlFromId: (id: string) => string;
/**
* A provider implementation for Wistia, following the {@link EmbedProvider} interface.
*/
export declare const WistiaProvider: EmbedProvider;
//# sourceMappingURL=wistia.d.ts.map