diff --git a/package.json b/package.json index 0daf4f6..3f511db 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "probely-record-sequence", - "version": "0.0.4", - "description": "Probely Record login/sequence", + "name": "snyk-api-and-web-record-sequence", + "version": "0.0.7", + "description": "Snyk API & Web Record login/sequence", "license": "MIT", "scripts": { "build": "node utils/build.js", diff --git a/src/assets/img/icon-128.png b/src/assets/img/icon-128.png index b090615..40eca3e 100644 Binary files a/src/assets/img/icon-128.png and b/src/assets/img/icon-128.png differ diff --git a/src/assets/img/icon-34-recording.png b/src/assets/img/icon-34-recording.png index 7f45dcd..a8eddcb 100644 Binary files a/src/assets/img/icon-34-recording.png and b/src/assets/img/icon-34-recording.png differ diff --git a/src/assets/img/icon-34.png b/src/assets/img/icon-34.png index 9e4650b..31164f7 100644 Binary files a/src/assets/img/icon-34.png and b/src/assets/img/icon-34.png differ diff --git a/src/assets/img/icon-48.png b/src/assets/img/icon-48.png index 04fddab..e641eac 100644 Binary files a/src/assets/img/icon-48.png and b/src/assets/img/icon-48.png differ diff --git a/src/assets/img/logo_probely.svg b/src/assets/img/logo_probely.svg index f2ddf86..084ca99 100644 --- a/src/assets/img/logo_probely.svg +++ b/src/assets/img/logo_probely.svg @@ -1,31 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/src/manifest-chrome.json b/src/manifest-chrome.json index bbf1bd0..3752d7e 100755 --- a/src/manifest-chrome.json +++ b/src/manifest-chrome.json @@ -1,6 +1,6 @@ { "manifest_version": 3, - "name": "Probely Sequence Recorder", + "name": "Snyk API & Web Sequence Recorder", "action": { "default_popup": "popup.html", "default_icon": { diff --git a/src/manifest-firefox.json b/src/manifest-firefox.json index 2826968..df4912c 100755 --- a/src/manifest-firefox.json +++ b/src/manifest-firefox.json @@ -1,6 +1,6 @@ { - "name": "Probely Sequence Recorder", - "version": "0.0.4", + "name": "Snyk API & Web Sequence Recorder", + "version": "0.0.7", "browser_specific_settings": { "gecko": { "id": "sequence-recorder@probely.com", diff --git a/src/manifest.json b/src/manifest.json index bbf1bd0..3752d7e 100755 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 3, - "name": "Probely Sequence Recorder", + "name": "Snyk API & Web Sequence Recorder", "action": { "default_popup": "popup.html", "default_icon": { diff --git a/src/pages/Content/modules/collectEvents.js b/src/pages/Content/modules/collectEvents.js index f96b227..d36c248 100644 --- a/src/pages/Content/modules/collectEvents.js +++ b/src/pages/Content/modules/collectEvents.js @@ -22,7 +22,22 @@ let stoMouseover = false; export function interceptEvents(event, doc, ifrSelector, callback) { let hasKeyReturn = false; - const tgt = event.target; + let tgt = null; + let composedPath = null; + if (event && event.composed && event.composedPath) { + composedPath = event.composedPath(); + } + let shadowRootIdx = -1; + if (composedPath && composedPath.length > 0) { + shadowRootIdx = composedPath.findIndex( + (item) => item instanceof ShadowRoot + ); + } + if (shadowRootIdx > -1) { + tgt = composedPath[0]; + } else { + tgt = event.target; + } const type = event.type; let nodeName = null; let nodeType = null; @@ -74,12 +89,20 @@ export function interceptEvents(event, doc, ifrSelector, callback) { if (selector && selector.toLowerCase() === 'html') { return; } - const xpath = getXPath(bestElm, doc); + let xpath = null; + try { + xpath = getXPath(bestElm, doc); + } catch (ex) { + // ignore + } + if (shadowRootIdx > -1) { + xpath = '/html/node/shadow'; + } let oEventBase = { timestamp: new Date().getTime(), css: selector || tgt, - xpath: xpath, + xpath: xpath || '', }; let oEventToSend = {}; diff --git a/src/pages/Popup/Popup.jsx b/src/pages/Popup/Popup.jsx index b50e0cc..159958e 100644 --- a/src/pages/Popup/Popup.jsx +++ b/src/pages/Popup/Popup.jsx @@ -3,7 +3,7 @@ import logo from '../../assets/img/logo_probely.svg'; import help from '../../assets/img/help.svg'; import './Popup.css'; -const helpURL = 'https://help.probely.com/'; +const helpURL = 'https://help.probely.com/en/articles/5402869-how-to-record-a-sequence-with-probely-s-sequence-recorder-plugin'; const Popup = (props) => { // 🔴 @@ -146,7 +146,7 @@ const Popup = (props) => { type: "text/plain;charset=utf-8" }); var a = document.createElement('a'); - a.download = 'probely-recording.json'; + a.download = 'snyk-api-and-web-recording.json'; a.rel = 'noopener'; a.href = URL.createObjectURL(blob); try { @@ -181,7 +181,7 @@ const Popup = (props) => {

- Use this plugin to record a sequence of steps to be followed by Probely during a scan.{' '} + Use this plugin to record a sequence of steps to be followed by Snyk API & Web during a scan.{' '} When you finish recording, upload the script to your target settings.

diff --git a/src/pages/Review/Review.jsx b/src/pages/Review/Review.jsx index d79635b..d950f6b 100644 --- a/src/pages/Review/Review.jsx +++ b/src/pages/Review/Review.jsx @@ -103,7 +103,7 @@ const Review = (props) => { return; } const a = document.createElement('a'); - a.download = 'probely-recording.json'; + a.download = 'snyk-api-and-web-recording.json'; a.rel = 'noopener'; a.href = URL.createObjectURL(blob); try { @@ -255,7 +255,7 @@ const Review = (props) => {

- probely + Snyk API & Web

Sequence Recorder

@@ -285,7 +285,7 @@ const Review = (props) => { onChange={(ev) => { onChangeReviewAdvanced(ev); }} />
-

After saving your sequence, make sure to import it to your target settings at Probely, so it is followed during scans.

+

After saving your sequence, make sure to import it to your target settings at Snyk API & Web, so it is followed during scans.

:

No data has been recorded

}
diff --git a/src/pages/Start/Start.jsx b/src/pages/Start/Start.jsx index 942c592..5424f9e 100644 --- a/src/pages/Start/Start.jsx +++ b/src/pages/Start/Start.jsx @@ -6,7 +6,7 @@ const Start = (props) => {
- probely + Snyk API & Web

Sequence Recorder

diff --git a/test-build-firefox/66ecd5af91720fc7888f.png b/test-build-firefox/66ecd5af91720fc7888f.png new file mode 100644 index 0000000..40eca3e Binary files /dev/null and b/test-build-firefox/66ecd5af91720fc7888f.png differ diff --git a/test-build-firefox/8867f464cc4dd91227f8.svg b/test-build-firefox/8867f464cc4dd91227f8.svg deleted file mode 100644 index f2ddf86..0000000 --- a/test-build-firefox/8867f464cc4dd91227f8.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test-build-firefox/8ed204157dcedddc56f2.png b/test-build-firefox/8ed204157dcedddc56f2.png deleted file mode 100644 index 9e4650b..0000000 Binary files a/test-build-firefox/8ed204157dcedddc56f2.png and /dev/null differ diff --git a/test-build-firefox/adc8b34de96d4007231c.svg b/test-build-firefox/adc8b34de96d4007231c.svg new file mode 100644 index 0000000..084ca99 --- /dev/null +++ b/test-build-firefox/adc8b34de96d4007231c.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test-build-firefox/contentScript.bundle.js b/test-build-firefox/contentScript.bundle.js index fd21228..752465b 100644 --- a/test-build-firefox/contentScript.bundle.js +++ b/test-build-firefox/contentScript.bundle.js @@ -1 +1 @@ -(()=>{"use strict";let e,t;function n(n,o){if(n.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===n.tagName.toLowerCase())return"html";const l={root:document.body,idName:e=>!0,className:e=>!0,tagName:e=>!0,attr:(e,t)=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};e={...l,...o},t=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(e.root,l);let u=r(n,"all",(()=>r(n,"two",(()=>r(n,"one",(()=>r(n,"none")))))));if(u){const e=v(w(u,n));return e.length>0&&(u=e[0]),i(u)}throw new Error("Selector was not found.")}function r(t,n,r){let i=null,l=[],u=t,g=0;for(;u;){let t=h(c(u))||h(...a(u))||h(...s(u))||h(d(u))||[{name:"*",penalty:3}];const y=f(u);if("all"==n)y&&(t=t.concat(t.filter(p).map((e=>m(e,y)))));else if("two"==n)t=t.slice(0,1),y&&(t=t.concat(t.filter(p).map((e=>m(e,y)))));else if("one"==n){const[e]=t=t.slice(0,1);y&&p(e)&&(t=[m(e,y)])}else"none"==n&&(t=[{name:"*",penalty:3}],y&&(t=[m(t[0],y)]));for(let e of t)e.level=g;if(l.push(t),l.length>=e.seedMinLength&&(i=o(l,r),i))break;u=u.parentElement,g++}return i||(i=o(l,r)),!i&&r?r():i}function o(t,n){const r=v(y(t));if(r.length>e.threshold)return n?n():null;for(let e of r)if(u(e))return e;return null}function i(e){let t=e[0],n=t.name;for(let r=1;r ${n}`:`${e[r].name} ${n}`,t=e[r]}return n}function l(e){return e.map((e=>e.penalty)).reduce(((e,t)=>e+t),0)}function u(e){const n=i(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return!0;default:return!1}}function c(t){const n=t.getAttribute("id");return n&&e.idName(n)?{name:"#"+CSS.escape(n),penalty:0}:null}function a(t){const n=Array.from(t.attributes).filter((t=>e.attr(t.name,t.value)));return n.map((e=>({name:`[${CSS.escape(e.name)}="${CSS.escape(e.value)}"]`,penalty:.5})))}function s(t){return Array.from(t.classList).filter(e.className).map((e=>({name:"."+CSS.escape(e),penalty:1})))}function d(t){const n=t.tagName.toLowerCase();return e.tagName(n)?{name:n,penalty:2}:null}function f(e){const t=e.parentNode;if(!t)return null;let n=t.firstChild;if(!n)return null;let r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}function m(e,t){return{name:e.name+`:nth-child(${t})`,penalty:e.penalty+1}}function p(e){return"html"!==e.name&&!e.name.startsWith("#")}function h(...e){const t=e.filter(g);return t.length>0?t:null}function g(e){return null!=e}function*y(e,t=[]){if(e.length>0)for(let n of e[0])yield*y(e.slice(1,e.length),t.concat(n));else yield t}function v(e){return[...e].sort(((e,t)=>l(e)-l(t)))}function*w(t,n,r={counter:0,visited:new Map}){if(t.length>2&&t.length>e.optimizedMinLength)for(let o=1;oe.maxNumberOfTries)return;r.counter+=1;const l=[...t];l.splice(o,1);const c=i(l);if(r.visited.has(c))return;u(l)&&b(l,n)&&(yield l,r.visited.set(c,!0),yield*w(l,n,r))}}function b(e,n){return t.querySelector(i(e))===n}function N(e,t){let n="",r=null,o=!1;try{if(r=e.nodeName&&"string"==typeof e.nodeName?e.nodeName.toLowerCase():null,!r)return null;n=`${r}`,e.getAttribute("id")&&(n=`${n}#${CSS.escape(e.getAttribute("id"))}`,o=!0);const t=["data-test-id","data-testid","data-test","data-cy"];if(e.matches(t.map((e=>`[${e}]`)).join(",")))for(const r of t){const t=e.getAttribute(r);if(t){n=`${n}[${r}="${CSS.escape(t)}"]`;break}}if(["input","button","textarea","select","option"].includes(r)){e.getAttribute("type")&&(n=`${n}[type="${CSS.escape(e.getAttribute("type"))}"]`),e.getAttribute("name")&&(n=`${n}[name="${CSS.escape(e.getAttribute("name"))}"]`);const t=e.closest("form");if(t){let e="form";t.getAttribute("id")&&(e=`${e}#${CSS.escape(t.getAttribute("id"))}`),n=`${e} ${n}`}}const i=e.getAttribute("aria-label");if(i&&!o&&(n=`${n}[aria-label="${CSS.escape(i)}"]`),n){const t=e.closest("body");if(t)try{1!==t.querySelectorAll(n).length&&(n="")}catch(e){n=""}}}catch(e){}return n}function E(e,t){let n,r=e,o=[];for(;r;){let e=0,n=r.previousElementSibling;for(;n;)n.nodeName===r.nodeName&&e++,n=n.previousElementSibling;let i=r.nodeName.toLowerCase();e>0&&(i=i+"["+(e+1)+"]"),r!==t&&o.unshift(i),r=r.parentNode}if(n="/"+o.join("/"),function(e,t){const n=t.evaluate(e,t,null,XPathResult.ANY_TYPE,null),r=n.iterateNext();return r}(n,t)===e)return n}const L={},S={keydown:null,return:null,blur:null,change:null,click:null,dblclick:null,contextmenu:null,focus:null,mouseover:null,mouseout:null};let C=!1;function A(e,t,r,o){let i=!1;const l=e.target,u=e.type;let c=null,a=null;if(!l||!l.getAttribute)return;c=l.nodeName.toLowerCase(),a=l.getAttribute("type");let s=null,d=null;try{d=function(e){let t=null;try{if(t=e.nodeName&&"string"==typeof e.nodeName?e.nodeName.toLowerCase():null,!t)return e;if(["input","button","a","textarea","select","option","progress"].includes(t))return e;const n=e.closest("button,a");if(n)return n;const r=e.closest("svg");r&&(e=r);const o=["data-test-id","data-testid","data-test","data-cy"];if(e.matches(o.map((e=>`[${e}]`)).join(",")))return e;if(e.parentNode.matches(o.map((e=>`[${e}]`)).join(",")))return e.parentNode}catch(e){}return e}(l),s=N(d)}catch(e){}if(!s)try{s=n(d,{root:t,idName:e=>!/^[0-9]+.*/i.test(e),className:e=>!e.includes("focus")&&!e.includes("highlight")&&!/^[0-9]+.*/i.test(e)})}catch(e){}if(s&&"html"===s.toLowerCase())return;const f=E(d,t);let m={timestamp:(new Date).getTime(),css:s||l,xpath:f},p={};if("click"===u){if(S.click=l,!(S.return!==S.change||l===S.return||"input"!==c&&"button"!==c||"submit"!==a&&"image"!==a||null===S.return))return;if("input"===c&&("checkbox"===a||"radio"===a))return;if("label"===c){const e=l.getAttribute("for");if(e&&document.getElementById(e))return}p={...m,type:"click",value:(l.value||l.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r}}else if("dblclick"===u)S.dblclick=l,p={...m,type:"dblclick",value:(l.value||l.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r};else if("contextmenu"===u)S.contextmenu=l,p={...m,type:"contextmenu",value:(l.value||l.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r};else if("focus"===u);else if("mouseover"===u)C&&(clearTimeout(C),C=!1),C=setTimeout((()=>{C=!1,S.mouseover=l,p={...m,type:"mouseover",value:(l.value||l.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r},p&&p.type&&o&&o({messageType:"events",event:{...p}})}),500);else if("mouseout"===u);else if("keydown"===u)S.keydown=l,["input","textarea"].indexOf(c)>-1&&(L[l]=l.value),"input"===c&&13===e.keyCode&&(i=!0,S.return=l,p={...m,type:"fill_value",value:l.value,frame:r});else if("blur"===u){if(S.blur=l,["input","textarea"].indexOf(c)>-1){if(L[l]=l.value,l===S.return)return void(S.return=null);if("input"===c&&("submit"===l.type||"button"===l.type||"image"===l.type))return;p={...m,type:"fill_value",value:l.value,frame:r}}}else if("change"===u)if(S.change=l,"input"===c)"checkbox"!==a&&"radio"!==a||(p={...m,type:"change",subtype:"check",checked:l.checked,frame:r});else if("select"===c)if(l.multiple){const e=[];for(let t=0;tg(e,s)))));else if(t===n.Two)e=e.slice(0,1),s&&(e=e.concat(e.filter(y).map((e=>g(e,s)))));else if(t===n.One){const[t]=e=e.slice(0,1);s&&y(t)&&(e=[g(t,s)])}for(const t of e)t.level=a;if(l.push(e),l.length>=o.seedMinLength&&(i=u(l,r),i))break;c=c.parentElement,a++}return i||(i=u(l,r)),i}function u(e,t){const n=N(b(e));if(n.length>o.threshold)return t?t():null;for(const e of n)if(s(e))return e;return null}function c(e){let t=e[0],n=t.name;for(let r=1;r ${n}`:`${e[r].name} ${n}`,t=e[r]}return n}function a(e){return e.map((e=>e.penalty)).reduce(((e,t)=>e+t),0)}function s(e){switch(i.querySelectorAll(c(e)).length){case 0:throw new Error(`Can't select any node with this selector: ${c(e)}`);case 1:return!0;default:return!1}}function d(e){const t=e.getAttribute("id");return t&&o.idName(t)?{name:`#${$(t,{isIdentifier:!0})}`,penalty:0}:null}function f(e){return Array.from(e.attributes).filter((e=>o.attr(e.name,e.value))).map((e=>({name:"["+$(e.name,{isIdentifier:!0})+'="'+$(e.value)+'"]',penalty:.5})))}function m(e){return Array.from(e.classList).filter(o.className).map((e=>({name:"."+$(e,{isIdentifier:!0}),penalty:1})))}function p(e){const t=e.tagName.toLowerCase();return o.tagName(t)?{name:t,penalty:2}:null}function h(e){const t=e.parentNode;if(!t)return null;let n=t.firstChild;if(!n)return null;let r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}function g(e,t){return{name:e.name+`:nth-child(${t})`,penalty:e.penalty+1}}function y(e){return"html"!==e.name&&!e.name.startsWith("#")}function v(...e){const t=e.filter(w);return 0a(e)-a(t)))}function E(e,t){return i.querySelector(c(e))===t}(r=n||(n={}))[r.All=0]="All",r[r.Two=1]="Two",r[r.One=2]="One";const L=/[ -,\.\/:-@\[-\^`\{-~]/,S=/[ -,\.\/:-@\[\]\^`\{-~]/,C=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g,A={escapeEverything:!1,isIdentifier:!1,quotes:"single",wrap:!1};function $(e,t={}){const n=Object.assign(Object.assign({},A),t);"single"!==n.quotes&&"double"!==n.quotes&&(n.quotes="single");const r="double"==n.quotes?'"':"'",o=n.isIdentifier,i=e.charAt(0);let l="",u=0;for(const t=e.length;ua||126=a&&u!0,className:()=>!0,tagName:()=>!0,attr:()=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};o=Object.assign(Object.assign({},T),t),i=function(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}(o.root,T);let _=l(e,n.All,(()=>l(e,n.Two,(()=>l(e,n.One)))));if(_){const t=N(function*e(t,n,r={counter:0,visited:new Map}){if(2o.optimizedMinLength)for(let i=1;io.maxNumberOfTries)return;r.counter+=1;const l=[...t];l.splice(i,1);const u=c(l);if(r.visited.has(u))return;s(l)&&E(l,n)&&(yield l,r.visited.set(u,!0),yield*e(l,n,r))}}(_,e));return 0{if(!o.isRecording)return;let i=!1,l=null;function u(e){e&&"mouseover"===e.type&&!i||A(e,window.document,null,(e=>{chrome.runtime.sendMessage(e)}))}function c(e,t){let n=null;try{n=N(e,window.document)}catch(e){}function r(t){A(t,e.contentWindow.document,n,(e=>{chrome.runtime.sendMessage(e)}))}n||(n=$(e,{root:window.document,seedMinLength:3,optimizedMinLength:3}));const i=()=>{try{if(o.isRecording){if(e.contentWindow.____probely_sequence_recorder)return;e.contentWindow.____probely_sequence_recorder=!0,e.contentWindow.document.addEventListener("click",r,!0),e.contentWindow.document.addEventListener("mouseover",r,!0),e.contentWindow.document.addEventListener("dblclick",r,!0),e.contentWindow.document.addEventListener("contextmenu",r,!0),e.contentWindow.document.addEventListener("keydown",r,!0),e.contentWindow.document.addEventListener("blur",r,!0),e.contentWindow.document.addEventListener("change",r,!0)}}catch(e){}};t?i():e.addEventListener("load",i)}o.isRecording&&(t=!0,e=document.title,function(){if(!t)return document.title=`${e}`,r=!1,void(n&&(clearInterval(n),n=!1));n=setInterval((()=>{r?(document.title=`${e}`,r=!1):(document.title=`🔴 ${e}`,r=!0)}),1e3)}(),chrome.runtime.sendMessage({messageType:"events",event:{type:"goto",timestamp:(new Date).getTime(),windowWidth:window.innerWidth,windowHeight:window.innerHeight,url:window.location.href}}),document.addEventListener("click",u,!0),document.addEventListener("mouseover",u,!0),document.addEventListener("dblclick",u,!0),document.addEventListener("contextmenu",u,!0),document.addEventListener("keydown",u,!0),document.addEventListener("blur",u,!0),document.addEventListener("change",u,!0));document.querySelectorAll("iframe, frame").forEach((e=>{c(e),setTimeout((()=>{try{e.contentWindow.____probely_sequence_recorder||c(e,!0)}catch(e){}}),2e3)}));new MutationObserver((async(e,t)=>{i=!0,l&&(clearTimeout(l),l=null),l=setTimeout((()=>{i=!1}),200);for(const t of e)for(let e=0;e-1?[n]:n.querySelectorAll("iframe, frame"),e.forEach((e=>{c(e),setTimeout((()=>{try{e.contentWindow.____probely_sequence_recorder||c(e,!0)}catch(e){}}),2e3)}))}}})).observe(document.body,{attributes:!1,childList:!0,subtree:!0})}))}()})(); \ No newline at end of file +(()=>{"use strict";let e,t;function n(n,o){if(n.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===n.tagName.toLowerCase())return"html";const i={root:document.body,idName:e=>!0,className:e=>!0,tagName:e=>!0,attr:(e,t)=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};e={...i,...o},t=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(e.root,i);let u=r(n,"all",(()=>r(n,"two",(()=>r(n,"one",(()=>r(n,"none")))))));if(u){const e=v(w(u,n));return e.length>0&&(u=e[0]),l(u)}throw new Error("Selector was not found.")}function r(t,n,r){let l=null,i=[],u=t,g=0;for(;u;){let t=h(c(u))||h(...a(u))||h(...s(u))||h(d(u))||[{name:"*",penalty:3}];const y=f(u);if("all"==n)y&&(t=t.concat(t.filter(p).map((e=>m(e,y)))));else if("two"==n)t=t.slice(0,1),y&&(t=t.concat(t.filter(p).map((e=>m(e,y)))));else if("one"==n){const[e]=t=t.slice(0,1);y&&p(e)&&(t=[m(e,y)])}else"none"==n&&(t=[{name:"*",penalty:3}],y&&(t=[m(t[0],y)]));for(let e of t)e.level=g;if(i.push(t),i.length>=e.seedMinLength&&(l=o(i,r),l))break;u=u.parentElement,g++}return l||(l=o(i,r)),!l&&r?r():l}function o(t,n){const r=v(y(t));if(r.length>e.threshold)return n?n():null;for(let e of r)if(u(e))return e;return null}function l(e){let t=e[0],n=t.name;for(let r=1;r ${n}`:`${e[r].name} ${n}`,t=e[r]}return n}function i(e){return e.map((e=>e.penalty)).reduce(((e,t)=>e+t),0)}function u(e){const n=l(e);switch(t.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return!0;default:return!1}}function c(t){const n=t.getAttribute("id");return n&&e.idName(n)?{name:"#"+CSS.escape(n),penalty:0}:null}function a(t){const n=Array.from(t.attributes).filter((t=>e.attr(t.name,t.value)));return n.map((e=>({name:`[${CSS.escape(e.name)}="${CSS.escape(e.value)}"]`,penalty:.5})))}function s(t){return Array.from(t.classList).filter(e.className).map((e=>({name:"."+CSS.escape(e),penalty:1})))}function d(t){const n=t.tagName.toLowerCase();return e.tagName(n)?{name:n,penalty:2}:null}function f(e){const t=e.parentNode;if(!t)return null;let n=t.firstChild;if(!n)return null;let r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}function m(e,t){return{name:e.name+`:nth-child(${t})`,penalty:e.penalty+1}}function p(e){return"html"!==e.name&&!e.name.startsWith("#")}function h(...e){const t=e.filter(g);return t.length>0?t:null}function g(e){return null!=e}function*y(e,t=[]){if(e.length>0)for(let n of e[0])yield*y(e.slice(1,e.length),t.concat(n));else yield t}function v(e){return[...e].sort(((e,t)=>i(e)-i(t)))}function*w(t,n,r={counter:0,visited:new Map}){if(t.length>2&&t.length>e.optimizedMinLength)for(let o=1;oe.maxNumberOfTries)return;r.counter+=1;const i=[...t];i.splice(o,1);const c=l(i);if(r.visited.has(c))return;u(i)&&b(i,n)&&(yield i,r.visited.set(c,!0),yield*w(i,n,r))}}function b(e,n){return t.querySelector(l(e))===n}function N(e,t){let n="",r=null,o=!1;try{if(r=e.nodeName&&"string"==typeof e.nodeName?e.nodeName.toLowerCase():null,!r)return null;n=`${r}`,e.getAttribute("id")&&(n=`${n}#${CSS.escape(e.getAttribute("id"))}`,o=!0);const t=["data-test-id","data-testid","data-test","data-cy"];if(e.matches(t.map((e=>`[${e}]`)).join(",")))for(const r of t){const t=e.getAttribute(r);if(t){n=`${n}[${r}="${CSS.escape(t)}"]`;break}}if(["input","button","textarea","select","option"].includes(r)){e.getAttribute("type")&&(n=`${n}[type="${CSS.escape(e.getAttribute("type"))}"]`),e.getAttribute("name")&&(n=`${n}[name="${CSS.escape(e.getAttribute("name"))}"]`);const t=e.closest("form");if(t){let e="form";t.getAttribute("id")&&(e=`${e}#${CSS.escape(t.getAttribute("id"))}`),n=`${e} ${n}`}}const l=e.getAttribute("aria-label");if(l&&!o&&(n=`${n}[aria-label="${CSS.escape(l)}"]`),n){const t=e.closest("body");if(t)try{1!==t.querySelectorAll(n).length&&(n="")}catch(e){n=""}}}catch(e){}return n}function E(e,t){let n,r=e,o=[];for(;r;){let e=0,n=r.previousElementSibling;for(;n;)n.nodeName===r.nodeName&&e++,n=n.previousElementSibling;let l=r.nodeName.toLowerCase();e>0&&(l=l+"["+(e+1)+"]"),r!==t&&o.unshift(l),r=r.parentNode}if(n="/"+o.join("/"),function(e,t){const n=t.evaluate(e,t,null,XPathResult.ANY_TYPE,null),r=n.iterateNext();return r}(n,t)===e)return n}const L={},S={keydown:null,return:null,blur:null,change:null,click:null,dblclick:null,contextmenu:null,focus:null,mouseover:null,mouseout:null};let C=!1;function A(e,t,r,o){let l=!1,i=null,u=null;e&&e.composed&&e.composedPath&&(u=e.composedPath());let c=-1;u&&u.length>0&&(c=u.findIndex((e=>e instanceof ShadowRoot))),i=c>-1?u[0]:e.target;const a=e.type;let s=null,d=null;if(!i||!i.getAttribute)return;s=i.nodeName.toLowerCase(),d=i.getAttribute("type");let f=null,m=null;try{m=function(e){let t=null;try{if(t=e.nodeName&&"string"==typeof e.nodeName?e.nodeName.toLowerCase():null,!t)return e;if(["input","button","a","textarea","select","option","progress"].includes(t))return e;const n=e.closest("button,a");if(n)return n;const r=e.closest("svg");r&&(e=r);const o=["data-test-id","data-testid","data-test","data-cy"];if(e.matches(o.map((e=>`[${e}]`)).join(",")))return e;if(e.parentNode.matches(o.map((e=>`[${e}]`)).join(",")))return e.parentNode}catch(e){}return e}(i),f=N(m)}catch(e){}if(!f)try{f=n(m,{root:t,idName:e=>!/^[0-9]+.*/i.test(e),className:e=>!e.includes("focus")&&!e.includes("highlight")&&!/^[0-9]+.*/i.test(e)})}catch(e){}if(f&&"html"===f.toLowerCase())return;let p=null;try{p=E(m,t)}catch(e){}c>-1&&(p="/html/node/shadow");let h={timestamp:(new Date).getTime(),css:f||i,xpath:p||""},g={};if("click"===a){if(S.click=i,!(S.return!==S.change||i===S.return||"input"!==s&&"button"!==s||"submit"!==d&&"image"!==d||null===S.return))return;if("input"===s&&("checkbox"===d||"radio"===d))return;if("label"===s){const e=i.getAttribute("for");if(e&&document.getElementById(e))return}g={...h,type:"click",value:(i.value||i.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r}}else if("dblclick"===a)S.dblclick=i,g={...h,type:"dblclick",value:(i.value||i.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r};else if("contextmenu"===a)S.contextmenu=i,g={...h,type:"contextmenu",value:(i.value||i.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r};else if("focus"===a);else if("mouseover"===a)C&&(clearTimeout(C),C=!1),C=setTimeout((()=>{C=!1,S.mouseover=i,g={...h,type:"mouseover",value:(i.value||i.textContent||"").trim().substr(0,20).replace(/\n/gi,""),frame:r},g&&g.type&&o&&o({messageType:"events",event:{...g}})}),500);else if("mouseout"===a);else if("keydown"===a)S.keydown=i,["input","textarea"].indexOf(s)>-1&&(L[i]=i.value),"input"===s&&13===e.keyCode&&(l=!0,S.return=i,g={...h,type:"fill_value",value:i.value,frame:r});else if("blur"===a){if(S.blur=i,["input","textarea"].indexOf(s)>-1){if(L[i]=i.value,i===S.return)return void(S.return=null);if("input"===s&&("submit"===i.type||"button"===i.type||"image"===i.type))return;g={...h,type:"fill_value",value:i.value,frame:r}}}else if("change"===a)if(S.change=i,"input"===s)"checkbox"!==d&&"radio"!==d||(g={...h,type:"change",subtype:"check",checked:i.checked,frame:r});else if("select"===s)if(i.multiple){const e=[];for(let t=0;tg(e,s)))));else if(t===n.Two)e=e.slice(0,1),s&&(e=e.concat(e.filter(y).map((e=>g(e,s)))));else if(t===n.One){const[t]=e=e.slice(0,1);s&&y(t)&&(e=[g(t,s)])}for(const t of e)t.level=a;if(i.push(e),i.length>=o.seedMinLength&&(l=u(i,r),l))break;c=c.parentElement,a++}return l||(l=u(i,r)),l}function u(e,t){const n=N(b(e));if(n.length>o.threshold)return t?t():null;for(const e of n)if(s(e))return e;return null}function c(e){let t=e[0],n=t.name;for(let r=1;r ${n}`:`${e[r].name} ${n}`,t=e[r]}return n}function a(e){return e.map((e=>e.penalty)).reduce(((e,t)=>e+t),0)}function s(e){switch(l.querySelectorAll(c(e)).length){case 0:throw new Error(`Can't select any node with this selector: ${c(e)}`);case 1:return!0;default:return!1}}function d(e){const t=e.getAttribute("id");return t&&o.idName(t)?{name:`#${$(t,{isIdentifier:!0})}`,penalty:0}:null}function f(e){return Array.from(e.attributes).filter((e=>o.attr(e.name,e.value))).map((e=>({name:"["+$(e.name,{isIdentifier:!0})+'="'+$(e.value)+'"]',penalty:.5})))}function m(e){return Array.from(e.classList).filter(o.className).map((e=>({name:"."+$(e,{isIdentifier:!0}),penalty:1})))}function p(e){const t=e.tagName.toLowerCase();return o.tagName(t)?{name:t,penalty:2}:null}function h(e){const t=e.parentNode;if(!t)return null;let n=t.firstChild;if(!n)return null;let r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}function g(e,t){return{name:e.name+`:nth-child(${t})`,penalty:e.penalty+1}}function y(e){return"html"!==e.name&&!e.name.startsWith("#")}function v(...e){const t=e.filter(w);return 0a(e)-a(t)))}function E(e,t){return l.querySelector(c(e))===t}(r=n||(n={}))[r.All=0]="All",r[r.Two=1]="Two",r[r.One=2]="One";const L=/[ -,\.\/:-@\[-\^`\{-~]/,S=/[ -,\.\/:-@\[\]\^`\{-~]/,C=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g,A={escapeEverything:!1,isIdentifier:!1,quotes:"single",wrap:!1};function $(e,t={}){const n=Object.assign(Object.assign({},A),t);"single"!==n.quotes&&"double"!==n.quotes&&(n.quotes="single");const r="double"==n.quotes?'"':"'",o=n.isIdentifier,l=e.charAt(0);let i="",u=0;for(const t=e.length;ua||126=a&&u!0,className:()=>!0,tagName:()=>!0,attr:()=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};o=Object.assign(Object.assign({},T),t),l=function(e,t){return e.nodeType===Node.DOCUMENT_NODE?e:e===t.root?e.ownerDocument:e}(o.root,T);let _=i(e,n.All,(()=>i(e,n.Two,(()=>i(e,n.One)))));if(_){const t=N(function*e(t,n,r={counter:0,visited:new Map}){if(2o.optimizedMinLength)for(let l=1;lo.maxNumberOfTries)return;r.counter+=1;const i=[...t];i.splice(l,1);const u=c(i);if(r.visited.has(u))return;s(i)&&E(i,n)&&(yield i,r.visited.set(u,!0),yield*e(i,n,r))}}(_,e));return 0{if(!o.isRecording)return;let l=!1,i=null;function u(e){e&&"mouseover"===e.type&&!l||A(e,window.document,null,(e=>{chrome.runtime.sendMessage(e)}))}function c(e,t){let n=null;try{n=N(e,window.document)}catch(e){}function r(t){A(t,e.contentWindow.document,n,(e=>{chrome.runtime.sendMessage(e)}))}n||(n=$(e,{root:window.document,seedMinLength:3,optimizedMinLength:3}));const l=()=>{try{if(o.isRecording){if(e.contentWindow.____probely_sequence_recorder)return;e.contentWindow.____probely_sequence_recorder=!0,e.contentWindow.document.addEventListener("click",r,!0),e.contentWindow.document.addEventListener("mouseover",r,!0),e.contentWindow.document.addEventListener("dblclick",r,!0),e.contentWindow.document.addEventListener("contextmenu",r,!0),e.contentWindow.document.addEventListener("keydown",r,!0),e.contentWindow.document.addEventListener("blur",r,!0),e.contentWindow.document.addEventListener("change",r,!0)}}catch(e){}};t?l():e.addEventListener("load",l)}o.isRecording&&(t=!0,e=document.title,function(){if(!t)return document.title=`${e}`,r=!1,void(n&&(clearInterval(n),n=!1));n=setInterval((()=>{r?(document.title=`${e}`,r=!1):(document.title=`🔴 ${e}`,r=!0)}),1e3)}(),chrome.runtime.sendMessage({messageType:"events",event:{type:"goto",timestamp:(new Date).getTime(),windowWidth:window.innerWidth,windowHeight:window.innerHeight,url:window.location.href}}),document.addEventListener("click",u,!0),document.addEventListener("mouseover",u,!0),document.addEventListener("dblclick",u,!0),document.addEventListener("contextmenu",u,!0),document.addEventListener("keydown",u,!0),document.addEventListener("blur",u,!0),document.addEventListener("change",u,!0));document.querySelectorAll("iframe, frame").forEach((e=>{c(e),setTimeout((()=>{try{e.contentWindow.____probely_sequence_recorder||c(e,!0)}catch(e){}}),2e3)}));new MutationObserver((async(e,t)=>{l=!0,i&&(clearTimeout(i),i=null),i=setTimeout((()=>{l=!1}),200);for(const t of e)for(let e=0;e-1?[n]:n.querySelectorAll("iframe, frame"),e.forEach((e=>{c(e),setTimeout((()=>{try{e.contentWindow.____probely_sequence_recorder||c(e,!0)}catch(e){}}),2e3)}))}}})).observe(document.body,{attributes:!1,childList:!0,subtree:!0})}))}()})(); \ No newline at end of file diff --git a/test-build-firefox/df7da346c29ed225f121.png b/test-build-firefox/df7da346c29ed225f121.png new file mode 100644 index 0000000..31164f7 Binary files /dev/null and b/test-build-firefox/df7da346c29ed225f121.png differ diff --git a/test-build-firefox/e1ff029ad955c8c1a09d.png b/test-build-firefox/e1ff029ad955c8c1a09d.png deleted file mode 100644 index b090615..0000000 Binary files a/test-build-firefox/e1ff029ad955c8c1a09d.png and /dev/null differ diff --git a/test-build-firefox/icon-128.png b/test-build-firefox/icon-128.png index b090615..40eca3e 100644 Binary files a/test-build-firefox/icon-128.png and b/test-build-firefox/icon-128.png differ diff --git a/test-build-firefox/icon-34.png b/test-build-firefox/icon-34.png index 9e4650b..31164f7 100644 Binary files a/test-build-firefox/icon-34.png and b/test-build-firefox/icon-34.png differ diff --git a/test-build-firefox/icon-48.png b/test-build-firefox/icon-48.png index 04fddab..e641eac 100644 Binary files a/test-build-firefox/icon-48.png and b/test-build-firefox/icon-48.png differ diff --git a/test-build-firefox/manifest.json b/test-build-firefox/manifest.json index 2826968..df4912c 100644 --- a/test-build-firefox/manifest.json +++ b/test-build-firefox/manifest.json @@ -1,6 +1,6 @@ { - "name": "Probely Sequence Recorder", - "version": "0.0.4", + "name": "Snyk API & Web Sequence Recorder", + "version": "0.0.7", "browser_specific_settings": { "gecko": { "id": "sequence-recorder@probely.com", diff --git a/test-build-firefox/popup.bundle.js b/test-build-firefox/popup.bundle.js index c4c654c..fd23c0e 100644 --- a/test-build-firefox/popup.bundle.js +++ b/test-build-firefox/popup.bundle.js @@ -27,4 +27,4 @@ var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),l=Symbol.for("rea * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -function n(e,t){var n=e.length;e.push(t);e:for(;0>>1,l=e[r];if(!(0>>1;ra(i,n))sa(c,i)?(e[r]=c,e[s]=n,r=s):(e[r]=i,e[u]=n,r=u);else{if(!(sa(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;t.unstable_now=function(){return o.now()}}else{var u=Date,i=u.now();t.unstable_now=function(){return u.now()-i}}var s=[],c=[],f=1,d=null,p=3,m=!1,h=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(c);null!==t;){if(null===t.callback)l(c);else{if(!(t.startTime<=e))break;l(c),t.sortIndex=t.expirationTime,n(s,t)}t=r(c)}}function k(e){if(g=!1,w(e),!h)if(null!==r(s))h=!0,F(S);else{var t=r(c);null!==t&&R(k,t.startTime-e)}}function S(e,n){h=!1,g&&(g=!1,y(_),_=-1),m=!0;var a=p;try{for(w(n),d=r(s);null!==d&&(!(d.expirationTime>n)||e&&!z());){var o=d.callback;if("function"==typeof o){d.callback=null,p=d.priorityLevel;var u=o(d.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?d.callback=u:d===r(s)&&l(s),w(n)}else l(s);d=r(s)}if(null!==d)var i=!0;else{var f=r(c);null!==f&&R(k,f.startTime-n),i=!1}return i}finally{d=null,p=a,m=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var x,E=!1,C=null,_=-1,N=5,P=-1;function z(){return!(t.unstable_now()-Pe||125o?(e.sortIndex=a,n(c,e),null===r(s)&&e===r(c)&&(g?(y(_),_=-1):g=!0,R(k,a-o))):(e.sortIndex=u,n(s,e),h||m||(h=!0,F(S))),e},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},982:(e,t,n)=>{e.exports=n(463)},72:e=>{var t=[];function n(e){for(var n=-1,r=0;r{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},159:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var l=void 0!==n.layer;l&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,l&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function n(r){var l=t[r];if(void 0!==l)return l.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.p="/",n.nc=void 0;var r=n(540),l=n(961);const a=n.p+"8867f464cc4dd91227f8.svg",o=n.p+"d2b15a3067409e19ad1e.svg";var u=n(72),i=n.n(u),s=n(825),c=n.n(s),f=n(659),d=n.n(f),p=n(56),m=n.n(p),h=n(159),g=n.n(h),v=n(113),y=n.n(v),b=n(346),w={};w.styleTagTransform=y(),w.setAttributes=m(),w.insert=d().bind(null,"head"),w.domAPI=c(),w.insertStyleElement=g();i()(b.A,w);b.A&&b.A.locals&&b.A.locals;const k="https://help.probely.com/",S=e=>{const[t,n]=(0,r.useState)(!1),[l,u]=(0,r.useState)(""),[i,s]=(0,r.useState)([]),[c,f]=(0,r.useState)({status:!1,error:!1,msg:"Successfully copied to clipboard"});function d(){chrome.runtime.sendMessage({messageType:"give_recording_data"})}function p(e,t){n(t),!0===t?(s([]),chrome&&((chrome.action||chrome.browserAction).setBadgeText({text:"🔴"},(()=>{})),chrome.storage.sync.set({isRecording:!0},(()=>{chrome.runtime.sendMessage({messageType:"start",event:{type:"goto",timestamp:(new Date).getTime(),windowWidth:null,windowHeight:null,url:l}}),chrome.tabs.create({active:!0,url:l},(e=>{}))})))):(e&&e.preventDefault(),chrome&&((chrome.action||chrome.browserAction).setBadgeText({text:""},(()=>{})),chrome.storage.sync.set({isRecording:!1},(()=>{d(),chrome.tabs.query({active:!0,currentWindow:!0},(e=>{if(e&&e.length){const t=e[0];chrome.tabs.remove(t.id),chrome.tabs.create({active:!0,url:"./review.html"},(e=>{}))}}))}))))}return(0,r.useEffect)((()=>{chrome&&chrome.storage&&(chrome.storage.sync.get(["isRecording"],(e=>{e.isRecording?(n(!0),(chrome.action||chrome.browserAction).setBadgeText({text:"🔴"},(()=>{}))):(n(!1),(chrome.action||chrome.browserAction).setBadgeText({text:""},(()=>{})))})),chrome.runtime.onMessage.addListener(((e,t,n)=>{"recording_data"===e.messageType&&s(e.recordingData||[])})),d())}),[]),r.createElement("div",{className:"App"},r.createElement("header",{className:"App-header"},r.createElement("img",{src:a,className:"App-logo",alt:"logo"}),r.createElement("h1",{className:"App-title"},"Sequence Recorder")),r.createElement("div",{className:"App-container"},r.createElement("p",null,"Use this plugin to record a sequence of steps to be followed by Probely during a scan."," ","When you finish recording, upload the script to your target settings."),r.createElement("p",{className:"help-container"},r.createElement("a",{href:k,className:"help-link",rel:"noreferrer",onClick:e=>{!function(e){e.preventDefault(),chrome.tabs.create({active:!0,url:k},(e=>{}))}(e)}},"Usage instructions ",r.createElement("img",{src:o,className:"help-logo",alt:"Help"})))),r.createElement("form",{method:"post",action:"#",className:"url-form",onSubmit:e=>{!function(e){e.preventDefault(),l&&p(null,!0)}(e)}},r.createElement("div",{className:"input-url-container"},t?null:r.createElement(r.Fragment,null,r.createElement("label",{className:"start_url_label",htmlFor:"start_url"},"Type the start URL to be recorded"),r.createElement("input",{type:"url",name:"start_url",id:"start_url",required:!0,className:"start-url",placeholder:"https://your-target-url.com/",autoComplete:"off",pattern:"^https?://.*",onChange:e=>{!function(e){const t=e.target;u(t.value)}(e)},value:l}))),r.createElement("div",{className:"buttons-container"},t?r.createElement("p",null,r.createElement("a",{href:"#",className:"App-button",onClick:e=>{p(e,!1)}},"Stop recording")):r.createElement("button",{type:"submit",className:"App-button"},i.length?"Start new recording":"Start recording"))),!t&&i.length?r.createElement(r.Fragment,null,r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button",onClick:()=>{!function(){const e=document.getElementById("input-copy-to-clipboard");if(e){e.select();const t=e.value;let n=!1;try{n=document.execCommand("copy")}catch(e){try{window.clipboardData.setData("text",t),n=!0}catch(e){}}n?(f({status:!0,error:!1,msg:"Successfully copied to clipboard"}),setTimeout((()=>{f({status:!1,error:!1,msg:""})}),3e3)):(f({status:!0,error:!0,msg:"Error on copy to clipboard"}),setTimeout((()=>{f({status:!1,error:!1,msg:""})}),5e3))}}()}},"Copy to clipboard")),r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button",onClick:()=>{!function(){var e=new Blob([JSON.stringify(i,null,2)],{type:"text/plain;charset=utf-8"}),t=document.createElement("a");t.download="probely-recording.json",t.rel="noopener",t.href=URL.createObjectURL(e);try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}()}},"Download")),r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button App-button-secondary",onClick:()=>{chrome&&(chrome.runtime.sendMessage({messageType:"clear"}),s([]))}},"Clear recording data"))):null,r.createElement("div",{className:"copy-status-container"},c.status?r.createElement("div",{className:c.error?"copy-status error":"copy-status success"},c.msg):null),i.length?r.createElement("textarea",{id:"input-copy-to-clipboard",defaultValue:JSON.stringify(i,null,2)}):null)};var x=n(812),E={};E.styleTagTransform=y(),E.setAttributes=m(),E.insert=d().bind(null,"head"),E.domAPI=c(),E.insertStyleElement=g();i()(x.A,E);x.A&&x.A.locals&&x.A.locals;(0,l.render)(r.createElement(S,null),window.document.querySelector("#app-container"))})(); \ No newline at end of file +function n(e,t){var n=e.length;e.push(t);e:for(;0>>1,l=e[r];if(!(0>>1;ra(i,n))sa(c,i)?(e[r]=c,e[s]=n,r=s):(e[r]=i,e[u]=n,r=u);else{if(!(sa(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var o=performance;t.unstable_now=function(){return o.now()}}else{var u=Date,i=u.now();t.unstable_now=function(){return u.now()-i}}var s=[],c=[],f=1,d=null,p=3,m=!1,h=!1,g=!1,v="function"==typeof setTimeout?setTimeout:null,y="function"==typeof clearTimeout?clearTimeout:null,b="undefined"!=typeof setImmediate?setImmediate:null;function w(e){for(var t=r(c);null!==t;){if(null===t.callback)l(c);else{if(!(t.startTime<=e))break;l(c),t.sortIndex=t.expirationTime,n(s,t)}t=r(c)}}function k(e){if(g=!1,w(e),!h)if(null!==r(s))h=!0,F(S);else{var t=r(c);null!==t&&R(k,t.startTime-e)}}function S(e,n){h=!1,g&&(g=!1,y(_),_=-1),m=!0;var a=p;try{for(w(n),d=r(s);null!==d&&(!(d.expirationTime>n)||e&&!z());){var o=d.callback;if("function"==typeof o){d.callback=null,p=d.priorityLevel;var u=o(d.expirationTime<=n);n=t.unstable_now(),"function"==typeof u?d.callback=u:d===r(s)&&l(s),w(n)}else l(s);d=r(s)}if(null!==d)var i=!0;else{var f=r(c);null!==f&&R(k,f.startTime-n),i=!1}return i}finally{d=null,p=a,m=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var x,E=!1,C=null,_=-1,N=5,P=-1;function z(){return!(t.unstable_now()-Pe||125o?(e.sortIndex=a,n(c,e),null===r(s)&&e===r(c)&&(g?(y(_),_=-1):g=!0,R(k,a-o))):(e.sortIndex=u,n(s,e),h||m||(h=!0,F(S))),e},t.unstable_shouldYield=z,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},982:(e,t,n)=>{e.exports=n(463)},72:e=>{var t=[];function n(e){for(var n=-1,r=0;r{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},159:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var l=void 0!==n.layer;l&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,l&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}}},t={};function n(r){var l=t[r];if(void 0!==l)return l.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.p="/",n.nc=void 0;var r=n(540),l=n(961);const a=n.p+"adc8b34de96d4007231c.svg",o=n.p+"d2b15a3067409e19ad1e.svg";var u=n(72),i=n.n(u),s=n(825),c=n.n(s),f=n(659),d=n.n(f),p=n(56),m=n.n(p),h=n(159),g=n.n(h),v=n(113),y=n.n(v),b=n(346),w={};w.styleTagTransform=y(),w.setAttributes=m(),w.insert=d().bind(null,"head"),w.domAPI=c(),w.insertStyleElement=g();i()(b.A,w);b.A&&b.A.locals&&b.A.locals;const k="https://help.probely.com/en/articles/5402869-how-to-record-a-sequence-with-probely-s-sequence-recorder-plugin",S=e=>{const[t,n]=(0,r.useState)(!1),[l,u]=(0,r.useState)(""),[i,s]=(0,r.useState)([]),[c,f]=(0,r.useState)({status:!1,error:!1,msg:"Successfully copied to clipboard"});function d(){chrome.runtime.sendMessage({messageType:"give_recording_data"})}function p(e,t){n(t),!0===t?(s([]),chrome&&((chrome.action||chrome.browserAction).setBadgeText({text:"🔴"},(()=>{})),chrome.storage.sync.set({isRecording:!0},(()=>{chrome.runtime.sendMessage({messageType:"start",event:{type:"goto",timestamp:(new Date).getTime(),windowWidth:null,windowHeight:null,url:l}}),chrome.tabs.create({active:!0,url:l},(e=>{}))})))):(e&&e.preventDefault(),chrome&&((chrome.action||chrome.browserAction).setBadgeText({text:""},(()=>{})),chrome.storage.sync.set({isRecording:!1},(()=>{d(),chrome.tabs.query({active:!0,currentWindow:!0},(e=>{if(e&&e.length){const t=e[0];chrome.tabs.remove(t.id),chrome.tabs.create({active:!0,url:"./review.html"},(e=>{}))}}))}))))}return(0,r.useEffect)((()=>{chrome&&chrome.storage&&(chrome.storage.sync.get(["isRecording"],(e=>{e.isRecording?(n(!0),(chrome.action||chrome.browserAction).setBadgeText({text:"🔴"},(()=>{}))):(n(!1),(chrome.action||chrome.browserAction).setBadgeText({text:""},(()=>{})))})),chrome.runtime.onMessage.addListener(((e,t,n)=>{"recording_data"===e.messageType&&s(e.recordingData||[])})),d())}),[]),r.createElement("div",{className:"App"},r.createElement("header",{className:"App-header"},r.createElement("img",{src:a,className:"App-logo",alt:"logo"}),r.createElement("h1",{className:"App-title"},"Sequence Recorder")),r.createElement("div",{className:"App-container"},r.createElement("p",null,"Use this plugin to record a sequence of steps to be followed by Snyk API & Web during a scan."," ","When you finish recording, upload the script to your target settings."),r.createElement("p",{className:"help-container"},r.createElement("a",{href:k,className:"help-link",rel:"noreferrer",onClick:e=>{!function(e){e.preventDefault(),chrome.tabs.create({active:!0,url:k},(e=>{}))}(e)}},"Usage instructions ",r.createElement("img",{src:o,className:"help-logo",alt:"Help"})))),r.createElement("form",{method:"post",action:"#",className:"url-form",onSubmit:e=>{!function(e){e.preventDefault(),l&&p(null,!0)}(e)}},r.createElement("div",{className:"input-url-container"},t?null:r.createElement(r.Fragment,null,r.createElement("label",{className:"start_url_label",htmlFor:"start_url"},"Type the start URL to be recorded"),r.createElement("input",{type:"url",name:"start_url",id:"start_url",required:!0,className:"start-url",placeholder:"https://your-target-url.com/",autoComplete:"off",pattern:"^https?://.*",onChange:e=>{!function(e){const t=e.target;u(t.value)}(e)},value:l}))),r.createElement("div",{className:"buttons-container"},t?r.createElement("p",null,r.createElement("a",{href:"#",className:"App-button",onClick:e=>{p(e,!1)}},"Stop recording")):r.createElement("button",{type:"submit",className:"App-button"},i.length?"Start new recording":"Start recording"))),!t&&i.length?r.createElement(r.Fragment,null,r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button",onClick:()=>{!function(){const e=document.getElementById("input-copy-to-clipboard");if(e){e.select();const t=e.value;let n=!1;try{n=document.execCommand("copy")}catch(e){try{window.clipboardData.setData("text",t),n=!0}catch(e){}}n?(f({status:!0,error:!1,msg:"Successfully copied to clipboard"}),setTimeout((()=>{f({status:!1,error:!1,msg:""})}),3e3)):(f({status:!0,error:!0,msg:"Error on copy to clipboard"}),setTimeout((()=>{f({status:!1,error:!1,msg:""})}),5e3))}}()}},"Copy to clipboard")),r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button",onClick:()=>{!function(){var e=new Blob([JSON.stringify(i,null,2)],{type:"text/plain;charset=utf-8"}),t=document.createElement("a");t.download="snyk-api-and-web-recording.json",t.rel="noopener",t.href=URL.createObjectURL(e);try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var n=document.createEvent("MouseEvents");n.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(n)}}()}},"Download")),r.createElement("div",{className:"buttons-container"},r.createElement("button",{type:"button",className:"App-button App-button-secondary",onClick:()=>{chrome&&(chrome.runtime.sendMessage({messageType:"clear"}),s([]))}},"Clear recording data"))):null,r.createElement("div",{className:"copy-status-container"},c.status?r.createElement("div",{className:c.error?"copy-status error":"copy-status success"},c.msg):null),i.length?r.createElement("textarea",{id:"input-copy-to-clipboard",defaultValue:JSON.stringify(i,null,2)}):null)};var x=n(812),E={};E.styleTagTransform=y(),E.setAttributes=m(),E.insert=d().bind(null,"head"),E.domAPI=c(),E.insertStyleElement=g();i()(x.A,E);x.A&&x.A.locals&&x.A.locals;(0,l.render)(r.createElement(S,null),window.document.querySelector("#app-container"))})(); \ No newline at end of file diff --git a/test-build-firefox/reviewpage.bundle.js b/test-build-firefox/reviewpage.bundle.js index e0844f0..2bf2dbb 100644 --- a/test-build-firefox/reviewpage.bundle.js +++ b/test-build-firefox/reviewpage.bundle.js @@ -7,7 +7,7 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n