@mochabug/adapt-web
Version:
Browser client library for Adapt automation platform
23 lines (22 loc) • 793 B
TypeScript
/**
* Utility for creating iframe URLs with tokens in the hash.
*
* The token is placed in the URL hash as `mb_token=<encoded_token>` so that
* the iframe content can retrieve it using the getToken() utility.
*/
/**
* Creates an iframe src URL with an optional token in the hash.
*
* @param url - The base URL for the iframe
* @param token - Optional authentication token to include in the hash
* @returns The URL with the token appended as a hash parameter if provided
*
* @example
* getIframeSrc('https://example.com', 'my-token')
* // Returns: 'https://example.com#mb_token=my-token'
*
* @example
* getIframeSrc('https://example.com', undefined)
* // Returns: 'https://example.com'
*/
export declare function getIframeSrc(url: string, token: string | undefined): string;