@qaiddev/thumbs-embed 1.0.7 → 1.0.9
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.
- package/dist/index.d.ts +1 -9
- package/dist/qaid.js +453 -465
- package/dist/qaid.js.map +1 -1
- package/dist/qaid.umd.cjs +8 -8
- package/dist/qaid.umd.cjs.map +1 -1
- package/package.json +9 -9
package/dist/qaid.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
var et = (e, t, o) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
|
|
3
|
-
var h = (e, t, o) => et(e, typeof t != "symbol" ? t + "" : t, o);
|
|
4
|
-
const T = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
1
|
+
const E = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
5
2
|
<path stroke-linecap="round" stroke-linejoin="round" d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5"/>
|
|
6
|
-
</svg>`,
|
|
3
|
+
</svg>`, T = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
7
4
|
<path stroke-linecap="round" stroke-linejoin="round" d="M10 14H5.236a2 2 0 01-1.789-2.894l3.5-7A2 2 0 018.737 3h4.018a2 2 0 01.485.06l3.76.94m-7 10v5a2 2 0 002 2h.095c.5 0 .905-.405.905-.905 0-.714.211-1.412.608-2.006L17 13V4m-7 10h2m5-10h2a2 2 0 012 2v6a2 2 0 01-2 2h-2.5"/>
|
|
8
|
-
</svg>`,
|
|
5
|
+
</svg>`, Z = `<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
9
6
|
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"/>
|
|
10
|
-
</svg>`, ot = ".qaid-buttons{display:flex;gap:.5rem}.qaid-buttons.qaid-vertical{flex-direction:column}.qaid-buttons.qaid-auto-container{position:fixed;z-index:50}.qaid-buttons.qaid-auto-container.qaid-bottom-right{bottom:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-bottom-left{bottom:1rem;left:1rem}.qaid-buttons.qaid-auto-container.qaid-top-right{top:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-top-left{top:1rem;left:1rem}.qaid-buttons.qaid-incognito{opacity:0;transition:opacity .2s ease-in-out}.qaid-buttons.qaid-incognito:hover{opacity:1}button.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.qaid-icon{width:24px;height:24px}.qaid-btn-structural:not(:has(svg)),.qaid-btn:not(:has(svg)){font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-emoji-icon{font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-buttons,.qaid-buttons *,.qaid-modal-container,.qaid-modal-container *{cursor:pointer!important}.qaid-tooltip-wrapper{position:relative}.qaid-tooltip-text{position:fixed;padding:.5rem .75rem;background:#1f2937;color:#fff;font-size:1rem;font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}.qaid-targeting-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;top:0;right:0;bottom:0;left:0;cursor:crosshair;pointer-events:auto;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;top:10px;right:10px;bottom:10px;left:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;top:20px;right:20px;bottom:20px;left:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;-moz-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}button.qaid-btn-record:hover{background:#dc2626;color:#fff}.qaid-recording-indicator{position:fixed;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:.875rem;font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:.75rem;font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;-moz-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:.875rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;-moz-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:light-dark(#6b7280,#9ca3af)}", nt = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}.qaid-highlight{outline:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent)!important;outline-offset:2px!important;box-shadow:inset 0 0 0 9999px color-mix(in srgb,var(--qaid-negative) 8%,transparent)!important;transition:outline .1s ease!important}body.qaid-targeting.qaid-type-up .qaid-highlight{outline-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)!important;box-shadow:inset 0 0 0 9999px color-mix(in srgb,var(--qaid-positive) 8%,transparent)!important}";
|
|
11
|
-
let
|
|
12
|
-
const
|
|
7
|
+
</svg>`, Q = "button{cursor:pointer}.qaid-buttons{display:flex;gap:.5rem}.qaid-buttons.qaid-vertical{flex-direction:column}.qaid-buttons.qaid-auto-container{position:fixed;z-index:50}.qaid-buttons.qaid-auto-container.qaid-bottom-right{bottom:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-bottom-left{bottom:1rem;left:1rem}.qaid-buttons.qaid-auto-container.qaid-top-right{top:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-top-left{top:1rem;left:1rem}.qaid-buttons.qaid-incognito{opacity:0;transition:opacity .2s ease-in-out}.qaid-buttons.qaid-incognito:hover{opacity:1}button.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;-webkit-appearance:none;appearance:none}.qaid-icon{width:24px;height:24px}.qaid-btn-structural:not(:has(svg)),.qaid-btn:not(:has(svg)){font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-emoji-icon{font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-buttons,.qaid-buttons *,.qaid-modal-container,.qaid-modal-container *{cursor:pointer!important}.qaid-tooltip-wrapper{position:relative}.qaid-tooltip-text{position:fixed;padding:.5rem .75rem;background:#1f2937;color:#fff;font-size:1rem;font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}.qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;inset:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}button.qaid-btn-record:hover{background:#dc2626;color:#fff}.qaid-recording-indicator{position:fixed;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:.875rem;font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:.75rem;font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:.875rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:light-dark(#6b7280,#9ca3af)}", tt = "body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";
|
|
8
|
+
let w = 0;
|
|
9
|
+
const et = "button.qaid-btn{width:var(--qaid-btn-size);height:var(--qaid-btn-size);border-radius:50%;border:none;background:#f3f4f6;color:#374151;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);transition:background-color .2s,color .2s,transform .2s;-webkit-appearance:none;appearance:none;--qaid-hover-up-bg:var(--qaid-positive);--qaid-hover-up-color:#fff;--qaid-hover-down-bg:var(--qaid-negative);--qaid-hover-down-color:#fff}button.qaid-btn:hover{transform:scale(1.05)}button.qaid-btn-up:hover{background:var(--qaid-hover-up-bg);color:var(--qaid-hover-up-color)}button.qaid-btn-down:hover{background:var(--qaid-hover-down-bg);color:var(--qaid-hover-down-color)}button.qaid-btn svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}", it = {
|
|
13
10
|
small: 36,
|
|
14
11
|
medium: 48,
|
|
15
12
|
large: 64
|
|
16
|
-
},
|
|
13
|
+
}, ot = {
|
|
17
14
|
small: 18,
|
|
18
15
|
medium: 24,
|
|
19
16
|
large: 32
|
|
20
17
|
};
|
|
21
|
-
function
|
|
22
|
-
const [
|
|
23
|
-
return 0.2126 *
|
|
18
|
+
function nt(e, t, i) {
|
|
19
|
+
const [o, n, a] = [e, t, i].map((r) => (r = r / 255, r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4)));
|
|
20
|
+
return 0.2126 * o + 0.7152 * n + 0.0722 * a;
|
|
24
21
|
}
|
|
25
|
-
function
|
|
22
|
+
function at(e) {
|
|
26
23
|
if (e.startsWith("#")) {
|
|
27
|
-
const
|
|
24
|
+
const i = e.slice(1), o = i.length === 3 ? i.split("").map((a) => a + a).join("") : i, n = parseInt(o, 16);
|
|
28
25
|
return {
|
|
29
26
|
r: n >> 16 & 255,
|
|
30
27
|
g: n >> 8 & 255,
|
|
@@ -38,248 +35,247 @@ function ct(e) {
|
|
|
38
35
|
b: parseInt(t[3])
|
|
39
36
|
} : null;
|
|
40
37
|
}
|
|
41
|
-
function
|
|
42
|
-
const t =
|
|
43
|
-
return t &&
|
|
38
|
+
function st(e) {
|
|
39
|
+
const t = at(e);
|
|
40
|
+
return t && nt(t.r, t.g, t.b) > 0.4 ? "black" : "white";
|
|
44
41
|
}
|
|
45
|
-
function
|
|
42
|
+
function rt(e = {}) {
|
|
46
43
|
const {
|
|
47
44
|
positiveColor: t = "rgb(0, 200, 83)",
|
|
48
|
-
negativeColor:
|
|
49
|
-
markerColor:
|
|
45
|
+
negativeColor: i = "rgb(255, 0, 0)",
|
|
46
|
+
markerColor: o = "#6366f1",
|
|
50
47
|
buttonSize: n = "medium",
|
|
51
48
|
modalWidth: a = 400,
|
|
52
|
-
backdropOpacity:
|
|
49
|
+
backdropOpacity: r = 0.3,
|
|
53
50
|
fontFamily: l = "system-ui, -apple-system, sans-serif",
|
|
54
51
|
fontSize: d = 16
|
|
55
|
-
} = e,
|
|
52
|
+
} = e, s = it[n], c = ot[n], h = st(o);
|
|
56
53
|
return {
|
|
57
54
|
"--qaid-positive": t,
|
|
58
|
-
"--qaid-negative":
|
|
59
|
-
"--qaid-marker":
|
|
60
|
-
"--qaid-marker-text":
|
|
61
|
-
"--qaid-btn-size": `${
|
|
55
|
+
"--qaid-negative": i,
|
|
56
|
+
"--qaid-marker": o,
|
|
57
|
+
"--qaid-marker-text": h,
|
|
58
|
+
"--qaid-btn-size": `${s}px`,
|
|
62
59
|
"--qaid-icon-size": `${c}px`,
|
|
63
60
|
"--qaid-modal-width": `${a}px`,
|
|
64
|
-
"--qaid-backdrop-opacity": String(
|
|
61
|
+
"--qaid-backdrop-opacity": String(r),
|
|
65
62
|
"--qaid-font-family": l,
|
|
66
63
|
"--qaid-font-size": `${d}px`
|
|
67
64
|
};
|
|
68
65
|
}
|
|
69
|
-
function
|
|
70
|
-
for (const [
|
|
71
|
-
e.style.setProperty(
|
|
66
|
+
function dt(e, t) {
|
|
67
|
+
for (const [i, o] of Object.entries(t))
|
|
68
|
+
e.style.setProperty(i, o);
|
|
72
69
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
70
|
+
function z() {
|
|
71
|
+
return Q + et;
|
|
75
72
|
}
|
|
76
|
-
function
|
|
77
|
-
if (
|
|
73
|
+
function ct() {
|
|
74
|
+
if (w++, w > 1) return;
|
|
78
75
|
const e = document.createElement("style");
|
|
79
|
-
e.id = "qaid-styles", e.textContent =
|
|
76
|
+
e.id = "qaid-styles", e.textContent = tt, document.head.appendChild(e);
|
|
80
77
|
}
|
|
81
|
-
function
|
|
82
|
-
if (!(
|
|
78
|
+
function lt() {
|
|
79
|
+
if (!(w <= 0) && (w--, w === 0)) {
|
|
83
80
|
const e = document.getElementById("qaid-styles");
|
|
84
81
|
e && e.remove();
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
|
-
const
|
|
88
|
-
function
|
|
89
|
-
let
|
|
90
|
-
for (;
|
|
91
|
-
for (const
|
|
92
|
-
const n =
|
|
84
|
+
const ht = ["data-comp", "data-qa", "data-testid", "data-id"];
|
|
85
|
+
function V(e, t = document.body) {
|
|
86
|
+
let i = e;
|
|
87
|
+
for (; i && i !== t; ) {
|
|
88
|
+
for (const o of ht) {
|
|
89
|
+
const n = i.getAttribute(o);
|
|
93
90
|
if (n)
|
|
94
|
-
return `${
|
|
91
|
+
return `${o}="${n}"`;
|
|
95
92
|
}
|
|
96
|
-
|
|
93
|
+
i = i.parentElement;
|
|
97
94
|
}
|
|
98
95
|
return null;
|
|
99
96
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return o.length === t ? o + "..." : o;
|
|
97
|
+
function ut(e, t = 100) {
|
|
98
|
+
const i = e.textContent?.trim().slice(0, t) || "";
|
|
99
|
+
return i.length === t ? i + "..." : i;
|
|
104
100
|
}
|
|
105
|
-
function
|
|
106
|
-
let t = 1,
|
|
107
|
-
for (;
|
|
108
|
-
t++,
|
|
101
|
+
function pt(e) {
|
|
102
|
+
let t = 1, i = e.previousElementSibling;
|
|
103
|
+
for (; i; )
|
|
104
|
+
t++, i = i.previousElementSibling;
|
|
109
105
|
return t;
|
|
110
106
|
}
|
|
111
|
-
function
|
|
107
|
+
function mt(e) {
|
|
112
108
|
const t = [];
|
|
113
|
-
let
|
|
114
|
-
for (;
|
|
115
|
-
const
|
|
116
|
-
t.unshift(`${
|
|
109
|
+
let i = e;
|
|
110
|
+
for (; i && i !== document.body && i !== document.documentElement; ) {
|
|
111
|
+
const o = i.tagName.toLowerCase(), n = pt(i);
|
|
112
|
+
t.unshift(`${o}:nth-child(${n})`), i = i.parentElement;
|
|
117
113
|
}
|
|
118
114
|
return t.length > 0 ? `body > ${t.join(" > ")}` : "body";
|
|
119
115
|
}
|
|
120
|
-
function
|
|
116
|
+
function ft(e) {
|
|
121
117
|
return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
|
|
122
118
|
}
|
|
123
|
-
function
|
|
124
|
-
const t =
|
|
125
|
-
return t ? `[${t}]` : e.id ? `#${
|
|
119
|
+
function gt(e) {
|
|
120
|
+
const t = V(e);
|
|
121
|
+
return t ? `[${t}]` : e.id ? `#${ft(e.id)}` : mt(e);
|
|
126
122
|
}
|
|
127
|
-
function
|
|
128
|
-
const t =
|
|
129
|
-
return { selector:
|
|
123
|
+
function bt(e) {
|
|
124
|
+
const t = ut(e), i = V(e);
|
|
125
|
+
return { selector: gt(e), text: t, dataAttr: i };
|
|
130
126
|
}
|
|
131
|
-
const
|
|
127
|
+
const U = {
|
|
132
128
|
width: 400,
|
|
133
129
|
height: 280,
|
|
134
130
|
arrowHeight: 12,
|
|
135
131
|
gap: 8,
|
|
136
132
|
viewportPadding: 16
|
|
137
133
|
};
|
|
138
|
-
function
|
|
139
|
-
const a = e.y,
|
|
140
|
-
if (
|
|
134
|
+
function vt(e, t, i, o, n) {
|
|
135
|
+
const a = e.y, r = t - (e.y + e.height);
|
|
136
|
+
if (r >= i + o)
|
|
141
137
|
return {
|
|
142
|
-
top: e.y + e.height +
|
|
138
|
+
top: e.y + e.height + o,
|
|
143
139
|
position: "below"
|
|
144
140
|
};
|
|
145
|
-
if (a >=
|
|
141
|
+
if (a >= i + o)
|
|
146
142
|
return {
|
|
147
|
-
top: e.y -
|
|
143
|
+
top: e.y - i - o,
|
|
148
144
|
position: "above"
|
|
149
145
|
};
|
|
150
|
-
const l =
|
|
146
|
+
const l = r > a ? "below" : "above";
|
|
151
147
|
let d;
|
|
152
148
|
return l === "below" ? d = Math.min(
|
|
153
|
-
e.y + e.height +
|
|
154
|
-
t -
|
|
155
|
-
) : d = Math.max(n, e.y -
|
|
149
|
+
e.y + e.height + o,
|
|
150
|
+
t - i - n
|
|
151
|
+
) : d = Math.max(n, e.y - i - o), { top: d, position: l };
|
|
156
152
|
}
|
|
157
|
-
function
|
|
158
|
-
let a = e.x + e.width / 2 -
|
|
159
|
-
return a = Math.max(
|
|
153
|
+
function yt(e, t, i, o) {
|
|
154
|
+
let a = e.x + e.width / 2 - i / 2;
|
|
155
|
+
return a = Math.max(o, Math.min(a, t - i - o)), a;
|
|
160
156
|
}
|
|
161
|
-
function
|
|
162
|
-
const
|
|
163
|
-
return Math.max(
|
|
157
|
+
function wt(e, t, i, o = 24, n = 24) {
|
|
158
|
+
const r = e.clickX - t - n / 2;
|
|
159
|
+
return Math.max(o, Math.min(r, i - o - n / 2));
|
|
164
160
|
}
|
|
165
|
-
function
|
|
166
|
-
const n =
|
|
161
|
+
function xt(e, t, i, o = U) {
|
|
162
|
+
const n = o.height + o.arrowHeight, a = vt(
|
|
167
163
|
e,
|
|
168
|
-
|
|
164
|
+
i,
|
|
169
165
|
n,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
),
|
|
166
|
+
o.gap,
|
|
167
|
+
o.viewportPadding
|
|
168
|
+
), r = yt(
|
|
173
169
|
e,
|
|
174
170
|
t,
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
o.width,
|
|
172
|
+
o.viewportPadding
|
|
177
173
|
);
|
|
178
174
|
return {
|
|
179
175
|
top: a.top,
|
|
180
|
-
left:
|
|
176
|
+
left: r,
|
|
181
177
|
position: a.position
|
|
182
178
|
};
|
|
183
179
|
}
|
|
184
|
-
function
|
|
185
|
-
const n =
|
|
180
|
+
function qt(e, t, i, o = U) {
|
|
181
|
+
const n = xt(e, t, i, o), a = wt(
|
|
186
182
|
e,
|
|
187
183
|
n.left,
|
|
188
|
-
|
|
184
|
+
o.width
|
|
189
185
|
);
|
|
190
186
|
return {
|
|
191
187
|
modal: n,
|
|
192
188
|
arrow: { left: a }
|
|
193
189
|
};
|
|
194
190
|
}
|
|
195
|
-
const
|
|
196
|
-
function
|
|
197
|
-
const t = [],
|
|
191
|
+
const kt = 20;
|
|
192
|
+
function Ct(e) {
|
|
193
|
+
const t = [], i = console.error, o = console.warn, n = console.log, a = (r, l) => {
|
|
198
194
|
const d = {
|
|
199
|
-
message: l.map((
|
|
195
|
+
message: l.map((s) => String(s)).join(" "),
|
|
200
196
|
timestamp: Date.now(),
|
|
201
|
-
level:
|
|
197
|
+
level: r
|
|
202
198
|
};
|
|
203
|
-
t.length >=
|
|
199
|
+
t.length >= kt && t.shift(), t.push(d), e && e(d);
|
|
204
200
|
};
|
|
205
|
-
return console.error = function(...
|
|
206
|
-
a("error",
|
|
207
|
-
}, console.warn = function(...
|
|
208
|
-
a("warn",
|
|
209
|
-
}, console.log = function(...
|
|
210
|
-
a("log",
|
|
201
|
+
return console.error = function(...r) {
|
|
202
|
+
a("error", r), i.apply(console, r);
|
|
203
|
+
}, console.warn = function(...r) {
|
|
204
|
+
a("warn", r), o.apply(console, r);
|
|
205
|
+
}, console.log = function(...r) {
|
|
206
|
+
a("log", r), n.apply(console, r);
|
|
211
207
|
}, {
|
|
212
208
|
errors: t,
|
|
213
209
|
restore: () => {
|
|
214
|
-
console.error =
|
|
210
|
+
console.error = i, console.warn = o, console.log = n;
|
|
215
211
|
}
|
|
216
212
|
};
|
|
217
213
|
}
|
|
218
|
-
const
|
|
219
|
-
function
|
|
214
|
+
const St = 20, B = 4096;
|
|
215
|
+
function q(e) {
|
|
220
216
|
if (e == null) return;
|
|
221
217
|
const t = typeof e == "string" ? e : JSON.stringify(e);
|
|
222
|
-
return t.length >
|
|
218
|
+
return t.length > B ? t.slice(0, B) + "…[truncated]" : t;
|
|
223
219
|
}
|
|
224
220
|
function P(e, t) {
|
|
225
|
-
e.length >=
|
|
221
|
+
e.length >= St && e.shift(), e.push(t);
|
|
226
222
|
}
|
|
227
|
-
async function
|
|
223
|
+
async function Et(e) {
|
|
228
224
|
try {
|
|
229
225
|
const t = await e.clone().text();
|
|
230
|
-
return
|
|
226
|
+
return q(t);
|
|
231
227
|
} catch {
|
|
232
228
|
return;
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
|
-
function
|
|
231
|
+
function Tt() {
|
|
236
232
|
const e = [], t = window.fetch;
|
|
237
233
|
window.fetch = async function(n, a) {
|
|
238
|
-
const
|
|
234
|
+
const r = typeof n == "string" ? n : n instanceof URL ? n.toString() : n.url, l = a?.method ?? (typeof n == "object" && "method" in n ? n.method : "GET");
|
|
239
235
|
let d;
|
|
240
|
-
a
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const c = await
|
|
236
|
+
a?.body && (d = q(a.body));
|
|
237
|
+
const s = await t.apply(window, [n, a]);
|
|
238
|
+
if (s.status >= 400) {
|
|
239
|
+
const c = await Et(s);
|
|
244
240
|
P(e, {
|
|
245
|
-
url:
|
|
241
|
+
url: r,
|
|
246
242
|
method: l.toUpperCase(),
|
|
247
|
-
status:
|
|
248
|
-
statusText:
|
|
243
|
+
status: s.status,
|
|
244
|
+
statusText: s.statusText,
|
|
249
245
|
requestBody: d,
|
|
250
246
|
responseBody: c,
|
|
251
247
|
timestamp: Date.now()
|
|
252
248
|
});
|
|
253
249
|
}
|
|
254
|
-
return
|
|
250
|
+
return s;
|
|
255
251
|
};
|
|
256
|
-
const
|
|
257
|
-
return XMLHttpRequest.prototype.open = function(n, a, ...
|
|
258
|
-
return this._qaid_method = n, this._qaid_url = typeof a == "string" ? a : a.toString(),
|
|
252
|
+
const i = XMLHttpRequest.prototype.open, o = XMLHttpRequest.prototype.send;
|
|
253
|
+
return XMLHttpRequest.prototype.open = function(n, a, ...r) {
|
|
254
|
+
return this._qaid_method = n, this._qaid_url = typeof a == "string" ? a : a.toString(), i.apply(this, [n, a, ...r]);
|
|
259
255
|
}, XMLHttpRequest.prototype.send = function(n) {
|
|
260
|
-
const a = this,
|
|
256
|
+
const a = this, r = n ? q(n) : void 0;
|
|
261
257
|
return a.addEventListener("load", function() {
|
|
262
258
|
a.status >= 400 && P(e, {
|
|
263
259
|
url: a._qaid_url,
|
|
264
260
|
method: a._qaid_method.toUpperCase(),
|
|
265
261
|
status: a.status,
|
|
266
262
|
statusText: a.statusText,
|
|
267
|
-
requestBody:
|
|
268
|
-
responseBody:
|
|
263
|
+
requestBody: r,
|
|
264
|
+
responseBody: q(a.responseText),
|
|
269
265
|
timestamp: Date.now()
|
|
270
266
|
});
|
|
271
|
-
}),
|
|
267
|
+
}), o.apply(this, [n]);
|
|
272
268
|
}, {
|
|
273
269
|
errors: e,
|
|
274
270
|
restore: () => {
|
|
275
|
-
window.fetch = t, XMLHttpRequest.prototype.open =
|
|
271
|
+
window.fetch = t, XMLHttpRequest.prototype.open = i, XMLHttpRequest.prototype.send = o;
|
|
276
272
|
}
|
|
277
273
|
};
|
|
278
274
|
}
|
|
279
|
-
function
|
|
275
|
+
function It() {
|
|
280
276
|
return typeof navigator < "u" && !!navigator.mediaDevices && typeof navigator.mediaDevices.getDisplayMedia == "function" && typeof MediaRecorder < "u";
|
|
281
277
|
}
|
|
282
|
-
function
|
|
278
|
+
function Lt() {
|
|
283
279
|
if (typeof MediaRecorder > "u") return "";
|
|
284
280
|
const e = [
|
|
285
281
|
"video/webm;codecs=vp9",
|
|
@@ -292,22 +288,22 @@ function Mt() {
|
|
|
292
288
|
return t;
|
|
293
289
|
return "";
|
|
294
290
|
}
|
|
295
|
-
function
|
|
296
|
-
const t = e.maxDuration ?? 15,
|
|
297
|
-
let
|
|
291
|
+
function Rt(e = {}) {
|
|
292
|
+
const t = e.maxDuration ?? 15, i = e.videoBitsPerSecond ?? 8e5;
|
|
293
|
+
let o = null, n = null, a = [], r = null, l = null, d = null, s = 0, c = null, h = null, u = !1, p = null;
|
|
298
294
|
function b() {
|
|
299
|
-
d !== null && (clearInterval(d), d = null),
|
|
295
|
+
d !== null && (clearInterval(d), d = null), p !== null && (clearTimeout(p), p = null), o && (o.getTracks().forEach((m) => m.stop()), o = null), n = null, a = [], r = null, l = null, c = null, h = null;
|
|
300
296
|
}
|
|
301
|
-
function
|
|
302
|
-
|
|
297
|
+
function f() {
|
|
298
|
+
u || (u = !0, n && n.state !== "inactive" && n.stop());
|
|
303
299
|
}
|
|
304
300
|
return {
|
|
305
301
|
async start() {
|
|
306
|
-
|
|
307
|
-
const m =
|
|
302
|
+
u = !1, a = [];
|
|
303
|
+
const m = Lt();
|
|
308
304
|
if (!m)
|
|
309
305
|
throw new Error("No supported video MIME type found");
|
|
310
|
-
|
|
306
|
+
o = await navigator.mediaDevices.getDisplayMedia({
|
|
311
307
|
video: {
|
|
312
308
|
frameRate: 15
|
|
313
309
|
},
|
|
@@ -315,132 +311,126 @@ function zt(e = {}) {
|
|
|
315
311
|
// @ts-expect-error preferCurrentTab is not in the TS types yet
|
|
316
312
|
preferCurrentTab: !0
|
|
317
313
|
});
|
|
318
|
-
const v =
|
|
314
|
+
const v = o.getVideoTracks()[0];
|
|
319
315
|
v && v.addEventListener("ended", () => {
|
|
320
|
-
|
|
321
|
-
}), n = new MediaRecorder(
|
|
316
|
+
f();
|
|
317
|
+
}), n = new MediaRecorder(o, {
|
|
322
318
|
mimeType: m,
|
|
323
|
-
videoBitsPerSecond:
|
|
324
|
-
}), n.ondataavailable = (
|
|
325
|
-
|
|
319
|
+
videoBitsPerSecond: i
|
|
320
|
+
}), n.ondataavailable = (g) => {
|
|
321
|
+
g.data.size > 0 && a.push(g.data);
|
|
326
322
|
}, n.onstop = () => {
|
|
327
|
-
const
|
|
328
|
-
c && c(
|
|
323
|
+
const g = new Blob(a, { type: m });
|
|
324
|
+
c && c(g), l && l(g), o && o.getTracks().forEach((x) => x.stop());
|
|
329
325
|
}, n.onerror = () => {
|
|
330
|
-
|
|
331
|
-
}, n.start(1e3),
|
|
332
|
-
const
|
|
333
|
-
|
|
334
|
-
}, 1e3),
|
|
335
|
-
|
|
326
|
+
h && h(new Error("MediaRecorder error"));
|
|
327
|
+
}, n.start(1e3), s = Date.now(), d = setInterval(() => {
|
|
328
|
+
const g = Math.floor((Date.now() - s) / 1e3);
|
|
329
|
+
r && r(g);
|
|
330
|
+
}, 1e3), p = setTimeout(() => {
|
|
331
|
+
f();
|
|
336
332
|
}, t * 1e3);
|
|
337
333
|
},
|
|
338
334
|
stop() {
|
|
339
335
|
return new Promise((m, v) => {
|
|
340
|
-
c = m,
|
|
336
|
+
c = m, h = v, f();
|
|
341
337
|
});
|
|
342
338
|
},
|
|
343
339
|
onTick(m) {
|
|
344
|
-
|
|
340
|
+
r = m;
|
|
345
341
|
},
|
|
346
342
|
onStop(m) {
|
|
347
343
|
l = m;
|
|
348
344
|
},
|
|
349
345
|
destroy() {
|
|
350
|
-
|
|
346
|
+
f(), b();
|
|
351
347
|
}
|
|
352
348
|
};
|
|
353
349
|
}
|
|
354
|
-
function
|
|
350
|
+
function Mt(e = 640) {
|
|
355
351
|
return typeof window < "u" && window.innerWidth < e;
|
|
356
352
|
}
|
|
357
|
-
function
|
|
358
|
-
const
|
|
359
|
-
|
|
353
|
+
function A(e, t, i) {
|
|
354
|
+
const o = i.map((a) => a.style.visibility);
|
|
355
|
+
i.forEach((a) => a.style.visibility = "hidden");
|
|
360
356
|
const n = document.elementFromPoint(e, t);
|
|
361
|
-
return
|
|
357
|
+
return i.forEach((a, r) => a.style.visibility = o[r]), n;
|
|
362
358
|
}
|
|
363
|
-
function
|
|
359
|
+
function O(e) {
|
|
364
360
|
return e ? e.hasAttribute("data-qaid-embed") || e.hasAttribute("data-qaid-embed-overlay") ? !0 : !!e.closest("[data-qaid-embed], [data-qaid-embed-overlay]") : !1;
|
|
365
361
|
}
|
|
366
|
-
function
|
|
367
|
-
const
|
|
362
|
+
function Dt(e, t = 0) {
|
|
363
|
+
const i = e.getBoundingClientRect();
|
|
368
364
|
return {
|
|
369
|
-
x:
|
|
370
|
-
y:
|
|
371
|
-
width:
|
|
372
|
-
height:
|
|
365
|
+
x: i.left - t,
|
|
366
|
+
y: i.top - t,
|
|
367
|
+
width: i.width + t * 2,
|
|
368
|
+
height: i.height + t * 2
|
|
373
369
|
};
|
|
374
370
|
}
|
|
375
|
-
function
|
|
376
|
-
|
|
377
|
-
t.classList.remove(e);
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
async function Ot(e = {}) {
|
|
381
|
-
var n;
|
|
382
|
-
const { quality: t = 1, maxWidth: o = 1280, maxHeight: i = 800 } = e;
|
|
371
|
+
async function Ht(e = {}) {
|
|
372
|
+
const { quality: t = 1, maxWidth: i = 1280, maxHeight: o = 800 } = e;
|
|
383
373
|
try {
|
|
384
|
-
if (!
|
|
374
|
+
if (!navigator.mediaDevices?.getDisplayMedia)
|
|
385
375
|
return console.warn("Screen Capture API not available"), null;
|
|
386
|
-
const
|
|
376
|
+
const n = await navigator.mediaDevices.getDisplayMedia({
|
|
387
377
|
preferCurrentTab: !0,
|
|
388
378
|
video: {
|
|
389
379
|
displaySurface: "browser"
|
|
390
380
|
}
|
|
391
|
-
}),
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
381
|
+
}), a = n.getVideoTracks()[0], r = a.getSettings(), l = document.createElement("video");
|
|
382
|
+
l.srcObject = n, l.muted = !0, await new Promise((f) => {
|
|
383
|
+
l.onloadedmetadata = () => {
|
|
384
|
+
l.play(), f();
|
|
395
385
|
};
|
|
396
|
-
}), await new Promise((
|
|
397
|
-
const
|
|
398
|
-
|
|
386
|
+
}), await new Promise((f) => {
|
|
387
|
+
const m = () => {
|
|
388
|
+
l.readyState >= 2 ? f() : requestAnimationFrame(m);
|
|
399
389
|
};
|
|
400
|
-
|
|
401
|
-
}), await new Promise((
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
const
|
|
405
|
-
return
|
|
406
|
-
} catch (
|
|
407
|
-
return console.warn("Screenshot capture failed:",
|
|
390
|
+
m();
|
|
391
|
+
}), await new Promise((f) => setTimeout(f, 100));
|
|
392
|
+
const d = r.width || l.videoWidth, s = r.height || l.videoHeight, c = Math.min(i / d, o / s, 1), h = Math.round(d * c), u = Math.round(s * c), p = document.createElement("canvas");
|
|
393
|
+
p.width = h, p.height = u;
|
|
394
|
+
const b = p.getContext("2d");
|
|
395
|
+
return b ? (b.drawImage(l, 0, 0, h, u), a.stop(), p.toDataURL("image/webp", t)) : (a.stop(), null);
|
|
396
|
+
} catch (n) {
|
|
397
|
+
return console.warn("Screenshot capture failed:", n), null;
|
|
408
398
|
}
|
|
409
399
|
}
|
|
410
|
-
const
|
|
411
|
-
let
|
|
412
|
-
function
|
|
400
|
+
const $ = "https://qaid.dev/lib/html2canvas.min.js", zt = 1e4, Bt = 50;
|
|
401
|
+
let y = null;
|
|
402
|
+
function Ut() {
|
|
413
403
|
if (typeof document > "u" || typeof window > "u")
|
|
414
404
|
return !1;
|
|
415
405
|
const e = document.createElement("canvas");
|
|
416
406
|
return typeof e.getContext == "function" && !!e.getContext("2d");
|
|
417
407
|
}
|
|
418
|
-
function
|
|
419
|
-
return window.html2canvas ? Promise.resolve(!0) :
|
|
408
|
+
function Pt() {
|
|
409
|
+
return window.html2canvas ? Promise.resolve(!0) : y || (y = new Promise((e) => {
|
|
420
410
|
if (!document.querySelector(
|
|
421
|
-
`script[src="${
|
|
411
|
+
`script[src="${$}"]`
|
|
422
412
|
)) {
|
|
423
413
|
const n = document.createElement("script");
|
|
424
|
-
n.src =
|
|
414
|
+
n.src = $, n.async = !0, document.head.appendChild(n);
|
|
425
415
|
}
|
|
426
|
-
const
|
|
416
|
+
const i = Date.now(), o = () => {
|
|
427
417
|
if (window.html2canvas) {
|
|
428
418
|
e(!0);
|
|
429
419
|
return;
|
|
430
420
|
}
|
|
431
|
-
if (Date.now() -
|
|
432
|
-
|
|
421
|
+
if (Date.now() - i > zt) {
|
|
422
|
+
y = null, e(!1);
|
|
433
423
|
return;
|
|
434
424
|
}
|
|
435
|
-
setTimeout(
|
|
425
|
+
setTimeout(o, Bt);
|
|
436
426
|
};
|
|
437
|
-
|
|
438
|
-
}),
|
|
427
|
+
o();
|
|
428
|
+
}), y);
|
|
439
429
|
}
|
|
440
|
-
async function
|
|
441
|
-
const { quality: t = 0.8, maxWidth:
|
|
430
|
+
async function At(e = {}) {
|
|
431
|
+
const { quality: t = 0.8, maxWidth: i = 1280, maxHeight: o = 800 } = e;
|
|
442
432
|
try {
|
|
443
|
-
if (!await
|
|
433
|
+
if (!await Pt() || !window.html2canvas)
|
|
444
434
|
return console.warn("html2canvas failed to load"), null;
|
|
445
435
|
const a = await window.html2canvas(document.body, {
|
|
446
436
|
useCORS: !0,
|
|
@@ -452,91 +442,86 @@ async function Vt(e = {}) {
|
|
|
452
442
|
height: document.documentElement.clientHeight,
|
|
453
443
|
x: window.scrollX,
|
|
454
444
|
y: window.scrollY,
|
|
455
|
-
ignoreElements: (
|
|
456
|
-
|
|
457
|
-
return r instanceof HTMLElement ? r.classList.contains("qaid-buttons") || r.classList.contains("qaid-targeting-overlay") || r.classList.contains("qaid-modal-container") || r.classList.contains("qaid-bottom-sheet") || r.classList.contains("qaid-backdrop") || r.classList.contains("qaid-selected-marker") || r.classList.contains("qaid-tooltip-text") || r.classList.contains("qaid-recording-indicator") || r.classList.contains("qaid-video-preview") || ((p = (c = r.className) == null ? void 0 : (u = c.toString()).startsWith) == null ? void 0 : p.call(u, "qaid-")) : !1;
|
|
458
|
-
}
|
|
459
|
-
}), s = a.width, l = a.height, d = Math.min(o / s, i / l, 1);
|
|
445
|
+
ignoreElements: (s) => s instanceof HTMLElement ? s.classList.contains("qaid-buttons") || s.classList.contains("qaid-targeting-overlay") || s.classList.contains("qaid-modal-container") || s.classList.contains("qaid-bottom-sheet") || s.classList.contains("qaid-backdrop") || s.classList.contains("qaid-selected-marker") || s.classList.contains("qaid-tooltip-text") || s.classList.contains("qaid-recording-indicator") || s.classList.contains("qaid-video-preview") || s.className?.toString().startsWith?.("qaid-") : !1
|
|
446
|
+
}), r = a.width, l = a.height, d = Math.min(i / r, o / l, 1);
|
|
460
447
|
if (d < 1) {
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
return
|
|
448
|
+
const s = Math.round(r * d), c = Math.round(l * d), h = document.createElement("canvas");
|
|
449
|
+
h.width = s, h.height = c;
|
|
450
|
+
const u = h.getContext("2d");
|
|
451
|
+
return u ? (u.drawImage(a, 0, 0, s, c), h.toDataURL("image/webp", t)) : null;
|
|
465
452
|
}
|
|
466
453
|
return a.toDataURL("image/webp", t);
|
|
467
454
|
} catch (n) {
|
|
468
455
|
return console.warn("DOM screenshot capture failed:", n), null;
|
|
469
456
|
}
|
|
470
457
|
}
|
|
471
|
-
const
|
|
472
|
-
function
|
|
458
|
+
const N = "qaid_visitor_id";
|
|
459
|
+
function Ot() {
|
|
473
460
|
try {
|
|
474
|
-
let e = localStorage.getItem(
|
|
475
|
-
return e || (e = crypto.randomUUID(), localStorage.setItem(
|
|
461
|
+
let e = localStorage.getItem(N);
|
|
462
|
+
return e || (e = crypto.randomUUID(), localStorage.setItem(N, e)), e;
|
|
476
463
|
} catch {
|
|
477
464
|
return crypto.randomUUID();
|
|
478
465
|
}
|
|
479
466
|
}
|
|
480
|
-
class
|
|
467
|
+
class $t {
|
|
468
|
+
config;
|
|
469
|
+
state = "IDLE";
|
|
470
|
+
feedbackData = {
|
|
471
|
+
feedbackType: null,
|
|
472
|
+
elementSelector: null,
|
|
473
|
+
elementText: null,
|
|
474
|
+
consoleErrors: []
|
|
475
|
+
};
|
|
476
|
+
selectedBounds = {
|
|
477
|
+
x: 0,
|
|
478
|
+
y: 0,
|
|
479
|
+
width: 0,
|
|
480
|
+
height: 0,
|
|
481
|
+
clickX: 0,
|
|
482
|
+
clickY: 0,
|
|
483
|
+
visible: !1
|
|
484
|
+
};
|
|
485
|
+
feedbackId = null;
|
|
486
|
+
mousePos = { x: 0, y: 0 };
|
|
487
|
+
isMobile = !1;
|
|
488
|
+
visitorId;
|
|
489
|
+
// Console capture
|
|
490
|
+
consoleCapture = null;
|
|
491
|
+
// Video recording
|
|
492
|
+
videoRecorder = null;
|
|
493
|
+
networkCapture = null;
|
|
494
|
+
recordedBlob = null;
|
|
495
|
+
recordingIndicator = null;
|
|
496
|
+
videoPreview = null;
|
|
497
|
+
isRecording = !1;
|
|
498
|
+
isSendingVideo = !1;
|
|
499
|
+
// Shadow DOM
|
|
500
|
+
shadowHost = null;
|
|
501
|
+
shadowRoot = null;
|
|
502
|
+
// Overlay shadow DOM (always on document.body for full-page coverage)
|
|
503
|
+
overlayShadowHost = null;
|
|
504
|
+
overlayShadowRoot = null;
|
|
505
|
+
// DOM elements (inside shadow root)
|
|
506
|
+
buttonsContainer = null;
|
|
507
|
+
isUserProvidedContainer = !1;
|
|
508
|
+
overlayContainer = null;
|
|
509
|
+
captureLayer = null;
|
|
510
|
+
crosshairH = null;
|
|
511
|
+
crosshairV = null;
|
|
512
|
+
scope = null;
|
|
513
|
+
highlightBox = null;
|
|
514
|
+
marker = null;
|
|
515
|
+
modalContainer = null;
|
|
516
|
+
backdrop = null;
|
|
517
|
+
// Per-instance CSS variables
|
|
518
|
+
cssVars = {};
|
|
519
|
+
// Bound event handlers
|
|
520
|
+
boundKeyDown;
|
|
521
|
+
boundMouseMove;
|
|
522
|
+
boundClick;
|
|
523
|
+
boundResize;
|
|
481
524
|
constructor(t) {
|
|
482
|
-
h(this, "config");
|
|
483
|
-
h(this, "state", "IDLE");
|
|
484
|
-
h(this, "feedbackData", {
|
|
485
|
-
feedbackType: null,
|
|
486
|
-
elementSelector: null,
|
|
487
|
-
elementText: null,
|
|
488
|
-
consoleErrors: []
|
|
489
|
-
});
|
|
490
|
-
h(this, "selectedBounds", {
|
|
491
|
-
x: 0,
|
|
492
|
-
y: 0,
|
|
493
|
-
width: 0,
|
|
494
|
-
height: 0,
|
|
495
|
-
clickX: 0,
|
|
496
|
-
clickY: 0,
|
|
497
|
-
visible: !1
|
|
498
|
-
});
|
|
499
|
-
h(this, "feedbackId", null);
|
|
500
|
-
h(this, "mousePos", { x: 0, y: 0 });
|
|
501
|
-
h(this, "lastHighlighted", null);
|
|
502
|
-
h(this, "isMobile", !1);
|
|
503
|
-
h(this, "visitorId");
|
|
504
|
-
// Console capture
|
|
505
|
-
h(this, "consoleCapture", null);
|
|
506
|
-
// Video recording
|
|
507
|
-
h(this, "videoRecorder", null);
|
|
508
|
-
h(this, "networkCapture", null);
|
|
509
|
-
h(this, "recordedBlob", null);
|
|
510
|
-
h(this, "recordingIndicator", null);
|
|
511
|
-
h(this, "videoPreview", null);
|
|
512
|
-
h(this, "isRecording", !1);
|
|
513
|
-
h(this, "isSendingVideo", !1);
|
|
514
|
-
// Shadow DOM
|
|
515
|
-
h(this, "shadowHost", null);
|
|
516
|
-
h(this, "shadowRoot", null);
|
|
517
|
-
// Overlay shadow DOM (always on document.body for full-page coverage)
|
|
518
|
-
h(this, "overlayShadowHost", null);
|
|
519
|
-
h(this, "overlayShadowRoot", null);
|
|
520
|
-
// DOM elements (inside shadow root)
|
|
521
|
-
h(this, "buttonsContainer", null);
|
|
522
|
-
h(this, "isUserProvidedContainer", !1);
|
|
523
|
-
h(this, "overlayContainer", null);
|
|
524
|
-
h(this, "captureLayer", null);
|
|
525
|
-
h(this, "crosshairH", null);
|
|
526
|
-
h(this, "crosshairV", null);
|
|
527
|
-
h(this, "scope", null);
|
|
528
|
-
h(this, "marker", null);
|
|
529
|
-
h(this, "modalContainer", null);
|
|
530
|
-
h(this, "backdrop", null);
|
|
531
|
-
// Per-instance CSS variables
|
|
532
|
-
h(this, "cssVars", {});
|
|
533
|
-
// Bound event handlers
|
|
534
|
-
h(this, "boundKeyDown");
|
|
535
|
-
h(this, "boundMouseMove");
|
|
536
|
-
h(this, "boundClick");
|
|
537
|
-
h(this, "boundResize");
|
|
538
|
-
h(this, "tooltipElement", null);
|
|
539
|
-
var o, i, n, a, s, l, d, r, c, u, p, f, b, g, m;
|
|
540
525
|
this.config = {
|
|
541
526
|
endpoint: t.endpoint,
|
|
542
527
|
apiKey: t.apiKey ?? "",
|
|
@@ -545,24 +530,24 @@ class Ft {
|
|
|
545
530
|
direction: t.direction ?? "horizontal",
|
|
546
531
|
position: t.position ?? "bottom-right",
|
|
547
532
|
offset: {
|
|
548
|
-
x:
|
|
549
|
-
y:
|
|
533
|
+
x: t.offset?.x ?? 16,
|
|
534
|
+
y: t.offset?.y ?? 16
|
|
550
535
|
},
|
|
551
536
|
zIndex: t.zIndex ?? 50,
|
|
552
537
|
skipTargeting: t.skipTargeting ?? !1,
|
|
553
538
|
colors: {
|
|
554
|
-
positive:
|
|
555
|
-
negative:
|
|
556
|
-
marker:
|
|
539
|
+
positive: t.colors?.positive ?? "rgb(0, 200, 83)",
|
|
540
|
+
negative: t.colors?.negative ?? "rgb(255, 0, 0)",
|
|
541
|
+
marker: t.colors?.marker ?? "#6366f1"
|
|
557
542
|
},
|
|
558
543
|
buttonSize: t.buttonSize ?? "medium",
|
|
559
544
|
text: {
|
|
560
|
-
tooltip:
|
|
561
|
-
modalTitle:
|
|
562
|
-
modalSubtitle:
|
|
563
|
-
placeholder:
|
|
564
|
-
submitButton:
|
|
565
|
-
skipButton:
|
|
545
|
+
tooltip: t.text?.tooltip ?? "",
|
|
546
|
+
modalTitle: t.text?.modalTitle ?? "Thank you for your feedback!",
|
|
547
|
+
modalSubtitle: t.text?.modalSubtitle ?? "Would you like to add a message to help us understand your feedback better?",
|
|
548
|
+
placeholder: t.text?.placeholder ?? "Optional: Tell us more about your experience...",
|
|
549
|
+
submitButton: t.text?.submitButton ?? "Submit",
|
|
550
|
+
skipButton: t.text?.skipButton ?? "Skip"
|
|
566
551
|
},
|
|
567
552
|
modalWidth: t.modalWidth ?? 400,
|
|
568
553
|
backdropOpacity: t.backdropOpacity ?? 0.3,
|
|
@@ -571,9 +556,9 @@ class Ft {
|
|
|
571
556
|
captureScreenshot: t.captureScreenshot ?? !1,
|
|
572
557
|
screenshotMethod: t.screenshotMethod ?? "permission",
|
|
573
558
|
screenshotOptions: {
|
|
574
|
-
quality:
|
|
575
|
-
maxWidth:
|
|
576
|
-
maxHeight:
|
|
559
|
+
quality: t.screenshotOptions?.quality ?? 0.8,
|
|
560
|
+
maxWidth: t.screenshotOptions?.maxWidth ?? 1280,
|
|
561
|
+
maxHeight: t.screenshotOptions?.maxHeight ?? 800
|
|
577
562
|
},
|
|
578
563
|
incognito: t.incognito ?? !1,
|
|
579
564
|
positiveIcon: t.positiveIcon ?? "",
|
|
@@ -582,16 +567,16 @@ class Ft {
|
|
|
582
567
|
css: t.css ?? "",
|
|
583
568
|
captureVideo: t.captureVideo ?? !1,
|
|
584
569
|
videoOptions: {
|
|
585
|
-
maxDuration:
|
|
570
|
+
maxDuration: t.videoOptions?.maxDuration ?? 15
|
|
586
571
|
},
|
|
587
572
|
recordIcon: t.recordIcon ?? ""
|
|
588
|
-
}, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundClick = this.handleClick.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId =
|
|
573
|
+
}, this.boundKeyDown = this.handleKeyDown.bind(this), this.boundMouseMove = this.handleMouseMove.bind(this), this.boundClick = this.handleClick.bind(this), this.boundResize = this.handleResize.bind(this), this.visitorId = Ot(), this.init();
|
|
589
574
|
}
|
|
590
575
|
applyVars(t) {
|
|
591
|
-
|
|
576
|
+
dt(t, this.cssVars);
|
|
592
577
|
}
|
|
593
578
|
init() {
|
|
594
|
-
|
|
579
|
+
ct(), this.cssVars = rt({
|
|
595
580
|
positiveColor: this.config.colors.positive,
|
|
596
581
|
negativeColor: this.config.colors.negative,
|
|
597
582
|
markerColor: this.config.colors.marker,
|
|
@@ -600,13 +585,12 @@ class Ft {
|
|
|
600
585
|
backdropOpacity: this.config.backdropOpacity,
|
|
601
586
|
fontFamily: this.config.fontFamily,
|
|
602
587
|
fontSize: this.config.fontSize
|
|
603
|
-
}), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture =
|
|
604
|
-
|
|
605
|
-
this.feedbackData.consoleErrors = ((o = this.consoleCapture) == null ? void 0 : o.errors) ?? [];
|
|
588
|
+
}), this.checkMobile(), window.addEventListener("resize", this.boundResize), this.createEmbed(), this.consoleCapture = Ct((t) => {
|
|
589
|
+
this.feedbackData.consoleErrors = this.consoleCapture?.errors ?? [];
|
|
606
590
|
}), this.feedbackData.consoleErrors = this.consoleCapture.errors;
|
|
607
591
|
}
|
|
608
592
|
checkMobile() {
|
|
609
|
-
this.isMobile =
|
|
593
|
+
this.isMobile = Mt();
|
|
610
594
|
}
|
|
611
595
|
handleResize() {
|
|
612
596
|
this.checkMobile();
|
|
@@ -615,36 +599,36 @@ class Ft {
|
|
|
615
599
|
this.shadowHost = document.createElement("div"), this.shadowHost.setAttribute("data-qaid-embed", ""), this.shadowHost.style.position = "static", this.shadowHost.style.display = "contents";
|
|
616
600
|
let t = null;
|
|
617
601
|
this.config.container && (t = document.querySelector(this.config.container)), t ? (t.appendChild(this.shadowHost), this.isUserProvidedContainer = !0) : (this.shadowHost.style.position = "fixed", this.shadowHost.style.display = "block", this.shadowHost.style.inset = "0", this.shadowHost.style.pointerEvents = "none", this.shadowHost.style.zIndex = String(this.config.zIndex), document.body.appendChild(this.shadowHost)), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" });
|
|
618
|
-
const
|
|
619
|
-
if (
|
|
620
|
-
const
|
|
621
|
-
|
|
602
|
+
const i = document.createElement("style");
|
|
603
|
+
if (i.textContent = z(), this.shadowRoot.appendChild(i), this.config.css) {
|
|
604
|
+
const s = document.createElement("style");
|
|
605
|
+
s.textContent = this.config.css, this.shadowRoot.appendChild(s);
|
|
622
606
|
}
|
|
623
|
-
const
|
|
607
|
+
const o = this.config.direction === "vertical" ? "qaid-vertical" : "";
|
|
624
608
|
if (this.isUserProvidedContainer)
|
|
625
|
-
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${
|
|
609
|
+
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-${this.config.position} ${o}`.trim(), this.config.incognito && this.buttonsContainer.classList.add("qaid-incognito");
|
|
626
610
|
else {
|
|
627
|
-
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${
|
|
628
|
-
const { x:
|
|
629
|
-
this.config.position.includes("right") ? this.buttonsContainer.style.right = `${
|
|
611
|
+
this.buttonsContainer = document.createElement("div"), this.buttonsContainer.className = `qaid-buttons qaid-auto-container qaid-${this.config.position} ${o}${this.config.incognito ? " qaid-incognito" : ""}`.trim(), this.buttonsContainer.style.pointerEvents = "auto";
|
|
612
|
+
const { x: s, y: c } = this.config.offset;
|
|
613
|
+
this.config.position.includes("right") ? this.buttonsContainer.style.right = `${s}px` : this.buttonsContainer.style.left = `${s}px`, this.config.position.includes("bottom") ? this.buttonsContainer.style.bottom = `${c}px` : this.buttonsContainer.style.top = `${c}px`;
|
|
630
614
|
}
|
|
631
615
|
this.applyVars(this.buttonsContainer), this.shadowRoot.appendChild(this.buttonsContainer);
|
|
632
616
|
const n = !!this.config.buttonClass, a = n ? `qaid-btn-structural ${this.config.buttonClass}` : "qaid-btn", l = this.config.text.tooltip || "Feedback for us?", d = document.createElement("div");
|
|
633
617
|
if (d.className = "qaid-tooltip-text", d.textContent = l, this.applyVars(d), this.shadowRoot.appendChild(d), this.tooltipElement = d, !this.config.hideThumbs) {
|
|
634
|
-
const
|
|
635
|
-
|
|
618
|
+
const s = document.createElement("div");
|
|
619
|
+
s.className = "qaid-tooltip-wrapper";
|
|
636
620
|
const c = document.createElement("button");
|
|
637
|
-
c.type = "button", c.className = n ? `${a} qaid-btn-up` : "qaid-btn qaid-btn-up", c.innerHTML = this.config.positiveIcon ||
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
621
|
+
c.type = "button", c.className = n ? `${a} qaid-btn-up` : "qaid-btn qaid-btn-up", c.innerHTML = this.config.positiveIcon || E, c.addEventListener("click", (p) => this.handleThumbClick("up", p.currentTarget, p)), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), s.appendChild(c);
|
|
622
|
+
const h = document.createElement("div");
|
|
623
|
+
h.className = "qaid-tooltip-wrapper";
|
|
624
|
+
const u = document.createElement("button");
|
|
625
|
+
u.type = "button", u.className = n ? `${a} qaid-btn-down` : "qaid-btn qaid-btn-down", u.innerHTML = this.config.negativeIcon || T, u.addEventListener("click", (p) => this.handleThumbClick("down", p.currentTarget, p)), u.addEventListener("mouseenter", () => this.showTooltip(u)), u.addEventListener("mouseleave", () => this.hideTooltip()), h.appendChild(u), this.buttonsContainer.appendChild(s), this.buttonsContainer.appendChild(h);
|
|
642
626
|
}
|
|
643
|
-
if (this.config.captureVideo &&
|
|
644
|
-
const
|
|
645
|
-
|
|
627
|
+
if (this.config.captureVideo && It()) {
|
|
628
|
+
const s = document.createElement("div");
|
|
629
|
+
s.className = "qaid-tooltip-wrapper";
|
|
646
630
|
const c = document.createElement("button");
|
|
647
|
-
c.type = "button", c.className = n ? `${a} qaid-btn-record` : "qaid-btn qaid-btn-record", c.innerHTML = this.config.recordIcon ||
|
|
631
|
+
c.type = "button", c.className = n ? `${a} qaid-btn-record` : "qaid-btn qaid-btn-record", c.innerHTML = this.config.recordIcon || Z, c.addEventListener("click", () => this.startRecording()), c.addEventListener("mouseenter", () => this.showTooltip(c)), c.addEventListener("mouseleave", () => this.hideTooltip()), s.appendChild(c), this.buttonsContainer.appendChild(s);
|
|
648
632
|
}
|
|
649
633
|
}
|
|
650
634
|
/**
|
|
@@ -657,87 +641,94 @@ class Ft {
|
|
|
657
641
|
if (this.overlayShadowRoot) return this.overlayShadowRoot;
|
|
658
642
|
this.overlayShadowHost = document.createElement("div"), this.overlayShadowHost.setAttribute("data-qaid-embed-overlay", ""), this.overlayShadowHost.style.position = "fixed", this.overlayShadowHost.style.inset = "0", this.overlayShadowHost.style.pointerEvents = "none", this.overlayShadowHost.style.zIndex = String(this.config.zIndex), document.body.appendChild(this.overlayShadowHost), this.overlayShadowRoot = this.overlayShadowHost.attachShadow({ mode: "open" });
|
|
659
643
|
const t = document.createElement("style");
|
|
660
|
-
if (t.textContent =
|
|
661
|
-
const
|
|
662
|
-
|
|
644
|
+
if (t.textContent = z(), this.overlayShadowRoot.appendChild(t), this.config.css) {
|
|
645
|
+
const i = document.createElement("style");
|
|
646
|
+
i.textContent = this.config.css, this.overlayShadowRoot.appendChild(i);
|
|
663
647
|
}
|
|
664
648
|
return this.overlayShadowRoot;
|
|
665
649
|
}
|
|
650
|
+
tooltipElement = null;
|
|
666
651
|
showTooltip(t) {
|
|
667
652
|
if (!this.tooltipElement) return;
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
const n = t.getBoundingClientRect(), a =
|
|
671
|
-
let d,
|
|
672
|
-
d = n.bottom +
|
|
653
|
+
const i = this.tooltipElement, o = 8;
|
|
654
|
+
i.style.visibility = "hidden", i.classList.add("qaid-tooltip-visible");
|
|
655
|
+
const n = t.getBoundingClientRect(), a = i.getBoundingClientRect(), r = window.innerWidth, l = window.innerHeight;
|
|
656
|
+
let d, s;
|
|
657
|
+
d = n.bottom + o, d + a.height > l - o && (d = n.top - a.height - o), s = n.left, s < o ? s = o : s + a.width > r - o && (s = r - a.width - o), d < o ? d = o : d + a.height > l - o && (d = l - a.height - o), i.style.top = `${d}px`, i.style.left = `${s}px`, i.style.visibility = "visible";
|
|
673
658
|
}
|
|
674
659
|
hideTooltip() {
|
|
675
660
|
this.tooltipElement && this.tooltipElement.classList.remove("qaid-tooltip-visible");
|
|
676
661
|
}
|
|
677
|
-
handleThumbClick(t, o) {
|
|
678
|
-
this.config.skipTargeting ? this.submitDirectFeedback(t,
|
|
662
|
+
handleThumbClick(t, i, o) {
|
|
663
|
+
this.config.skipTargeting ? this.submitDirectFeedback(t, i) : this.startTargeting(t, o);
|
|
679
664
|
}
|
|
680
|
-
submitDirectFeedback(t,
|
|
665
|
+
submitDirectFeedback(t, i) {
|
|
681
666
|
this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null;
|
|
682
|
-
const
|
|
667
|
+
const o = i.getBoundingClientRect();
|
|
683
668
|
this.selectedBounds = {
|
|
684
|
-
x:
|
|
685
|
-
y:
|
|
686
|
-
width:
|
|
687
|
-
height:
|
|
688
|
-
clickX:
|
|
689
|
-
clickY:
|
|
669
|
+
x: o.left,
|
|
670
|
+
y: o.top,
|
|
671
|
+
width: o.width,
|
|
672
|
+
height: o.height,
|
|
673
|
+
clickX: o.left + o.width / 2,
|
|
674
|
+
clickY: o.top + o.height / 2,
|
|
690
675
|
visible: !1
|
|
691
676
|
}, this.submitFeedback();
|
|
692
677
|
}
|
|
693
|
-
startTargeting(t) {
|
|
694
|
-
this.state = "TARGETING", this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), document.body.style.setProperty("--qaid-positive", this.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.cssVars["--qaid-negative"]), this.createTargetingOverlay(),
|
|
678
|
+
startTargeting(t, i) {
|
|
679
|
+
this.state = "TARGETING", this.feedbackData.feedbackType = t, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1, this.mousePos.x = i.clientX, this.mousePos.y = i.clientY, document.body.classList.add("qaid-targeting"), t === "up" ? document.body.classList.add("qaid-type-up") : document.body.classList.remove("qaid-type-up"), document.body.style.setProperty("--qaid-positive", this.cssVars["--qaid-positive"]), document.body.style.setProperty("--qaid-negative", this.cssVars["--qaid-negative"]), this.createTargetingOverlay(), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("click", this.boundClick, !0);
|
|
695
680
|
}
|
|
696
681
|
createTargetingOverlay() {
|
|
697
682
|
const t = this.ensureOverlayHost();
|
|
698
|
-
this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer"
|
|
699
|
-
const
|
|
700
|
-
|
|
683
|
+
this.overlayContainer = document.createElement("div"), this.overlayContainer.className = `qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`, this.captureLayer = document.createElement("div"), this.captureLayer.className = "qaid-capture-layer";
|
|
684
|
+
const i = document.createElement("div");
|
|
685
|
+
i.className = "qaid-vignette", this.crosshairH = document.createElement("div"), this.crosshairH.className = "qaid-crosshair-h", this.crosshairV = document.createElement("div"), this.crosshairV.className = "qaid-crosshair-v", this.scope = document.createElement("div"), this.scope.className = "qaid-scope", this.scope.innerHTML = `
|
|
701
686
|
<div class="qaid-scope-ring"></div>
|
|
702
687
|
<div class="qaid-scope-ring-inner"></div>
|
|
703
688
|
<div class="qaid-scope-dot"></div>
|
|
704
|
-
`, this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(
|
|
689
|
+
`, this.highlightBox = document.createElement("div"), this.highlightBox.className = "qaid-highlight-box", this.overlayContainer.appendChild(this.captureLayer), this.overlayContainer.appendChild(i), this.overlayContainer.appendChild(this.highlightBox), this.overlayContainer.appendChild(this.crosshairH), this.overlayContainer.appendChild(this.crosshairV), this.overlayContainer.appendChild(this.scope), this.crosshairH.style.top = `${this.mousePos.y}px`, this.crosshairV.style.left = `${this.mousePos.x}px`, this.scope.style.left = `${this.mousePos.x}px`, this.scope.style.top = `${this.mousePos.y}px`, this.applyVars(this.overlayContainer), t.appendChild(this.overlayContainer);
|
|
705
690
|
}
|
|
706
691
|
handleKeyDown(t) {
|
|
707
692
|
t.key === "Escape" && (this.isRecording ? this.stopRecording() : this.videoPreview ? this.cancelRecordingPreview() : this.state === "TARGETING" ? this.cancelTargeting() : this.state === "MODAL_OPEN" && this.closeModal());
|
|
708
693
|
}
|
|
709
694
|
handleMouseMove(t) {
|
|
710
695
|
if (this.mousePos.x = t.clientX, this.mousePos.y = t.clientY, this.crosshairH && (this.crosshairH.style.top = `${t.clientY}px`), this.crosshairV && (this.crosshairV.style.left = `${t.clientX}px`), this.scope && (this.scope.style.left = `${t.clientX}px`, this.scope.style.top = `${t.clientY}px`), this.captureLayer && this.shadowHost) {
|
|
711
|
-
const
|
|
696
|
+
const i = [this.shadowHost, this.overlayShadowHost].filter(Boolean), o = A(
|
|
712
697
|
t.clientX,
|
|
713
698
|
t.clientY,
|
|
714
|
-
|
|
699
|
+
i
|
|
715
700
|
);
|
|
716
|
-
|
|
701
|
+
if (o && !O(o)) {
|
|
702
|
+
if (this.highlightBox) {
|
|
703
|
+
const n = o.getBoundingClientRect();
|
|
704
|
+
this.highlightBox.style.transform = `translate(${n.left}px, ${n.top}px)`, this.highlightBox.style.width = `${n.width}px`, this.highlightBox.style.height = `${n.height}px`, this.highlightBox.style.display = "block";
|
|
705
|
+
}
|
|
706
|
+
} else
|
|
707
|
+
this.highlightBox && (this.highlightBox.style.display = "none");
|
|
717
708
|
}
|
|
718
709
|
}
|
|
719
710
|
handleClick(t) {
|
|
720
|
-
if (
|
|
721
|
-
|
|
711
|
+
if (this.state !== "TARGETING" || !this.shadowHost) return;
|
|
712
|
+
t.preventDefault(), t.stopPropagation();
|
|
713
|
+
const i = [this.shadowHost, this.overlayShadowHost].filter(Boolean), o = A(
|
|
722
714
|
t.clientX,
|
|
723
715
|
t.clientY,
|
|
724
|
-
|
|
716
|
+
i
|
|
725
717
|
);
|
|
726
|
-
if (!
|
|
718
|
+
if (!o || O(o))
|
|
727
719
|
return;
|
|
728
|
-
|
|
729
|
-
const n = At(i, 8);
|
|
720
|
+
const n = Dt(o, 8);
|
|
730
721
|
this.selectedBounds = {
|
|
731
722
|
...n,
|
|
732
723
|
clickX: t.clientX,
|
|
733
724
|
clickY: t.clientY,
|
|
734
725
|
visible: !0
|
|
735
726
|
};
|
|
736
|
-
const { selector: a, text:
|
|
737
|
-
this.feedbackData.elementSelector = a, this.feedbackData.elementText =
|
|
727
|
+
const { selector: a, text: r } = bt(o);
|
|
728
|
+
this.feedbackData.elementSelector = a, this.feedbackData.elementText = r, this.removeTargetingOverlay(), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), document.removeEventListener("keydown", this.boundKeyDown), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.state = "SELECTED", this.showSelectedMarker(), this.submitFeedback();
|
|
738
729
|
}
|
|
739
730
|
cancelTargeting() {
|
|
740
|
-
|
|
731
|
+
this.removeTargetingOverlay(), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), document.removeEventListener("keydown", this.boundKeyDown), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.state = "IDLE", this.feedbackData.feedbackType = null, this.feedbackData.elementSelector = null, this.feedbackData.elementText = null, this.selectedBounds.visible = !1;
|
|
741
732
|
}
|
|
742
733
|
removeTargetingOverlay() {
|
|
743
734
|
this.overlayContainer && (this.overlayContainer.remove(), this.overlayContainer = null), this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null;
|
|
@@ -753,13 +744,13 @@ class Ft {
|
|
|
753
744
|
async submitFeedback() {
|
|
754
745
|
if (!this.feedbackData.feedbackType) return;
|
|
755
746
|
let t = null;
|
|
756
|
-
this.config.captureScreenshot && (this.config.screenshotMethod === "dom" ? t = await
|
|
757
|
-
const
|
|
747
|
+
this.config.captureScreenshot && (this.config.screenshotMethod === "dom" ? t = await At(this.config.screenshotOptions) : t = await Ht(this.config.screenshotOptions));
|
|
748
|
+
const i = this.feedbackData.elementSelector ? {
|
|
758
749
|
x: this.selectedBounds.x,
|
|
759
750
|
y: this.selectedBounds.y,
|
|
760
751
|
width: this.selectedBounds.width,
|
|
761
752
|
height: this.selectedBounds.height
|
|
762
|
-
} : null,
|
|
753
|
+
} : null, o = {
|
|
763
754
|
feedbackType: this.feedbackData.feedbackType,
|
|
764
755
|
pageUrl: window.location.href,
|
|
765
756
|
apiKey: this.config.apiKey || void 0,
|
|
@@ -775,14 +766,14 @@ class Ft {
|
|
|
775
766
|
screenshot: t,
|
|
776
767
|
visitorId: this.visitorId,
|
|
777
768
|
// Include element bounds and user agent for server-side screenshot fallback
|
|
778
|
-
elementBounds:
|
|
769
|
+
elementBounds: i,
|
|
779
770
|
userAgent: navigator.userAgent
|
|
780
771
|
};
|
|
781
772
|
try {
|
|
782
773
|
const n = await fetch(this.config.endpoint, {
|
|
783
774
|
method: "POST",
|
|
784
775
|
headers: { "Content-Type": "application/json" },
|
|
785
|
-
body: JSON.stringify(
|
|
776
|
+
body: JSON.stringify(o)
|
|
786
777
|
});
|
|
787
778
|
if (n.ok) {
|
|
788
779
|
const a = await n.json();
|
|
@@ -798,16 +789,16 @@ class Ft {
|
|
|
798
789
|
this.backdrop = document.createElement("div"), this.backdrop.className = "qaid-backdrop", this.backdrop.style.zIndex = String(this.config.zIndex + 2), this.backdrop.style.background = `rgba(0, 0, 0, ${this.config.backdropOpacity})`, this.backdrop.addEventListener("click", () => this.closeModal()), this.applyVars(this.backdrop), this.isMobile ? this.showBottomSheet() : this.showPositionedModal(), t.appendChild(this.backdrop), document.addEventListener("keydown", this.boundKeyDown);
|
|
799
790
|
}
|
|
800
791
|
showBottomSheet() {
|
|
801
|
-
const t = this.ensureOverlayHost(),
|
|
802
|
-
|
|
792
|
+
const t = this.ensureOverlayHost(), i = document.createElement("div");
|
|
793
|
+
i.className = "qaid-bottom-sheet", i.style.zIndex = String(this.config.zIndex + 3), i.innerHTML = `
|
|
803
794
|
<div class="qaid-bottom-sheet-content">
|
|
804
795
|
<div class="qaid-bottom-sheet-handle"></div>
|
|
805
796
|
${this.getModalContent()}
|
|
806
797
|
</div>
|
|
807
|
-
`, this.applyVars(
|
|
798
|
+
`, this.applyVars(i), t.appendChild(i), this.modalContainer = i, this.setupModalInteractions();
|
|
808
799
|
}
|
|
809
800
|
showPositionedModal() {
|
|
810
|
-
const t = this.ensureOverlayHost(), { modal:
|
|
801
|
+
const t = this.ensureOverlayHost(), { modal: i, arrow: o } = qt(
|
|
811
802
|
this.selectedBounds,
|
|
812
803
|
window.innerWidth,
|
|
813
804
|
window.innerHeight,
|
|
@@ -819,18 +810,18 @@ class Ft {
|
|
|
819
810
|
viewportPadding: 16
|
|
820
811
|
}
|
|
821
812
|
);
|
|
822
|
-
this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${
|
|
813
|
+
this.modalContainer = document.createElement("div"), this.modalContainer.className = `qaid-modal-container qaid-${i.position}`, this.modalContainer.style.top = `${i.top}px`, this.modalContainer.style.left = `${i.left}px`, this.modalContainer.style.zIndex = String(this.config.zIndex + 3);
|
|
823
814
|
const n = document.createElement("div");
|
|
824
|
-
n.className = "qaid-modal-arrow", n.style.left = `${
|
|
815
|
+
n.className = "qaid-modal-arrow", n.style.left = `${o.left}px`;
|
|
825
816
|
const a = document.createElement("div");
|
|
826
817
|
a.className = "qaid-modal-box", a.innerHTML = this.getModalContent(), this.modalContainer.appendChild(n), this.modalContainer.appendChild(a), this.applyVars(this.modalContainer), t.appendChild(this.modalContainer), this.setupModalInteractions();
|
|
827
818
|
}
|
|
828
819
|
getModalContent() {
|
|
829
|
-
const t = this.feedbackData.feedbackType === "up",
|
|
820
|
+
const t = this.feedbackData.feedbackType === "up", i = this.config.positiveIcon || E, o = this.config.negativeIcon || T;
|
|
830
821
|
return `
|
|
831
822
|
<div class="qaid-modal-header">
|
|
832
823
|
<button type="button" class="${this.config.buttonClass ? `qaid-type-toggle qaid-type-toggle-custom ${this.config.buttonClass} ${t ? "qaid-btn-up" : "qaid-btn-down"}` : `qaid-type-toggle ${t ? "qaid-type-up" : "qaid-type-down"}`}" title="Click to switch">
|
|
833
|
-
${t ?
|
|
824
|
+
${t ? i : o}
|
|
834
825
|
</button>
|
|
835
826
|
<div class="qaid-modal-header-text">
|
|
836
827
|
<h3 class="qaid-modal-title">${this.config.text.modalTitle}</h3>
|
|
@@ -845,19 +836,19 @@ class Ft {
|
|
|
845
836
|
}
|
|
846
837
|
setupModalInteractions() {
|
|
847
838
|
if (!this.modalContainer) return;
|
|
848
|
-
const t = this.modalContainer.querySelector(".qaid-textarea"),
|
|
839
|
+
const t = this.modalContainer.querySelector(".qaid-textarea"), i = this.modalContainer.querySelector(".qaid-btn-submit");
|
|
849
840
|
t && (setTimeout(() => t.focus(), 100), t.addEventListener("input", () => {
|
|
850
|
-
|
|
851
|
-
})),
|
|
852
|
-
const n =
|
|
841
|
+
i && (i.textContent = t.value.trim() ? this.config.text.submitButton : this.config.text.skipButton);
|
|
842
|
+
})), i && i.addEventListener("click", () => {
|
|
843
|
+
const n = t?.value.trim() || null;
|
|
853
844
|
this.submitMessage(n);
|
|
854
845
|
});
|
|
855
|
-
const
|
|
856
|
-
|
|
846
|
+
const o = this.modalContainer.querySelector(".qaid-type-toggle");
|
|
847
|
+
o && o.addEventListener("click", () => {
|
|
857
848
|
const n = this.feedbackData.feedbackType === "up" ? "down" : "up";
|
|
858
|
-
this.feedbackData.feedbackType = n, this.config.buttonClass ? (
|
|
859
|
-
const a = this.config.positiveIcon ||
|
|
860
|
-
|
|
849
|
+
this.feedbackData.feedbackType = n, this.config.buttonClass ? (o.classList.toggle("qaid-btn-up", n === "up"), o.classList.toggle("qaid-btn-down", n === "down")) : (o.classList.toggle("qaid-type-up", n === "up"), o.classList.toggle("qaid-type-down", n === "down"));
|
|
850
|
+
const a = this.config.positiveIcon || E, r = this.config.negativeIcon || T;
|
|
851
|
+
o.innerHTML = n === "up" ? a : r, this.feedbackId && fetch(`${this.config.endpoint}/${this.feedbackId}`, {
|
|
861
852
|
method: "PATCH",
|
|
862
853
|
headers: { "Content-Type": "application/json" },
|
|
863
854
|
body: JSON.stringify({ feedbackType: n })
|
|
@@ -872,8 +863,8 @@ class Ft {
|
|
|
872
863
|
headers: { "Content-Type": "application/json" },
|
|
873
864
|
body: JSON.stringify({ message: t })
|
|
874
865
|
});
|
|
875
|
-
} catch (
|
|
876
|
-
console.error("Failed to submit feedback message:",
|
|
866
|
+
} catch (i) {
|
|
867
|
+
console.error("Failed to submit feedback message:", i);
|
|
877
868
|
}
|
|
878
869
|
this.feedbackId = null;
|
|
879
870
|
}
|
|
@@ -890,7 +881,7 @@ class Ft {
|
|
|
890
881
|
async startRecording() {
|
|
891
882
|
if (!(this.isRecording || this.state !== "IDLE"))
|
|
892
883
|
try {
|
|
893
|
-
this.networkCapture =
|
|
884
|
+
this.networkCapture = Tt(), this.videoRecorder = Rt({
|
|
894
885
|
maxDuration: this.config.videoOptions.maxDuration
|
|
895
886
|
}), this.videoRecorder.onTick((t) => {
|
|
896
887
|
this.updateRecordingTimer(t);
|
|
@@ -914,53 +905,53 @@ class Ft {
|
|
|
914
905
|
showRecordingIndicator() {
|
|
915
906
|
const t = this.ensureOverlayHost();
|
|
916
907
|
this.recordingIndicator = document.createElement("div"), this.recordingIndicator.className = "qaid-recording-indicator", this.recordingIndicator.style.zIndex = String(this.config.zIndex + 100);
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
|
|
908
|
+
const i = document.createElement("div");
|
|
909
|
+
i.className = "qaid-recording-dot";
|
|
910
|
+
const o = document.createElement("span");
|
|
911
|
+
o.className = "qaid-recording-time", o.textContent = this.formatTime(this.config.videoOptions.maxDuration);
|
|
921
912
|
const n = document.createElement("button");
|
|
922
|
-
n.type = "button", n.className = "qaid-recording-stop", n.textContent = "Stop", n.addEventListener("click", () => this.stopRecording()), this.recordingIndicator.appendChild(
|
|
913
|
+
n.type = "button", n.className = "qaid-recording-stop", n.textContent = "Stop", n.addEventListener("click", () => this.stopRecording()), this.recordingIndicator.appendChild(i), this.recordingIndicator.appendChild(o), this.recordingIndicator.appendChild(n), this.applyVars(this.recordingIndicator), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.recordingIndicator);
|
|
923
914
|
}
|
|
924
915
|
updateRecordingTimer(t) {
|
|
925
916
|
if (!this.recordingIndicator) return;
|
|
926
|
-
const
|
|
927
|
-
if (
|
|
928
|
-
const
|
|
929
|
-
|
|
917
|
+
const i = this.recordingIndicator.querySelector(".qaid-recording-time");
|
|
918
|
+
if (i) {
|
|
919
|
+
const o = Math.max(0, this.config.videoOptions.maxDuration - t);
|
|
920
|
+
i.textContent = this.formatTime(o);
|
|
930
921
|
}
|
|
931
922
|
}
|
|
932
923
|
formatTime(t) {
|
|
933
|
-
const
|
|
934
|
-
return `${
|
|
924
|
+
const i = Math.floor(t / 60), o = t % 60;
|
|
925
|
+
return `${i}:${o.toString().padStart(2, "0")}`;
|
|
935
926
|
}
|
|
936
927
|
removeRecordingIndicator() {
|
|
937
928
|
this.recordingIndicator && (this.recordingIndicator.remove(), this.recordingIndicator = null);
|
|
938
929
|
}
|
|
939
930
|
showRecordingPreview() {
|
|
940
931
|
if (!this.recordedBlob) return;
|
|
941
|
-
const t = this.ensureOverlayHost(),
|
|
932
|
+
const t = this.ensureOverlayHost(), i = URL.createObjectURL(this.recordedBlob);
|
|
942
933
|
this.videoPreview = document.createElement("div"), this.videoPreview.className = "qaid-video-preview", this.videoPreview.style.zIndex = String(this.config.zIndex + 100);
|
|
943
|
-
const
|
|
944
|
-
|
|
934
|
+
const o = document.createElement("div");
|
|
935
|
+
o.className = "qaid-video-preview-box";
|
|
945
936
|
const n = document.createElement("h3");
|
|
946
937
|
n.textContent = "Review your recording";
|
|
947
938
|
const a = document.createElement("video");
|
|
948
|
-
a.src =
|
|
949
|
-
const
|
|
950
|
-
|
|
939
|
+
a.src = i, a.controls = !0, a.autoplay = !0, a.muted = !0;
|
|
940
|
+
const r = document.createElement("textarea");
|
|
941
|
+
r.placeholder = "Optional: Describe the issue you recorded...";
|
|
951
942
|
const l = document.createElement("div");
|
|
952
943
|
l.className = "qaid-video-preview-actions";
|
|
953
944
|
const d = document.createElement("button");
|
|
954
945
|
d.type = "button", d.className = "qaid-video-btn qaid-video-btn-cancel", d.textContent = "Cancel", d.addEventListener("click", () => this.cancelRecordingPreview());
|
|
955
|
-
const
|
|
956
|
-
|
|
946
|
+
const s = document.createElement("button");
|
|
947
|
+
s.type = "button", s.className = "qaid-video-btn qaid-video-btn-rerecord", s.textContent = "Re-record", s.addEventListener("click", () => {
|
|
957
948
|
this.cancelRecordingPreview(), this.startRecording();
|
|
958
949
|
});
|
|
959
950
|
const c = document.createElement("button");
|
|
960
951
|
c.type = "button", c.className = "qaid-video-btn qaid-video-btn-send", c.textContent = "Send", c.addEventListener("click", () => {
|
|
961
|
-
const
|
|
962
|
-
this.submitVideoFeedback(
|
|
963
|
-
}), l.appendChild(d), l.appendChild(
|
|
952
|
+
const h = r.value.trim() || null;
|
|
953
|
+
this.submitVideoFeedback(h, c);
|
|
954
|
+
}), l.appendChild(d), l.appendChild(s), l.appendChild(c), o.appendChild(n), o.appendChild(a), o.appendChild(r), o.appendChild(l), this.videoPreview.appendChild(o), this.applyVars(this.videoPreview), this.overlayShadowHost && (this.overlayShadowHost.style.pointerEvents = "auto"), t.appendChild(this.videoPreview), document.addEventListener("keydown", this.boundKeyDown);
|
|
964
955
|
}
|
|
965
956
|
cancelRecordingPreview() {
|
|
966
957
|
this.removeVideoPreview(), this.cleanupRecording();
|
|
@@ -968,19 +959,19 @@ class Ft {
|
|
|
968
959
|
removeVideoPreview() {
|
|
969
960
|
if (this.videoPreview) {
|
|
970
961
|
const t = this.videoPreview.querySelector("video");
|
|
971
|
-
t
|
|
962
|
+
t?.src && URL.revokeObjectURL(t.src), this.videoPreview.remove(), this.videoPreview = null;
|
|
972
963
|
}
|
|
973
964
|
document.removeEventListener("keydown", this.boundKeyDown);
|
|
974
965
|
}
|
|
975
|
-
async submitVideoFeedback(t,
|
|
966
|
+
async submitVideoFeedback(t, i) {
|
|
976
967
|
if (!this.recordedBlob || this.isSendingVideo) return;
|
|
977
|
-
this.isSendingVideo = !0,
|
|
978
|
-
const
|
|
979
|
-
|
|
968
|
+
this.isSendingVideo = !0, i.disabled = !0, i.textContent = "Sending...";
|
|
969
|
+
const o = new FormData();
|
|
970
|
+
o.append("video", this.recordedBlob, `recording.${this.recordedBlob.type.includes("mp4") ? "mp4" : "webm"}`), o.append("pageUrl", window.location.href), o.append("visitorId", this.visitorId), this.config.apiKey && o.append("apiKey", this.config.apiKey), t && o.append("message", t), this.consoleCapture && o.append("consoleErrors", JSON.stringify(this.consoleCapture.errors)), this.networkCapture && o.append("networkErrors", JSON.stringify(this.networkCapture.errors));
|
|
980
971
|
try {
|
|
981
972
|
const n = await fetch(`${this.config.endpoint}/video`, {
|
|
982
973
|
method: "POST",
|
|
983
|
-
body:
|
|
974
|
+
body: o
|
|
984
975
|
});
|
|
985
976
|
n.ok || console.error("Failed to submit video feedback:", await n.text());
|
|
986
977
|
} catch (n) {
|
|
@@ -993,29 +984,26 @@ class Ft {
|
|
|
993
984
|
}
|
|
994
985
|
setButtonsDisabled(t) {
|
|
995
986
|
if (!this.buttonsContainer) return;
|
|
996
|
-
this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((
|
|
997
|
-
t ?
|
|
987
|
+
this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach((o) => {
|
|
988
|
+
t ? o.classList.contains("qaid-btn-record") || (o.disabled = !0, o.style.opacity = "0.5") : (o.disabled = !1, o.style.opacity = "");
|
|
998
989
|
});
|
|
999
990
|
}
|
|
1000
991
|
/**
|
|
1001
992
|
* Destroy the embed and clean up all resources
|
|
1002
993
|
*/
|
|
1003
994
|
destroy() {
|
|
1004
|
-
this.cleanupRecording(), this.removeVideoPreview(), this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown),
|
|
995
|
+
this.cleanupRecording(), this.removeVideoPreview(), this.consoleCapture && (this.consoleCapture.restore(), this.consoleCapture = null), window.removeEventListener("resize", this.boundResize), document.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("click", this.boundClick, !0), document.body.classList.remove("qaid-targeting", "qaid-type-up"), document.body.style.removeProperty("--qaid-positive"), document.body.style.removeProperty("--qaid-negative"), this.shadowHost && (this.shadowHost.remove(), this.shadowHost = null, this.shadowRoot = null), this.overlayShadowHost && (this.overlayShadowHost.remove(), this.overlayShadowHost = null, this.overlayShadowRoot = null), this.buttonsContainer = null, this.overlayContainer = null, this.captureLayer = null, this.crosshairH = null, this.crosshairV = null, this.scope = null, this.marker = null, this.modalContainer = null, this.backdrop = null, this.tooltipElement = null, lt();
|
|
1005
996
|
}
|
|
1006
997
|
}
|
|
1007
998
|
function _(e) {
|
|
1008
|
-
|
|
1009
|
-
const t = document.querySelector(e);
|
|
1010
|
-
return ((o = t == null ? void 0 : t.textContent) == null ? void 0 : o.trim()) ?? "";
|
|
999
|
+
return document.querySelector(e)?.textContent?.trim() ?? "";
|
|
1011
1000
|
}
|
|
1012
|
-
function
|
|
1013
|
-
var o;
|
|
1001
|
+
function Nt() {
|
|
1014
1002
|
const e = document.querySelector(
|
|
1015
1003
|
'script[type="application/json"][data-feedback-config]'
|
|
1016
1004
|
);
|
|
1017
1005
|
if (!e) return null;
|
|
1018
|
-
const t =
|
|
1006
|
+
const t = e.textContent?.trim();
|
|
1019
1007
|
if (!t) return null;
|
|
1020
1008
|
try {
|
|
1021
1009
|
const i = JSON.parse(t);
|
|
@@ -1024,73 +1012,73 @@ function Wt() {
|
|
|
1024
1012
|
return null;
|
|
1025
1013
|
}
|
|
1026
1014
|
}
|
|
1027
|
-
function
|
|
1015
|
+
function Vt(e) {
|
|
1028
1016
|
const t = e.getAttribute("data-endpoint");
|
|
1029
1017
|
if (!t) return null;
|
|
1030
|
-
const
|
|
1018
|
+
const i = e.getAttribute("data-position"), o = e.getAttribute("data-zindex"), n = e.getAttribute("data-positive-color"), a = e.getAttribute("data-negative-color"), r = e.getAttribute("data-marker-color"), l = e.getAttribute("data-container"), d = e.getAttribute("data-button-class"), s = e.getAttribute("data-skip-targeting"), c = e.getAttribute("data-incognito"), h = e.getAttribute("data-button-size"), u = e.getAttribute("data-offset-x"), p = e.getAttribute("data-offset-y"), b = e.getAttribute("data-modal-width"), f = e.getAttribute("data-backdrop-opacity"), m = e.getAttribute("data-font-family"), v = e.getAttribute("data-font-size"), g = e.getAttribute("data-tooltip"), x = e.getAttribute("data-modal-title"), I = e.getAttribute("data-modal-subtitle"), L = e.getAttribute("data-placeholder"), R = e.getAttribute("data-submit-button"), M = e.getAttribute("data-skip-button"), F = e.getAttribute("data-positive-icon"), W = e.getAttribute("data-negative-icon"), X = e.getAttribute("data-api-key"), j = e.getAttribute("data-capture-screenshot"), k = e.getAttribute("data-screenshot-quality"), C = e.getAttribute("data-screenshot-max-width"), S = e.getAttribute("data-screenshot-max-height"), K = e.getAttribute("data-capture-video"), Y = e.getAttribute("data-hide-thumbs"), D = e.getAttribute("data-video-max-duration"), J = e.getAttribute("data-screenshot-method"), G = e.getAttribute("data-direction"), H = e.getAttribute("data-css-selector");
|
|
1031
1019
|
return {
|
|
1032
1020
|
endpoint: t,
|
|
1033
|
-
css:
|
|
1034
|
-
apiKey:
|
|
1035
|
-
captureScreenshot:
|
|
1036
|
-
screenshotOptions:
|
|
1037
|
-
quality:
|
|
1038
|
-
maxWidth:
|
|
1039
|
-
maxHeight:
|
|
1021
|
+
css: H ? _(H) : void 0,
|
|
1022
|
+
apiKey: X ?? void 0,
|
|
1023
|
+
captureScreenshot: j === "true" ? !0 : void 0,
|
|
1024
|
+
screenshotOptions: k || C || S ? {
|
|
1025
|
+
quality: k ? parseFloat(k) : void 0,
|
|
1026
|
+
maxWidth: C ? parseInt(C, 10) : void 0,
|
|
1027
|
+
maxHeight: S ? parseInt(S, 10) : void 0
|
|
1040
1028
|
} : void 0,
|
|
1041
1029
|
container: l ?? void 0,
|
|
1042
1030
|
buttonClass: d ?? void 0,
|
|
1043
|
-
direction:
|
|
1044
|
-
position:
|
|
1045
|
-
zIndex:
|
|
1046
|
-
skipTargeting:
|
|
1031
|
+
direction: G ?? void 0,
|
|
1032
|
+
position: i ?? void 0,
|
|
1033
|
+
zIndex: o ? parseInt(o, 10) : void 0,
|
|
1034
|
+
skipTargeting: s === "true" ? !0 : void 0,
|
|
1047
1035
|
incognito: c === "true" ? !0 : void 0,
|
|
1048
|
-
buttonSize:
|
|
1049
|
-
offset:
|
|
1050
|
-
x:
|
|
1051
|
-
y:
|
|
1036
|
+
buttonSize: h ?? void 0,
|
|
1037
|
+
offset: u || p ? {
|
|
1038
|
+
x: u ? parseInt(u, 10) : void 0,
|
|
1039
|
+
y: p ? parseInt(p, 10) : void 0
|
|
1052
1040
|
} : void 0,
|
|
1053
1041
|
modalWidth: b ? parseInt(b, 10) : void 0,
|
|
1054
|
-
backdropOpacity:
|
|
1042
|
+
backdropOpacity: f ? parseFloat(f) : void 0,
|
|
1055
1043
|
fontFamily: m ?? void 0,
|
|
1056
1044
|
fontSize: v ? parseInt(v, 10) : void 0,
|
|
1057
1045
|
colors: {
|
|
1058
1046
|
positive: n ?? void 0,
|
|
1059
1047
|
negative: a ?? void 0,
|
|
1060
|
-
marker:
|
|
1048
|
+
marker: r ?? void 0
|
|
1061
1049
|
},
|
|
1062
|
-
text:
|
|
1063
|
-
tooltip:
|
|
1050
|
+
text: g || x || I || L || R || M ? {
|
|
1051
|
+
tooltip: g ?? void 0,
|
|
1064
1052
|
modalTitle: x ?? void 0,
|
|
1065
|
-
modalSubtitle:
|
|
1066
|
-
placeholder:
|
|
1067
|
-
submitButton:
|
|
1053
|
+
modalSubtitle: I ?? void 0,
|
|
1054
|
+
placeholder: L ?? void 0,
|
|
1055
|
+
submitButton: R ?? void 0,
|
|
1068
1056
|
skipButton: M ?? void 0
|
|
1069
1057
|
} : void 0,
|
|
1070
|
-
positiveIcon:
|
|
1071
|
-
negativeIcon:
|
|
1072
|
-
screenshotMethod:
|
|
1073
|
-
captureVideo:
|
|
1074
|
-
hideThumbs:
|
|
1075
|
-
videoOptions:
|
|
1076
|
-
maxDuration: parseInt(
|
|
1058
|
+
positiveIcon: F ?? void 0,
|
|
1059
|
+
negativeIcon: W ?? void 0,
|
|
1060
|
+
screenshotMethod: J ?? void 0,
|
|
1061
|
+
captureVideo: K === "true" ? !0 : void 0,
|
|
1062
|
+
hideThumbs: Y === "true" ? !0 : void 0,
|
|
1063
|
+
videoOptions: D ? {
|
|
1064
|
+
maxDuration: parseInt(D, 10)
|
|
1077
1065
|
} : void 0
|
|
1078
1066
|
};
|
|
1079
1067
|
}
|
|
1080
1068
|
if (typeof document < "u") {
|
|
1081
1069
|
const e = () => {
|
|
1082
|
-
const t = document.currentScript,
|
|
1083
|
-
n
|
|
1070
|
+
const t = document.currentScript, i = Nt(), o = t ? Vt(t) : null, n = i ?? o;
|
|
1071
|
+
n?.endpoint && new $t(n);
|
|
1084
1072
|
};
|
|
1085
1073
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", e) : e();
|
|
1086
1074
|
}
|
|
1087
1075
|
export {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1076
|
+
$t as QaidFeedback,
|
|
1077
|
+
At as captureDomScreenshot,
|
|
1078
|
+
Tt as captureNetworkErrors,
|
|
1079
|
+
Rt as createVideoRecorder,
|
|
1080
|
+
Lt as getSupportedMimeType,
|
|
1081
|
+
Ut as isDomScreenshotSupported,
|
|
1082
|
+
It as isVideoRecordingSupported
|
|
1095
1083
|
};
|
|
1096
1084
|
//# sourceMappingURL=qaid.js.map
|