@feedbackrelay/web 0.0.0-stage → 0.1.1
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/AGENTS.md +77 -0
- package/LICENSE +202 -0
- package/README.md +331 -2
- package/THIRD_PARTY_NOTICES +127 -0
- package/dist/chunk-XFS2L2L2.js +1 -0
- package/dist/html2canvas.esm-YU5VG5Y4.js +28 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1 -0
- package/dist/replay.d.ts +28 -0
- package/dist/replay.js +1 -0
- package/dist/types-NumvllwL.d.ts +73 -0
- package/package.json +59 -4
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Third-party notices for the bundled DOM capture renderer.
|
|
2
|
+
Relay SDK code is licensed under Apache-2.0; bundled components retain the licenses below.
|
|
3
|
+
|
|
4
|
+
html2canvas
|
|
5
|
+
===========
|
|
6
|
+
Copyright (c) 2012 Niklas von Hertzen
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person
|
|
9
|
+
obtaining a copy of this software and associated documentation
|
|
10
|
+
files (the "Software"), to deal in the Software without
|
|
11
|
+
restriction, including without limitation the rights to use,
|
|
12
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the
|
|
14
|
+
Software is furnished to do so, subject to the following
|
|
15
|
+
conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be
|
|
18
|
+
included in all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
21
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
22
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
23
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
24
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
25
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
26
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
27
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
css-line-break
|
|
30
|
+
==============
|
|
31
|
+
Copyright (c) 2017 Niklas von Hertzen
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person
|
|
34
|
+
obtaining a copy of this software and associated documentation
|
|
35
|
+
files (the "Software"), to deal in the Software without
|
|
36
|
+
restriction, including without limitation the rights to use,
|
|
37
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
38
|
+
copies of the Software, and to permit persons to whom the
|
|
39
|
+
Software is furnished to do so, subject to the following
|
|
40
|
+
conditions:
|
|
41
|
+
|
|
42
|
+
The above copyright notice and this permission notice shall be
|
|
43
|
+
included in all copies or substantial portions of the Software.
|
|
44
|
+
|
|
45
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
46
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
47
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
48
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
49
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
50
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
51
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
52
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
53
|
+
|
|
54
|
+
text-segmentation
|
|
55
|
+
=================
|
|
56
|
+
Copyright (c) 2021 Niklas von Hertzen
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person
|
|
59
|
+
obtaining a copy of this software and associated documentation
|
|
60
|
+
files (the "Software"), to deal in the Software without
|
|
61
|
+
restriction, including without limitation the rights to use,
|
|
62
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
63
|
+
copies of the Software, and to permit persons to whom the
|
|
64
|
+
Software is furnished to do so, subject to the following
|
|
65
|
+
conditions:
|
|
66
|
+
|
|
67
|
+
The above copyright notice and this permission notice shall be
|
|
68
|
+
included in all copies or substantial portions of the Software.
|
|
69
|
+
|
|
70
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
71
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
72
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
73
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
74
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
75
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
76
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
77
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
78
|
+
|
|
79
|
+
utrie
|
|
80
|
+
=====
|
|
81
|
+
Copyright (c) 2021 Niklas von Hertzen
|
|
82
|
+
|
|
83
|
+
Permission is hereby granted, free of charge, to any person
|
|
84
|
+
obtaining a copy of this software and associated documentation
|
|
85
|
+
files (the "Software"), to deal in the Software without
|
|
86
|
+
restriction, including without limitation the rights to use,
|
|
87
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
88
|
+
copies of the Software, and to permit persons to whom the
|
|
89
|
+
Software is furnished to do so, subject to the following
|
|
90
|
+
conditions:
|
|
91
|
+
|
|
92
|
+
The above copyright notice and this permission notice shall be
|
|
93
|
+
included in all copies or substantial portions of the Software.
|
|
94
|
+
|
|
95
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
96
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
97
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
98
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
99
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
100
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
101
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
102
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
103
|
+
|
|
104
|
+
base64-arraybuffer
|
|
105
|
+
==================
|
|
106
|
+
Copyright (c) 2012 Niklas von Hertzen
|
|
107
|
+
|
|
108
|
+
Permission is hereby granted, free of charge, to any person
|
|
109
|
+
obtaining a copy of this software and associated documentation
|
|
110
|
+
files (the "Software"), to deal in the Software without
|
|
111
|
+
restriction, including without limitation the rights to use,
|
|
112
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
113
|
+
copies of the Software, and to permit persons to whom the
|
|
114
|
+
Software is furnished to do so, subject to the following
|
|
115
|
+
conditions:
|
|
116
|
+
|
|
117
|
+
The above copyright notice and this permission notice shall be
|
|
118
|
+
included in all copies or substantial portions of the Software.
|
|
119
|
+
|
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
121
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
122
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
123
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
124
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
125
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
126
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
127
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var P=!1;async function q({signal:t,privateSelectors:o=[],maxEdge:r},s){if(t.aborted||P)return;P=!0;let c,i,w,y,a,g;try{if(c=window.innerWidth,i=window.innerHeight,w=window.scrollX,y=window.scrollY,a=Math.min(window.devicePixelRatio||1,2),r!==void 0&&(a=Math.min(1,r/Math.max(c,i))),!(c>0&&i>0&&Number.isFinite(c+i+a))){P=!1;return}g=["input[type='password']","[data-relay-private]",...o].join(",")}catch{P=!1;return}let u=!1,R,O,E=()=>{try{O?.remove()}catch{}},m,A=new Promise(p=>{m=()=>{u=!0,E(),p(void 0)},R=setTimeout(m,5e3),t.addEventListener("abort",m,{once:!0})}),D=(async()=>{let{default:p}=await import("./html2canvas.esm-YU5VG5Y4.js");if(u||t.aborted)return;let e=new Set,n=f=>{f.querySelectorAll(g).forEach(x=>{e.add(x),x.localName==="slot"&&f instanceof ShadowRoot&&e.add(f.host)}),f.querySelectorAll("*").forEach(x=>{x.shadowRoot&&n(x.shadowRoot)})};if(n(document),e.has(document.documentElement)||e.has(document.body))return;let l=new Set(document.querySelectorAll("iframe.html2canvas-container")),S=p(document.documentElement,{x:w,y,width:c,height:i,windowWidth:c,windowHeight:i,scrollX:w,scrollY:y,scale:a,allowTaint:!1,useCORS:!0,logging:!1,imageTimeout:1e3,removeContainer:!0,ignoreElements:f=>f.localName==="iframe"||e.has(f),onclone:f=>{if(O=f.defaultView?.frameElement??O,u||t.aborted)throw E(),new Error("Relay capture cancelled.")}});O??=Array.from(document.querySelectorAll("iframe.html2canvas-container")).find(f=>!l.has(f));let h=await S;try{if(u||t.aborted)return;let f=await s(h);return!u&&!t.aborted?f:void 0}finally{h.width=h.height=0}})().catch(()=>{}).finally(()=>{P=!1});try{return await Promise.race([D,A])}finally{u=!0,clearTimeout(R),t.removeEventListener("abort",m),E()}}function B(t){return q(t,async o=>{let r=await new Promise(s=>o.toBlob(s,"image/png"));return r?{mimeType:"image/png",width:o.width,height:o.height,blob:r}:void 0})}function J(t,o){return q(t,async r=>(o(r),!0))}var L=/password|passwd|secret|token$|authorization|cookie|api.?key|private.?key/i;function $(t){let o=0;for(let r of t){let s=r.codePointAt(0);o+=s<=127?1:s<=2047?2:s<=65535?3:4}return o}function z(t){let o=new WeakMap,r=Date.now(),s=24*1024,c=0,i=!1,w=e=>$(JSON.stringify(e)),y=()=>s<256||c>=500||Date.now()-r>25,a=e=>{let n={$type:e};return s-=w(n),n},g=(e,n=8192)=>{let l=e.slice(0,n);for(;$(l)>n;)l=l.slice(0,Math.floor(l.length*.75));return l.length<e.length&&(i=!0),/[\uD800-\uDBFF]$/.test(l)&&(l=l.slice(0,-1)),l},u=e=>{let n=w(e);return n>s?(i=!0,a("truncated")):(s-=n,e)},R=(e,n,l=!1)=>{let S=e;for(let h=0;S&&h<5;h++,S=Object.getPrototypeOf(S)){let f=Object.getOwnPropertyDescriptor(S,n);if(f){if("value"in f)return f.value;if(typeof DOMException<"u"&&(n==="name"||n==="message"||n==="code"))try{let x=Object.getOwnPropertyDescriptor(DOMException.prototype,n)?.get;if(x)return x.call(e)}catch{}return l&&f.get&&Function.prototype.toString.call(f.get).includes("[native code]")?Reflect.get(e,n):{$type:"accessor"}}}},O=e=>{let n=R(e,"constructor"),l=typeof n=="function"?R(n,"name"):void 0;return typeof l=="string"?g(l,128):"object"},E=e=>{let n=Error.isError;if(n?n(e):e instanceof Error)return!0;if(!e||typeof e!="object")return!1;if(typeof DOMException<"u"&&(e instanceof DOMException||O(e)==="DOMException"))try{return Object.getOwnPropertyDescriptor(DOMException.prototype,"name").get.call(e),!0}catch{}if(n)return!1;let l=Object.getPrototypeOf(e);for(let S=0;l&&S<5;S++,l=Object.getPrototypeOf(l)){let h=Object.getOwnPropertyDescriptor(l,"constructor")?.value;if(typeof h=="function"&&Function.prototype.toString.call(h)===Function.prototype.toString.call(Error))return!0}return!1};function m(e,n,l){if(++c>500||l>8||y())return i=!0,a("truncated");if(e===null||typeof e=="boolean")return u(e);if(typeof e=="string")return u(g(e));if(typeof e=="number")return Number.isFinite(e)?u(e):u({$type:"number",value:String(e)});if(typeof e>"u")return a("undefined");if(typeof e=="bigint")return e>10n**1000n||e<-(10n**1000n)?(i=!0,a("bigint-too-large")):u({$type:"bigint",value:e.toString()});if(typeof e=="symbol")return u({$type:"symbol",value:g(String(e))});if(typeof e=="function")try{let h=R(e,"name");return u({$type:"function",name:typeof h=="string"?g(h,128):""})}catch{return a("unavailable")}let S=o.get(e);if(S!==void 0)return u({$ref:S});o.set(e,n);try{if(e instanceof Date){let d=Date.prototype.getTime.call(e);return u({$type:"date",value:Number.isFinite(d)?Date.prototype.toISOString.call(e):"Invalid Date"})}if(e instanceof Map||e instanceof Set){let d=[],b=e instanceof Map,I=b?Map.prototype.entries.call(e):Set.prototype.values.call(e);s-=40;for(let T of I){if(d.length>=50||y()){i=!0,d.push(a("truncated"));break}let M=`${n}/values/${d.length}`;d.push(b&&typeof T[0]=="string"&&L.test(T[0])?[m(T[0],`${M}/0`,l+1),a("redacted")]:m(T,M,l+1))}return{$type:b?"map":"set",values:d}}if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer){let d=e instanceof ArrayBuffer?ArrayBuffer.prototype:e instanceof DataView?DataView.prototype:Object.getPrototypeOf(Uint8Array.prototype),b=Object.getOwnPropertyDescriptor(d,"byteLength").get.call(e);return u({$type:"bytes",byteLength:b})}if(Array.isArray(e)){let d=[];s-=2;for(let b=0;b<e.length;b++){if(b>=50||y()){i=!0,d.push(a("truncated"));break}let I=Object.getOwnPropertyDescriptor(e,String(b));d.push(I&&"value"in I?m(I.value,`${n}/${b}`,l+1):a(I?"accessor":"empty")),s--}return d}let h=Object.create(null);s-=2;let f=E(e),x=f?"error":O(e);x!=="Object"&&x!=="object"&&(h.$type=u(x));let j=0,N=(d,b)=>{if(d.length>128){i=!0;return}s-=w(d)+2,h[d]=L.test(d)?a("redacted"):m(b,`${n}/${d.replace(/~/g,"~0").replace(/\//g,"~1")}`,l+1),j++};if(f)for(let d of["name","message","stack","cause","errors","code"]){if(y()){i=!0;break}try{let b=R(e,d,d==="stack");b!==void 0&&N(d,b)}catch{h[d]=a("unavailable")}}for(let d in e){if(j>=50||y()){i=!0,h.$truncated=!0;break}if(!Object.hasOwn(e,d)||Object.hasOwn(h,d))continue;let b=Object.getOwnPropertyDescriptor(e,d);b&&N(d,"value"in b?b.value:{$type:"accessor"})}return h}catch{return a("unavailable")}}let A;try{A=t===null?"null":E(t)?"error":Array.isArray(t)?"array":typeof t}catch{A="unavailable"}let D;try{D=m(t,"#",0)}catch{D={$type:"unavailable"}}return w({type:A,value:D,truncated:i})>32*1024&&(D={$type:"truncated",reason:"byte-limit"},i=!0),{type:A,value:D,truncated:i}}var k=class extends Error{constructor(r,s,c){super(c);this.code=r;this.submissionId=s}code;submissionId;name="RelaySendError"};function C(t,o){if(t.blob.size>8*1024*1024)throw new k("screenshot-too-large",o,"Screenshot exceeds 8 MiB. Retry with screenshot: false and the same submissionId.");return{mimeType:t.mimeType,width:t.width,height:t.height,byteSize:t.blob.size}}function V(t,o){let r=new URL(t);if(!/^https?:\/\//i.test(t)||!/^https?:$/.test(r.protocol)||!r.hostname||r.username||r.password||r.href.includes("#")||o&&r.href.includes("?"))throw new TypeError("Relay requires an HTTP(S) URL without credentials, a fragment or a base query.");return o?r.href.replace(/\/+$/,""):r.href}async function F(t,o){let s=t.headers?.get("Content-Length");if(s&&/^\d+$/.test(s)&&Number(s)>65536){try{t.body?.cancel().catch(()=>{})}catch{}throw new Error("Relay response exceeds 64 KiB.")}let c="";if(t.body){let i=t.body.getReader(),w=()=>{try{i.cancel().catch(()=>{})}catch{}};o.addEventListener("abort",w,{once:!0});let y=new TextDecoder,a=0;try{if(o.aborted)throw w(),new Error("Relay request cancelled.");for(;;){let{done:g,value:u}=await i.read();if(o.aborted)throw new Error("Relay request cancelled.");if(g)break;if(a+=u.byteLength,a>65536)throw w(),new Error("Relay response exceeds 64 KiB.");c+=y.decode(u,{stream:!0})}c+=y.decode()}finally{o.removeEventListener("abort",w);try{i.releaseLock()}catch{}}}else if(c=await t.text(),$(c)>65536)throw new Error("Relay response exceeds 64 KiB.");return JSON.parse(c)}async function v(t,o,r,s=!0){let c=new AbortController,i=()=>c.abort();r.aborted?i():r.addEventListener("abort",i,{once:!0});let w=setTimeout(i,3e4);try{if(c.signal.aborted)throw new Error("Relay request cancelled.");let y=await fetch(t,{...o,signal:c.signal,credentials:"omit",redirect:"error"});if(c.signal.aborted)throw new Error("Relay request cancelled.");if(!y.ok||!s){try{y.body?.cancel().catch(()=>{})}catch{}if(!y.ok)throw new Error("Relay request failed.");return}let a=await F(y,c.signal);if(c.signal.aborted)throw new Error("Relay request cancelled.");return a}finally{clearTimeout(w),r.removeEventListener("abort",i)}}function X(t){let{teamId:o,relayId:r,publishableKey:s}=t;if(typeof o!="string"||!o.trim()||o==="."||o===".."||typeof s!="string"||!s||/[^\x21-\x7e]/.test(s))throw new TypeError("Relay requires a teamId and a visible-ASCII publishableKey.");if(typeof r!="string"||!r.trim()||r.length>128||r==="."||r==="..")throw new TypeError("relayId must be 1 to 128 characters and cannot equal '.' or '..'.");let c=t.baseUrl;if(c!==void 0&&typeof c!="string")throw new TypeError("baseUrl must be a string.");let i=V(c===void 0?"https://api.feedbackrelay.app":c,!0),w=`${i}/v1/sdk/teams/${encodeURIComponent(o)}/relays/${encodeURIComponent(r)}`,y=async(a,g,u,R)=>{let O=JSON.stringify(g);if($(O)>128*1024)throw new Error("Relay submission exceeds 128 KiB.");let E={"X-Relay-Key":s};R?R.append("_relay_metadata",O):E["Content-Type"]="application/json";let m=await v(a,{method:"POST",headers:E,body:R??O},u);if(!m||typeof m!="object"||Array.isArray(m))throw new Error("Invalid Relay response.");return m};return{scope:{baseUrl:i,teamId:o,relayId:r,publishableKey:s},async submit(a,g,u){let R=p=>{if(!("receipt"in p))return;let e=p.receipt;if(!e||typeof e.id!="string"||!e.id||e.submissionId!==a.submissionId||typeof e.receivedAt!="string"||!Number.isFinite(Date.parse(e.receivedAt)))throw new Error("Invalid Relay receipt.");return{id:e.id,submissionId:e.submissionId,receivedAt:e.receivedAt}},{screenshot:O,...E}=a;u&&delete E.data;let m,A;if(O){m=C(O,a.submissionId);let p=await y(`${w}/uploads`,{submissionId:a.submissionId,screenshot:m},g),e=R(p);if(e)return e;if(typeof p.uploadId!="string"||!p.uploadId||p.uploadId.length>128||typeof p.url!="string"||typeof p.expiresAt!="string"||!Number.isFinite(Date.parse(p.expiresAt))||!p.fields||typeof p.fields!="object"||Array.isArray(p.fields))throw new Error("Invalid Relay upload ticket.");let n=new FormData;for(let[l,S]of Object.entries(p.fields)){if(typeof S!="string")throw new Error("Invalid Relay upload field.");n.append(l,S)}n.append("file",O.blob,`${a.submissionId}.png`),await v(V(p.url,!1),{method:"POST",body:n},g,!1),A=p.uploadId}let D=R(await y(w,{...E,...m?{screenshot:m,uploadId:A}:{}},g,u));if(!D)throw new Error("Missing Relay receipt.");return D}}}export{B as a,J as b,$ as c,z as d,k as e,C as f,V as g,v as h,X as i};
|