@amplitude/plugin-autocapture-browser 1.0.0-beta.2 → 1.0.0-beta.3
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/lib/cjs/autocapture/track-action-click.d.ts +13 -0
- package/lib/cjs/autocapture/track-action-click.d.ts.map +1 -0
- package/lib/cjs/autocapture/track-action-click.js +43 -0
- package/lib/cjs/autocapture/track-action-click.js.map +1 -0
- package/lib/cjs/autocapture/track-change.d.ts +11 -0
- package/lib/cjs/autocapture/track-change.d.ts.map +1 -0
- package/lib/cjs/autocapture/track-change.js +19 -0
- package/lib/cjs/autocapture/track-change.js.map +1 -0
- package/lib/cjs/autocapture/track-click.d.ts +10 -0
- package/lib/cjs/autocapture/track-click.d.ts.map +1 -0
- package/lib/cjs/autocapture/track-click.js +53 -0
- package/lib/cjs/autocapture/track-click.js.map +1 -0
- package/lib/cjs/autocapture-plugin.d.ts +66 -0
- package/lib/cjs/autocapture-plugin.d.ts.map +1 -1
- package/lib/cjs/autocapture-plugin.js +122 -130
- package/lib/cjs/autocapture-plugin.js.map +1 -1
- package/lib/cjs/helpers.d.ts +5 -0
- package/lib/cjs/helpers.d.ts.map +1 -1
- package/lib/cjs/helpers.js +63 -3
- package/lib/cjs/helpers.js.map +1 -1
- package/lib/cjs/libs/messenger.d.ts +3 -1
- package/lib/cjs/libs/messenger.d.ts.map +1 -1
- package/lib/cjs/libs/messenger.js +3 -1
- package/lib/cjs/libs/messenger.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/autocapture/track-action-click.d.ts +13 -0
- package/lib/esm/autocapture/track-action-click.d.ts.map +1 -0
- package/lib/esm/autocapture/track-action-click.js +40 -0
- package/lib/esm/autocapture/track-action-click.js.map +1 -0
- package/lib/esm/autocapture/track-change.d.ts +11 -0
- package/lib/esm/autocapture/track-change.d.ts.map +1 -0
- package/lib/esm/autocapture/track-change.js +16 -0
- package/lib/esm/autocapture/track-change.js.map +1 -0
- package/lib/esm/autocapture/track-click.d.ts +10 -0
- package/lib/esm/autocapture/track-click.d.ts.map +1 -0
- package/lib/esm/autocapture/track-click.js +50 -0
- package/lib/esm/autocapture/track-click.js.map +1 -0
- package/lib/esm/autocapture-plugin.d.ts +66 -0
- package/lib/esm/autocapture-plugin.d.ts.map +1 -1
- package/lib/esm/autocapture-plugin.js +122 -131
- package/lib/esm/autocapture-plugin.js.map +1 -1
- package/lib/esm/helpers.d.ts +5 -0
- package/lib/esm/helpers.d.ts.map +1 -1
- package/lib/esm/helpers.js +60 -2
- package/lib/esm/helpers.js.map +1 -1
- package/lib/esm/libs/messenger.d.ts +3 -1
- package/lib/esm/libs/messenger.d.ts.map +1 -1
- package/lib/esm/libs/messenger.js +3 -1
- package/lib/esm/libs/messenger.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/autocapture/track-action-click.d.ts +13 -0
- package/lib/scripts/autocapture/track-action-click.d.ts.map +1 -0
- package/lib/scripts/autocapture/track-change.d.ts +11 -0
- package/lib/scripts/autocapture/track-change.d.ts.map +1 -0
- package/lib/scripts/autocapture/track-click.d.ts +10 -0
- package/lib/scripts/autocapture/track-click.d.ts.map +1 -0
- package/lib/scripts/autocapture-plugin.d.ts +66 -0
- package/lib/scripts/autocapture-plugin.d.ts.map +1 -1
- package/lib/scripts/helpers.d.ts +5 -0
- package/lib/scripts/helpers.d.ts.map +1 -1
- package/lib/scripts/libs/messenger.d.ts +3 -1
- package/lib/scripts/libs/messenger.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function l(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(l,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(l=0)),l;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(o=l.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){l=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){l.label=a[1];break}if(6===a[0]&&l.label<o[1]){l.label=o[1],o=a;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(a);break}o[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)l.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return l}function l(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var a,u,c="[Amplitude] Element Tag",s="[Amplitude] Element Text",d="[Amplitude] Element Selector",f="[Amplitude] Page URL",v="https://app.amplitude.com",p={US:v,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function h(e,n){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};a=t(t({},r),n),u=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(a.root,r);var o=m(e,"all",(function(){return m(e,"two",(function(){return m(e,"one",(function(){return m(e,"none")}))}))}));if(o){var i=C(L(o,e));return i.length>0&&(o=i[0]),w(o)}throw new Error("Selector was not found.")}function m(e,t,n){for(var r=null,u=[],c=e,s=0,d=function(){var e,d,f=N(function(e){var t=e.getAttribute("id");if(t&&a.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(c))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.attributes).filter((function(e){return a.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(c)),!1))||N.apply(void 0,l([],i(function(e){var t=Array.from(e.classList).filter(a.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(c)),!1))||N(function(e){var t=e.tagName.toLowerCase();if(a.tagName(t))return{name:t,penalty:2};return null}(c))||[{name:"*",penalty:3}],v=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(c);if("all"==t)v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("two"==t)f=f.slice(0,1),v&&(f=f.concat(f.filter(A).map((function(e){return S(e,v)}))));else if("one"==t){var p=i(f=f.slice(0,1),1)[0];v&&A(p)&&(f=[S(p,v)])}else"none"==t&&(f=[{name:"*",penalty:3}],v&&(f=[S(f[0],v)]));try{for(var g=(e=void 0,o(f)),h=g.next();!h.done;h=g.next()){(p=h.value).level=s}}catch(t){e={error:t}}finally{try{h&&!h.done&&(d=g.return)&&d.call(g)}finally{if(e)throw e.error}}if(u.push(f),u.length>=a.seedMinLength&&(r=y(u,n)))return"break";c=c.parentElement,s++};c;){if("break"===d())break}return r||(r=y(u,n)),!r&&n?n():r}function y(e,t){var n,r,i=C(T(e));if(i.length>a.threshold)return t?t():null;try{for(var l=o(i),u=l.next();!u.done;u=l.next()){var c=u.value;if(E(c))return c}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}return null}function w(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var o=e[r].level||0;n=t.level===o-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function b(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function E(e){var t=w(e);switch(u.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function S(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function A(e){return"html"!==e.name&&!e.name.startsWith("#")}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(k);return n.length>0?n:null}function k(e){return null!=e}function T(e,t){var n,i,l,a,u,c;return void 0===t&&(t=[]),r(this,(function(r){switch(r.label){case 0:if(!(e.length>0))return[3,9];r.label=1;case 1:r.trys.push([1,6,7,8]),n=o(e[0]),i=n.next(),r.label=2;case 2:return i.done?[3,5]:(l=i.value,[5,o(T(e.slice(1,e.length),t.concat(l)))]);case 3:r.sent(),r.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return a=r.sent(),u={error:a},[3,8];case 7:try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(u)throw u.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:r.sent(),r.label=11;case 11:return[2]}}))}function C(e){return l([],i(e),!1).sort((function(e,t){return b(e)-b(t)}))}function L(e,t,n){var c,s,d;return void 0===n&&(n={counter:0,visited:new Map}),r(this,(function(r){switch(r.label){case 0:if(!(e.length>2&&e.length>a.optimizedMinLength))return[3,5];c=1,r.label=1;case 1:return c<e.length-1?n.counter>a.maxNumberOfTries?[2]:(n.counter+=1,(s=l([],i(e),!1)).splice(c,1),d=w(s),n.visited.has(d)?[2]:E(s)&&function(e,t){return u.querySelector(w(e))===t}(s,t)?[4,s]:[3,4]):[3,5];case 2:return r.sent(),n.visited.set(d,!0),[5,o(L(s,t,n))];case 3:r.sent(),r.label=4;case 4:return c++,[3,1];case 5:return[2]}}))}var x=["input","select","textarea"],O=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},M=function(e){var t,n,r=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o="true"===e.getAttribute("contenteditable");return!x.includes(r)&&!o},P=function(e){var t="";return M(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=P(e),t+=r.split(/(\s+)/).filter(O).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},j=function(e,t){var n,r,o="";try{return o=h(e,{className:function(e){return e!==g}})}catch(e){if(t){var i=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(i.toString()))}}var l=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(l&&(o=l),e.id)o="#".concat(e.id);else if(e.className){var a=e.className.split(" ").filter((function(e){return e!==g})).join(".");a&&(o="".concat(o,".").concat(a))}return o},q=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},R=function(e){var t=e.parentElement;if(!t)return"";var n=t.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return O(r)?r:""}return R(t)},D=function(e,t){if(e&&"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=t.reduce((function(t,n){n&&Array.from(e.querySelectorAll(n)).forEach((function(e){t.add(e)}));return t}),new Set);return Array.from(n)}return[]},_=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:_(null==e?void 0:e.parentElement,t):null},U=function(e,t){var n,r,o;if(!e)return{};var i=null===(o=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l=j(e,t),a=((n={})[c]=i,n[s]=P(e),n[d]=l,n[f]=window.location.href.split("?")[0],n);return q(a)};var F=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?v:t,r=this;this.endpoint=v,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,o;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(o=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===o||o.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var o="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),i={id:o,action:e,args:t};return new Promise((function(t,l){r.requestCallbacks[o]={resolve:t,reject:l},r.notify(i),(null==n?void 0:n.timeout)>0&&setTimeout((function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete r.requestCallbacks[o]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,o=n.endpoint,i=n.isElementSelectable;this.logger=r,o&&this.endpoint===v&&(this.endpoint=o);var l=null;window.addEventListener("message",(function(e){var n,r,o,a,u;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var c,s=null==e?void 0:e.data,d=null==s?void 0:s.action;if(d)if("id"in s)null===(a=null===(o=t.logger)||void 0===o?void 0:o.debug)||void 0===a||a.call(o,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(s);else if("ping"===d)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===d){var f=null==s?void 0:s.data;(c="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=c,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(c)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;l=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:U,isElementSelectable:function(e){return!i||i((null==f?void 0:f.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:g,messenger:t}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===d&&(null===(u=null==l?void 0:l.close)||void 0===u||u.call(l))}})),this.notify({action:"page-loaded"})},e}(),H=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],W=["type"],z=["svg","path","g"],I=["password","hidden"];var V=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var o=e[r];if(null===o)n+=4;else{var i=B(o);n+=i?Array.from(i).length:4}if(n>t)return e.slice(0,r)}return e}(function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e).map((function(e){return function(e){var t,n,r,i,l,a;if(null===e)return null;var u=e.tagName.toLowerCase(),c={tag:u},s=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(c.index=s.indexOf(e),c.indexOfType=s.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(a=null===(l=e.previousElementSibling)||void 0===l?void 0:l.tagName)||void 0===a?void 0:a.toLowerCase();d&&(c.prevSib=d);var f=e.id;f&&(c.id=f);var v=Array.from(e.classList);v.length&&(c.classes=v);var p={},g=Array.from(e.attributes).filter((function(e){return!H.includes(e.name)})),h=!M(e);if(!I.includes(e.type)&&!z.includes(u))try{for(var m=o(g),y=m.next();!y.done;y=m.next()){var w=y.value;h&&!W.includes(w.name)||(p[w.name]=String(w.value).substring(0,128))}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return Object.keys(p).length&&(c.attrs=p),c}(e)})),1024),t):[]};function B(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return B(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=i(e,1)[0]})).map((function(e){var t=i(e,2),n=t[0],r=t[1];return"".concat(String(B(n,!0)),": ").concat(String(B(r,!0)))})),o="{".concat(r.join(", "),"}");return o.includes("\\'")&&(o=o.replace(/'/g,"'").replace(/'/g,"\\'")),o}return e.toString()}catch(e){return null}}var G=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],J="data-amp-track-",Z=function(e){void 0===e&&(e={});var o,i=e.cssSelectorAllowlist,l=void 0===i?G:i,a=e.pageUrlAllowlist,u=e.shouldTrackEventResolver,v=e.dataAttributePrefix,g=void 0===v?J:v,h=e.visualTaggingOptions,m=void 0===h?{enabled:!0,messenger:new F}:h,y="@amplitude/plugin-autocapture-browser",w=[],b=void 0,E=function(e,t,n){e.addEventListener(t,n),w.push({element:e,type:t,handler:n})},S=function(e,t){var n,r,o;if(!t)return!1;var i=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(!i)return!1;if(u)return u(e,t);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,a))return!1;var c=(null==t?void 0:t.type)||"";if("string"==typeof c)switch(c.toLowerCase()){case"hidden":case"password":return!1}if(l){var s=l.some((function(e){var n;return!!(null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e))}));if(!s)return!1}switch(i){case"input":case"select":case"textarea":return"change"===e||"click"===e;default:var d=null===(o=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===o?void 0:o.call(window,t);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==e)||"click"===e}},A=function(e,t){var n,r,o,i=null===(o=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===o?void 0:o.call(r),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),u=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var o=r.replace(t,""),i=e.getAttribute(r);o&&(n[o]=i||"")}return n}),{})}(t,g),v=R(t),p=j(t,b),h=((n={})["[Amplitude] Element ID"]=t.id,n["[Amplitude] Element Class"]=t.className,n["[Amplitude] Element Hierarchy"]=V(t),n[c]=i,n[s]=P(t),n["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),n["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),n["[Amplitude] Element Aria Label"]=a,n["[Amplitude] Element Attributes"]=u,n[d]=p,n["[Amplitude] Element Parent Label"]=v,n[f]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===i&&"click"===e&&t instanceof HTMLAnchorElement&&(h["[Amplitude] Element Href"]=t.href),q(h)};return{name:y,type:"enrichment",setup:function(e,i){return n(void 0,void 0,void 0,(function(){var n,a,u,c,s;return r(this,(function(r){return i?(b=e.loggerProvider,"undefined"==typeof document||(n=function(e){S("click",e)&&E(e,"click",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Clicked",A("click",e))})),S("change",e)&&E(e,"change",(function(t){(null==t?void 0:t.target)!=(null==t?void 0:t.currentTarget)&&_(null==t?void 0:t.target,l)!=(null==t?void 0:t.currentTarget)||null==i||i.track("[Amplitude] Element Changed",A("change",e))}))},"undefined"!=typeof MutationObserver&&(o=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&D(e,l).map(n)}))}))}))),a=function(){D(document.body,l).forEach(n),null==o||o.observe(document.body,{subtree:!0,childList:!0})},document.body?a():window.addEventListener("load",a),null===(c=null==e?void 0:e.loggerProvider)||void 0===c||c.log("".concat(y," has been successfully added.")),window.opener&&m.enabled&&(null===(s=m.messenger)||void 0===s||s.setup(t(t({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:p[e.serverZone]}),{isElementSelectable:S})))),[2]):(null===(u=null==e?void 0:e.loggerProvider)||void 0===u||u.warn("".concat(y," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(e){return n(void 0,void 0,void 0,(function(){return r(this,(function(t){return[2,e]}))}))},teardown:function(){return n(void 0,void 0,void 0,(function(){return r(this,(function(e){return o&&o.disconnect(),w.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),w=[],[2]}))}))}}};e.DEFAULT_CSS_SELECTOR_ALLOWLIST=G,e.DEFAULT_DATA_ATTRIBUTE_PREFIX=J,e.WindowMessenger=F,e.autocapturePlugin=Z,e.plugin=Z,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).amplitude={})}(this,(function(t){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)};function i(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{l(r.next(t))}catch(t){o(t)}}function c(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}l((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),u=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)u.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function l(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function s(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),o=[];return r={},u("next"),u("throw"),u("return"),r[Symbol.asyncIterator]=function(){return this},r;function u(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){o.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=i[t](e)).value instanceof a?Promise.resolve(n.value.v).then(l,s):f(o[0][2],n)}catch(t){f(o[0][3],t)}var n}function l(t){c("next",t)}function s(t){c("throw",t)}function f(t,e){t(e),o.shift(),o.length&&c(o[0][0],o[0][1])}}function f(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=u(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}var d="[Amplitude] Element Clicked",h="[Amplitude] Element Tag",p="[Amplitude] Element Text",v="[Amplitude] Element Selector",y="[Amplitude] Page URL",b="https://app.amplitude.com",m={US:b,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},g="amp-visual-tagging-selector-highlight";function w(t){return"function"==typeof t}function _(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var x=_((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function A(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var E=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=u(o),s=a.next();!s.done;s=a.next()){s.value.remove(this)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else o.remove(this);var f=this.initialTeardown;if(w(f))try{f()}catch(t){i=t instanceof x?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var h=u(d),p=h.next();!p.done;p=h.next()){var v=p.value;try{T(v)}catch(t){i=null!=i?i:[],t instanceof x?i=l(l([],c(i)),c(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(i)throw new x(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)T(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&A(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&A(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),S=E.EMPTY;function k(t){return t instanceof E||t&&"closed"in t&&w(t.remove)&&w(t.add)&&w(t.unsubscribe)}function T(t){w(t)?t():t.unsubscribe()}var C={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},O=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([t,e],c(n)))};function N(t){O((function(){throw t}))}function P(){}function I(t){t()}var L=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,k(e)&&e.add(n)):n.destination=R,n}return n(e,t),e.create=function(t,e,n){return new q(t,e,n)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(E),j=Function.prototype.bind;function F(t,e){return j.call(t,e)}var M=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){z(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){z(t)}else z(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){z(t)}},t}(),q=function(t){function e(e,n,r){var i,o,u=t.call(this)||this;w(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:u&&C.useDeprecatedNextContext?((o=Object.create(e)).unsubscribe=function(){return u.unsubscribe()},i={next:e.next&&F(e.next,o),error:e.error&&F(e.error,o),complete:e.complete&&F(e.complete,o)}):i=e;return u.destination=new M(i),u}return n(e,t),e}(L);function z(t){N(t)}var R={closed:!0,next:P,error:function(t){throw t},complete:P},D="function"==typeof Symbol&&Symbol.observable||"@@observable";function U(t){return t}function V(t){return 0===t.length?U:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var W=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,o=(r=t)&&r instanceof L||function(t){return t&&w(t.next)&&w(t.error)&&w(t.complete)}(r)&&k(r)?t:new q(t,e,n);return I((function(){var t=i,e=t.operator,n=t.source;o.add(e?e.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=H(e))((function(e,r){var i=new q({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[D]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return V(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=H(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function H(t){var e;return null!==(e=null!=t?t:C.Promise)&&void 0!==e?e:Promise}function Y(t){return w(null==t?void 0:t.lift)}function B(t){return function(e){if(Y(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function X(t,e,n,r,i){return new G(t,e,n,r,i)}var G=function(t){function e(e,n,r,i,o,u){var c=t.call(this,e)||this;return c.onFinalize=o,c.shouldUnsubscribe=u,c._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return n(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(L);!function(t){function e(e,n){var r=t.call(this)||this;return r.source=e,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Y(e)&&(r.lift=e.lift),r}n(e,t),e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,null==t||t.unsubscribe()},e.prototype.connect=function(){var t=this,e=this._connection;if(!e){e=this._connection=new E;var n=this.getSubject();e.add(this.source.subscribe(X(n,void 0,(function(){t._teardown(),n.complete()}),(function(e){t._teardown(),n.error(e)}),(function(){return t._teardown()})))),e.closed&&(this._connection=null,e=E.EMPTY)}return e},e.prototype.refCount=function(){return B((function(t,e){var n=null;t._refCount++;var r=X(e,void 0,void 0,void 0,(function(){if(!t||t._refCount<=0||0<--t._refCount)n=null;else{var r=t._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),e.unsubscribe()}}));t.subscribe(r),r.closed||(n=t.connect())}))(this)}}(W);var J,Z={now:function(){return(Z.delegate||performance).now()},delegate:void 0},$={schedule:function(t){var e=requestAnimationFrame,n=cancelAnimationFrame,r=e((function(e){n=void 0,t(e)}));return new E((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=$.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(t)))},cancelAnimationFrame:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return cancelAnimationFrame.apply(void 0,l([],c(t)))},delegate:void 0};new W((function(t){var e=J||Z,n=e.now(),r=0,i=function(){t.closed||(r=$.requestAnimationFrame((function(o){r=0;var u=e.now();t.next({timestamp:J?u:o,elapsed:u-n}),i()})))};return i(),function(){r&&$.cancelAnimationFrame(r)}}));var K=_((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Q=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return n(e,t),e.prototype.lift=function(t){var e=new tt(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new K},e.prototype.next=function(t){var e=this;I((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=u(e.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(t)}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;I((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;I((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?S:(this.currentObservers=null,o.push(t),new E((function(){e.currentObservers=null,A(o,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new W;return t.source=this,t},e.create=function(t,e){return new tt(t,e)},e}(W),tt=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return n(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:S},e}(Q);!function(t){function e(e){var n=t.call(this)||this;return n._value=e,n}n(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var n=t.prototype._subscribe.call(this,e);return!n.closed&&e.next(this._value),n},e.prototype.getValue=function(){var t=this,e=t.hasError,n=t.thrownError,r=t._value;if(e)throw n;return this._throwIfClosed(),r},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)}}(Q);var et={now:function(){return(et.delegate||Date).now()},delegate:void 0};!function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=et);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}n(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;r||(i.push(e),!o&&i.push(u.now()+c)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,o=(i?1:2)*e;if(e<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var u=n.now(),c=0,l=1;l<r.length&&r[l]<=u;l+=2)c=l;c&&r.splice(0,c+1)}}}(Q),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._value=null,e._hasValue=!1,e._isComplete=!1,e}n(e,t),e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e._hasValue,i=e._value,o=e.thrownError,u=e.isStopped,c=e._isComplete;n?t.error(o):(u||c)&&(r&&t.next(i),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var e=this,n=e._hasValue,r=e._value;e._isComplete||(this._isComplete=!0,n&&t.prototype.next.call(this,r),t.prototype.complete.call(this))}}(Q);var nt,rt=function(t){function e(e,n){return t.call(this)||this}return n(e,t),e.prototype.schedule=function(t,e){return this},e}(E),it=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([t,e],c(n)))},ot=function(t){return clearInterval(t)},ut=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r.pending=!1,r}return n(e,t),e.prototype.schedule=function(t,e){var n;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,e)),this.pending=!0,this.delay=e,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,e),this},e.prototype.requestAsyncId=function(t,e,n){return void 0===n&&(n=0),it(t.flush.bind(t,this),n)},e.prototype.recycleAsyncId=function(t,e,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return e;null!=e&&ot(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var n,r=!1;try{this.work(t)}catch(t){r=!0,n=t||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,A(r,this),null!=e&&(this.id=this.recycleAsyncId(n,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(rt),ct=1,lt={};function at(t){return t in lt&&(delete lt[t],!0)}var st=function(t){var e=ct++;return lt[e]=!0,nt||(nt=Promise.resolve()),nt.then((function(){return at(e)&&t()})),e},ft=function(t){at(t)},dt={setImmediate:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=dt.delegate;return((null==n?void 0:n.setImmediate)||st).apply(void 0,l([],c(t)))},clearImmediate:function(t){return ft(t)},delegate:void 0},ht=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=dt.setImmediate(e.flush.bind(e,void 0))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(dt.clearImmediate(n),e._scheduled===n&&(e._scheduled=void 0))},e}(ut),pt=function(){function t(e,n){void 0===n&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(t,e,n){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(n,e)},t.now=et.now,t}(),vt=function(t){function e(e,n){void 0===n&&(n=pt.now);var r=t.call(this,e,n)||this;return r.actions=[],r._active=!1,r}return n(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var n;this._active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}},e}(pt),yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new yt(ht);var bt=new vt(ut),mt=bt,gt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.schedule=function(e,n){return void 0===n&&(n=0),n>0?t.prototype.schedule.call(this,e,n):(this.delay=n,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,n){return n>0||this.closed?t.prototype.execute.call(this,e,n):this._execute(e,n)},e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.flush(this),0)},e}(ut),wt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(vt);new wt(gt);var _t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.scheduler=e,r.work=n,r}return n(e,t),e.prototype.requestAsyncId=function(e,n,r){return void 0===r&&(r=0),null!==r&&r>0?t.prototype.requestAsyncId.call(this,e,n,r):(e.actions.push(this),e._scheduled||(e._scheduled=$.requestAnimationFrame((function(){return e.flush(void 0)}))))},e.prototype.recycleAsyncId=function(e,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return t.prototype.recycleAsyncId.call(this,e,n,r);var o=e.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&($.cancelAnimationFrame(n),e._scheduled=void 0)},e}(ut),xt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.flush=function(t){this._active=!0;var e=this._scheduled;this._scheduled=void 0;var n,r=this.actions;t=t||r.shift();do{if(n=t.execute(t.state,t.delay))break}while((t=r[0])&&t.id===e&&r.shift());if(this._active=!1,n){for(;(t=r[0])&&t.id===e&&r.shift();)t.unsubscribe();throw n}},e}(vt);new xt(_t),function(t){function e(e,n){void 0===e&&(e=At),void 0===n&&(n=1/0);var r=t.call(this,e,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}n(e,t),e.prototype.flush=function(){for(var t,e,n=this.actions,r=this.maxFrames;(e=n[0])&&e.delay<=r&&(n.shift(),this.frame=e.delay,!(t=e.execute(e.state,e.delay))););if(t){for(;e=n.shift();)e.unsubscribe();throw t}},e.frameTimeFactor=10}(vt);var At=function(t){function e(e,n,r){void 0===r&&(r=e.index+=1);var i=t.call(this,e,n)||this;return i.scheduler=e,i.work=n,i.index=r,i.active=!0,i.index=e.index=r,i}return n(e,t),e.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return t.prototype.schedule.call(this,n,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return E.EMPTY},e.prototype.requestAsyncId=function(t,n,r){void 0===r&&(r=0),this.delay=t.frame+r;var i=t.actions;return i.push(this),i.sort(e.sortActions),1},e.prototype.recycleAsyncId=function(t,e,n){},e.prototype._execute=function(e,n){if(!0===this.active)return t.prototype._execute.call(this,e,n)},e.sortActions=function(t,e){return t.delay===e.delay?t.index===e.index?0:t.index>e.index?1:-1:t.delay>e.delay?1:-1},e}(ut),Et=new W((function(t){return t.complete()}));function St(t){return t&&w(t.schedule)}function kt(t){return t[t.length-1]}function Tt(t){return St(kt(t))?t.pop():void 0}function Ct(t,e){return"number"==typeof kt(t)?t.pop():e}var Ot=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function Nt(t){return w(null==t?void 0:t.then)}function Pt(t){return w(t[D])}function It(t){return Symbol.asyncIterator&&w(null==t?void 0:t[Symbol.asyncIterator])}function Lt(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var jt,Ft="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Mt(t){return w(null==t?void 0:t[Ft])}function qt(t){return s(this,arguments,(function(){var e,n,r;return o(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,a(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,a(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,a(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function zt(t){return w(null==t?void 0:t.getReader)}function Rt(t){if(t instanceof W)return t;if(null!=t){if(Pt(t))return i=t,new W((function(t){var e=i[D]();if(w(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ot(t))return r=t,new W((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(Nt(t))return n=t,new W((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,N)}));if(It(t))return Dt(t);if(Mt(t))return e=t,new W((function(t){var n,r;try{for(var i=u(e),o=i.next();!o.done;o=i.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(zt(t))return Dt(qt(t))}var e,n,r,i;throw Lt(t)}function Dt(t){return new W((function(e){(function(t,e){var n,r,u,c;return i(this,void 0,void 0,(function(){var i,l;return o(this,(function(o){switch(o.label){case 0:o.trys.push([0,5,6,11]),n=f(t),o.label=1;case 1:return[4,n.next()];case 2:if((r=o.sent()).done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];o.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=o.sent(),u={error:l},[3,11];case 6:return o.trys.push([6,,9,10]),r&&!r.done&&(c=n.return)?[4,c.call(n)]:[3,8];case 7:o.sent(),o.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function Ut(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(o),!i)return o}function Vt(t,e){return void 0===e&&(e=0),B((function(n,r){n.subscribe(X(r,(function(n){return Ut(r,t,(function(){return r.next(n)}),e)}),(function(){return Ut(r,t,(function(){return r.complete()}),e)}),(function(n){return Ut(r,t,(function(){return r.error(n)}),e)})))}))}function Wt(t,e){return void 0===e&&(e=0),B((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Ht(t,e){if(!t)throw new Error("Iterable cannot be null");return new W((function(n){Ut(n,e,(function(){var r=t[Symbol.asyncIterator]();Ut(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function Yt(t,e){if(null!=t){if(Pt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(Ot(t))return function(t,e){return new W((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(Nt(t))return function(t,e){return Rt(t).pipe(Wt(e),Vt(e))}(t,e);if(It(t))return Ht(t,e);if(Mt(t))return function(t,e){return new W((function(n){var r;return Ut(n,e,(function(){r=t[Ft](),Ut(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return w(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(zt(t))return function(t,e){return Ht(qt(t),e)}(t,e)}throw Lt(t)}function Bt(t,e){return e?Yt(t,e):Rt(t)}function Xt(t){return t instanceof Date&&!isNaN(t)}!function(t){t.NEXT="N",t.ERROR="E",t.COMPLETE="C"}(jt||(jt={})),_((function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}})),_((function(t){return function(){t(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),_((function(t){return function(e){t(this),this.name="NotFoundError",this.message=e}})),_((function(t){return function(e){t(this),this.name="SequenceError",this.message=e}}));var Gt=_((function(t){return function(e){void 0===e&&(e=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=e}}));function Jt(t){throw new Gt(t)}function Zt(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){r.next(t.call(e,n,i++))})))}))}var $t=Array.isArray;function Kt(t){return Zt((function(e){return function(t,e){return $t(e)?t.apply(void 0,l([],c(e))):t(e)}(t,e)}))}function Qt(t,e,n){return void 0===n&&(n=1/0),w(e)?Qt((function(n,r){return Zt((function(t,i){return e(n,t,r,i)}))(Rt(t(n,r)))}),n):("number"==typeof e&&(n=e),B((function(e,r){return function(t,e,n,r,i,o,u,c){var l=[],a=0,s=0,f=!1,d=function(){!f||l.length||a||e.complete()},h=function(t){return a<r?p(t):l.push(t)},p=function(t){o&&e.next(t),a++;var c=!1;Rt(n(t,s++)).subscribe(X(e,(function(t){null==i||i(t),o?h(t):e.next(t)}),(function(){c=!0}),void 0,(function(){if(c)try{a--;for(var t=function(){var t=l.shift();u?Ut(e,u,(function(){return p(t)})):p(t)};l.length&&a<r;)t();d()}catch(t){e.error(t)}})))};return t.subscribe(X(e,h,(function(){f=!0,d()}))),function(){null==c||c()}}(e,r,t,n)})))}function te(t){return void 0===t&&(t=1/0),Qt(U,t)}function ee(){return te(1)}var ne,re,ie=["addListener","removeListener"],oe=["addEventListener","removeEventListener"],ue=["on","off"];function ce(t,e,n,r){if(w(n)&&(r=n,n=void 0),r)return ce(t,e,n).pipe(Kt(r));var i=c(function(t){return w(t.addEventListener)&&w(t.removeEventListener)}(t)?oe.map((function(r){return function(i){return t[r](e,i,n)}})):function(t){return w(t.addListener)&&w(t.removeListener)}(t)?ie.map(le(t,e)):function(t){return w(t.on)&&w(t.off)}(t)?ue.map(le(t,e)):[],2),o=i[0],u=i[1];if(!o&&Ot(t))return Qt((function(t){return ce(t,e,n)}))(Rt(t));if(!o)throw new TypeError("Invalid event target");return new W((function(t){var e=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.next(1<e.length?e:e[0])};return o(e),function(){return u(e)}}))}function le(t,e){return function(n){return function(r){return t[n](e,r)}}}function ae(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Tt(t),r=Ct(t,1/0),i=t;return i.length?1===i.length?Rt(i[0]):te(r)(Bt(i,n)):Et}function se(t,e){return B((function(n,r){var i=0;n.subscribe(X(r,(function(n){return t.call(e,n,i++)&&r.next(n)})))}))}function fe(t){return t<=0?function(){return Et}:B((function(e,n){var r=0;e.subscribe(X(n,(function(e){++r<=t&&(n.next(e),t<=r&&n.complete())})))}))}function de(t,e){return e?function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ee()(Bt(t,Tt(t)))}(e.pipe(fe(1),B((function(t,e){t.subscribe(X(e,P))}))),n.pipe(de(t)))}:Qt((function(e,n){return Rt(t(e,n)).pipe(fe(1),function(t){return Zt((function(){return t}))}(e))}))}function he(t,e){void 0===e&&(e=bt);var n=function(t,e,n){void 0===t&&(t=0),void 0===n&&(n=mt);var r=-1;return null!=e&&(St(e)?n=e:r=e),new W((function(e){var i=Xt(t)?+t-n.now():t;i<0&&(i=0);var o=0;return n.schedule((function(){e.closed||(e.next(o++),0<=r?this.schedule(void 0,r):e.complete())}),i)}))}(t,e);return de((function(){return n}))}function pe(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===t.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(t){return!0},className:function(t){return!0},tagName:function(t){return!0},attr:function(t,e){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};ne=r(r({},n),e),re=function(t,e){if(t.nodeType===Node.DOCUMENT_NODE)return t;if(t===e.root)return t.ownerDocument;return t}(ne.root,n);var i=ve(t,"all",(function(){return ve(t,"two",(function(){return ve(t,"one",(function(){return ve(t,"none")}))}))}));if(i){var o=Se(ke(i,t));return o.length>0&&(i=o[0]),be(i)}throw new Error("Selector was not found.")}function ve(t,e,n){for(var r=null,i=[],o=t,a=0,s=function(){var t,s,f=xe(function(t){var e=t.getAttribute("id");if(e&&ne.idName(e))return{name:"#"+CSS.escape(e),penalty:0};return null}(o))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.attributes).filter((function(t){return ne.attr(t.name,t.value)}));return e.map((function(t){return{name:"[".concat(CSS.escape(t.name),'="').concat(CSS.escape(t.value),'"]'),penalty:.5}}))}(o)),!1))||xe.apply(void 0,l([],c(function(t){var e=Array.from(t.classList).filter(ne.className);return e.map((function(t){return{name:"."+CSS.escape(t),penalty:1}}))}(o)),!1))||xe(function(t){var e=t.tagName.toLowerCase();if(ne.tagName(e))return{name:e,penalty:2};return null}(o))||[{name:"*",penalty:3}],d=function(t){var e=t.parentNode;if(!e)return null;var n=e.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==t);)n=n.nextSibling;return r}(o);if("all"==e)d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("two"==e)f=f.slice(0,1),d&&(f=f.concat(f.filter(_e).map((function(t){return we(t,d)}))));else if("one"==e){var h=c(f=f.slice(0,1),1)[0];d&&_e(h)&&(f=[we(h,d)])}else"none"==e&&(f=[{name:"*",penalty:3}],d&&(f=[we(f[0],d)]));try{for(var p=(t=void 0,u(f)),v=p.next();!v.done;v=p.next()){(h=v.value).level=a}}catch(e){t={error:e}}finally{try{v&&!v.done&&(s=p.return)&&s.call(p)}finally{if(t)throw t.error}}if(i.push(f),i.length>=ne.seedMinLength&&(r=ye(i,n)))return"break";o=o.parentElement,a++};o;){if("break"===s())break}return r||(r=ye(i,n)),!r&&n?n():r}function ye(t,e){var n,r,i=Se(Ee(t));if(i.length>ne.threshold)return e?e():null;try{for(var o=u(i),c=o.next();!c.done;c=o.next()){var l=c.value;if(ge(l))return l}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function be(t){for(var e=t[0],n=e.name,r=1;r<t.length;r++){var i=t[r].level||0;n=e.level===i-1?"".concat(t[r].name," > ").concat(n):"".concat(t[r].name," ").concat(n),e=t[r]}return n}function me(t){return t.map((function(t){return t.penalty})).reduce((function(t,e){return t+e}),0)}function ge(t){var e=be(t);switch(re.querySelectorAll(e).length){case 0:throw new Error("Can't select any node with this selector: ".concat(e));case 1:return!0;default:return!1}}function we(t,e){return{name:t.name+":nth-child(".concat(e,")"),penalty:t.penalty+1}}function _e(t){return"html"!==t.name&&!t.name.startsWith("#")}function xe(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t.filter(Ae);return n.length>0?n:null}function Ae(t){return null!=t}function Ee(t,e){var n,r,i,c,l,a;return void 0===e&&(e=[]),o(this,(function(o){switch(o.label){case 0:if(!(t.length>0))return[3,9];o.label=1;case 1:o.trys.push([1,6,7,8]),n=u(t[0]),r=n.next(),o.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,u(Ee(t.slice(1,t.length),e.concat(i)))]);case 3:o.sent(),o.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return c=o.sent(),l={error:c},[3,8];case 7:try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(l)throw l.error}return[7];case 8:return[3,11];case 9:return[4,e];case 10:o.sent(),o.label=11;case 11:return[2]}}))}function Se(t){return l([],c(t),!1).sort((function(t,e){return me(t)-me(e)}))}function ke(t,e,n){var r,i,a;return void 0===n&&(n={counter:0,visited:new Map}),o(this,(function(o){switch(o.label){case 0:if(!(t.length>2&&t.length>ne.optimizedMinLength))return[3,5];r=1,o.label=1;case 1:return r<t.length-1?n.counter>ne.maxNumberOfTries?[2]:(n.counter+=1,(i=l([],c(t),!1)).splice(r,1),a=be(i),n.visited.has(a)?[2]:ge(i)&&function(t,e){return re.querySelector(be(t))===e}(i,e)?[4,i]:[3,4]):[3,5];case 2:return o.sent(),n.visited.set(a,!0),[5,u(ke(i,e,n))];case 3:o.sent(),o.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}new W(P);var Te=["input","select","textarea"],Ce=function(t,e){return function(n,r){var i,o,u,c=t.pageUrlAllowlist,l=t.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(l)return l(n,r);if(!Le(window.location.href,c))return!1;var s=(null==r?void 0:r.type)||"";if("string"==typeof s)switch(s.toLowerCase()){case"hidden":case"password":return!1}if(e){var f=e.some((function(t){var e;return!!(null===(e=null==r?void 0:r.matches)||void 0===e?void 0:e.call(r,t))}));if(!f)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var d=null===(u=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===u?void 0:u.call(window,r);return!(!d||"pointer"!==d.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},Oe=function(t){if(null==t)return!1;if("string"==typeof t){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(t))return!1}return!0},Ne=function(t){var e,n,r,i=null===(n=null===(e=null==t?void 0:t.tagName)||void 0===e?void 0:e.toLowerCase)||void 0===n?void 0:n.call(e),o=t instanceof HTMLElement&&"true"===(null===(r=t.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Te.includes(i)&&!o},Pe=function(t){var e="";return Ne(t)&&t.childNodes&&t.childNodes.length&&t.childNodes.forEach((function(t){var n,r="";(n=t)&&3===n.nodeType?t.textContent&&(r=t.textContent):r=Pe(t),e+=r.split(/(\s+)/).filter(Oe).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),e},Ie=function(t,e){var n,r,i="";try{return i=pe(t,{className:function(t){return t!==g}})}catch(t){if(e){var o=t;e.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(o.toString()))}}var u=null===(r=null===(n=null==t?void 0:t.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);if(u&&(i=u),t.id)i="#".concat(t.id);else if(t.className){var c=t.className.split(" ").filter((function(t){return t!==g})).join(".");c&&(i="".concat(i,".").concat(c))}return i},Le=function(t,e){return!e||!e.length||e.some((function(e){return"string"==typeof e?t===e:t.match(e)}))},je=function(t){return Object.keys(t).reduce((function(e,n){var r=t[n];return function(t){return null==t||"object"==typeof t&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length}(r)||(e[n]=r),e}),{})},Fe=function(t){var e=t.parentElement;if(!e)return"";var n=e.querySelector(":scope>span,h1,h2,h3,h4,h5,h6");if(n){var r=n.textContent||"";return Oe(r)?r:""}return Fe(e)},Me=function(t,e){return t?e.some((function(e){var n;return null===(n=null==t?void 0:t.matches)||void 0===n?void 0:n.call(t,e)}))?t:Me(null==t?void 0:t.parentElement,e):null},qe=function(t,e){var n,r,i;if(!t)return{};var o=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u=Ie(t,e),c=((n={})[h]=o,n[p]=Pe(t),n[v]=u,n[y]=window.location.href.split("?")[0],n);return je(c)};var ze=function(t){return!(null===t.event.target||!t.closestTrackedAncestor)},Re=function(){function t(t){var e=(void 0===t?{}:t).origin,n=void 0===e?b:e,r=this;this.endpoint=b,this.requestCallbacks={},this.onSelect=function(t){r.notify({action:"element-selected",data:t})},this.onTrack=function(t,e){"selector-mode-changed"===t?r.notify({action:"track-selector-mode-changed",data:e}):"selector-moved"===t&&r.notify({action:"track-selector-moved",data:e})},this.endpoint=n}return t.prototype.notify=function(t){var e,n,r,i;null===(n=null===(e=this.logger)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"Message sent: ",JSON.stringify(t)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,t,this.endpoint)},t.prototype.sendRequest=function(t,e,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:t,args:e};return new Promise((function(e,u){r.requestCallbacks[i]={resolve:e,reject:u},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){u(new Error("".concat(t," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},t.prototype.handleResponse=function(t){var e;this.requestCallbacks[t.id]?(this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]):null===(e=this.logger)||void 0===e||e.warn("No callback found for request id: ".concat(t.id))},t.prototype.setup=function(t){var e=this,n=void 0===t?{}:t,r=n.logger,i=n.endpoint,o=n.isElementSelectable,u=n.cssSelectorAllowlist,c=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===b&&(this.endpoint=i);var l=null;window.addEventListener("message",(function(t){var n,r,i,a,s;if(null===(r=null===(n=e.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(t)),e.endpoint===t.origin){var f,d=null==t?void 0:t.data,h=null==d?void 0:d.action;if(h)if("id"in d)null===(a=null===(i=e.logger)||void 0===i?void 0:i.debug)||void 0===a||a.call(i,"Received Response to previous request: ",JSON.stringify(t)),e.handleResponse(d);else if("ping"===h)e.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=null==d?void 0:d.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(t,e){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){t({status:!0})}),{once:!0}),r.addEventListener("error",(function(){e({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(t){e(t)}}))).then((function(){var t;l=null===(t=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===t?void 0:t.call(window,{getEventTagProps:qe,isElementSelectable:function(t){return!o||o((null==p?void 0:p.actionType)||"click",t)},onTrack:e.onTrack,onSelect:e.onSelect,visualHighlightClass:g,messenger:e,cssSelectorAllowlist:u,actionClickAllowlist:c}),e.notify({action:"selector-loaded"})})).catch((function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===h&&(null===(s=null==l?void 0:l.close)||void 0===s||s.call(l))}})),this.notify({action:"page-loaded"})},t}(),De=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Ue=["type"],Ve=["svg","path","g"],We=["password","hidden"];var He=function(t){var e;return t?(e=function(t,e){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(null===i)n+=4;else{var o=Ye(i);n+=o?Array.from(o).length:4}if(n>e)return t.slice(0,r)}return t}(function(t){var e=[];if(!t)return e;e.push(t);for(var n=t.parentElement;n&&"HTML"!==n.tagName;)e.push(n),n=n.parentElement;return e}(t).map((function(t){return function(t){var e,n,r,i,o,c;if(null===t)return null;var l=t.tagName.toLowerCase(),a={tag:l},s=Array.from(null!==(i=null===(r=t.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);s.length&&(a.index=s.indexOf(t),a.indexOfType=s.filter((function(e){return e.tagName===t.tagName})).indexOf(t));var f=null===(c=null===(o=t.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===c?void 0:c.toLowerCase();f&&(a.prevSib=f);var d=t.id;d&&(a.id=d);var h=Array.from(t.classList);h.length&&(a.classes=h);var p={},v=Array.from(t.attributes).filter((function(t){return!De.includes(t.name)})),y=!Ne(t);if(!We.includes(t.type)&&!Ve.includes(l))try{for(var b=u(v),m=b.next();!m.done;m=b.next()){var g=m.value;y&&!Ue.includes(g.name)||(p[g.name]=String(g.value).substring(0,128))}}catch(t){e={error:t}}finally{try{m&&!m.done&&(n=b.return)&&n.call(b)}finally{if(e)throw e.error}}return Object.keys(p).length&&(a.attrs=p),a}(t)})),1024),e):[]};function Ye(t,e){void 0===e&&(e=!1);try{if(null==t)return e?"None":null;if("string"==typeof t)return e?(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(t,"'"):t.includes("'")?'"'.concat(t.replace(/'/g,"\\'"),'"'):"'".concat(t,"'"):t;if("boolean"==typeof t)return t?"True":"False";if(Array.isArray(t)){var n=t.map((function(t){return Ye(t,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof t){var r=Object.entries(t).filter((function(t){return null!=c(t,1)[0]})).map((function(t){var e=c(t,2),n=e[0],r=e[1];return"".concat(String(Ye(n,!0)),": ").concat(String(Ye(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return t.toString()}catch(t){return null}}function Be(t){var e,n,r,i=t.amplitude,o=t.allObservables,l=t.options,a=t.shouldTrackEvent,s=o.clickObservable,f=s.pipe(B((function(t,e){var n,r=!1;t.subscribe(X(e,(function(t){var i=n;n=t,r&&e.next([i,t]),r=!0})))})),se((function(t){var e=c(t,2),n=e[0],r=e[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),h=ae(f,s.pipe((e=l.debounceTime,void 0===n&&(n=bt),B((function(t,r){var i=null,o=null,u=null,c=function(){if(i){i.unsubscribe(),i=null;var t=o;o=null,r.next(t)}};function l(){var t=u+e,o=n.now();if(o<t)return i=this.schedule(void 0,t-o),void r.add(i);c()}t.subscribe(X(r,(function(t){o=t,u=n.now(),i||(i=n.schedule(l,e),r.add(i))}),(function(){c(),r.complete()}),void 0,(function(){o=i=null})))}))),Zt((function(){return"timeout"}))));return s.pipe(he(0),se(ze),se((function(t){return a("click",t.closestTrackedAncestor)})),(r=h,B((function(t,e){var n=[];return t.subscribe(X(e,(function(t){return n.push(t)}),(function(){e.next(n),e.complete()}))),Rt(r).subscribe(X(e,(function(){var t=n;n=[],e.next(t)}),P)),function(){n=null}})))).subscribe((function(t){var e,n,r=(t.length,d);try{for(var o=u(t),c=o.next();!c.done;c=o.next()){var l=c.value;null==i||i.track(r,l.targetElementProperties,{time:l.timestamp})}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}))}function Xe(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,u=t.shouldTrackActionClick,a=n.clickObservable,s=n.mutationObservable,f=n.navigateObservable,h=a.pipe(se((function(t){return!o("click",t.closestTrackedAncestor)})),Zt((function(t){var e=Me(t.event.target,r.actionClickAllowlist);return t.closestTrackedAncestor=e,null!==t.closestTrackedAncestor&&(t.targetElementProperties=i(t.type,t.closestTrackedAncestor)),t})),se(ze),se((function(t){return u("click",t.closestTrackedAncestor)}))),p=[s];f&&p.push(f);var v,y,b=ae.apply(void 0,l([],c(p),!1)),m=h.pipe((v=function(t){return b.pipe(function(t,e){var n=Xt(t)?{first:t}:"number"==typeof t?{each:t}:t,r=n.first,i=n.each,o=n.with,u=void 0===o?Jt:o,c=n.scheduler,l=void 0===c?null!=e?e:bt:c,a=n.meta,s=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return B((function(t,e){var n,o,c=null,a=0,f=function(t){o=Ut(e,l,(function(){try{n.unsubscribe(),Rt(u({meta:s,lastValue:c,seen:a})).subscribe(e)}catch(t){e.error(t)}}),t)};n=t.subscribe(X(e,(function(t){null==o||o.unsubscribe(),a++,e.next(c=t),i>0&&f(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),c=null}))),!a&&f(null!=r?"number"==typeof r?r:+r-l.now():i)}))}({first:500,with:function(){return Et}}),Zt((function(){return t})))},B((function(t,e){var n=null,r=0,i=!1,o=function(){return i&&!n&&e.complete()};t.subscribe(X(e,(function(t){null==n||n.unsubscribe();var i=0,u=r++;Rt(v(t,u)).subscribe(n=X(e,(function(n){return e.next(y?y(t,n,u,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return m.subscribe((function(t){null==e||e.track(d,i("click",t.closestTrackedAncestor))}))}var Ge,Je=["a","button","input","select","textarea","label","[data-amp-default-track]",".amp-default-track"],Ze=["div","span","h1","h2","h3","h4","h5","h6"],$e="data-amp-track-";!function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"}(Ge||(Ge={}));var Ke=function(t){var e,n,a;void 0===t&&(t={});var s=t.dataAttributePrefix,f=void 0===s?$e:s,d=t.visualTaggingOptions,b=void 0===d?{enabled:!0,messenger:new Re}:d;t.cssSelectorAllowlist=null!==(e=t.cssSelectorAllowlist)&&void 0!==e?e:Je,t.actionClickAllowlist=null!==(n=t.actionClickAllowlist)&&void 0!==n?n:Ze,t.debounceTime=null!==(a=t.debounceTime)&&void 0!==a?a:1e3;var g="@amplitude/plugin-autocapture-browser",w=[],_=void 0,x=function(t,e){var n,r,i,o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),u="function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{left:null,top:null},c=e.getAttribute("aria-label"),l=function(t,e){return t.getAttributeNames().reduce((function(n,r){if(r.startsWith(e)){var i=r.replace(e,""),o=t.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(e,f),a=Fe(e),s=Ie(e,_),d=((n={})["[Amplitude] Element ID"]=e.id,n["[Amplitude] Element Class"]=e.className,n["[Amplitude] Element Hierarchy"]=He(e),n[h]=o,n[p]=Pe(e),n["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),n["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),n["[Amplitude] Element Aria Label"]=c,n["[Amplitude] Element Attributes"]=l,n[v]=s,n["[Amplitude] Element Parent Label"]=a,n[y]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===o&&"click"===t&&e instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=e.href),je(d)},A=function(e,n){var r={event:e,timestamp:Date.now(),type:n};if(function(t){return"click"===t.type||"change"===t.type}(r)&&null!==r.event.target){var i=Me(r.event.target,t.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=x(r.type,i)),r}return r};return{name:g,type:"enrichment",setup:function(e,n){return i(void 0,void 0,void 0,(function(){var i,u,a,s,f,d,h,p,v,y,E;return o(this,(function(o){return n?(_=e.loggerProvider,"undefined"==typeof document||(i=Ce(t,t.cssSelectorAllowlist),u=Ce(t,t.actionClickAllowlist),a=function(){var t,e,n=ce(document,"click",{capture:!0}).pipe(Zt((function(t){return A(t,"click")}))),r=ce(document,"change",{capture:!0}).pipe(Zt((function(t){return A(t,"change")})));window.navigation&&(e=ce(window.navigation,"navigate").pipe(Zt((function(t){return A(t,"navigate")}))));var i=new W((function(t){var e=new MutationObserver((function(e){t.next(e)}));return e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}})).pipe(Zt((function(t){return A(t,"mutation")})));return(t={})[Ge.ClickObservable]=n,t[Ge.ChangeObservable]=r,t[Ge.NavigateObservable]=e,t[Ge.MutationObservable]=i,t}(),s=Be({allObservables:a,options:t,amplitude:n,shouldTrackEvent:i}),w.push(s),f=function(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent;return n.changeObservable.pipe(se(ze),se((function(t){return i("change",t.closestTrackedAncestor)}))).subscribe((function(t){null==e||e.track("[Amplitude] Element Changed",r("change",t.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:x,amplitude:n,shouldTrackEvent:i}),w.push(f),d=Xe({allObservables:a,options:t,getEventProperties:x,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:u}),w.push(d),null===(y=null==e?void 0:e.loggerProvider)||void 0===y||y.log("".concat(g," has been successfully added.")),window.opener&&b.enabled&&(h=t.cssSelectorAllowlist,p=t.actionClickAllowlist,null===(E=b.messenger)||void 0===E||E.setup(r(r({logger:null==e?void 0:e.loggerProvider},(null==e?void 0:e.serverZone)&&{endpoint:m[e.serverZone]}),{isElementSelectable:Ce(t,l(l([],c(h),!1),c(p),!1)),cssSelectorAllowlist:h,actionClickAllowlist:p})))),[2]):(null===(v=null==e?void 0:e.loggerProvider)||void 0===v||v.warn("".concat(g," plugin requires a later version of @amplitude/analytics-browser. Events are not tracked.")),[2])}))}))},execute:function(t){return i(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,t]}))}))},teardown:function(){return i(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(i){try{for(t=u(w),e=t.next();!e.done;e=t.next())e.value.unsubscribe()}catch(t){n={error:t}}finally{try{e&&!e.done&&(r=t.return)&&r.call(t)}finally{if(n)throw n.error}}return[2]}))}))}}};t.DEFAULT_CSS_SELECTOR_ALLOWLIST=Je,t.DEFAULT_DATA_ATTRIBUTE_PREFIX=$e,t.WindowMessenger=Re,t.autocapturePlugin=Ke,t.plugin=Ke,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
Binary file
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AllWindowObservables, AutoCaptureOptionsWithDefaults } from 'src/autocapture-plugin';
|
|
2
|
+
import { ActionType } from 'src/typings/autocapture';
|
|
3
|
+
import { BrowserClient } from '@amplitude/analytics-types';
|
|
4
|
+
import { shouldTrackEvent } from '../helpers';
|
|
5
|
+
export declare function trackActionClick({ amplitude, allObservables, options, getEventProperties, shouldTrackEvent, shouldTrackActionClick, }: {
|
|
6
|
+
amplitude: BrowserClient;
|
|
7
|
+
allObservables: AllWindowObservables;
|
|
8
|
+
options: AutoCaptureOptionsWithDefaults;
|
|
9
|
+
getEventProperties: (actionType: ActionType, element: Element) => Record<string, any>;
|
|
10
|
+
shouldTrackActionClick: shouldTrackEvent;
|
|
11
|
+
shouldTrackEvent: shouldTrackEvent;
|
|
12
|
+
}): import("rxjs").Subscription;
|
|
13
|
+
//# sourceMappingURL=track-action-click.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-action-click.d.ts","sourceRoot":"","sources":["../../../src/autocapture/track-action-click.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAG/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAkD,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9F,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,cAAc,EACd,OAAO,EACP,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,GACvB,EAAE;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,oBAAoB,CAAC;IACrC,OAAO,EAAE,8BAA8B,CAAC;IACxC,kBAAkB,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtF,sBAAsB,EAAE,gBAAgB,CAAC;IACzC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,+BAoDA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AllWindowObservables } from 'src/autocapture-plugin';
|
|
2
|
+
import { ActionType } from 'src/typings/autocapture';
|
|
3
|
+
import { BrowserClient } from '@amplitude/analytics-types';
|
|
4
|
+
import { shouldTrackEvent } from '../helpers';
|
|
5
|
+
export declare function trackChange({ amplitude, allObservables, getEventProperties, shouldTrackEvent, }: {
|
|
6
|
+
amplitude: BrowserClient;
|
|
7
|
+
allObservables: AllWindowObservables;
|
|
8
|
+
getEventProperties: (actionType: ActionType, element: Element) => Record<string, any>;
|
|
9
|
+
shouldTrackEvent: shouldTrackEvent;
|
|
10
|
+
}): import("rxjs").Subscription;
|
|
11
|
+
//# sourceMappingURL=track-change.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-change.d.ts","sourceRoot":"","sources":["../../../src/autocapture/track-change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAA+B,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG3E,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,oBAAoB,CAAC;IACrC,kBAAkB,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtF,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,+BAeA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AllWindowObservables, AutoCaptureOptionsWithDefaults } from 'src/autocapture-plugin';
|
|
2
|
+
import { BrowserClient } from '@amplitude/analytics-types';
|
|
3
|
+
import { shouldTrackEvent } from '../helpers';
|
|
4
|
+
export declare function trackClicks({ amplitude, allObservables, options, shouldTrackEvent, }: {
|
|
5
|
+
amplitude: BrowserClient;
|
|
6
|
+
allObservables: AllWindowObservables;
|
|
7
|
+
options: AutoCaptureOptionsWithDefaults;
|
|
8
|
+
shouldTrackEvent: shouldTrackEvent;
|
|
9
|
+
}): import("rxjs").Subscription;
|
|
10
|
+
//# sourceMappingURL=track-click.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track-click.d.ts","sourceRoot":"","sources":["../../../src/autocapture/track-click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAA+B,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK3E,wBAAgB,WAAW,CAAC,EAC1B,SAAS,EACT,cAAc,EACd,OAAO,EACP,gBAAgB,GACjB,EAAE;IACD,SAAS,EAAE,aAAa,CAAC;IACzB,cAAc,EAAE,oBAAoB,CAAC;IACrC,OAAO,EAAE,8BAA8B,CAAC;IACxC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,+BAiDA"}
|
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
import { BrowserClient, BrowserConfig, EnrichmentPlugin } from '@amplitude/analytics-types';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
2
3
|
import { Messenger } from './libs/messenger';
|
|
3
4
|
import { ActionType } from './typings/autocapture';
|
|
5
|
+
import { HasEventTargetAddRemove } from 'rxjs/internal/observable/fromEvent';
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
navigation: HasEventTargetAddRemove<Event>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
interface NavigateEvent extends Event {
|
|
12
|
+
readonly navigationType: 'reload' | 'push' | 'replace' | 'traverse';
|
|
13
|
+
readonly destination: {
|
|
14
|
+
readonly url: string;
|
|
15
|
+
readonly key: string | null;
|
|
16
|
+
readonly id: string | null;
|
|
17
|
+
readonly index: number;
|
|
18
|
+
readonly sameDocument: boolean;
|
|
19
|
+
getState(): any;
|
|
20
|
+
};
|
|
21
|
+
readonly canIntercept: boolean;
|
|
22
|
+
readonly userInitiated: boolean;
|
|
23
|
+
readonly hashChange: boolean;
|
|
24
|
+
readonly signal: AbortSignal;
|
|
25
|
+
readonly formData: FormData | null;
|
|
26
|
+
readonly downloadRequest: string | null;
|
|
27
|
+
readonly info: any;
|
|
28
|
+
readonly hasUAVisualTransition: boolean;
|
|
29
|
+
/** @see https://github.com/WICG/navigation-api/pull/264 */
|
|
30
|
+
readonly sourceElement: Element | null;
|
|
31
|
+
scroll(): void;
|
|
32
|
+
}
|
|
4
33
|
type BrowserEnrichmentPlugin = EnrichmentPlugin<BrowserClient, BrowserConfig>;
|
|
5
34
|
export declare const DEFAULT_CSS_SELECTOR_ALLOWLIST: string[];
|
|
35
|
+
export declare const DEFAULT_ACTION_CLICK_ALLOWLIST: string[];
|
|
6
36
|
export declare const DEFAULT_DATA_ATTRIBUTE_PREFIX = "data-amp-track-";
|
|
7
37
|
export interface AutocaptureOptions {
|
|
8
38
|
/**
|
|
@@ -38,7 +68,43 @@ export interface AutocaptureOptions {
|
|
|
38
68
|
enabled?: boolean;
|
|
39
69
|
messenger?: Messenger;
|
|
40
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Debounce time in milliseconds for tracking events.
|
|
73
|
+
* This is used to detect rage clicks.
|
|
74
|
+
*/
|
|
75
|
+
debounceTime?: number;
|
|
76
|
+
/**
|
|
77
|
+
* CSS selector allowlist for tracking clicks that result in a DOM change/navigation on elements not already allowed by the cssSelectorAllowlist
|
|
78
|
+
*/
|
|
79
|
+
actionClickAllowlist?: string[];
|
|
80
|
+
}
|
|
81
|
+
export type AutoCaptureOptionsWithDefaults = Required<Pick<AutocaptureOptions, 'debounceTime' | 'cssSelectorAllowlist' | 'actionClickAllowlist'>> & AutocaptureOptions;
|
|
82
|
+
export declare enum ObservablesEnum {
|
|
83
|
+
ClickObservable = "clickObservable",
|
|
84
|
+
ChangeObservable = "changeObservable",
|
|
85
|
+
NavigateObservable = "navigateObservable",
|
|
86
|
+
MutationObservable = "mutationObservable"
|
|
87
|
+
}
|
|
88
|
+
type BaseTimestampedEvent<T> = {
|
|
89
|
+
event: T;
|
|
90
|
+
timestamp: number;
|
|
91
|
+
type: 'rage' | 'click' | 'change' | 'error' | 'navigate' | 'mutation';
|
|
92
|
+
};
|
|
93
|
+
export type ElementBasedEvent = MouseEvent | Event;
|
|
94
|
+
export type ElementBasedTimestampedEvent<T> = BaseTimestampedEvent<T> & {
|
|
95
|
+
event: MouseEvent | Event;
|
|
96
|
+
type: 'click' | 'change';
|
|
97
|
+
closestTrackedAncestor: Element;
|
|
98
|
+
targetElementProperties: Record<string, any>;
|
|
99
|
+
};
|
|
100
|
+
export type TimestampedEvent<T> = BaseTimestampedEvent<T> | ElementBasedTimestampedEvent<T>;
|
|
101
|
+
export interface AllWindowObservables {
|
|
102
|
+
[ObservablesEnum.ClickObservable]: Observable<ElementBasedTimestampedEvent<MouseEvent>>;
|
|
103
|
+
[ObservablesEnum.ChangeObservable]: Observable<ElementBasedTimestampedEvent<Event>>;
|
|
104
|
+
[ObservablesEnum.NavigateObservable]: Observable<TimestampedEvent<NavigateEvent>> | undefined;
|
|
105
|
+
[ObservablesEnum.MutationObservable]: Observable<TimestampedEvent<MutationRecord[]>>;
|
|
41
106
|
}
|
|
107
|
+
export declare function isElementBasedEvent<T>(event: BaseTimestampedEvent<T>): event is ElementBasedTimestampedEvent<T>;
|
|
42
108
|
export declare const autocapturePlugin: (options?: AutocaptureOptions) => BrowserEnrichmentPlugin;
|
|
43
109
|
export {};
|
|
44
110
|
//# sourceMappingURL=autocapture-plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture-plugin.d.ts","sourceRoot":"","sources":["../../src/autocapture-plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAU,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"autocapture-plugin.d.ts","sourceRoot":"","sources":["../../src/autocapture-plugin.ts"],"names":[],"mappings":"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"}
|
package/lib/scripts/helpers.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Logger } from '@amplitude/analytics-types';
|
|
2
|
+
import { AutocaptureOptions, ElementBasedEvent, ElementBasedTimestampedEvent } from './autocapture-plugin';
|
|
3
|
+
import { ActionType } from './typings/autocapture';
|
|
2
4
|
export type JSONValue = string | number | boolean | null | {
|
|
3
5
|
[x: string]: JSONValue;
|
|
4
6
|
} | Array<JSONValue>;
|
|
7
|
+
export type shouldTrackEvent = (actionType: ActionType, element: Element) => boolean;
|
|
8
|
+
export declare const createShouldTrackEvent: (autocaptureOptions: AutocaptureOptions, allowlist: string[]) => shouldTrackEvent;
|
|
5
9
|
export declare const isNonSensitiveString: (text: string | null) => boolean;
|
|
6
10
|
export declare const isTextNode: (node: Node) => boolean;
|
|
7
11
|
export declare const isNonSensitiveElement: (element: Element) => boolean;
|
|
@@ -25,4 +29,5 @@ export declare const getEventTagProps: (element: Element, logger?: Logger) => {
|
|
|
25
29
|
};
|
|
26
30
|
export declare const asyncLoadScript: (url: string) => Promise<unknown>;
|
|
27
31
|
export declare function generateUniqueId(): string;
|
|
32
|
+
export declare const filterOutNonTrackableEvents: (event: ElementBasedTimestampedEvent<ElementBasedEvent>) => boolean;
|
|
28
33
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAIzG,MAAM,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;AAErF,eAAO,MAAM,sBAAsB,uBACb,kBAAkB,aAC3B,MAAM,EAAE,KAClB,gBAsDF,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,MAAM,GAAG,IAAI,YAgBvD,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,IAAI,YAEpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,YAAa,OAAO,YAOrD,CAAC;AAGF,eAAO,MAAM,OAAO,YAAa,OAAO,KAAG,MAsB1C,CAAC;AAEF,eAAO,MAAM,WAAW,YAAa,OAAO,WAAW,MAAM,KAAG,MA+B/D,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAS,MAAM,oBAAoB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,SAAS,YAU9F,CAAC;AAEF,eAAO,MAAM,uBAAuB,YAAa,OAAO,UAAU,MAAM;;CAWvE,CAAC;AAEF,eAAO,MAAM,OAAO,UAAW,OAAO,YAOrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;CAQjC,CAAC;AAEF,eAAO,MAAM,eAAe,YAAa,OAAO,KAAG,MAYlD,CAAC;AAEF,eAAO,MAAM,yBAAyB,SAAU,OAAO,GAAG,QAAQ,aAAa,MAAM,EAAE,KAAG,OAAO,EAchG,CAAC;AAGF,eAAO,MAAM,iBAAiB,YAAa,OAAO,GAAG,IAAI,aAAa,MAAM,EAAE,KAAG,OAAO,GAAG,IAU1F,CAAC;AAGF,eAAO,MAAM,gBAAgB,YAAa,OAAO,WAAW,MAAM;;CAejE,CAAC;AAEF,eAAO,MAAM,eAAe,QAAS,MAAM,qBA2B1C,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,eAAO,MAAM,2BAA2B,UAAW,6BAA6B,iBAAiB,CAAC,KAAG,OAQpG,CAAC"}
|
|
@@ -56,10 +56,12 @@ export declare class WindowMessenger implements Messenger {
|
|
|
56
56
|
timeout: number;
|
|
57
57
|
}): Promise<any>;
|
|
58
58
|
private handleResponse;
|
|
59
|
-
setup({ logger, endpoint, isElementSelectable, }?: {
|
|
59
|
+
setup({ logger, endpoint, isElementSelectable, cssSelectorAllowlist, actionClickAllowlist, }?: {
|
|
60
60
|
logger?: Logger;
|
|
61
61
|
endpoint?: string;
|
|
62
62
|
isElementSelectable?: (action: InitializeVisualTaggingSelectorData['actionType'], element: Element) => boolean;
|
|
63
|
+
cssSelectorAllowlist?: string[];
|
|
64
|
+
actionClickAllowlist?: string[];
|
|
63
65
|
}): void;
|
|
64
66
|
private onSelect;
|
|
65
67
|
private onTrack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messenger.d.ts","sourceRoot":"","sources":["../../../src/libs/messenger.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,MAAM,MAAM,GACd,MAAM,GACN,MAAM,GACN,aAAa,GACb,iBAAiB,GACjB,oCAAoC,GACpC,+BAA+B,GAC/B,kBAAkB,GAClB,6BAA6B,GAC7B,sBAAsB,CAAC;AAE3B,UAAU,mCAAmC;IAC3C,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,+BAA+B,CAAC,EAAE,MAAM,CAAC;IACzC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,IAAI,CAAC;CAC1B;AAED,UAAU,4BAA4B;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;IACvB,aAAa,EAAE,IAAI,GAAG,SAAS,CAAC;IAChC,iBAAiB,EAAE,IAAI,GAAG,SAAS,CAAC;IACpC,oCAAoC,EAAE,mCAAmC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7F,+BAA+B,EAAE,IAAI,GAAG,SAAS,CAAC;IAClD,kBAAkB,EAAE,mBAAmB,CAAC;IACxC,6BAA6B,EAAE,4BAA4B,CAAC;IAC5D,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,CAAC;AAEF,MAAM,WAAW,OAAO,CAAC,CAAC,SAAS,MAAM;IACvC,MAAM,EAAE,CAAC,CAAC;IACV,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACtB;AAeD,qBAAa,eAAgB,YAAW,SAAS;IAC/C,QAAQ,SAAoB;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE;QAChB,CAAC,EAAE,EAAE,MAAM,GAAG;YACZ,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;YAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;SAC7B,CAAC;KACH,CAAM;gBAEK,EAAE,MAAyB,EAAE,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;IAInE,OAAO,CAAC,MAAM;IAMP,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO;;KAAsB,GAAG,OAAO,CAAC,GAAG,CAAC;IA6B1G,OAAO,CAAC,cAAc;IAUtB,KAAK,CAAC,EACJ,MAAM,EACN,QAAQ,EACR,mBAAmB,
|
|
1
|
+
{"version":3,"file":"messenger.d.ts","sourceRoot":"","sources":["../../../src/libs/messenger.ts"],"names":[],"mappings":"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"}
|
package/lib/scripts/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "1.0.0-beta.
|
|
1
|
+
export declare const VERSION = "1.0.0-beta.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amplitude/plugin-autocapture-browser",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Amplitude Inc",
|
|
6
6
|
"homepage": "https://github.com/amplitude/Amplitude-TypeScript",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@amplitude/analytics-client-common": ">=1 <3",
|
|
43
43
|
"@amplitude/analytics-types": ">=1 <3",
|
|
44
|
+
"rxjs": "^7.8.1",
|
|
44
45
|
"tslib": "^2.4.1"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"files": [
|
|
58
59
|
"lib"
|
|
59
60
|
],
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "8f38464162deb357c20d6612ea18a6328ceb2cc0"
|
|
61
62
|
}
|