Something went wrong. Try again.
Atproto AMA app
Something went wrong. Try again.
1234567891011121314151617181920212223/** Origin the widget module itself was loaded from (CDN/static origin). */export function moduleOrigin() { try { return new URL(import.meta.url).origin; } catch { return ""; }}
/** * Widget context from the closest `askimut` wrapper: the Recipient, and * the Askimut origin (explicit attribute, else the bundle's own origin). * The wrapper is a plain element (custom element names require a hyphen), * so context comes from its attributes. */export function widgetContext(host) { const wrapper = host.closest("askimut"); return { recipient: wrapper?.getAttribute("recipient") ?? "", origin: wrapper?.getAttribute("origin") || moduleOrigin(), };}