Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

coveo.analytics

Package Overview
Dependencies
Maintainers
3
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coveo.analytics - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

dist/definitions/coveoua/headless.d.ts

2

dist/library.es.js

@@ -15,3 +15,3 @@ /*! *****************************************************************************

***************************************************************************** */
var t,e=function(){return(e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function n(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function r(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function i(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}!function(t){t.search="search",t.click="click",t.custom="custom",t.view="view",t.collect="collect"}(t||(t={}));var a=function(){function n(t){this.opts=t}return n.prototype.sendEvent=function(t,e){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u;return o(this,(function(o){switch(o.label){case 0:return n=this.opts,r=n.baseUrl,i=n.visitorIdProvider,a=this.shouldAppendVisitorId(t)?this.visitorIdParam:"",[4,fetch(r+"/analytics/"+t+a,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(e),credentials:"include"})];case 1:return(s=o.sent()).ok?[4,s.json()]:[3,3];case 2:return(u=o.sent()).visitorId&&(i.currentVisitorId=u.visitorId),[2,u];case 3:try{s.json()}catch(t){}throw console.error('An error has occured when sending the "'+t+'" event.',s,e),new Error('An error has occurred when sending the "'+t+'" event. Check the console logs for more details.')}}))}))},n.prototype.shouldAppendVisitorId=function(e){return-1!==[t.click,t.custom,t.search,t.view].indexOf(e)},Object.defineProperty(n.prototype,"visitorIdParam",{get:function(){var t=this.opts.visitorIdProvider.currentVisitorId;return t?"?visitor="+t:""},enumerable:!0,configurable:!0}),n.prototype.getHeaders=function(){var t=this.opts.token;return e(e({},t?{Authorization:"Bearer "+t}:{}),{"Content-Type":"application/json"})},n}();function s(){return"undefined"!=typeof navigator}function u(){return"undefined"!=typeof localStorage}function c(){return s()&&navigator.cookieEnabled}function l(){return"undefined"!=typeof crypto&&void 0!==crypto.getRandomValues}var p=[t.click,t.custom,t.search,t.view],f=function(t,n){return-1!==p.indexOf(t)?e({language:document.documentElement.lang,userAgent:navigator.userAgent},n):n},d=function(){function t(){}return t.set=function(e,n,r){var o,i,a,s,u;r?((a=new Date).setTime(a.getTime()+r),s="; expires="+a.toGMTString()):s="",-1===(u=location.hostname).indexOf(".")?document.cookie=e+"="+n+s+"; path=/":((i=u.split(".")).shift(),o="."+i.join("."),document.cookie=e+"="+n+s+"; path=/; domain="+o,null!=t.get(e)&&t.get(e)==n||(o="."+u,document.cookie=e+"="+n+s+"; path=/; domain="+o))},t.get=function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(0==(o=o.replace(/^\s+/,"")).indexOf(e))return o.substring(e.length,o.length)}return null},t.erase=function(e){t.set(e,"",-1)},t}();function h(){return u()?localStorage:c()?new y:"undefined"!=typeof sessionStorage?sessionStorage:new b}var v,g,y=function(){function t(){}return t.prototype.getItem=function(e){return d.get(""+t.prefix+e)},t.prototype.removeItem=function(e){d.erase(""+t.prefix+e)},t.prototype.setItem=function(e,n){d.set(""+t.prefix+e,n)},t.prefix="coveo_",t}(),m=function(){function t(){this.cookieStorage=new y}return t.prototype.getItem=function(t){return localStorage.getItem(t)||this.cookieStorage.getItem(t)},t.prototype.removeItem=function(t){this.cookieStorage.removeItem(t),localStorage.removeItem(t)},t.prototype.setItem=function(t,e){localStorage.setItem(t,e),this.cookieStorage.setItem(t,e)},t}(),b=function(){function t(){}return t.prototype.getItem=function(t){return null},t.prototype.removeItem=function(t){},t.prototype.setItem=function(t,e){},t}(),w=Object.freeze({__proto__:null,preferredStorage:null,getAvailableStorage:h,CookieStorage:y,CookieAndLocalStorage:m,NullStorage:b}),E="__coveo.analytics.history",I=function(){function t(t){this.store=t||h(),this.store instanceof y||!c()||(new y).removeItem(E)}return t.prototype.addElement=function(t){t.internalTime=(new Date).getTime(),this.cropQueryElement(t);var e=this.getHistoryWithInternalTime();null!=e?this.isValidEntry(t)&&this.setHistory([t].concat(e)):this.setHistory([t])},t.prototype.getHistory=function(){var t=this.getHistoryWithInternalTime();return this.stripInternalTime(t)},t.prototype.getHistoryWithInternalTime=function(){try{var t=this.store.getItem(E);return t?JSON.parse(t):[]}catch(t){return[]}},t.prototype.setHistory=function(t){try{this.store.setItem(E,JSON.stringify(t.slice(0,20)))}catch(t){}},t.prototype.clear=function(){try{this.store.removeItem(E)}catch(t){}},t.prototype.getMostRecentElement=function(){var t=this.getHistoryWithInternalTime();return null!=t?t.sort((function(t,e){return(e.internalTime||0)-(t.internalTime||0)}))[0]:null},t.prototype.cropQueryElement=function(t){t.name&&"query"==t.name.toLowerCase()&&null!=t.value&&(t.value=t.value.slice(0,75))},t.prototype.isValidEntry=function(t){var e=this.getMostRecentElement();return!e||e.value!=t.value||(t.internalTime||0)-(e.internalTime||0)>6e4},t.prototype.stripInternalTime=function(t){return t.map((function(t){return{name:t.name,time:t.time,value:t.value}}))},t}(),S=Object.freeze({__proto__:null,STORE_KEY:E,MAX_NUMBER_OF_HISTORY_ELEMENTS:20,MIN_THRESHOLD_FOR_DUPLICATE_VALUE:6e4,MAX_VALUE_SIZE:75,HistoryStore:I,default:I}),k=function(n,r){return n===t.view?(x(r.contentIdValue),e({location:window.location.toString(),referrer:document.referrer,title:document.title},r)):r},x=function(t){var e=new I,n={name:"PageView",value:t,time:JSON.stringify(new Date)};e.addElement(n)},P=function(t){return t?(Number(t)^C(new Uint8Array(1))[0]%16>>Number(t)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,P)},C=function(t){if(l())return crypto.getRandomValues(t);for(var e=0,n=0;e<t.length;e++)0==(3&e)&&(n=4294967296*Math.random()),t[e]=n>>>((3&e)<<3)&255;return t},T={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},O={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},A=e(e(e(e(e({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"}),R=Object.keys,V=function(t){return R(t).reduce((function(n,r){var o,i=A[r]||r;return e(e({},n),((o={})[i]=t[r],o))}),{})},j=function(t,n,r){return R(t).reduce((function(o,i){var a,s="il"+(n+1)+"pi"+(r+1)+(O[i]||i);return e(e({},o),((a={})[s]=t[i],a))}),{})},L=R(A).map((function(t){return A[t]})),_=R(T).map((function(t){return T[t]})),D=R(O).map((function(t){return O[t]})),F=i(_,["custom"]).join("|"),N=i(D,["custom"]).join("|"),H=new RegExp("^(pr[0-9]+)("+F+")$"),q=new RegExp("^((il[0-9]+pi[0-9]+)("+N+"))|(il[0-9]+nm)$"),B=new RegExp("^(pr[0-9]+)custom$"),M=new RegExp("^(il[0-9]+pi[0-9]+)custom$"),U=function(t){return H.test(t)},Y=function(t){return q.test(t)},Q=function(t){return-1!==L.indexOf(t)},z=function(t){return"custom"===t},W=function(t,n){return R(n).reduce((function(r,o){var i;return e(e({},r),((i={})[""+t+o]=n[o],i))}),{})},$=function(){function t(t){this.opts=t}return t.prototype.sendEvent=function(t,e){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,p;return o(this,(function(o){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return n=this.opts,r=n.baseUrl,i=n.token,a=n.visitorIdProvider,s=this.getParsedRequestDataKey(t),u=s+"="+encodeURIComponent(JSON.stringify(e)),c=a.currentVisitorId,l=[i?"access_token="+i:"",c?"visitorId="+c:""].filter((function(t){return!!t})).join("&"),p=r+"/analytics/"+t+"?"+l,console.log('Sending beacon for "'+t+'" with: ',JSON.stringify(e)),navigator.sendBeacon(p,new Blob([u],{type:"application/x-www-form-urlencoded"})),[2]}))}))},t.prototype.getParsedRequestDataKey=function(t){return t+"Event"},t}(),G=function(){function t(){}return t.prototype.sendEvent=function(t,e){return r(this,void 0,void 0,(function(){return o(this,(function(t){return[2,Promise.resolve()]}))}))},t}(),J=function(t,e){u()&&c()?this.storage=new m:u()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new b),this.beaconClient=new $(t),window.addEventListener("beforeunload",(function(){return e()}))},K=function(){this.storage=new b,this.beaconClient=new G},X={default:"https://platform.cloud.coveo.com/rest/ua",production:"https://platform.cloud.coveo.com/rest/ua",hipaa:"https://platformhipaa.cloud.coveo.com/rest/ua"},Z=function(){function i(t){if(!t)throw new Error("You have to pass options to this constructor");this.options=e(e({},this.defaultOptions),t),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[k,f],this.eventTypeMapping={};var n={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this};this.runtime=this.initRuntime(n),this.analyticsFetchClient=new a(n),this.initVisitorId()}return Object.defineProperty(i.prototype,"defaultOptions",{get:function(){return{endpoint:X.default,token:"",version:"v15"}},enumerable:!0,configurable:!0}),i.prototype.initRuntime=function(t){var e=this;return"undefined"!=typeof window&&"undefined"!=typeof document?new J(t,(function(){return e.flushBufferWithBeacon()})):new K},Object.defineProperty(i.prototype,"analyticsBeaconClient",{get:function(){return this.runtime.beaconClient},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"storage",{get:function(){return this.runtime.storage},enumerable:!0,configurable:!0}),i.prototype.initVisitorId=function(){var t=this.visitorId||this.storage.getItem("visitorId")||"";this.currentVisitorId=t||P()},Object.defineProperty(i.prototype,"currentVisitorId",{get:function(){return this.visitorId},set:function(t){this.visitorId=t,this.storage.setItem("visitorId",t)},enumerable:!0,configurable:!0}),i.prototype.sendEvent=function(t){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return r(this,void 0,void 0,(function(){var r,i,a,s,u,c,l,p,f,d,h=this;return o(this,(function(o){switch(o.label){case 0:return r=this.eventTypeMapping[t]||{},i=r.newEventType,a=void 0===i?t:i,s=r.variableLengthArgumentsNames,u=void 0===s?[]:s,c=r.addVisitorIdParameter,l=void 0!==c&&c,p=r.usesMeasurementProtocol,f=void 0!==p&&p,d=[function(t){return u.length>0?h.parseVariableArgumentsPayload(u,t):t[0]},function(t){return e({visitorId:l?h.visitorId:""},t)},function(e){return h.beforeSendHooks.reduce((function(e,n){return n(t,e)}),e)},function(e){return h.removeEmptyPayloadValues(e,t)},function(t){return h.validateParams(t)},function(t){return f?V(t):t},function(t){return f?h.removeUnknownParameters(t):t},function(t){return f?h.processCustomParameters(t):t}].reduce((function(t,e){return e(t)}),n),this.bufferedRequests.push({eventType:a,payload:d,handled:!1}),[4,this.deferExecution()];case 1:return o.sent(),[4,this.sendFromBufferWithFetch()];case 2:return[2,o.sent()]}}))}))},i.prototype.deferExecution=function(){return new Promise((function(t){return setTimeout(t,0)}))},i.prototype.flushBufferWithBeacon=function(){for(;this.hasPendingRequests();){var t=this.bufferedRequests.pop(),e=t.eventType,n=t.payload;this.analyticsBeaconClient.sendEvent(e,n)}},i.prototype.sendFromBufferWithFetch=function(){return r(this,void 0,void 0,(function(){var t,e,n;return o(this,(function(r){return(t=this.bufferedRequests.shift())?(e=t.eventType,n=t.payload,[2,this.analyticsFetchClient.sendEvent(e,n)]):[2]}))}))},i.prototype.hasPendingRequests=function(){return this.bufferedRequests.length>0},i.prototype.sendSearchEvent=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,this.sendEvent(t.search,e)]}))}))},i.prototype.sendClickEvent=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,this.sendEvent(t.click,e)]}))}))},i.prototype.sendCustomEvent=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,this.sendEvent(t.custom,e)]}))}))},i.prototype.sendViewEvent=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(n){return[2,this.sendEvent(t.view,e)]}))}))},i.prototype.getVisit=function(){return r(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return[4,fetch(this.baseUrl+"/analytics/visit")];case 1:return[4,e.sent().json()];case 2:return t=e.sent(),this.visitorId=t.visitorId,[2,t]}}))}))},i.prototype.getHealth=function(){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,fetch(this.baseUrl+"/analytics/monitoring/health")];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()]}}))}))},i.prototype.registerBeforeSendEventHook=function(t){this.beforeSendHooks.push(t)},i.prototype.addEventTypeMapping=function(t,e){this.eventTypeMapping[t]=e},i.prototype.parseVariableArgumentsPayload=function(t,n){for(var r={},o=0,i=n.length;o<i;o++){var a=n[o];if("string"==typeof a)r[t[o]]=a;else if("object"==typeof a)return e(e({},r),a)}return r},i.prototype.isKeyAllowedEmpty=function(e,n){var r;return-1!==(((r={})[t.search]=["queryText"],r)[e]||[]).indexOf(n)},i.prototype.removeEmptyPayloadValues=function(t,n){var r=this;return Object.keys(t).filter((function(e){return r.isKeyAllowedEmpty(n,e)||null!=(o=t[e])&&""!==o;var o})).reduce((function(n,r){var o;return e(e({},n),((o={})[r]=t[r],o))}),{})},i.prototype.removeUnknownParameters=function(t){return Object.keys(t).filter((function(t){if(function(t){return[U,Y,Q,z].some((function(e){return e(t)}))}(t))return!0;console.log(t,"is not processed by coveoua")})).reduce((function(n,r){var o;return e(e({},n),((o={})[r]=t[r],o))}),{})},i.prototype.processCustomParameters=function(t){var r,o=t.custom,i=n(t,["custom"]),a=R(r=i).reduce((function(t,n){var o,i=B.exec(n)||M.exec(n);if(i){var a=i[1];return e(e({},t),W(a,r[n]))}return e(e({},t),((o={})[n]=r[n],o))}),{});return e(e({},o||{}),a)},i.prototype.validateParams=function(t){var e=t.anonymizeIp,r=n(t,["anonymizeIp"]);return void 0!==e&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+e).toLowerCase())&&(r.anonymizeIp=1),r},Object.defineProperty(i.prototype,"baseUrl",{get:function(){var t=this.options,e=t.version,n=t.endpoint,r=-1!==n.indexOf(".cloud.coveo.com");return n+(r?"":"/rest")+"/"+e},enumerable:!0,configurable:!0}),i}(),tt=Object.freeze({__proto__:null,Version:"v15",Endpoints:X,CoveoAnalyticsClient:Z,default:Z}),et=s()?[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack):0,nt=Object.freeze({__proto__:null,doNotTrack:et,default:et}),rt=function(){function t(){this.plugins={}}return t.prototype.register=function(t,e){this.plugins[t]=e},t.prototype.execute=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.plugins[t],i=o[e];return i.apply(o,n)},t}(),ot=function(t){return t.protocol+"//"+t.hostname+(0===t.pathname.indexOf("/")?t.pathname:"/"+t.pathname)+t.search},it={pageview:"pageview",event:"event"},at=Object.keys(it).map((function(t){return it[t]})),st=function(){function r(t){var e=t.client,n=t.uuidGenerator,r=void 0===n?P:n;this.products=[],this.impressions=[],this.actionData={},this.client=e,this.uuidGenerator=r,this.pageViewId=r(),this.lastLocation=ot(window.location),this.lastReferrer=document.referrer,this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()}return r.prototype.addProduct=function(t){this.products.push(t)},r.prototype.addImpression=function(t){this.impressions.push(t)},r.prototype.setAction=function(t,e){this.action=t,this.actionData=e},r.prototype.clearData=function(){this.products=[],this.impressions=[],this.action=void 0,this.actionData={}},r.prototype.addHooksForECEvents=function(){var t=this;this.client.registerBeforeSendEventHook((function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=n[0];return-1!==at.indexOf(e)?t.addECDataToPayload(e,o):o}))},r.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(it.pageview,{newEventType:t.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},r.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(it.event,{newEventType:t.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},r.prototype.addECDataToPayload=function(t,n){var r=e(e(e(e({},this.getLocationInformation(t,n)),this.getDefaultContextInformation(t)),this.action?{action:this.action}:{}),this.actionData||{}),o=this.products.reduce((function(t,n,r){return e(e({},t),function(t,n){return R(t).reduce((function(r,o){var i,a="pr"+(n+1)+(T[o]||o);return e(e({},r),((i={})[a]=t[o],i))}),{})}(n,r))}),{}),i=this.getImpressionsByList().reduce((function(t,n,r){return e(e({},t),function(t,n){var r=t.impressions.reduce((function(t,r,o){return e(e({},t),j(r,n,o))}),{});t.listName&&(r["il"+(n+1)+"nm"]=t.listName);return r}(n,r))}),{});return this.clearData(),e(e(e(e({},i),o),r),n)},r.prototype.getImpressionsByList=function(){return this.impressions.reduce((function(t,e){var r=e.list,o=n(e,["list"]),i=t.find((function(t){return t.listName===r}));return i?i.impressions.push(o):t.push({listName:r,impressions:[o]}),t}),[])},r.prototype.updateStateForNewPageView=function(t){if(this.hasSentFirstPageView&&(this.pageViewId=this.uuidGenerator(),this.lastReferrer=this.lastLocation),t.page){this.lastLocation=""+function(t){return t.split("/").slice(0,3).join("/")}(this.lastLocation)+t.page.replace(/^\/?(.*)$/,"/$1")}else this.lastLocation=ot(window.location);this.hasSentFirstPageView=!0},r.prototype.getLocationInformation=function(t,e){return t===it.pageview&&this.updateStateForNewPageView(e),{referrer:this.lastReferrer,location:this.lastLocation}},r.prototype.getDefaultContextInformation=function(t){var n={hitType:t,pageViewId:this.pageViewId},r={title:document.title,encoding:document.characterSet},o={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},i={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now().toString(),eventId:this.uuidGenerator()};return e(e(e(e(e({},n),a),o),i),r)},r}(),ut=function(){function t(){this.plugins=new rt,this.params={}}return t.prototype.init=function(t,n){var r=this;if(!t)throw new Error("You must pass your token when you call 'init'");if("string"==typeof t?(n=n||X.default,this.client=new Z({token:t,endpoint:n})):"object"==typeof t&&void 0!==t.sendEvent&&(this.client=t),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");this.plugins.register("ec",new st({client:this.client})),this.client.registerBeforeSendEventHook((function(t,n){return e(e({},n),r.params)}))},t.prototype.initForProxy=function(t){if(!t)throw new Error("You must pass your endpoint when you call 'initForProxy'");if("string"!=typeof t)throw new Error("You must pass a string as the endpoint parameter when you call 'initForProxy'");this.client=new Z({endpoint:t})},t.prototype.set=function(t,e){var n=this;"string"==typeof t?this.params[t]=e:Object.keys(t).map((function(e){n.params[e]=t[e]}))},t.prototype.send=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0],o=e.slice(1);if(void 0===this.client)throw new Error("You must call init before sending an event");if(!r)throw new Error('You must provide an event type when calling "send".');return(t=this.client).sendEvent.apply(t,i([r.toLowerCase()],o))},t.prototype.onLoad=function(t){if(void 0===t)throw new Error("You must pass a function when you call 'onLoad'");t()},t.prototype.callPlugin=function(t,e){for(var n,r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];(n=this.plugins).execute.apply(n,i([t,e],r))},t.prototype.reset=function(){this.client=void 0,this.plugins=new rt,this.params={}},t}(),ct=new ut,lt=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(t),o=(r[1],r[2]),a=r[3],s=ct[a];if(o&&a)return ct.callPlugin.apply(ct,i([o,a],e));if(s)return s.apply(ct,e);var u=["init","set","send","onLoad","callPlugin"];throw new Error('The action "'+t+'" does not exist. Available actions: '+u.join(", ")+".")},pt=Object.freeze({__proto__:null,CoveoUA:ut,coveoua:ct,handleOneAnalyticsEvent:lt,default:lt});!function(t){t.interfaceLoad="interfaceLoad",t.interfaceChange="interfaceChange",t.didyoumeanAutomatic="didyoumeanAutomatic",t.didyoumeanClick="didyoumeanClick",t.resultsSort="resultsSort",t.searchboxSubmit="searchboxSubmit",t.searchboxClear="searchboxClear",t.searchboxAsYouType="searchboxAsYouType",t.breadcrumbFacet="breadcrumbFacet",t.breadcrumbResetAll="breadcrumbResetAll",t.documentQuickview="documentQuickview",t.documentOpen="documentOpen",t.omniboxAnalytics="omniboxAnalytics",t.omniboxFromLink="omniboxFromLink",t.triggerNotify="notify",t.triggerExecute="execute",t.triggerQuery="query",t.triggerRedirect="redirect"}(g||(g={}));var ft=((v={})[g.triggerNotify]="queryPipelineTriggers",v[g.triggerExecute]="queryPipelineTriggers",v[g.triggerQuery]="queryPipelineTriggers",v[g.triggerRedirect]="queryPipelineTriggers",v),dt=function(){function t(t,e){this.opts=t,this.provider=e,this.coveoAnalyticsClient=new Z(t)}return t.prototype.logInterfaceLoad=function(){return this.logSearchEvent(g.interfaceLoad)},t.prototype.logInterfaceChange=function(t){return this.logSearchEvent(g.interfaceChange,t)},t.prototype.logDidYouMeanAutomatic=function(){return this.logSearchEvent(g.didyoumeanAutomatic)},t.prototype.logDidYouMeanClick=function(){return this.logSearchEvent(g.didyoumeanClick)},t.prototype.logResultsSort=function(t){return this.logSearchEvent(g.resultsSort,t)},t.prototype.logSearchboxSubmit=function(){return this.logSearchEvent(g.searchboxSubmit)},t.prototype.logSearchboxClear=function(){return this.logSearchEvent(g.searchboxClear)},t.prototype.logSearchboxAsYouType=function(){return this.logSearchEvent(g.searchboxAsYouType)},t.prototype.logBreadcrumbFacet=function(t){return this.logSearchEvent(g.breadcrumbFacet,t)},t.prototype.logBreadcrumbResetAll=function(){return this.logSearchEvent(g.breadcrumbResetAll)},t.prototype.logDocumentQuickview=function(t,e){return this.logClickEvent(g.documentQuickview,t,e)},t.prototype.logDocumentOpen=function(t,e){return this.logClickEvent(g.documentOpen,t,e)},t.prototype.logOmniboxAnalytics=function(t){return this.logSearchEvent(g.omniboxAnalytics,t)},t.prototype.logOmniboxFromLink=function(t){return this.logSearchEvent(g.omniboxFromLink,t)},t.prototype.logTriggerNotify=function(t){return this.logCustomEvent(g.triggerNotify,t)},t.prototype.logTriggerExecute=function(t){return this.logCustomEvent(g.triggerExecute,t)},t.prototype.logTriggerQuery=function(){var t={query:this.provider.getSearchEventRequestPayload().queryText};return this.logCustomEvent(g.triggerQuery,t)},t.prototype.logTriggerRedirect=function(t){var n=e(e({},t),{query:this.provider.getSearchEventRequestPayload().queryText});return this.logCustomEvent(g.triggerRedirect,n)},t.prototype.logCustomEvent=function(t,n){var r=e(e({},this.provider.getBaseMetadata()),n),o={eventType:ft[t],eventValue:t,lastSearchQueryUid:this.provider.getSearchUID(),customData:r};return this.coveoAnalyticsClient.sendCustomEvent(o)},t.prototype.logSearchEvent=function(t,n){var r=e(e({},this.provider.getBaseMetadata()),n),o=e(e({},this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),customData:r,actionCause:t});return this.coveoAnalyticsClient.sendSearchEvent(o)},t.prototype.logClickEvent=function(t,n,r,o){var i=e(e(e({},this.provider.getBaseMetadata()),r),o),a=e(e({},n),{searchQueryUid:this.provider.getSearchUID(),actionCause:t,customData:i});return this.coveoAnalyticsClient.sendClickEvent(a)},t}();export{Z as CoveoAnalyticsClient,dt as CoveoSearchPageClient,ut as CoveoUA,pt as SimpleAnalytics,tt as analytics,nt as donottrack,lt as handleOneAnalyticsEvent,S as history,w as storage};
function e(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function t(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))}var r;!function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"}(r||(r={}));class n{constructor(e){this.opts=e}sendEvent(e,r){return t(this,void 0,void 0,(function*(){const{baseUrl:t,visitorIdProvider:n}=this.opts,i=this.shouldAppendVisitorId(e)?this.visitorIdParam:"",s=yield fetch(`${t}/analytics/${e}${i}`,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(r),credentials:"include"});if(s.ok){const e=yield s.json();return e.visitorId&&(n.currentVisitorId=e.visitorId),e}try{s.json()}catch(e){}throw console.error(`An error has occured when sending the "${e}" event.`,s,r),new Error(`An error has occurred when sending the "${e}" event. Check the console logs for more details.`)}))}shouldAppendVisitorId(e){return-1!==[r.click,r.custom,r.search,r.view].indexOf(e)}get visitorIdParam(){const{visitorIdProvider:e}=this.opts,t=e.currentVisitorId;return t?"?visitor="+t:""}getHeaders(){const{token:e}=this.opts;return Object.assign(Object.assign({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})}}function i(){return"undefined"!=typeof localStorage}function s(){return"undefined"!=typeof navigator&&navigator.cookieEnabled}function o(){return"undefined"!=typeof crypto&&void 0!==crypto.getRandomValues}const a=[r.click,r.custom,r.search,r.view],c=(e,t)=>-1!==a.indexOf(e)?Object.assign({language:document.documentElement.lang,userAgent:navigator.userAgent},t):t;class u{static set(e,t,r){var n,i,s,o,a;r?((s=new Date).setTime(s.getTime()+r),o="; expires="+s.toGMTString()):o="",-1===(a=location.hostname).indexOf(".")?document.cookie=e+"="+t+o+"; path=/":((i=a.split(".")).shift(),n="."+i.join("."),document.cookie=e+"="+t+o+"; path=/; domain="+n,null!=u.get(e)&&u.get(e)==t||(n="."+a,document.cookie=e+"="+t+o+"; path=/; domain="+n))}static get(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){var i=r[n];if(0==(i=i.replace(/^\s+/,"")).indexOf(t))return i.substring(t.length,i.length)}return null}static erase(e){u.set(e,"",-1)}}function l(){return i()?localStorage:s()?new d:"undefined"!=typeof sessionStorage?sessionStorage:new h}class d{getItem(e){return u.get(`${d.prefix}${e}`)}removeItem(e){u.erase(`${d.prefix}${e}`)}setItem(e,t){u.set(`${d.prefix}${e}`,t)}}d.prefix="coveo_";class g{constructor(){this.cookieStorage=new d}getItem(e){return localStorage.getItem(e)||this.cookieStorage.getItem(e)}removeItem(e){this.cookieStorage.removeItem(e),localStorage.removeItem(e)}setItem(e,t){localStorage.setItem(e,t),this.cookieStorage.setItem(e,t)}}class h{getItem(e){return null}removeItem(e){}setItem(e,t){}}const m="__coveo.analytics.history";class v{constructor(e){this.store=e||l(),this.store instanceof d||!s()||(new d).removeItem(m)}addElement(e){e.internalTime=(new Date).getTime(),this.cropQueryElement(e);let t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])}getHistory(){const e=this.getHistoryWithInternalTime();return this.stripInternalTime(e)}getHistoryWithInternalTime(){try{const e=this.store.getItem(m);return e?JSON.parse(e):[]}catch(e){return[]}}setHistory(e){try{this.store.setItem(m,JSON.stringify(e.slice(0,20)))}catch(e){}}clear(){try{this.store.removeItem(m)}catch(e){}}getMostRecentElement(){let e=this.getHistoryWithInternalTime();if(null!=e){return e.sort((e,t)=>(t.internalTime||0)-(e.internalTime||0))[0]}return null}cropQueryElement(e){e.name&&"query"==e.name.toLowerCase()&&null!=e.value&&(e.value=e.value.slice(0,75))}isValidEntry(e){let t=this.getMostRecentElement();return!t||t.value!=e.value||(e.internalTime||0)-(t.internalTime||0)>6e4}stripInternalTime(e){return e.map(e=>{const{name:t,time:r,value:n}=e;return{name:t,time:r,value:n}})}}const p=(e,t)=>e===r.view?(y(t.contentIdValue),Object.assign({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t,y=e=>{const t=new v,r={name:"PageView",value:e,time:JSON.stringify(new Date)};t.addElement(r)},f=e=>e?(Number(e)^b(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,f),b=e=>{if(o())return crypto.getRandomValues(e);for(var t=0,r=0;t<e.length;t++)0==(3&t)&&(r=4294967296*Math.random()),e[t]=r>>>((3&t)<<3)&255;return e},O={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},E={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},I=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"}),w=Object.keys,S=w(I).map(e=>I[e]),j=w(O).map(e=>O[e]),x=w(E).map(e=>E[e]),k=[...j,"custom"].join("|"),C=[...x,"custom"].join("|"),T=new RegExp(`^(pr[0-9]+)(${k})$`),P=new RegExp(`^((il[0-9]+pi[0-9]+)(${C}))|(il[0-9]+nm)$`),A=new RegExp("^(pr[0-9]+)custom$"),R=new RegExp("^(il[0-9]+pi[0-9]+)custom$"),$=e=>T.test(e),V=e=>P.test(e),q=e=>-1!==S.indexOf(e),B=e=>"custom"===e,U=(e,t)=>w(t).reduce((r,n)=>Object.assign(Object.assign({},r),{[`${e}${n}`]:t[n]}),{});class D{constructor(e){this.opts=e}sendEvent(e,r){return t(this,void 0,void 0,(function*(){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');const{baseUrl:t,token:n,visitorIdProvider:i}=this.opts,s=`${this.getParsedRequestDataKey(e)}=${encodeURIComponent(JSON.stringify(r))}`,o=i.currentVisitorId,a=[n?"access_token="+n:"",o?"visitorId="+o:""].filter(e=>!!e).join("&"),c=`${t}/analytics/${e}?${a}`;console.log(`Sending beacon for "${e}" with: `,JSON.stringify(r)),navigator.sendBeacon(c,new Blob([s],{type:"application/x-www-form-urlencoded"}))}))}getParsedRequestDataKey(e){return e+"Event"}}class H{sendEvent(e,r){return t(this,void 0,void 0,(function*(){return Promise.resolve()}))}}class F{constructor(e,t){i()&&s()?this.storage=new g:i()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new h),this.beaconClient=new D(e),window.addEventListener("beforeunload",()=>t())}}class M{constructor(){this.storage=new h,this.beaconClient=new H}}const L="https://platform.cloud.coveo.com/rest/ua";class N{constructor(e){if(!e)throw new Error("You have to pass options to this constructor");this.options=Object.assign(Object.assign({},this.defaultOptions),e),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[p,c],this.eventTypeMapping={};const t={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this};this.runtime=this.initRuntime(t),this.analyticsFetchClient=new n(t),this.initVisitorId()}get defaultOptions(){return{endpoint:L,token:"",version:"v15"}}initRuntime(e){return"undefined"!=typeof window&&"undefined"!=typeof document?new F(e,()=>this.flushBufferWithBeacon()):new M}get analyticsBeaconClient(){return this.runtime.beaconClient}get storage(){return this.runtime.storage}initVisitorId(){const e=this.visitorId||this.storage.getItem("visitorId")||"";this.currentVisitorId=e||f()}get currentVisitorId(){return this.visitorId}set currentVisitorId(e){this.visitorId=e,this.storage.setItem("visitorId",e)}sendEvent(e,...r){return t(this,void 0,void 0,(function*(){const{newEventType:t=e,variableLengthArgumentsNames:n=[],addVisitorIdParameter:i=!1,usesMeasurementProtocol:s=!1}=this.eventTypeMapping[e]||{},o=[e=>n.length>0?this.parseVariableArgumentsPayload(n,e):e[0],e=>Object.assign({visitorId:i?this.visitorId:""},e),t=>this.beforeSendHooks.reduce((t,r)=>r(e,t),t),t=>this.removeEmptyPayloadValues(t,e),e=>this.validateParams(e),e=>{return s?w(t=e).reduce((e,r)=>{const n=I[r]||r;return Object.assign(Object.assign({},e),{[n]:t[r]})},{}):e;var t},e=>s?this.removeUnknownParameters(e):e,e=>s?this.processCustomParameters(e):e].reduce((e,t)=>t(e),r);return this.bufferedRequests.push({eventType:t,payload:o,handled:!1}),yield this.deferExecution(),yield this.sendFromBufferWithFetch()}))}deferExecution(){return new Promise(e=>setTimeout(e,0))}flushBufferWithBeacon(){for(;this.hasPendingRequests();){const{eventType:e,payload:t}=this.bufferedRequests.pop();this.analyticsBeaconClient.sendEvent(e,t)}}sendFromBufferWithFetch(){return t(this,void 0,void 0,(function*(){const e=this.bufferedRequests.shift();if(e){const{eventType:t,payload:r}=e;return this.analyticsFetchClient.sendEvent(t,r)}}))}hasPendingRequests(){return this.bufferedRequests.length>0}sendSearchEvent(e){return t(this,void 0,void 0,(function*(){return this.sendEvent(r.search,e)}))}sendClickEvent(e){return t(this,void 0,void 0,(function*(){return this.sendEvent(r.click,e)}))}sendCustomEvent(e){return t(this,void 0,void 0,(function*(){return this.sendEvent(r.custom,e)}))}sendViewEvent(e){return t(this,void 0,void 0,(function*(){return this.sendEvent(r.view,e)}))}getVisit(){return t(this,void 0,void 0,(function*(){const e=yield fetch(this.baseUrl+"/analytics/visit"),t=yield e.json();return this.visitorId=t.visitorId,t}))}getHealth(){return t(this,void 0,void 0,(function*(){const e=yield fetch(this.baseUrl+"/analytics/monitoring/health");return yield e.json()}))}registerBeforeSendEventHook(e){this.beforeSendHooks.push(e)}addEventTypeMapping(e,t){this.eventTypeMapping[e]=t}parseVariableArgumentsPayload(e,t){const r={};for(let n=0,i=t.length;n<i;n++){const i=t[n];if("string"==typeof i)r[e[n]]=i;else if("object"==typeof i)return Object.assign(Object.assign({},r),i)}return r}isKeyAllowedEmpty(e,t){return-1!==({[r.search]:["queryText"]}[e]||[]).indexOf(t)}removeEmptyPayloadValues(e,t){return Object.keys(e).filter(r=>{return this.isKeyAllowedEmpty(t,r)||null!=(n=e[r])&&""!==n;var n}).reduce((t,r)=>Object.assign(Object.assign({},t),{[r]:e[r]}),{})}removeUnknownParameters(e){return Object.keys(e).filter(e=>{if((e=>[$,V,q,B].some(t=>t(e)))(e))return!0;console.log(e,"is not processed by coveoua")}).reduce((t,r)=>Object.assign(Object.assign({},t),{[r]:e[r]}),{})}processCustomParameters(t){const{custom:r}=t,n=e(t,["custom"]),i=w(s=n).reduce((e,t)=>{const r=A.exec(t)||R.exec(t);if(r){const n=r[1];return Object.assign(Object.assign({},e),U(n,s[t]))}return Object.assign(Object.assign({},e),{[t]:s[t]})},{});var s;return Object.assign(Object.assign({},r||{}),i)}validateParams(t){const{anonymizeIp:r}=t,n=e(t,["anonymizeIp"]);return void 0!==r&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+r).toLowerCase())&&(n.anonymizeIp=1),n}get baseUrl(){const{version:e,endpoint:t}=this.options,r=-1!==t.indexOf(".cloud.coveo.com");return`${t}${r?"":"/rest"}/${e}`}}var Q;!function(e){e.interfaceLoad="interfaceLoad",e.interfaceChange="interfaceChange",e.didyoumeanAutomatic="didyoumeanAutomatic",e.didyoumeanClick="didyoumeanClick",e.resultsSort="resultsSort",e.searchboxSubmit="searchboxSubmit",e.searchboxClear="searchboxClear",e.searchboxAsYouType="searchboxAsYouType",e.breadcrumbFacet="breadcrumbFacet",e.breadcrumbResetAll="breadcrumbResetAll",e.documentQuickview="documentQuickview",e.documentOpen="documentOpen",e.omniboxAnalytics="omniboxAnalytics",e.omniboxFromLink="omniboxFromLink",e.triggerNotify="notify",e.triggerExecute="execute",e.triggerQuery="query",e.triggerRedirect="redirect"}(Q||(Q={}));const W={[Q.triggerNotify]:"queryPipelineTriggers",[Q.triggerExecute]:"queryPipelineTriggers",[Q.triggerQuery]:"queryPipelineTriggers",[Q.triggerRedirect]:"queryPipelineTriggers"};class Y{constructor(e,t){this.opts=e,this.provider=t,this.coveoAnalyticsClient=new N(e)}logInterfaceLoad(){return this.logSearchEvent(Q.interfaceLoad)}logInterfaceChange(e){return this.logSearchEvent(Q.interfaceChange,e)}logDidYouMeanAutomatic(){return this.logSearchEvent(Q.didyoumeanAutomatic)}logDidYouMeanClick(){return this.logSearchEvent(Q.didyoumeanClick)}logResultsSort(e){return this.logSearchEvent(Q.resultsSort,e)}logSearchboxSubmit(){return this.logSearchEvent(Q.searchboxSubmit)}logSearchboxClear(){return this.logSearchEvent(Q.searchboxClear)}logSearchboxAsYouType(){return this.logSearchEvent(Q.searchboxAsYouType)}logBreadcrumbFacet(e){return this.logSearchEvent(Q.breadcrumbFacet,e)}logBreadcrumbResetAll(){return this.logSearchEvent(Q.breadcrumbResetAll)}logDocumentQuickview(e,t){return this.logClickEvent(Q.documentQuickview,e,t)}logDocumentOpen(e,t){return this.logClickEvent(Q.documentOpen,e,t)}logOmniboxAnalytics(e){return this.logSearchEvent(Q.omniboxAnalytics,e)}logOmniboxFromLink(e){return this.logSearchEvent(Q.omniboxFromLink,e)}logTriggerNotify(e){return this.logCustomEvent(Q.triggerNotify,e)}logTriggerExecute(e){return this.logCustomEvent(Q.triggerExecute,e)}logTriggerQuery(){const e={query:this.provider.getSearchEventRequestPayload().queryText};return this.logCustomEvent(Q.triggerQuery,e)}logTriggerRedirect(e){const t=Object.assign(Object.assign({},e),{query:this.provider.getSearchEventRequestPayload().queryText});return this.logCustomEvent(Q.triggerRedirect,t)}logCustomEvent(e,t){const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t),n={eventType:W[e],eventValue:e,lastSearchQueryUid:this.provider.getSearchUID(),customData:r};return this.coveoAnalyticsClient.sendCustomEvent(n)}logSearchEvent(e,t){const r=Object.assign(Object.assign({},this.provider.getBaseMetadata()),t),n=Object.assign(Object.assign({},this.provider.getSearchEventRequestPayload()),{searchQueryUid:this.provider.getSearchUID(),customData:r,actionCause:e});return this.coveoAnalyticsClient.sendSearchEvent(n)}logClickEvent(e,t,r,n){const i=Object.assign(Object.assign(Object.assign({},this.provider.getBaseMetadata()),r),n),s=Object.assign(Object.assign({},t),{searchQueryUid:this.provider.getSearchUID(),actionCause:e,customData:i});return this.coveoAnalyticsClient.sendClickEvent(s)}}export{N as CoveoAnalyticsClient,Y as CoveoSearchPageClient};
//# sourceMappingURL=library.es.js.map
{
"name": "coveo.analytics",
"version": "2.2.1",
"version": "2.3.0",
"description": "📈 Coveo analytics client (node and browser compatible) ",

@@ -5,0 +5,0 @@ "main": "dist/library.js",

import CoveoAnalyticsClient, { ClientOptions } from '../client/analytics';
import { SearchEventRequest, ClickEventRequest, DocumentInformation, CustomEventRequest } from '../events';
import { SearchEventRequest, ClickEventRequest, CustomEventRequest } from '../events';
import { SearchPageEvents, OmniboxSuggestionsMetadata, FacetMetadata, FacetRangeMetadata, CategoryFacetMetadata, DocumentIdentifier, InterfaceChangeMetadata, ResultsSortMetadata, PartialDocumentInformation, CustomEventsTypes, TriggerNotifyMetadata, TriggerExecuteMetadata, TriggerRedirectMetadata } from './searchPageEvents';

@@ -4,0 +4,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc