export type PlatformServiceUrlUpdateListener = (url: URL) => void; export interface IPlatformService { /** * Indicates if the current platform is a native mobile app * like react-native or flutter. */ isNativeMobile: boolean; /** * Indicates whether the SDK is executed in an environment where * waas keyshares secure storage is supported. */ isWaasSecureStorageSupported: boolean; /** * Gets the hostname of the current location. * * @example window.location.hostname */ getHostname(): string; /** * Gets the host of the current location. * * @example window.location.host */ getHost(): string; /** * Gets the current URL. * * @example new URL(window.location.href) */ getUrl(): URL; /** * Gets the origin of the current location. * * @example window.location.origin */ getOrigin(): string; /** * Gets the origin to be displayed in the UI. * * @example window.location.origin */ getDisplayOrigin(): string | undefined; getTLD(domain?: string): string | undefined; /** * Opens a URL. * * Target options: * - 'self': Opens the URL in the current window (default). * - 'blank': Opens the URL in a new window. * * The `features` parameter is passed to the `window.open` function when the target is 'blank'. * * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open */ openURL(url: string, target?: 'self' | 'blank', features?: string): Promise; /** * Downloads a file with the given filename and content. * * @param fileName - The name of the file to download * @param file - The file content as a Blob */ downloadFile(fileName: string, file: Blob): Promise; /** * Registers a listener for URL updates. * This is primarily used in native mobile environments where deep links * can update the current URL asynchronously. * * @returns A function to unsubscribe the listener. */ onUrlUpdate?(listener: PlatformServiceUrlUpdateListener): () => void; }