@qaiddev/thumbs-embed 1.12.2 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +74 -10
  2. package/dist/bootstrap.d.ts +29 -4
  3. package/dist/chunks/annotate-Dvrfeb8k.js +2 -0
  4. package/dist/chunks/annotate-Dvrfeb8k.js.map +1 -0
  5. package/dist/chunks/core-C36Mpll9.js +26 -0
  6. package/dist/chunks/core-C36Mpll9.js.map +1 -0
  7. package/dist/chunks/dom-kdwHduNo.js +2 -0
  8. package/dist/chunks/dom-kdwHduNo.js.map +1 -0
  9. package/dist/chunks/html2canvas.esm-Csbr1w14.js +6 -0
  10. package/dist/chunks/html2canvas.esm-Csbr1w14.js.map +1 -0
  11. package/dist/chunks/modal-CXZZ6LG0.js +2 -0
  12. package/dist/chunks/modal-CXZZ6LG0.js.map +1 -0
  13. package/dist/chunks/recording-D_iYhxpC.js +2 -0
  14. package/dist/chunks/recording-D_iYhxpC.js.map +1 -0
  15. package/dist/chunks/screenshot-dom-DO-0UlOz.js +2 -0
  16. package/dist/chunks/screenshot-dom-DO-0UlOz.js.map +1 -0
  17. package/dist/chunks/send-o4flR35U.js +2 -0
  18. package/dist/chunks/send-o4flR35U.js.map +1 -0
  19. package/dist/chunks/{targeting-CMUEe-7C.js → targeting-Jjo_Jyqy.js} +2 -6
  20. package/dist/chunks/{targeting-CMUEe-7C.js.map → targeting-Jjo_Jyqy.js.map} +1 -1
  21. package/dist/dom.d.ts +0 -2
  22. package/dist/embed-loader.d.ts +20 -0
  23. package/dist/embed.d.ts +4 -4
  24. package/dist/embed.js +1 -1
  25. package/dist/embed.js.map +1 -1
  26. package/dist/icons.d.ts +2 -0
  27. package/dist/index.js +6721 -1539
  28. package/dist/index.js.map +1 -1
  29. package/dist/integrity-probe.js +2 -0
  30. package/dist/loader.js +1 -1
  31. package/dist/loader.js.map +1 -1
  32. package/dist/modal.d.ts +7 -2
  33. package/dist/network-capture.d.ts +4 -0
  34. package/dist/origin-key.d.ts +7 -0
  35. package/dist/qaid.umd.cjs +17 -17
  36. package/dist/qaid.umd.cjs.map +1 -1
  37. package/dist/quest-config.d.ts +27 -2
  38. package/dist/quest-launcher.d.ts +12 -0
  39. package/dist/redact.d.ts +40 -0
  40. package/dist/screenshot-dom.d.ts +7 -5
  41. package/dist/send.d.ts +2 -2
  42. package/dist/svg-sanitize.d.ts +35 -0
  43. package/dist/trusted-types.d.ts +36 -0
  44. package/dist/types.d.ts +13 -0
  45. package/package.json +4 -2
  46. package/dist/chunks/annotate-DGyRcgPt.js +0 -2
  47. package/dist/chunks/annotate-DGyRcgPt.js.map +0 -1
  48. package/dist/chunks/core-BsR7oV99.js +0 -26
  49. package/dist/chunks/core-BsR7oV99.js.map +0 -1
  50. package/dist/chunks/dom-scpOS8nl.js +0 -2
  51. package/dist/chunks/dom-scpOS8nl.js.map +0 -1
  52. package/dist/chunks/modal-DYxcs1Gm.js +0 -2
  53. package/dist/chunks/modal-DYxcs1Gm.js.map +0 -1
  54. package/dist/chunks/recording-BUw5-5Rf.js +0 -2
  55. package/dist/chunks/recording-BUw5-5Rf.js.map +0 -1
  56. package/dist/chunks/screenshot-dom-ZYP2w2h0.js +0 -2
  57. package/dist/chunks/screenshot-dom-ZYP2w2h0.js.map +0 -1
  58. package/dist/chunks/send-C26DRoYc.js +0 -2
  59. package/dist/chunks/send-C26DRoYc.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import{D as O}from"./core-BsR7oV99.js";const Q=["a[href]","button","input","textarea","select","[tabindex]"].join(",");function _(e){return e.hasAttribute("disabled")?!0:e.disabled===!0}function F(e){let t=e;for(;t;){if(t.hasAttribute("hidden"))return!0;const n=t.style;if(n&&(n.display==="none"||n.visibility==="hidden"||n.visibility==="collapse"))return!0;t=t.parentElement}return!1}function b(e){return Array.from(e.querySelectorAll(Q)).filter(n=>!(n.getAttribute("tabindex")==="-1"||n instanceof HTMLInputElement&&n.type==="hidden"||n instanceof HTMLAnchorElement&&!n.getAttribute("href")||_(n)||F(n)))}function m(e){let t=e.activeElement;for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t instanceof HTMLElement?t:null}function h(e){const t=e.ownerDocument||document;let n=!1;const r=i=>{if(i.key!=="Tab")return;const a=b(e);if(a.length===0){i.preventDefault(),e.focus();return}const s=a[0],l=a[a.length-1],u=m(t),c=u?a.indexOf(u)!==-1:!1;i.shiftKey?(!c||u===s)&&(i.preventDefault(),l.focus()):(!c||u===l)&&(i.preventDefault(),s.focus())};e.addEventListener("keydown",r);const o=b(e);return o.length>0?o[0].focus():(e.hasAttribute("tabindex")||(e.setAttribute("tabindex","-1"),n=!0),e.focus()),{release(){e.removeEventListener("keydown",r),n&&(e.removeAttribute("tabindex"),n=!1)}}}function g(){return m(document)}function w(e){if(!(!e||typeof e.focus!="function"))try{e.focus()}catch{}}function v(e,t={}){e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),t.labelledbyId&&e.setAttribute("aria-labelledby",t.labelledbyId),t.describedbyId&&e.setAttribute("aria-describedby",t.describedbyId),t.label&&e.setAttribute("aria-label",t.label)}function L(e,t){let n=e;for(;n&&n!==t;){const r=n.parentNode;if(r===t)return n;if(r&&r.host){n=r.host;continue}if(!r)return null;n=r}return null}function A(e){const n=(e.ownerDocument||document).body;if(!n)return()=>{};const r=L(e,n),o=[];return Array.from(n.children).forEach(i=>{if(!(i instanceof HTMLElement)||r&&i===r)return;const a=i.inert===!0,s=i.getAttribute("aria-hidden");a&&s==="true"||(i.inert=!0,i.setAttribute("aria-hidden","true"),o.push({el:i,prevInert:a,prevAriaHidden:s}))}),function(){for(;o.length;){const a=o.pop();a.el.inert=a.prevInert,a.prevAriaHidden===null?a.el.removeAttribute("aria-hidden"):a.el.setAttribute("aria-hidden",a.prevAriaHidden)}}}function H(e,t){const n=g();v(e,t);const r=h(e),o=A(e);return()=>{r.release(),o(),w(n)}}const U=Object.freeze(Object.defineProperty({__proto__:null,applyDialog:v,createFocusTrap:h,getFocusable:b,openDialog:H,restoreFocus:w,saveFocus:g,setBackgroundInert:A},Symbol.toStringTag,{value:"Module"})),k=e=>import(e);let E=k,d=null,f=null;const p=new Map,y=new Map;function q(e){E=e??k,d=null,f=null,p.clear(),y.clear()}function S(e,t){return`${e.replace(/\/+$/,"")}/${encodeURIComponent(t)}/definition`}function x(e){if(p.has(e))return Promise.resolve();const t=y.get(e);if(t)return t;const n=fetch(e,{headers:{Accept:"application/json"}}).then(r=>r.ok?r.json():null).then(r=>{r&&p.set(e,r)}).catch(()=>{}).finally(()=>{y.delete(e)});return y.set(e,n),n}function D(e){return d&&f===e||(f=e,d=Promise.resolve(E(e)).then(t=>{const n=t;if(!n||typeof n.QaidQuests!="function")throw new Error("quests module has no QaidQuests export");return n}).catch(t=>{throw d=null,f=null,t})),d}async function I(e){const t=await D(e.moduleUrl),n=e.base.replace(/\/+$/,""),r=S(n,e.questId),o=s=>s!=null?{feedbackId:s}:void 0;let i;const a=e.feedbackId;return a instanceof Promise?i=t.QaidQuests.supports?.asyncMetadata?a.then(o,()=>{}):o(await a.catch(()=>null)):i=o(a??null),new t.QaidQuests({endpoint:`${n}/responses`,configUrl:r,questionnaire:p.get(r),apiKey:e.apiKey||void 0,metadata:i,onClose:e.onClose})}const j=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_QUESTS_MODULE_URL:O,_setQuestsImporter:q,launchQuest:I,loadQuestsModule:D,prefetchQuestDefinition:x,questDefinitionUrl:S},Symbol.toStringTag,{value:"Module"}));async function T(e,t){const n=e.ensureOverlayHost(),r=e.overlayShadowHost,o=r.style.pointerEvents;r.style.pointerEvents="auto";try{const{openAnnotationEditor:i,styles:a}=await import("./annotate-DGyRcgPt.js");return e.addFeatureStyles(a),await i({dataUrl:t,root:n,quality:e.config.screenshotOptions.quality,color:e.config.annotationColor,palette:e.config.annotationPalette,applyVars:s=>e.applyVars(s),announce:(s,l)=>e.announceMsg(s,l),openDialog:(s,l)=>e.openDialogA11y(s,l),closeDialog:()=>e.closeDialogA11y()})}catch(i){return console.error("Annotation editor failed to open:",i),null}finally{r.style.pointerEvents=o}}async function P(e){const{config:t,feedbackData:n,selectedBounds:r}=e;let o=null;if(t.captureScreenshot||t.feedbackMode==="annotate")try{if(e.shouldCaptureViaDom()){const{captureDomScreenshot:c}=await import("./screenshot-dom-ZYP2w2h0.js");o=await c(t.screenshotOptions)}else{const{captureScreenshot:c}=await import("./screenshot-CNe1irEz.js");o=await c(t.screenshotOptions)}o&&e.announceMsg("Screenshot captured")}catch(c){console.error("Screenshot capture failed:",c),o=null}o&&t.annotate&&(o=await T(e,o)??o);const a=n.elementSelector?{x:r.x,y:r.y,width:r.width,height:r.height}:null,s={feedbackType:n.feedbackType,pageUrl:window.location.href,apiKey:t.apiKey||void 0,elementSelector:n.elementSelector,elementText:n.elementText,consoleErrors:[...n.consoleErrors],screenWidth:window.innerWidth,screenHeight:window.innerHeight,clickX:r.clickX,clickY:r.clickY,scrollX:window.scrollX,scrollY:window.scrollY,screenshot:o,visitorId:e.visitorId,elementBounds:a,userAgent:navigator.userAgent},l=C(e,s);e.setFeedbackId(l);const u=n.feedbackType;if(u&&u!=="neutral"&&await M(e,u,l)){e.resetFeedbackUi();return}e.setState("MODAL_OPEN");try{const c=await e.ensureModal();if(e.destroyed)return;c.open(),e.overlayShadowHost&&(e.overlayShadowHost.style.pointerEvents="auto")}catch(c){console.error("Failed to open the feedback modal:",c),e.announceMsg("Thank you for your feedback!",!0),e.resetFeedbackUi()}}async function C(e,t){try{const n=await fetch(e.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(n.ok){const r=await n.json();return e.announceMsg("Feedback sent"),r.id}}catch(n){console.error("Failed to submit feedback:",n),e.announceMsg("Failed to send feedback",!0)}return null}async function M(e,t,n){const r=e.config.quests,o=r.base&&r[t]||"";if(!o)return!1;try{return e.activeQuest?.destroy(),e.activeQuest=await I({questId:o,base:r.base,apiKey:r.apiKey||void 0,moduleUrl:r.moduleUrl,feedbackId:n,onClose:()=>{e.activeQuest=null}}),!0}catch(i){return console.error("Failed to launch quest:",i),e.activeQuest=null,!1}}const K=Object.freeze(Object.defineProperty({__proto__:null,openAnnotationEditor:T,submitFeedback:P,tryLaunchQuest:M},Symbol.toStringTag,{value:"Module"}));export{U as a,j as q,K as s};
2
- //# sourceMappingURL=send-C26DRoYc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"send-C26DRoYc.js","sources":["../../src/a11y-dialog.ts","../../src/quest-launcher.ts","../../src/send.ts"],"sourcesContent":["/**\n * Dialog accessibility for the qaid embeds: focus management (trap,\n * save/restore), dialog semantics, and background isolation. Split from\n * a11y.ts so the startup chunk ships only `announce`; this module loads with\n * the click path (the message box, the markup editor, the video preview).\n *\n * Framework-free and self-contained (no CSS dependency), so it can be dropped\n * into any open shadow root.\n */\n\n/** Options accepted by {@link applyDialog}. */\nexport interface ApplyDialogOptions {\n /** id of the element that labels the dialog (wired via aria-labelledby). */\n labelledbyId?: string;\n /** id of the element that describes the dialog (wired via aria-describedby). */\n describedbyId?: string;\n /** Fallback accessible name when no labelling element exists. */\n label?: string;\n}\n\n/** Handle returned by {@link createFocusTrap}. */\nexport interface FocusTrap {\n /** Remove the trap's key handler and clean up any tabindex it added. */\n release(): void;\n}\n\n/**\n * Selector for natively focusable / author-focusable elements. Elements that\n * opt out with tabindex=\"-1\" are excluded below in {@link getFocusable}.\n */\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button\",\n \"input\",\n \"textarea\",\n \"select\",\n \"[tabindex]\",\n].join(\",\");\n\nfunction isDisabled(el: HTMLElement): boolean {\n if (el.hasAttribute(\"disabled\")) return true;\n const asInput = el as HTMLElement & { disabled?: boolean };\n return asInput.disabled === true;\n}\n\nfunction isHidden(el: HTMLElement): boolean {\n let node: HTMLElement | null = el;\n while (node) {\n if (node.hasAttribute(\"hidden\")) return true;\n const style = node.style;\n if (\n style &&\n (style.display === \"none\" ||\n style.visibility === \"hidden\" ||\n style.visibility === \"collapse\")\n ) {\n return true;\n }\n node = node.parentElement;\n }\n return false;\n}\n\n/**\n * Collect the focusable descendants of `container` in DOM order, excluding\n * disabled controls, elements opted out with tabindex=\"-1\", and elements that\n * are hidden (via the hidden attribute or an inline display/visibility rule on\n * themselves or an ancestor up to the document root).\n */\nexport function getFocusable(container: HTMLElement): HTMLElement[] {\n const nodes = Array.from(\n container.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR)\n );\n return nodes.filter((el) => {\n if (el.getAttribute(\"tabindex\") === \"-1\") return false;\n if (el instanceof HTMLInputElement && el.type === \"hidden\") return false;\n if (el instanceof HTMLAnchorElement && !el.getAttribute(\"href\")) return false;\n if (isDisabled(el)) return false;\n if (isHidden(el)) return false;\n return true;\n });\n}\n\n/** Resolve the deepest active element, drilling through open shadow roots. */\nfunction getDeepActiveElement(doc: Document): HTMLElement | null {\n let active: Element | null = doc.activeElement;\n while (active && active.shadowRoot && active.shadowRoot.activeElement) {\n active = active.shadowRoot.activeElement;\n }\n return active instanceof HTMLElement ? active : null;\n}\n\n/**\n * Trap keyboard focus inside `container`: Tab / Shift+Tab cycle between the\n * first and last focusable descendants and can never leave the container. On\n * creation focus moves to the first focusable element, or to the container\n * itself (made programmatically focusable) when it has no focusable children.\n *\n * Call {@link FocusTrap.release} to remove the handler; pair it with\n * {@link restoreFocus} to return focus to the invoking control.\n */\nexport function createFocusTrap(container: HTMLElement): FocusTrap {\n const doc = container.ownerDocument || document;\n let addedTabindex = false;\n\n const onKeydown = (event: KeyboardEvent): void => {\n if (event.key !== \"Tab\") return;\n\n const focusable = getFocusable(container);\n if (focusable.length === 0) {\n // Nothing to move to — keep focus pinned on the container.\n event.preventDefault();\n container.focus();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = getDeepActiveElement(doc);\n const withinTrap = active ? focusable.indexOf(active) !== -1 : false;\n\n if (event.shiftKey) {\n if (!withinTrap || active === first) {\n event.preventDefault();\n last.focus();\n }\n } else {\n if (!withinTrap || active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n };\n\n container.addEventListener(\"keydown\", onKeydown);\n\n const initial = getFocusable(container);\n if (initial.length > 0) {\n initial[0].focus();\n } else {\n if (!container.hasAttribute(\"tabindex\")) {\n container.setAttribute(\"tabindex\", \"-1\");\n addedTabindex = true;\n }\n container.focus();\n }\n\n return {\n release(): void {\n container.removeEventListener(\"keydown\", onKeydown);\n if (addedTabindex) {\n container.removeAttribute(\"tabindex\");\n addedTabindex = false;\n }\n },\n };\n}\n\n/**\n * Capture the currently focused element (drilling through shadow roots) so it\n * can be restored later with {@link restoreFocus}. Returns null when focus is\n * on nothing focusable.\n */\nexport function saveFocus(): HTMLElement | null {\n return getDeepActiveElement(document);\n}\n\n/**\n * Restore focus to a previously saved element. Safe to call with null or an\n * element that has since been detached (a missing/throwing focus is ignored).\n */\nexport function restoreFocus(el: HTMLElement | null): void {\n if (!el || typeof el.focus !== \"function\") return;\n try {\n el.focus();\n } catch {\n // The element may have been removed; nothing more to do.\n }\n}\n\n/**\n * Apply dialog semantics to `el`: role=\"dialog\", aria-modal=\"true\", and the\n * naming/description wiring described by `opts`. Prefer aria-labelledby /\n * aria-describedby pointing at visible title/subtitle elements; fall back to\n * aria-label when no visible label element exists.\n */\nexport function applyDialog(el: HTMLElement, opts: ApplyDialogOptions = {}): void {\n el.setAttribute(\"role\", \"dialog\");\n el.setAttribute(\"aria-modal\", \"true\");\n if (opts.labelledbyId) {\n el.setAttribute(\"aria-labelledby\", opts.labelledbyId);\n }\n if (opts.describedbyId) {\n el.setAttribute(\"aria-describedby\", opts.describedbyId);\n }\n if (opts.label) {\n el.setAttribute(\"aria-label\", opts.label);\n }\n}\n\n/** Walk up to the body-level ancestor of `el`, crossing shadow boundaries. */\nfunction topLevelAncestor(el: HTMLElement, body: HTMLElement): HTMLElement | null {\n let node: Node | null = el;\n while (node && node !== body) {\n const parent: Node | null = node.parentNode;\n if (parent === body) return node as HTMLElement;\n if (parent && (parent as ShadowRoot).host) {\n node = (parent as ShadowRoot).host;\n continue;\n }\n if (!parent) return null;\n node = parent;\n }\n return null;\n}\n\n/**\n * Isolate the background from assistive technology while a dialog is open by\n * marking every top-level sibling of the dialog inert (with an aria-hidden\n * fallback). `except` is the open dialog (or any element inside it); the\n * top-level element that contains it is left interactive.\n *\n * Returns a restore function that reverts every attribute this call changed,\n * leaving elements that were already inert/hidden untouched.\n */\nexport function setBackgroundInert(except: HTMLElement): () => void {\n const doc = except.ownerDocument || document;\n const body = doc.body;\n if (!body) return () => {};\n\n const keep = topLevelAncestor(except, body);\n const changed: Array<{\n el: HTMLElement;\n prevInert: boolean;\n prevAriaHidden: string | null;\n }> = [];\n\n Array.from(body.children).forEach((child) => {\n if (!(child instanceof HTMLElement)) return;\n if (keep && child === keep) return;\n\n const prevInert = child.inert === true;\n const prevAriaHidden = child.getAttribute(\"aria-hidden\");\n // Only record (and later revert) elements we actually change.\n if (prevInert && prevAriaHidden === \"true\") return;\n\n child.inert = true;\n child.setAttribute(\"aria-hidden\", \"true\");\n changed.push({ el: child, prevInert, prevAriaHidden });\n });\n\n return function restore(): void {\n while (changed.length) {\n // The loop guard guarantees pop() returns an entry.\n const entry = changed.pop()!;\n entry.el.inert = entry.prevInert;\n if (entry.prevAriaHidden === null) {\n entry.el.removeAttribute(\"aria-hidden\");\n } else {\n entry.el.setAttribute(\"aria-hidden\", entry.prevAriaHidden);\n }\n }\n };\n}\n\n/** What {@link openDialog} needs to name the dialog. */\nexport type DialogOptions = ApplyDialogOptions;\n\n/**\n * Turn a transient surface into an accessible modal dialog: save the\n * invoking control, apply dialog semantics, trap focus, and inert the\n * background. Returns the matching close: release the trap, restore the\n * background, and return focus to the saved control.\n */\nexport function openDialog(container: HTMLElement, opts: DialogOptions): () => void {\n const trigger = saveFocus();\n applyDialog(container, opts);\n const trap = createFocusTrap(container);\n const restoreInert = setBackgroundInert(container);\n return () => {\n trap.release();\n restoreInert();\n restoreFocus(trigger);\n };\n}\n","/**\n * Lazy loader + launcher for `@qaiddev/quests-embed`.\n *\n * `thumbs-embed` links a button to a quest but owns no questionnaire code\n * and takes no build-time dependency on the quests package. Instead the\n * quests widget is imported from a CDN the first time a quest is triggered,\n * so the shipped bundle stays zero-dependency and small.\n *\n * Only the tiny slice of the quests public API that we actually use is\n * modelled here structurally, so a version bump of the quests package that\n * keeps this surface stable needs no change in thumbs-embed.\n */\n\n// The default module URL lives apart so the startup chunk can fill in the\n// config default without carrying this loader.\nexport { DEFAULT_QUESTS_MODULE_URL } from \"./quest-config\";\n\n/** The bit of a QaidQuests instance we hold onto. */\nexport interface QuestInstance {\n destroy(): void;\n}\n\n/** The bit of QaidQuests config we pass. Mirrors QuestsConfig loosely. */\nexport interface LaunchedQuestConfig {\n endpoint: string;\n configUrl: string;\n /** The definition, when it was fetched ahead of time (wins over configUrl). */\n questionnaire?: unknown;\n apiKey?: string;\n /** A promise only when the loaded module says it accepts one. */\n metadata?: Record<string, unknown> | Promise<Record<string, unknown> | undefined>;\n onComplete?: (answers: Record<string, unknown>) => void;\n onClose?: () => void;\n}\n\ninterface QuestsConstructor {\n new (config: LaunchedQuestConfig): QuestInstance;\n /** quests-embed 1.7+: `asyncMetadata` means `metadata` may be a promise. */\n supports?: { asyncMetadata?: boolean };\n}\n\n/** Shape of the quests module's default/entry exports. */\nexport interface QuestsModule {\n QaidQuests: QuestsConstructor;\n}\n\ntype Importer = (url: string) => Promise<unknown>;\n\nconst defaultImporter: Importer = (url) =>\n // The URL is a runtime value, not a static specifier — keep Vite from\n // trying to analyze/bundle it.\n import(/* @vite-ignore */ url);\n\nlet importer: Importer = defaultImporter;\nlet modulePromise: Promise<QuestsModule> | null = null;\nlet cachedUrl: string | null = null;\n\n/** Quest definitions fetched ahead of a click, by definition URL. */\nconst definitions = new Map<string, unknown>();\nconst definitionLoads = new Map<string, Promise<void>>();\n\n/**\n * @internal Test seam: swap the dynamic importer and clear the cache.\n * Pass `null` to restore the real dynamic `import()`. Not re-exported\n * from the package entry, so it isn't public API.\n */\nexport function _setQuestsImporter(fn: Importer | null): void {\n importer = fn ?? defaultImporter;\n modulePromise = null;\n cachedUrl = null;\n definitions.clear();\n definitionLoads.clear();\n}\n\n/** Where the quest service serves a quest's live definition. */\nexport function questDefinitionUrl(base: string, questId: string): string {\n return `${base.replace(/\\/+$/, \"\")}/${encodeURIComponent(questId)}/definition`;\n}\n\n/**\n * Fetch a quest's definition before anyone clicks, so the quest opens from\n * memory. Never rejects: a failed fetch is forgotten, and the quests widget\n * then loads the definition itself, the way it did before this existed.\n */\nexport function prefetchQuestDefinition(url: string): Promise<void> {\n if (definitions.has(url)) return Promise.resolve();\n const pending = definitionLoads.get(url);\n if (pending) return pending;\n const load = fetch(url, { headers: { Accept: \"application/json\" } })\n .then((res) => (res.ok ? res.json() : null))\n .then((def: unknown) => {\n if (def) definitions.set(url, def);\n })\n .catch(() => {})\n .finally(() => {\n definitionLoads.delete(url);\n });\n definitionLoads.set(url, load);\n return load;\n}\n\n/**\n * Import the quests module, caching the promise per URL. A failed load\n * clears the cache so a later trigger can retry (e.g. after a transient\n * network error) rather than being stuck with a rejected promise.\n */\nexport function loadQuestsModule(moduleUrl: string): Promise<QuestsModule> {\n if (modulePromise && cachedUrl === moduleUrl) return modulePromise;\n cachedUrl = moduleUrl;\n modulePromise = Promise.resolve(importer(moduleUrl))\n .then((mod) => {\n const m = mod as Partial<QuestsModule>;\n if (!m || typeof m.QaidQuests !== \"function\") {\n throw new Error(\"quests module has no QaidQuests export\");\n }\n return m as QuestsModule;\n })\n .catch((err) => {\n modulePromise = null;\n cachedUrl = null;\n throw err;\n });\n return modulePromise;\n}\n\nexport interface LaunchQuestOptions {\n /** Quest id to launch (the `[id]` in `{base}/{id}/definition`). */\n questId: string;\n /** Quest-service base URL, e.g. \"https://qaid.dev/api/quests\". */\n base: string;\n /** API key for the quest service (optional). */\n apiKey?: string;\n /** ES-module URL to load the quests widget from. */\n moduleUrl: string;\n /**\n * Feedback record id to correlate the response with (optional). A promise\n * lets the quest open before the feedback POST has answered.\n */\n feedbackId?: string | number | null | Promise<string | number | null>;\n /** Called when the quest embed is torn down. */\n onClose?: () => void;\n}\n\n/**\n * Load the quests widget (if not already loaded) and open the given quest\n * as its own centered modal. Rejects if the module can't be loaded — the\n * caller should fall back to its normal UI.\n */\nexport async function launchQuest(opts: LaunchQuestOptions): Promise<QuestInstance> {\n const mod = await loadQuestsModule(opts.moduleUrl);\n const base = opts.base.replace(/\\/+$/, \"\");\n const configUrl = questDefinitionUrl(base, opts.questId);\n const toMetadata = (id: string | number | null): Record<string, unknown> | undefined =>\n id != null ? { feedbackId: id } : undefined;\n\n let metadata: LaunchedQuestConfig[\"metadata\"];\n const id = opts.feedbackId;\n if (id instanceof Promise) {\n // A quests build that takes a promise opens now and sends the id when it\n // lands. An older one (a pinned moduleUrl) would serialise the promise as\n // {} and lose the id, so for it we wait, as before.\n metadata = mod.QaidQuests.supports?.asyncMetadata\n ? id.then(toMetadata, () => undefined)\n : toMetadata(await id.catch(() => null));\n } else {\n metadata = toMetadata(id ?? null);\n }\n\n return new mod.QaidQuests({\n endpoint: `${base}/responses`,\n configUrl,\n // Only a definition already in hand. One still loading is left to the\n // widget, which shows its own loading state instead of nothing.\n questionnaire: definitions.get(configUrl),\n apiKey: opts.apiKey || undefined,\n metadata,\n onClose: opts.onClose,\n });\n}\n","/**\n * The feedback send flow — extracted from embed.ts into its own lazily-loaded\n * chunk. It runs only after a thumb click (or a targeted element), so it is\n * pre-warmed when the pointer or focus reaches the buttons, or on idle,\n * whichever comes first.\n *\n * It captures (and lets the visitor mark up) a screenshot when configured,\n * POSTs the feedback, then opens the linked quest or the message box. It talks\n * back to the embed through the narrow `SendHost` interface.\n */\n\nimport { launchQuest, type QuestInstance } from \"./quest-launcher\";\nimport type { ModalController } from \"./modal\";\nimport type {\n ResolvedFeedbackConfig,\n EmbedState,\n FeedbackData,\n SelectedBounds,\n FeedbackPayload,\n FeedbackResponse,\n} from \"./types\";\n\n/** The slice of the embed the send flow needs. */\nexport interface SendHost {\n readonly config: ResolvedFeedbackConfig;\n readonly visitorId: string;\n /** Live references, filled in by the click or the targeting controller. */\n readonly feedbackData: FeedbackData;\n readonly selectedBounds: SelectedBounds;\n readonly destroyed: boolean;\n readonly overlayShadowHost: HTMLDivElement | null;\n /** A quest launched from a button, so destroy() can tear it down. */\n activeQuest: QuestInstance | null;\n setState(state: EmbedState): void;\n /** Record the pending POST, which the message box's PATCHes wait on. */\n setFeedbackId(id: Promise<number | null>): void;\n shouldCaptureViaDom(): boolean;\n ensureOverlayHost(): ShadowRoot;\n ensureModal(): Promise<ModalController>;\n addFeatureStyles(css: string): void;\n applyVars(el: HTMLElement): void;\n announceMsg(message: string, assertive?: boolean): void;\n openDialogA11y(\n container: HTMLElement,\n opts: { labelledbyId?: string; describedbyId?: string; label?: string }\n ): void;\n closeDialogA11y(): void;\n resetFeedbackUi(): void;\n}\n\n/**\n * Open the full-screen annotation editor over the captured screenshot,\n * reusing the overlay shadow host and the shared dialog a11y helpers.\n * Resolves with the composited WebP data URL, or null when the user skips\n * (caller keeps the original). Pointer events on the overlay host are\n * enabled while the editor is open and restored on close.\n */\nexport async function openAnnotationEditor(\n host: SendHost,\n screenshot: string\n): Promise<string | null> {\n const root = host.ensureOverlayHost();\n const overlay = host.overlayShadowHost!;\n const prevPointerEvents = overlay.style.pointerEvents;\n overlay.style.pointerEvents = \"auto\";\n try {\n const { openAnnotationEditor, styles } = await import(\"./annotate\");\n host.addFeatureStyles(styles);\n return await openAnnotationEditor({\n dataUrl: screenshot,\n root,\n quality: host.config.screenshotOptions.quality,\n color: host.config.annotationColor,\n palette: host.config.annotationPalette,\n applyVars: (el) => host.applyVars(el),\n announce: (msg, assertive) => host.announceMsg(msg, assertive),\n openDialog: (container, opts) => host.openDialogA11y(container, opts),\n closeDialog: () => host.closeDialogA11y(),\n });\n } catch (err) {\n // The annotate chunk failed to load / the editor threw — keep the\n // original screenshot rather than aborting the whole submission.\n console.error(\"Annotation editor failed to open:\", err);\n return null;\n } finally {\n overlay.style.pointerEvents = prevPointerEvents;\n }\n}\n\n/** Capture, POST, then hand off to a linked quest or the message box. */\nexport async function submitFeedback(host: SendHost): Promise<void> {\n const { config, feedbackData, selectedBounds } = host;\n // Capture screenshot if enabled (server will gate by plan). \"annotate\" mode\n // always captures one to mark up, even without captureScreenshot set.\n let screenshot: string | null = null;\n const wantScreenshot = config.captureScreenshot || config.feedbackMode === \"annotate\";\n if (wantScreenshot) {\n // Loaded on demand so visitors who never submit a screenshot never\n // download the capture + annotation code. A capture failure (denied\n // permission, chunk load error) must never abort the feedback — we just\n // submit without a screenshot so the user still reaches the modal.\n try {\n if (host.shouldCaptureViaDom()) {\n const { captureDomScreenshot } = await import(\"./screenshot-dom\");\n screenshot = await captureDomScreenshot(config.screenshotOptions);\n } else {\n const { captureScreenshot } = await import(\"./screenshot\");\n screenshot = await captureScreenshot(config.screenshotOptions);\n }\n if (screenshot) host.announceMsg(\"Screenshot captured\");\n } catch (err) {\n console.error(\"Screenshot capture failed:\", err);\n screenshot = null;\n }\n }\n\n // Let the user mark up / redact the screenshot before it is submitted.\n // The message modal only opens after the POST below, so the composited\n // result lands in the same request — no backend change needed. On skip\n // the editor resolves null and the original screenshot is kept.\n if (screenshot && config.annotate) {\n screenshot = (await openAnnotationEditor(host, screenshot)) ?? screenshot;\n }\n\n // Include element bounds for server-side screenshot fallback\n // Only include if we have an element selector (element was targeted)\n const elementBounds = feedbackData.elementSelector\n ? {\n x: selectedBounds.x,\n y: selectedBounds.y,\n width: selectedBounds.width,\n height: selectedBounds.height,\n }\n : null;\n\n const payload: FeedbackPayload = {\n feedbackType: feedbackData.feedbackType!,\n pageUrl: window.location.href,\n apiKey: config.apiKey || undefined,\n elementSelector: feedbackData.elementSelector,\n elementText: feedbackData.elementText,\n consoleErrors: [...feedbackData.consoleErrors],\n screenWidth: window.innerWidth,\n screenHeight: window.innerHeight,\n clickX: selectedBounds.clickX,\n clickY: selectedBounds.clickY,\n scrollX: window.scrollX,\n scrollY: window.scrollY,\n screenshot,\n visitorId: host.visitorId,\n // Include element bounds and user agent for server-side screenshot fallback\n elementBounds,\n userAgent: navigator.userAgent,\n };\n\n // The POST goes out in the background. The message box or linked quest\n // opens now instead of a server round trip later; what needs the new\n // record's id (the message PATCH, the quest's link back) waits on this.\n const feedbackId = postFeedback(host, payload);\n host.setFeedbackId(feedbackId);\n\n // If this button is linked to a quest, launch it in place of the\n // message box, handing it the pending id. On success we just tear down\n // the targeting UI and hand off. On any load failure we fall through to\n // the classic message box so the user can still leave an optional message.\n const type = feedbackData.feedbackType;\n // Quest links are keyed by up/down/video; neutral single-button feedback\n // has no quest mapping, so it always falls through to the message box.\n if (type && type !== \"neutral\" && (await tryLaunchQuest(host, type, feedbackId))) {\n host.resetFeedbackUi();\n return;\n }\n\n // Always show the message modal as the terminal state (even if the API\n // failed — useful for demos).\n host.setState(\"MODAL_OPEN\");\n try {\n // The modal chunk loads async; bail if the embed was destroyed meanwhile,\n // so a raced modal never opens (and never leaks a listener) post-destroy.\n const modal = await host.ensureModal();\n if (host.destroyed) return;\n modal.open();\n\n // Enable pointer events on overlay host for modal\n if (host.overlayShadowHost) {\n host.overlayShadowHost.style.pointerEvents = \"auto\";\n }\n } catch (err) {\n // The modal chunk failed to load/open. Never leave the user stuck in a\n // re-targetable limbo: thank them and reset to IDLE so a fresh click\n // starts a clean flow (the feedback itself was already POSTed above).\n console.error(\"Failed to open the feedback modal:\", err);\n host.announceMsg(\"Thank you for your feedback!\", true);\n host.resetFeedbackUi();\n }\n}\n\n/** POST the feedback. Resolves to the new record's id, or null if it failed. */\nasync function postFeedback(host: SendHost, payload: FeedbackPayload): Promise<number | null> {\n try {\n const response = await fetch(host.config.endpoint, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n\n if (response.ok) {\n const data: FeedbackResponse = await response.json();\n host.announceMsg(\"Feedback sent\");\n return data.id;\n }\n } catch (error) {\n console.error(\"Failed to submit feedback:\", error);\n host.announceMsg(\"Failed to send feedback\", true);\n }\n return null;\n}\n\n/**\n * Launch the quest linked to `type`, if any. Resolves `true` when a quest\n * was configured and the widget launched; `false` when no quest is\n * configured (quest launching off: no `base`, or this button has no quest)\n * or the widget failed to load (caller falls back to its normal UI). The\n * created feedback record id is passed through so the quest response can be\n * joined back to it server-side.\n */\nexport async function tryLaunchQuest(\n host: SendHost,\n type: \"up\" | \"down\" | \"video\",\n feedbackId: number | string | null | Promise<number | string | null>,\n): Promise<boolean> {\n const q = host.config.quests;\n const questId = q.base ? q[type] || \"\" : \"\";\n if (!questId) return false;\n try {\n host.activeQuest?.destroy();\n host.activeQuest = await launchQuest({\n questId,\n base: q.base,\n apiKey: q.apiKey || undefined,\n moduleUrl: q.moduleUrl,\n feedbackId,\n onClose: () => {\n host.activeQuest = null;\n },\n });\n return true;\n } catch (error) {\n console.error(\"Failed to launch quest:\", error);\n host.activeQuest = null;\n return false;\n }\n}\n"],"names":["FOCUSABLE_SELECTOR","isDisabled","el","isHidden","node","style","getFocusable","container","getDeepActiveElement","doc","active","createFocusTrap","addedTabindex","onKeydown","event","focusable","first","last","withinTrap","initial","saveFocus","restoreFocus","applyDialog","opts","topLevelAncestor","body","parent","setBackgroundInert","except","keep","changed","child","prevInert","prevAriaHidden","entry","openDialog","trigger","trap","restoreInert","defaultImporter","url","importer","modulePromise","cachedUrl","definitions","definitionLoads","_setQuestsImporter","fn","questDefinitionUrl","base","questId","prefetchQuestDefinition","pending","load","res","def","loadQuestsModule","moduleUrl","mod","m","err","launchQuest","configUrl","toMetadata","id","metadata","openAnnotationEditor","host","screenshot","root","overlay","prevPointerEvents","styles","msg","assertive","submitFeedback","config","feedbackData","selectedBounds","captureDomScreenshot","captureScreenshot","elementBounds","payload","feedbackId","postFeedback","type","tryLaunchQuest","modal","response","data","error","q"],"mappings":"uCA8BA,MAAMA,EAAqB,CACzB,UACA,SACA,QACA,WACA,SACA,Y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