coveo.analytics 2.19.4 → 2.19.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/caseAssist/caseAssistActions.d.ts +1 -0
- package/dist/definitions/caseAssist/caseAssistClient.d.ts +5 -1
- package/dist/definitions/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.d.ts +2 -2
- package/dist/definitions/client/measurementProtocolMapping/serviceMeasurementProtocolMapper.d.ts +2 -1
- package/dist/definitions/coveoua/headless.d.ts +1 -1
- package/dist/definitions/coveoua/library.d.ts +1 -1
- package/dist/definitions/src/coveoua/headless.d.ts +1 -1
- package/dist/definitions/src/coveoua/library.d.ts +1 -1
- package/dist/library.es.js +25 -14
- package/dist/library.js +297 -461
- package/dist/react-native.es.js +10 -10
- package/package.json +4 -1
- package/src/caseAssist/caseAssistActions.ts +1 -0
- package/src/caseAssist/caseAssistClient.spec.ts +17 -5
- package/src/caseAssist/caseAssistClient.ts +28 -4
- package/src/coveoua/headless.ts +1 -1
- package/src/coveoua/library.ts +1 -1
- package/dist/definitions/src/client/location.d.ts +0 -1
package/dist/coveoua.browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var coveoua=function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function e(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o,t,g=function(){return(g=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}).apply(this,arguments)};function y(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function p(e,s,a,c){return new(a=a||Promise)(function(n,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function o(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(r,o)}i((c=c.apply(e,s||[])).next())})}function m(n,r){var o,i,s,e,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,i&&(s=2&t[0]?i.return:t[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,t[1])).done)return s;switch(i=0,s&&(t=[2&t[0],s.value]),t[0]){case 0:case 1:s=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,i=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!s||t[1]>s[0]&&t[1]<s[3])){a.label=t[1];break}if(6===t[0]&&a.label<s[1]){a.label=s[1],s=t;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(t);break}s[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],i=0}finally{o=s=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function a(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r}function n(){return"undefined"!=typeof navigator}function i(){return"undefined"!=typeof document}function c(){try{return"undefined"!=typeof localStorage}catch(e){return}}function u(){return n()&&navigator.cookieEnabled}function s(){return"undefined"!=typeof crypto&&void 0!==crypto.getRandomValues}(t=o=o||{}).search="search",t.click="click",t.custom="custom",t.view="view",t.collect="collect";var l=[o.click,o.custom,o.search,o.view],d=(h.set=function(e,t,n){var r,o,i,s;i=n?((o=new Date).setTime(o.getTime()+n),"; expires="+o.toGMTString()):"",-1===(s=location.hostname).indexOf(".")?document.cookie=e+"="+t+i+"; path=/":((r=s.split(".")).shift(),f({name:e,value:t,expires:i,domain:"."+r.join(".")}),null!=h.get(e)&&h.get(e)==t||f({name:e,value:t,expires:i,domain:"."+s}))},h.get=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(0==(o=o.replace(/^\s+/,"")).indexOf(t))return o.substring(t.length,o.length)}return null},h.erase=function(e){h.set(e,"",-1)},h);function h(){}function f(e){var t=e.name,n=e.value,r=e.expires,o=e.domain;document.cookie=t+"="+n+r+"; path=/; domain="+o+"; SameSite=Lax"}function v(){return c()?localStorage:u()?new S:function(){try{return"undefined"!=typeof sessionStorage}catch(e){return}}()?sessionStorage:new k}var S=(w.prototype.getItem=function(e){return d.get(""+w.prefix+e)},w.prototype.removeItem=function(e){d.erase(""+w.prefix+e)},w.prototype.setItem=function(e,t){d.set(""+w.prefix+e,t)},w.prefix="coveo_",w);function w(){}var E=(b.prototype.getItem=function(e){return localStorage.getItem(e)||this.cookieStorage.getItem(e)},b.prototype.removeItem=function(e){this.cookieStorage.removeItem(e),localStorage.removeItem(e)},b.prototype.setItem=function(e,t){localStorage.setItem(e,t),this.cookieStorage.setItem(e,t)},b);function b(){this.cookieStorage=new S}var k=(C.prototype.getItem=function(e){return null},C.prototype.removeItem=function(e){},C.prototype.setItem=function(e,t){},C);function C(){}var I=Object.freeze({__proto__:null,preferredStorage:null,getAvailableStorage:v,CookieStorage:S,CookieAndLocalStorage:E,NullStorage:k}),P="__coveo.analytics.history",A=(R.prototype.addElement=function(e){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));var t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])},R.prototype.addElementAsync=function(n){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return n.internalTime=(new Date).getTime(),n=this.cropQueryElement(this.stripEmptyQuery(n)),[4,this.getHistoryWithInternalTimeAsync()];case 1:return null!=(t=e.sent())?this.isValidEntry(n)&&this.setHistory([n].concat(t)):this.setHistory([n]),[2]}})})},R.prototype.getHistory=function(){var e=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(e))},R.prototype.getHistoryAsync=function(){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,this.getHistoryWithInternalTimeAsync()];case 1:return t=e.sent(),[2,this.stripEmptyQueries(this.stripInternalTime(t))]}})})},R.prototype.getHistoryWithInternalTime=function(){try{var e=this.store.getItem(P);return e&&"string"==typeof e?JSON.parse(e):[]}catch(e){return[]}},R.prototype.getHistoryWithInternalTimeAsync=function(){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.store.getItem(P)];case 1:return(t=e.sent())?[2,JSON.parse(t)]:[2,[]];case 2:return e.sent(),[2,[]];case 3:return[2]}})})},R.prototype.setHistory=function(e){try{this.store.setItem(P,JSON.stringify(e.slice(0,20)))}catch(e){}},R.prototype.clear=function(){try{this.store.removeItem(P)}catch(e){}},R.prototype.getMostRecentElement=function(){var e=this.getHistoryWithInternalTime();return null==e?null:e.sort(function(e,t){return(t.internalTime||0)-(e.internalTime||0)})[0]},R.prototype.cropQueryElement=function(e){return e.name&&e.value&&"query"===e.name.toLowerCase()&&(e.value=e.value.slice(0,75)),e},R.prototype.isValidEntry=function(e){var t=this.getMostRecentElement();return!t||t.value!=e.value||6e4<(e.internalTime||0)-(t.internalTime||0)},R.prototype.stripInternalTime=function(e){return e.map(function(e){return{name:e.name,time:e.time,value:e.value}})},R.prototype.stripEmptyQuery=function(e){var t=e.name,n=e.time,r=e.value;return t&&"string"==typeof r&&"query"===t.toLowerCase()&&""===r.trim()?{name:t,time:n}:e},R.prototype.stripEmptyQueries=function(e){var t=this;return e.map(function(e){return t.stripEmptyQuery(e)})},R);function R(e){this.store=e||v()}function x(e){return-1!==ve.indexOf(e)}function T(e){return"custom"===e}var F=Object.freeze({__proto__:null,STORE_KEY:P,MAX_NUMBER_OF_HISTORY_ELEMENTS:20,MIN_THRESHOLD_FOR_DUPLICATE_VALUE:6e4,MAX_VALUE_SIZE:75,HistoryStore:A,default:A}),O=function(r){return p(void 0,void 0,void 0,function(){var t,n;return m(this,function(e){switch(e.label){case 0:return t=new A,n={name:"PageView",value:r,time:JSON.stringify(new Date)},[4,t.addElementAsync(n)];case 1:return e.sent(),[2]}})})},_=function(e){return e?(Number(e)^V(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,_)},V=function(e){if(s())return crypto.getRandomValues(e);for(var t=0,n=0;t<e.length;t++)0==(3&t)&&(n=4294967296*Math.random()),e[t]=n>>>((3&t)<<3)&255;return e},q=Object.keys,L={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},H=a(q(L).map(function(e){return L[e]})).join("|"),M=new RegExp("^("+H+"$)"),N=[function(e){return M.test(e)}],D={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},j={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},U={action:"pa",list:"pal",listSource:"pls"},B={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},Q={id:"quoteId",affiliation:"quoteAffiliation"},z={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},Y={add:U,bookmark_add:U,bookmark_remove:U,click:U,checkout:U,checkout_option:U,detail:U,impression:U,remove:U,refund:g(g({},U),B),purchase:g(g({},U),B),quickview:U,quote:g(g({},U),Q),review:g(g({},U),z)},W=function(o,i,s,a){return q(o).reduce(function(e,t){var n,r="il"+(i+1)+a+(s+1)+(j[t]||t);return g(g({},e),((n={})[r]=o[t],n))},{})},$=q(D).map(function(e){return D[e]}),G=q(j).map(function(e){return j[e]}),K=q(U).map(function(e){return U[e]}),J=q(B).map(function(e){return B[e]}),X=q(z).map(function(e){return z[e]}),Z=q(Q).map(function(e){return Q[e]}),ee=a($,["custom"]).join("|"),te=a(G,["custom"]).join("|"),ne="(pr[0-9]+)",re="(il[0-9]+pi[0-9]+)",oe=new RegExp("^"+ne+"("+ee+")$"),ie=new RegExp("^("+re+"("+te+"))|(il[0-9]+nm)$"),se=new RegExp("^("+K.join("|")+")$"),ae=new RegExp("^("+J.join("|")+")$"),ce=new RegExp("^"+ne+"custom$"),ue=new RegExp("^"+re+"custom$"),le=new RegExp("^("+a(["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],X,Z).join("|")+")$"),pe=[function(e){return ie.test(e)},function(e){return oe.test(e)},function(e){return se.test(e)},function(e){return ae.test(e)},function(e){return le.test(e)}],de=[ce,ue],he=g(g(g(g({},{anonymizeIp:"aip"}),{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale"].reduce(function(e,t){var n;return g(g({},e),((n={})[t]=t,n))},{})),fe=g(g({},he),{svcAction:"svc_action",svcActionData:"svc_action_data"}),ve=q(fe).map(function(e){return fe[e]}),ge=function(n){var r=void 0;return a(de).every(function(e){var t;return r=null===(t=e.exec(n))||void 0===t?void 0:t[1],!Boolean(r)}),r},ye=function(r,o){return q(o).reduce(function(e,t){var n;return g(g({},e),((n={})[""+r+t]=o[t],n))},{})},me=(Se.prototype.sendEvent=function(d,h){return p(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,l,p;return m(this,function(e){switch(e.label){case 0:if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return t=this.opts,n=t.baseUrl,r=t.preprocessRequest,o=this.encodeForEventType(d,h),[4,this.getQueryParamsForEventType(d)];case 1:return i=e.sent(),s={url:n+"/analytics/"+d+"?"+i,body:new Blob([o],{type:"application/x-www-form-urlencoded"})},l=[g({},s)],r?[4,r(s,"analyticsBeacon")]:[3,3];case 2:return p=e.sent(),[3,4];case 3:p={},e.label=4;case 4:return a=g.apply(void 0,l.concat([p])),c=a.url,u=a.body,console.log('Sending beacon for "'+d+'" with: ',JSON.stringify(h)),navigator.sendBeacon(c,u),[2]}})})},Se.prototype.encodeForEventType=function(e,t){return this.isEventTypeLegacy(e)?this.encodeForLegacyType(e,t):this.encodeForFormUrlEncoded(g({access_token:this.opts.token},t))},Se.prototype.getQueryParamsForEventType=function(o){return p(this,void 0,void 0,function(){var t,n,r;return m(this,function(e){switch(e.label){case 0:return t=this.opts,n=t.token,[4,t.visitorIdProvider.getCurrentVisitorId()];case 1:return r=e.sent(),[2,[n&&this.isEventTypeLegacy(o)?"access_token="+n:"",r?"visitorId="+r:"","discardVisitInfo=true"].filter(function(e){return!!e}).join("&")]}})})},Se.prototype.isEventTypeLegacy=function(e){return-1!==[o.click,o.custom,o.search,o.view].indexOf(e)},Se.prototype.encodeForLegacyType=function(e,t){return e+"Event="+encodeURIComponent(JSON.stringify(t))},Se.prototype.encodeForFormUrlEncoded=function(t){var n=this;return Object.keys(t).filter(function(e){return!!t[e]}).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(n.encodeValue(t[e]))}).join("&")},Se.prototype.encodeValue=function(e){return"number"==typeof e||"string"==typeof e||"boolean"==typeof e?e:JSON.stringify(e)},Se);function Se(e){this.opts=e}var we=(Ee.prototype.sendEvent=function(e,t){return p(this,void 0,void 0,function(){return m(this,function(e){return[2,Promise.resolve()]})})},Ee);function Ee(){}var be=window.fetch,ke=(Ce.prototype.sendEvent=function(f,v){return p(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,l,p,d,h;return m(this,function(e){switch(e.label){case 0:return t=this.opts,n=t.baseUrl,r=t.visitorIdProvider,o=t.preprocessRequest,this.shouldAppendVisitorId(f)?[4,this.getVisitorIdParam()]:[3,2];case 1:return i=e.sent(),[3,3];case 2:i="",e.label=3;case 3:return s={url:n+"/analytics/"+f+i,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(v)},l=[g({},s)],o?[4,o(s,"analyticsFetch")]:[3,5];case 4:return p=e.sent(),[3,6];case 5:p={},e.label=6;case 6:return a=g.apply(void 0,l.concat([p])),c=a.url,u=y(a,["url"]),[4,be(c,u)];case 7:return(d=e.sent()).ok?[4,d.json()]:[3,9];case 8:return(h=e.sent()).visitorId&&r.setCurrentVisitorId(h.visitorId),[2,h];case 9:try{d.json()}catch(e){}throw console.error('An error has occured when sending the "'+f+'" event.',d,v),new Error('An error has occurred when sending the "'+f+'" event. Check the console logs for more details.')}})})},Ce.prototype.shouldAppendVisitorId=function(e){return-1!==[o.click,o.custom,o.search,o.view].indexOf(e)},Ce.prototype.getVisitorIdParam=function(){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,this.opts.visitorIdProvider.getCurrentVisitorId()];case 1:return[2,(t=e.sent())?"?visitor="+t:""]}})})},Ce.prototype.getHeaders=function(){var e=this.opts.token;return g(g({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})},Ce);function Ce(e){this.opts=e}var Ie=function(e,i){var s=this;c()&&u()?this.storage=new E:c()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new k),this.client=new ke(e),this.beaconClient=new me(e),window.addEventListener("beforeunload",function(){for(var e=0,t=i();e<t.length;e++){var n=t[e],r=n.eventType,o=n.payload;s.beaconClient.sendEvent(r,o)}})},Pe=function(e,t){this.storage=t||new k,this.client=new ke(e)},Ae=function(){this.storage=new k,this.client=new we};var Re=["1",1,"yes",!0];function xe(){return n()&&[navigator.globalPrivacyControl,navigator.doNotTrack,navigator.msDoNotTrack,window.doNotTrack].some(function(e){return-1!==Re.indexOf(e)})}var Te=Object.freeze({__proto__:null,doNotTrack:xe,default:xe}),Fe={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"},Oe=(Object.defineProperty(_e.prototype,"defaultOptions",{get:function(){return{endpoint:Fe.default,token:"",version:"v15",beforeSendHooks:[],afterSendHooks:[]}},enumerable:!0,configurable:!0}),_e.prototype.initRuntime=function(e){var t=this;return"undefined"!=typeof window&&i()?new Ie(e,function(){var e=a(t.bufferedRequests);return t.bufferedRequests=[],e}):("undefined"!=typeof navigator&&"ReactNative"==navigator.product&&console.warn("\n We've detected you're using React Native but have not provided the corresponding runtime, \n for an optimal experience please install @react-native-async-storage/async-storage and instantiate \n your analytics client as follows:\n \n import {ReactNativeRuntime} from 'coveo.analytics/react-native';\n \n const analytics = new CoveoAnalytics({\n ...your options,\n runtimeEnvironment: new ReactNativeRuntime();\n })\n "),new Pe(e))},Object.defineProperty(_e.prototype,"storage",{get:function(){return this.runtime.storage},enumerable:!0,configurable:!0}),_e.prototype.determineVisitorId=function(){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.storage.getItem("visitorId")];case 1:return[2,e.sent()||_()];case 2:return t=e.sent(),console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),[2,_()];case 3:return[2]}})})},_e.prototype.getCurrentVisitorId=function(){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return this.visitorId?[3,3]:[4,this.determineVisitorId()];case 1:return t=e.sent(),[4,this.setCurrentVisitorId(t)];case 2:e.sent(),e.label=3;case 3:return[2,this.visitorId]}})})},_e.prototype.setCurrentVisitorId=function(t){return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return this.visitorId=t,[4,this.storage.setItem("visitorId",t)];case 1:return e.sent(),[2]}})})},_e.prototype.getParameters=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,this.resolveParameters.apply(this,a([t],n))];case 1:return[2,e.sent()]}})})},_e.prototype.getPayload=function(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,this.resolveParameters.apply(this,a([n],r))];case 1:return t=e.sent(),[4,this.resolvePayloadForParameters(n,t)];case 2:return[2,e.sent()]}})})},Object.defineProperty(_e.prototype,"currentVisitorId",{get:function(){return"string"!=typeof(this.visitorId||this.storage.getItem("visitorId"))&&this.setCurrentVisitorId(_()),this.visitorId},set:function(e){this.visitorId=e,this.storage.setItem("visitorId",e)},enumerable:!0,configurable:!0}),_e.prototype.resolveParameters=function(u){for(var l=[],e=1;e<arguments.length;e++)l[e-1]=arguments[e];return p(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c=this;return m(this,function(e){switch(e.label){case 0:return t=this.eventTypeMapping[u]||{},r=void 0===(n=t.variableLengthArgumentsNames)?[]:n,i=void 0!==(o=t.addVisitorIdParameter)&&o,a=void 0!==(s=t.usesMeasurementProtocol)&&s,[4,[function(e){return 0<r.length?c.parseVariableArgumentsPayload(r,e):e[0]},function(o){return p(c,void 0,void 0,function(){var t,n,r;return m(this,function(e){switch(e.label){case 0:return t=[g({},o)],n={},i?[4,this.getCurrentVisitorId()]:[3,2];case 1:return r=e.sent(),[3,3];case 2:r="",e.label=3;case 3:return[2,g.apply(void 0,t.concat([(n.visitorId=r,n)]))]}})})},function(e){return a?c.ensureAnonymousUserWhenUsingApiKey(e):e},function(e){return c.beforeSendHooks.reduce(function(n,r){return p(c,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(u,t)];case 2:return[2,e.sent()]}})})},e)}].reduce(function(n,r){return p(c,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(t)];case 2:return[2,e.sent()]}})})},Promise.resolve(l))];case 1:return[2,e.sent()]}})})},_e.prototype.resolvePayloadForParameters=function(r,i){return p(this,void 0,void 0,function(){var t,n,o=this;return m(this,function(e){switch(e.label){case 0:return t=(this.eventTypeMapping[r]||{}).usesMeasurementProtocol,n=void 0!==t&&t,[4,[function(e){return o.removeEmptyPayloadValues(e,r)},function(e){return o.validateParams(e)},function(e){return n?(i=!!(o=e).action&&Y[o.action]||{},q(o).reduce(function(e,t){var n,r=i[t]||fe[t]||t;return g(g({},e),((n={})[r]=o[t],n))},{})):e;var o,i},function(e){return n?o.removeUnknownParameters(e):e},function(e){return n?o.processCustomParameters(e):e}].reduce(function(n,r){return p(o,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(t)];case 2:return[2,e.sent()]}})})},Promise.resolve(i))];case 1:return[2,e.sent()]}})})},_e.prototype.sendEvent=function(i){for(var s=[],e=1;e<arguments.length;e++)s[e-1]=arguments[e];return p(this,void 0,void 0,function(){var t,n,r,o;return m(this,function(e){switch(e.label){case 0:return t=(this.eventTypeMapping[i]||{}).newEventType,n=void 0===t?i:t,[4,this.resolveParameters.apply(this,a([i],s))];case 1:return r=e.sent(),[4,this.resolvePayloadForParameters(i,r)];case 2:return o=e.sent(),this.bufferedRequests.push({eventType:n,payload:o}),[4,Promise.all(this.afterSendHooks.map(function(e){return e(i,r)}))];case 3:return e.sent(),[4,this.deferExecution()];case 4:return e.sent(),[4,this.sendFromBufferWithFetch()];case 5:return[2,e.sent()]}})})},_e.prototype.deferExecution=function(){return new Promise(function(e){return setTimeout(e,0)})},_e.prototype.sendFromBufferWithFetch=function(){return p(this,void 0,void 0,function(){var t,n,r;return m(this,function(e){return(t=this.bufferedRequests.shift())?(n=t.eventType,r=t.payload,[2,this.runtime.client.sendEvent(n,r)]):[2]})})},_e.prototype.clear=function(){this.storage.removeItem("visitorId"),(new A).clear()},_e.prototype.sendSearchEvent=function(t){return p(this,void 0,void 0,function(){return m(this,function(e){return[2,this.sendEvent(o.search,t)]})})},_e.prototype.sendClickEvent=function(t){return p(this,void 0,void 0,function(){return m(this,function(e){return[2,this.sendEvent(o.click,t)]})})},_e.prototype.sendCustomEvent=function(t){return p(this,void 0,void 0,function(){return m(this,function(e){return[2,this.sendEvent(o.custom,t)]})})},_e.prototype.sendViewEvent=function(t){return p(this,void 0,void 0,function(){return m(this,function(e){return[2,this.sendEvent(o.view,t)]})})},_e.prototype.getVisit=function(){return p(this,void 0,void 0,function(){var t;return m(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]}})})},_e.prototype.getHealth=function(){return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,fetch(this.baseUrl+"/analytics/monitoring/health")];case 1:return[4,e.sent().json()];case 2:return[2,e.sent()]}})})},_e.prototype.registerBeforeSendEventHook=function(e){this.beforeSendHooks.push(e)},_e.prototype.registerAfterSendEventHook=function(e){this.afterSendHooks.push(e)},_e.prototype.addEventTypeMapping=function(e,t){this.eventTypeMapping[e]=t},_e.prototype.parseVariableArgumentsPayload=function(e,t){for(var n={},r=0,o=t.length;r<o;r++){var i=t[r];if("string"==typeof i)n[e[r]]=i;else if("object"==typeof i)return g(g({},n),i)}return n},_e.prototype.isKeyAllowedEmpty=function(e,t){var n;return-1!==((n={})[o.search]=["queryText"],(n[e]||[]).indexOf(t))},_e.prototype.removeEmptyPayloadValues=function(r,n){var o=this;return Object.keys(r).filter(function(e){return o.isKeyAllowedEmpty(n,e)||null!=(t=r[e])&&""!==t;var t}).reduce(function(e,t){var n;return g(g({},e),((n={})[t]=r[t],n))},{})},_e.prototype.removeUnknownParameters=function(r){return Object.keys(r).filter(function(e){if(t=e,a(pe,N,[x,T]).some(function(e){return e(t)}))return!0;var t;console.log(e,"is not processed by coveoua")}).reduce(function(e,t){var n;return g(g({},e),((n={})[t]=r[t],n))},{})},_e.prototype.processCustomParameters=function(e){var o,t=e.custom,n=y(e,["custom"]),r=this.lowercaseKeys(t),i=q(o=n).reduce(function(e,t){var n,r=ge(t);return g(g({},e),r?ye(r,o[t]):((n={})[t]=o[t],n))},{});return g(g({},r),i)},_e.prototype.lowercaseKeys=function(r){return Object.keys(r||{}).reduce(function(e,t){var n;return g(g({},e),((n={})[t.toLowerCase()]=r[t],n))},{})},_e.prototype.validateParams=function(e){var t=e.anonymizeIp,n=y(e,["anonymizeIp"]);return void 0!==t&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+t).toLowerCase())&&(n.anonymizeIp=1),n},_e.prototype.ensureAnonymousUserWhenUsingApiKey=function(e){var t,n=e.userId,r=y(e,["userId"]);return null!=(t=this.options.token)&&t.startsWith("xx")&&!n?(r.userId="anonymous",r):e},Object.defineProperty(_e.prototype,"baseUrl",{get:function(){var e=this.options,t=e.version,n=e.endpoint,r=-1!==n.indexOf(".cloud.coveo.com");return n+(r?"":"/rest")+"/"+t},enumerable:!0,configurable:!0}),_e);function _e(e){if(!e)throw new Error("You have to pass options to this constructor");this.options=g(g({},this.defaultOptions),e),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[function(t,n){return p(void 0,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return t!==o.view?[3,2]:[4,O(n.contentIdValue)];case 1:return e.sent(),[2,g({location:window.location.toString(),referrer:document.referrer,title:document.title},n)];case 2:return[2,n]}})})},function(e,t){return-1!==l.indexOf(e)?g({language:i()?document.documentElement.lang:"unknown",userAgent:n()?navigator.userAgent:"unknown"},t):t}].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};var t={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};this.runtime=this.options.runtimeEnvironment||this.initRuntime(t),xe()&&(this.clear(),this.runtime.storage=new k)}function Ve(e){return e.protocol+"//"+e.hostname+(0===e.pathname.indexOf("/")?e.pathname:"/"+e.pathname)+e.search}var qe=Object.freeze({__proto__:null,Version:"v15",Endpoints:Fe,CoveoAnalyticsClient:Oe,default:Oe}),Le={pageview:"pageview",event:"event"},He=(Me.prototype.setAction=function(e,t){this.action=e,this.actionData=t},Me.prototype.clearData=function(){this.clearPluginData(),this.action=void 0,this.actionData={}},Me.prototype.getLocationInformation=function(e,t){return g({hitType:e},this.getNextValues(e,t))},Me.prototype.updateLocationInformation=function(e,t){this.updateLocationForNextPageView(e,t)},Me.prototype.getDefaultContextInformation=function(e){var t={title:document.title,encoding:document.characterSet},n={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},r={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now().toString(),eventId:this.uuidGenerator()};return g(g(g(g({},o),n),r),t)},Me.prototype.updateLocationForNextPageView=function(e,t){var n=this.getNextValues(e,t),r=n.pageViewId,o=n.referrer,i=n.location;this.lastReferrer=o,this.pageViewId=r,this.currentLocation=i,e===Le.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)},Me.prototype.getNextValues=function(e,t){return{pageViewId:e===Le.pageview?this.nextPageViewId:this.pageViewId,referrer:e===Le.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:e===Le.pageview?this.getCurrentLocationFromPayload(t):this.currentLocation}},Me.prototype.getCurrentLocationFromPayload=function(e){return e.page?""+this.currentLocation.split("/").slice(0,3).join("/")+e.page.replace(/^\/?(.*)$/,"/$1"):Ve(window.location)},Me);function Me(e){var t=e.client,n=e.uuidGenerator,r=void 0===n?_:n;this.actionData={},this.client=t,this.uuidGenerator=r,this.pageViewId=r(),this.nextPageViewId=this.pageViewId,this.currentLocation=Ve(window.location),this.lastReferrer=document.referrer,this.addHooks()}var Ne,De=g({},Le),je=Object.keys(De).map(function(e){return De[e]});function Ue(e){var t=e.client,n=e.uuidGenerator,r=void 0===n?_:n,o=Ne.call(this,{client:t,uuidGenerator:r})||this;return o.products=[],o.impressions=[],o}var Be,Qe=(e(Ue,Ne=He),Ue.prototype.addHooks=function(){this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()},Ue.prototype.addProduct=function(e){this.products.push(e)},Ue.prototype.addImpression=function(e){this.impressions.push(e)},Ue.prototype.clearPluginData=function(){this.products=[],this.impressions=[]},Ue.prototype.addHooksForECEvents=function(){var o=this;this.client.registerBeforeSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==je.indexOf(e)?o.addECDataToPayload(e,r):r}),this.client.registerAfterSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==je.indexOf(e)&&o.updateLocationInformation(e,r),r})},Ue.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(De.pageview,{newEventType:o.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},Ue.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(De.event,{newEventType:o.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},Ue.prototype.addECDataToPayload=function(e,t){var n=g(g(g(g({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{action:this.action}:{}),this.actionData||{}),r=this.getProductPayload(),o=this.getImpressionPayload();return this.clearData(),g(g(g(g({},o),r),n),t)},Ue.prototype.getProductPayload=function(){var t=this;return this.products.map(function(e){return t.assureProductValidity(e)}).reduce(function(e,t,n){return g(g({},e),(i=n,q(o=t).reduce(function(e,t){var n,r="pr"+(i+1)+(D[t]||t);return g(g({},e),((n={})[r]=o[t],n))},{})));var o,i},{})},Ue.prototype.getImpressionPayload=function(){var r=this;return this.getImpressionsByList().map(function(e){var t=e.impressions,n=y(e,["impressions"]);return g(g({},n),{impressions:t.map(function(e){return r.assureBaseImpressionValidity(e)})})}).reduce(function(e,t,n){return g(g({},e),function(e,r,o){var t=e.impressions.reduce(function(e,t,n){return g(g({},e),W(t,r,n,o))},{});return e.listName&&(t["il"+(r+1)+"nm"]=e.listName),t}(t,n,"pi"))},{})},Ue.prototype.assureProductValidity=function(e){var t=e.position,n=y(e,["position"]);return void 0!==t&&t<1?(console.warn("The position for product '"+(e.name||e.id)+"' must be greater than 0 when provided."),n):e},Ue.prototype.assureBaseImpressionValidity=function(e){var t=e.position,n=y(e,["position"]);return void 0!==t&&t<1?(console.warn("The position for impression '"+(e.name||e.id)+"' must be greater than 0 when provided."),n):e},Ue.prototype.getImpressionsByList=function(){return this.impressions.reduce(function(e,t){var n=t.list,r=y(t,["list"]),o=e.find(function(e){return e.listName===n});return o?o.impressions.push(r):e.push({listName:n,impressions:[r]}),e},[])},Ue.Id="ec",Ue),ze=g({},Le),Ye=Object.keys(ze).map(function(e){return ze[e]}),We=(e($e,Be=He),$e.prototype.addHooks=function(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()},$e.prototype.setTicket=function(e){this.ticket=e},$e.prototype.clearPluginData=function(){this.ticket={}},$e.prototype.addHooksForSVCEvents=function(){var o=this;this.client.registerBeforeSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==Ye.indexOf(e)?o.addSVCDataToPayload(e,r):r}),this.client.registerAfterSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==Ye.indexOf(e)&&o.updateLocationInformation(e,r),r})},$e.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(ze.pageview,{newEventType:o.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},$e.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(ze.event,{newEventType:o.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},$e.prototype.addSVCDataToPayload=function(e,t){var n,r=g(g(g(g({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{svcAction:this.action}:{}),0<Object.keys(null!==(n=this.actionData)&&void 0!==n?n:{}).length?{svcActionData:this.actionData}:{}),o=this.getTicketPayload();return this.clearData(),g(g(g({},o),r),t)},$e.prototype.getTicketPayload=function(){return o=this.ticket,q(o).filter(function(e){return void 0!==o[e]}).reduce(function(e,t){var n,r=L[t]||t;return g(g({},e),((n={})[r]=o[t],n))},{});var o},$e.Id="svc",$e);function $e(e){var t=e.client,n=e.uuidGenerator,r=void 0===n?_:n,o=Be.call(this,{client:t,uuidGenerator:r})||this;return o.ticket={},o}var Ge=We,Ke=(Je.prototype.require=function(e,t){var n=this.registeredPluginsMap[e];if(!n)throw new Error('No plugin named "'+e+"\" is currently registered. If you use a custom plugin, use 'provide' first.");this.requiredPlugins[e]=new n(t)},Je.prototype.provide=function(e,t){this.registeredPluginsMap[e]=t},Je.prototype.clearRequired=function(){this.requiredPlugins={}},Je.prototype.execute=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.requiredPlugins[e];if(!o)throw new Error('The plugin "'+e+'" is not required. Check that you required it on initialization.');var i=o[t];if(!i)throw new Error('The function "'+t+'" does not exists on the plugin "'+e+'".');if("function"!=typeof i)throw new Error('"'+t+'" of the plugin "'+e+'" is not a function.');return i.apply(o,n)},Je.DefaultPlugins=[Qe.Id,Ge.Id],Je);function Je(){var e;this.registeredPluginsMap=((e={})[Qe.Id]=Qe,e[Ge.Id]=Ge,e),this.requiredPlugins={}}var Xe=(Ze.prototype.init=function(e,t){var n=this;if(!e)throw new Error("You must pass your token when you call 'init'");if("string"==typeof e?this.client=new Oe({token:e,endpoint:this.getEndpoint(t)}):this.isAnalyticsClient(e)&&(this.client=e),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");var r={client:this.client};this.plugins.clearRequired(),this.getPluginKeys(t).forEach(function(e){return n.plugins.require(e,r)}),this.client.registerBeforeSendEventHook(function(e,t){return g(g({},t),n.params)})},Ze.prototype.isAnalyticsClient=function(e){return"object"==typeof e&&void 0!==e.sendEvent},Ze.prototype.getPluginKeys=function(e){return"string"!=typeof e&&Array.isArray(null==e?void 0:e.plugins)?e.plugins:Ke.DefaultPlugins},Ze.prototype.getEndpoint=function(e){return"string"==typeof e?e||Fe.default:null!=e&&e.endpoint?e.endpoint:Fe.default},Ze.prototype.initForProxy=function(e){if(!e)throw new Error("You must pass your endpoint when you call 'initForProxy'");if("string"!=typeof e)throw new Error("You must pass a string as the endpoint parameter when you call 'initForProxy'");this.client=new Oe({endpoint:e})},Ze.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]})},Ze.prototype.send=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0],o=t.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(e=this.client).sendEvent.apply(e,a([r.toLowerCase()],o))},Ze.prototype.onLoad=function(e){if(void 0===e)throw new Error("You must pass a function when you call 'onLoad'");e()},Ze.prototype.provide=function(e,t){this.plugins.provide(e,t)},Ze.prototype.require=function(e,t){if(!this.client)throw new Error("You must call init before requiring a plugin");this.plugins.require(e,g(g({},t),{client:this.client}))},Ze.prototype.callPlugin=function(e,t){for(var n,r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];(n=this.plugins).execute.apply(n,a([e,t],r))},Ze.prototype.reset=function(){this.client=void 0,this.plugins=new Ke,this.params={}},Ze);function Ze(){this.plugins=new Ke,this.params={}}function et(){return it.client}function tt(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(e);r[1];var o=r[2],i=r[3],s=it[i];if(o&&i)return it.callPlugin.apply(it,a([o,i],t));if(s)return s.apply(it,t);throw new Error('The action "'+e+'" does not exist. Available actions: '+["init","set","send","onLoad","callPlugin","reset","require","provide"].join(", ")+".")}var nt,rt,ot,it=new Xe,st=Object.freeze({__proto__:null,CoveoUA:Xe,coveoua:it,getCurrentClient:et,handleOneAnalyticsEvent:tt,default:tt});(ot=rt=rt||{}).interfaceLoad="interfaceLoad",ot.interfaceChange="interfaceChange",ot.didyoumeanAutomatic="didyoumeanAutomatic",ot.didyoumeanClick="didyoumeanClick",ot.resultsSort="resultsSort",ot.searchboxSubmit="searchboxSubmit",ot.searchboxClear="searchboxClear",ot.searchboxAsYouType="searchboxAsYouType",ot.breadcrumbFacet="breadcrumbFacet",ot.breadcrumbResetAll="breadcrumbResetAll",ot.documentQuickview="documentQuickview",ot.documentOpen="documentOpen",ot.omniboxAnalytics="omniboxAnalytics",ot.omniboxFromLink="omniboxFromLink",ot.searchFromLink="searchFromLink",ot.triggerNotify="notify",ot.triggerExecute="execute",ot.triggerQuery="query",ot.triggerRedirect="redirect",ot.pagerResize="pagerResize",ot.pagerNumber="pagerNumber",ot.pagerNext="pagerNext",ot.pagerPrevious="pagerPrevious",ot.pagerScrolling="pagerScrolling",ot.staticFilterClearAll="staticFilterClearAll",ot.staticFilterSelect="staticFilterSelect",ot.staticFilterDeselect="staticFilterDeselect",ot.facetClearAll="facetClearAll",ot.facetSearch="facetSearch",ot.facetSelect="facetSelect",ot.facetSelectAll="facetSelectAll",ot.facetDeselect="facetDeselect",ot.facetExclude="facetExclude",ot.facetUnexclude="facetUnexclude",ot.facetUpdateSort="facetUpdateSort",ot.facetShowMore="showMoreFacetResults",ot.facetShowLess="showLessFacetResults",ot.queryError="query",ot.queryErrorBack="errorBack",ot.queryErrorClear="errorClearQuery",ot.queryErrorRetry="errorRetry",ot.recommendation="recommendation",ot.recommendationInterfaceLoad="recommendationInterfaceLoad",ot.recommendationOpen="recommendationOpen",ot.likeSmartSnippet="likeSmartSnippet",ot.dislikeSmartSnippet="dislikeSmartSnippet",ot.expandSmartSnippet="expandSmartSnippet",ot.collapseSmartSnippet="collapseSmartSnippet",ot.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",ot.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",ot.sendSmartSnippetReason="sendSmartSnippetReason",ot.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",ot.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",ot.openSmartSnippetSource="openSmartSnippetSource",ot.recentQueryClick="recentQueriesClick",ot.clearRecentQueries="clearRecentQueries",ot.recentResultClick="recentResultClick",ot.clearRecentResults="clearRecentResults",ot.noResultsBack="noResultsBack";var at=((nt={})[rt.triggerNotify]="queryPipelineTriggers",nt[rt.triggerExecute]="queryPipelineTriggers",nt[rt.triggerQuery]="queryPipelineTriggers",nt[rt.triggerRedirect]="queryPipelineTriggers",nt[rt.queryError]="errors",nt[rt.queryErrorBack]="errors",nt[rt.queryErrorClear]="errors",nt[rt.queryErrorRetry]="errors",nt[rt.pagerNext]="getMoreResults",nt[rt.pagerPrevious]="getMoreResults",nt[rt.pagerNumber]="getMoreResults",nt[rt.pagerResize]="getMoreResults",nt[rt.pagerScrolling]="getMoreResults",nt[rt.facetSearch]="facet",nt[rt.facetShowLess]="facet",nt[rt.facetShowMore]="facet",nt[rt.recommendation]="recommendation",nt[rt.likeSmartSnippet]="smartSnippet",nt[rt.dislikeSmartSnippet]="smartSnippet",nt[rt.expandSmartSnippet]="smartSnippet",nt[rt.collapseSmartSnippet]="smartSnippet",nt[rt.openSmartSnippetFeedbackModal]="smartSnippet",nt[rt.closeSmartSnippetFeedbackModal]="smartSnippet",nt[rt.sendSmartSnippetReason]="smartSnippet",nt[rt.expandSmartSnippetSuggestion]="smartSnippetSuggestions",nt[rt.collapseSmartSnippetSuggestion]="smartSnippetSuggestions",nt[rt.clearRecentQueries]="recentQueries",nt[rt.recentResultClick]="recentlyClickedDocuments",nt[rt.clearRecentResults]="recentlyClickedDocuments",nt),ct=(ut.prototype.getPayload=function(){return Promise.resolve()},ut.prototype.getParameters=function(){return Promise.resolve()},ut.prototype.sendEvent=function(){return Promise.resolve()},ut.prototype.sendSearchEvent=function(){return Promise.resolve()},ut.prototype.sendClickEvent=function(){return Promise.resolve()},ut.prototype.sendCustomEvent=function(){return Promise.resolve()},ut.prototype.sendViewEvent=function(){return Promise.resolve()},ut.prototype.getVisit=function(){return Promise.resolve({id:"",visitorId:""})},ut.prototype.getHealth=function(){return Promise.resolve({status:""})},ut.prototype.registerBeforeSendEventHook=function(){},ut.prototype.registerAfterSendEventHook=function(){},ut.prototype.addEventTypeMapping=function(){},ut);function ut(){this.runtime=new Ae,this.currentVisitorId=""}function lt(e){var n,t=e.map(function(e){return e.replace(/;/g,"")});return function e(t){var n=t.join(";");return n.length<=256?n:e(t.slice(1))}((n="",t.filter(function(e){var t=e!==n;return n=e,t})))}function pt(e){var t="string"==typeof e.partialQueries?e.partialQueries:lt(e.partialQueries),n="string"==typeof e.suggestions?e.suggestions:lt(e.suggestions);return g(g({},e),{partialQueries:t,suggestions:n})}var dt,ht,ft,vt,gt,yt,mt=(St.prototype.disable=function(){this.coveoAnalyticsClient instanceof Oe&&this.coveoAnalyticsClient.clear(),this.coveoAnalyticsClient=new ct},St.prototype.enable=function(){this.coveoAnalyticsClient=new Oe(this.opts)},St.prototype.logInterfaceLoad=function(){return this.logSearchEvent(rt.interfaceLoad)},St.prototype.logRecommendationInterfaceLoad=function(){return this.logSearchEvent(rt.recommendationInterfaceLoad)},St.prototype.logRecommendation=function(){return this.logCustomEvent(rt.recommendation)},St.prototype.logRecommendationOpen=function(e,t){return this.logClickEvent(rt.recommendationOpen,e,t)},St.prototype.logStaticFilterClearAll=function(e){return this.logSearchEvent(rt.staticFilterClearAll,e)},St.prototype.logStaticFilterSelect=function(e){return this.logSearchEvent(rt.staticFilterSelect,e)},St.prototype.logStaticFilterDeselect=function(e){return this.logSearchEvent(rt.staticFilterDeselect,e)},St.prototype.logFetchMoreResults=function(){return this.logCustomEvent(rt.pagerScrolling,{type:"getMoreResults"})},St.prototype.logInterfaceChange=function(e){return this.logSearchEvent(rt.interfaceChange,e)},St.prototype.logDidYouMeanAutomatic=function(){return this.logSearchEvent(rt.didyoumeanAutomatic)},St.prototype.logDidYouMeanClick=function(){return this.logSearchEvent(rt.didyoumeanClick)},St.prototype.logResultsSort=function(e){return this.logSearchEvent(rt.resultsSort,e)},St.prototype.logSearchboxSubmit=function(){return this.logSearchEvent(rt.searchboxSubmit)},St.prototype.logSearchboxClear=function(){return this.logSearchEvent(rt.searchboxClear)},St.prototype.logSearchboxAsYouType=function(){return this.logSearchEvent(rt.searchboxAsYouType)},St.prototype.logBreadcrumbFacet=function(e){return this.logSearchEvent(rt.breadcrumbFacet,e)},St.prototype.logBreadcrumbResetAll=function(){return this.logSearchEvent(rt.breadcrumbResetAll)},St.prototype.logDocumentQuickview=function(e,t){return this.logClickEvent(rt.documentQuickview,e,t)},St.prototype.logDocumentOpen=function(e,t){return this.logClickEvent(rt.documentOpen,e,t)},St.prototype.logOmniboxAnalytics=function(e){return this.logSearchEvent(rt.omniboxAnalytics,pt(e))},St.prototype.logOmniboxFromLink=function(e){return this.logSearchEvent(rt.omniboxFromLink,pt(e))},St.prototype.logSearchFromLink=function(){return this.logSearchEvent(rt.searchFromLink)},St.prototype.logTriggerNotify=function(e){return this.logCustomEvent(rt.triggerNotify,e)},St.prototype.logTriggerExecute=function(e){return this.logCustomEvent(rt.triggerExecute,e)},St.prototype.logTriggerQuery=function(){var e={query:this.provider.getSearchEventRequestPayload().queryText};return this.logCustomEvent(rt.triggerQuery,e)},St.prototype.logTriggerRedirect=function(e){var t=g(g({},e),{query:this.provider.getSearchEventRequestPayload().queryText});return this.logCustomEvent(rt.triggerRedirect,t)},St.prototype.logPagerResize=function(e){return this.logCustomEvent(rt.pagerResize,e)},St.prototype.logPagerNumber=function(e){return this.logCustomEvent(rt.pagerNumber,e)},St.prototype.logPagerNext=function(e){return this.logCustomEvent(rt.pagerNext,e)},St.prototype.logPagerPrevious=function(e){return this.logCustomEvent(rt.pagerPrevious,e)},St.prototype.logPagerScrolling=function(){return this.logCustomEvent(rt.pagerScrolling)},St.prototype.logFacetClearAll=function(e){return this.logSearchEvent(rt.facetClearAll,e)},St.prototype.logFacetSearch=function(e){return this.logSearchEvent(rt.facetSearch,e)},St.prototype.logFacetSelect=function(e){return this.logSearchEvent(rt.facetSelect,e)},St.prototype.logFacetDeselect=function(e){return this.logSearchEvent(rt.facetDeselect,e)},St.prototype.logFacetExclude=function(e){return this.logSearchEvent(rt.facetExclude,e)},St.prototype.logFacetUnexclude=function(e){return this.logSearchEvent(rt.facetUnexclude,e)},St.prototype.logFacetSelectAll=function(e){return this.logSearchEvent(rt.facetSelectAll,e)},St.prototype.logFacetUpdateSort=function(e){return this.logSearchEvent(rt.facetUpdateSort,e)},St.prototype.logFacetShowMore=function(e){return this.logCustomEvent(rt.facetShowMore,e)},St.prototype.logFacetShowLess=function(e){return this.logCustomEvent(rt.facetShowLess,e)},St.prototype.logQueryError=function(e){return this.logCustomEvent(rt.queryError,e)},St.prototype.logQueryErrorBack=function(){return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(rt.queryErrorBack)];case 1:return e.sent(),[2,this.logSearchEvent(rt.queryErrorBack)]}})})},St.prototype.logQueryErrorRetry=function(){return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(rt.queryErrorRetry)];case 1:return e.sent(),[2,this.logSearchEvent(rt.queryErrorRetry)]}})})},St.prototype.logQueryErrorClear=function(){return p(this,void 0,void 0,function(){return m(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(rt.queryErrorClear)];case 1:return e.sent(),[2,this.logSearchEvent(rt.queryErrorClear)]}})})},St.prototype.logLikeSmartSnippet=function(){return this.logCustomEvent(rt.likeSmartSnippet)},St.prototype.logDislikeSmartSnippet=function(){return this.logCustomEvent(rt.dislikeSmartSnippet)},St.prototype.logExpandSmartSnippet=function(){return this.logCustomEvent(rt.expandSmartSnippet)},St.prototype.logCollapseSmartSnippet=function(){return this.logCustomEvent(rt.collapseSmartSnippet)},St.prototype.logOpenSmartSnippetFeedbackModal=function(){return this.logCustomEvent(rt.openSmartSnippetFeedbackModal)},St.prototype.logCloseSmartSnippetFeedbackModal=function(){return this.logCustomEvent(rt.closeSmartSnippetFeedbackModal)},St.prototype.logSmartSnippetFeedbackReason=function(e,t){return this.logCustomEvent(rt.sendSmartSnippetReason,{reason:e,details:t})},St.prototype.logExpandSmartSnippetSuggestion=function(e){return this.logCustomEvent(rt.expandSmartSnippetSuggestion,{documentId:e})},St.prototype.logCollapseSmartSnippetSuggestion=function(e){return this.logCustomEvent(rt.collapseSmartSnippetSuggestion,{documentId:e})},St.prototype.logOpenSmartSnippetSource=function(e,t){return this.logClickEvent(rt.openSmartSnippetSource,e,t)},St.prototype.logRecentQueryClick=function(){return this.logSearchEvent(rt.recentQueryClick)},St.prototype.logClearRecentQueries=function(){return this.logCustomEvent(rt.clearRecentQueries)},St.prototype.logRecentResultClick=function(e,t){return this.logCustomEvent(rt.recentResultClick,{info:e,identifier:t})},St.prototype.logClearRecentResults=function(){return this.logCustomEvent(rt.clearRecentResults)},St.prototype.logNoResultsBack=function(){return this.logSearchEvent(rt.noResultsBack)},St.prototype.logCustomEvent=function(o,i){return p(this,void 0,void 0,function(){var t,n,r;return m(this,function(e){switch(e.label){case 0:return t=g(g({},this.provider.getBaseMetadata()),i),r=[{}],[4,this.getBaseCustomEventRequest(t)];case 1:return n=g.apply(void 0,[g.apply(void 0,r.concat([e.sent()])),{eventType:at[o],eventValue:o}]),[2,this.coveoAnalyticsClient.sendCustomEvent(n)]}})})},St.prototype.logCustomEventWithType=function(o,i,s){return p(this,void 0,void 0,function(){var t,n,r;return m(this,function(e){switch(e.label){case 0:return t=g(g({},this.provider.getBaseMetadata()),s),r=[{}],[4,this.getBaseCustomEventRequest(t)];case 1:return n=g.apply(void 0,[g.apply(void 0,r.concat([e.sent()])),{eventType:i,eventValue:o}]),[2,this.coveoAnalyticsClient.sendCustomEvent(n)]}})})},St.prototype.logSearchEvent=function(r,o){return p(this,void 0,void 0,function(){var t,n;return m(this,function(e){switch(e.label){case 0:return n=(t=this.coveoAnalyticsClient).sendSearchEvent,[4,this.getBaseSearchEventRequest(r,o)];case 1:return[2,n.apply(t,[e.sent()])]}})})},St.prototype.logClickEvent=function(r,o,i,s){return p(this,void 0,void 0,function(){var t,n;return m(this,function(e){switch(e.label){case 0:return n=[g({},o)],[4,this.getBaseEventRequest(g(g({},i),s))];case 1:return t=g.apply(void 0,[g.apply(void 0,n.concat([e.sent()])),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:r}]),[2,this.coveoAnalyticsClient.sendClickEvent(t)]}})})},St.prototype.getBaseSearchEventRequest=function(n,r){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return t=[{}],[4,this.getBaseEventRequest(r)];case 1:return[2,g.apply(void 0,[g.apply(void 0,[g.apply(void 0,t.concat([e.sent()])),this.provider.getSearchEventRequestPayload()]),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:n}])]}})})},St.prototype.getBaseCustomEventRequest=function(n){return p(this,void 0,void 0,function(){var t;return m(this,function(e){switch(e.label){case 0:return t=[{}],[4,this.getBaseEventRequest(n)];case 1:return[2,g.apply(void 0,[g.apply(void 0,t.concat([e.sent()])),{lastSearchQueryUid:this.provider.getSearchUID()}])]}})})},St.prototype.getBaseEventRequest=function(o){return p(this,void 0,void 0,function(){var t,n,r;return m(this,function(e){switch(e.label){case 0:return t=g(g({},this.provider.getBaseMetadata()),o),n=[g({},this.getOrigins())],r={customData:t,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous()},[4,this.getClientId()];case 1:return[2,g.apply(void 0,n.concat([(r.clientId=e.sent(),r)]))]}})})},St.prototype.getOrigins=function(){var e,t;return{originContext:null===(t=(e=this.provider).getOriginContext)||void 0===t?void 0:t.call(e),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}},St.prototype.getClientId=function(){return this.coveoAnalyticsClient instanceof Oe?this.coveoAnalyticsClient.getCurrentVisitorId():void 0},St);function St(e,t){this.opts=e,this.provider=t,this.coveoAnalyticsClient=!1===e.enableAnalytics?new ct:new Oe(e)}(ht=dt=dt||{}).click="click",ht.flowStart="flowStart",(vt=ft=ft||{}).enterInterface="ticket_create_start",vt.fieldUpdate="ticket_field_update",vt.fieldSuggestionClick="ticket_classification_click",vt.suggestionClick="suggestion_click",vt.suggestionRate="suggestion_rate",vt.nextCaseStep="ticket_next_stage",vt.caseCancelled="ticket_cancel",vt.caseSolved="ticket_cancel",vt.caseCreated="ticket_create",(yt=gt=gt||{}).quit="Quit",yt.solved="Solved";var wt=(Et.prototype.disable=function(){this.coveoAnalyticsClient instanceof Oe&&this.coveoAnalyticsClient.clear(),this.coveoAnalyticsClient=new ct,this.svc=new We({client:this.coveoAnalyticsClient})},Et.prototype.enable=function(){this.coveoAnalyticsClient=new Oe(this.options),this.svc=new We({client:this.coveoAnalyticsClient})},Et.prototype.logEnterInterface=function(e){return this.svc.setAction(ft.enterInterface),this.svc.setTicket(e.ticket),this.sendFlowStartEvent()},Et.prototype.logUpdateCaseField=function(e){return this.svc.setAction(ft.fieldUpdate,{fieldName:e.fieldName}),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logSelectFieldSuggestion=function(e){return this.svc.setAction(ft.fieldSuggestionClick,e.suggestion),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logSelectDocumentSuggestion=function(e){return this.svc.setAction(ft.suggestionClick,e.suggestion),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logRateDocumentSuggestion=function(e){return this.svc.setAction(ft.suggestionRate,g({rate:e.rating},e.suggestion)),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logMoveToNextCaseStep=function(e){return this.svc.setAction(ft.nextCaseStep),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logCaseCancelled=function(e){return this.svc.setAction(ft.caseCancelled,{reason:gt.quit}),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logCaseSolved=function(e){return this.svc.setAction(ft.caseSolved,{reason:gt.solved}),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.logCaseCreated=function(e){return this.svc.setAction(ft.caseCreated),this.svc.setTicket(e.ticket),this.sendClickEvent()},Et.prototype.sendFlowStartEvent=function(){return this.coveoAnalyticsClient.sendEvent("event","svc",dt.flowStart)},Et.prototype.sendClickEvent=function(){return this.coveoAnalyticsClient.sendEvent("event","svc",dt.click)},Et);function Et(e){var t,n=null===(t=(this.options=e).enableAnalytics)||void 0===t||t;this.coveoAnalyticsClient=n?new Oe(e):new ct,this.svc=new We({client:this.coveoAnalyticsClient})}var bt=Object.freeze({__proto__:null,analytics:qe,donottrack:Te,history:F,SimpleAnalytics:st,storage:I,CoveoAnalyticsClient:Oe,CoveoUA:Xe,getCurrentClient:et,handleOneAnalyticsEvent:tt,CoveoSearchPageClient:mt,CaseAssistClient:wt});window.Promise instanceof Function||console.error('This script uses window.Promise which is not supported in your browser. Consider adding a polyfill like "es6-promise".'),window.fetch instanceof Function||console.error('This script uses window.fetch which is not supported in your browser. Consider adding a polyfill like "fetch".');var kt=self.coveoua||tt;self.coveoua=tt,self.coveoanalytics=bt,kt.q&&a(kt.q.filter(function(e){return"init"===e[0]}),kt.q.filter(function(e){return"init"!==e[0]})).forEach(function(e){return tt.apply(void 0,e)});return self.coveoua}();
|
|
1
|
+
var coveoua=function(){"use strict";var q=function(e,t){return(q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function H(e,t){function n(){this.constructor=e}q(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var r,h=function(){return(h=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}).apply(this,arguments)};function f(e,t){var n={};for(o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]]);return n}function v(e,s,a,c){return new(a=a||Promise)(function(n,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function o(e){try{i(c.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?n(e.value):((t=e.value)instanceof a?t:new a(function(e){e(t)})).then(r,o)}i((c=c.apply(e,s||[])).next())})}function g(r,o){var i,s,a,c={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(n){return function(e){var t=[n,e];if(i)throw new TypeError("Generator is already executing.");for(;c;)try{if(i=1,s&&(a=2&t[0]?s.return:t[0]?s.throw||((a=s.return)&&a.call(s),0):s.next)&&!(a=a.call(s,t[1])).done)return a;switch(s=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return c.label++,{value:t[1],done:!1};case 5:c.label++,s=t[1],t=[0];continue;case 7:t=c.ops.pop(),c.trys.pop();continue;default:if(!(a=0<(a=c.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){c=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){c.label=t[1];break}if(6===t[0]&&c.label<a[1]){c.label=a[1],a=t;break}if(a&&c.label<a[2]){c.label=a[2],c.ops.push(t);break}a[2]&&c.ops.pop(),c.trys.pop();continue}t=o.call(r,c)}catch(e){t=[6,e],s=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}}}function c(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),o=0,t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r}function M(){return"undefined"!=typeof navigator}function N(){return"undefined"!=typeof document}function D(){try{return"undefined"!=typeof localStorage}catch(e){return}}function j(){return M()&&navigator.cookieEnabled}function U(){return"undefined"!=typeof crypto&&void 0!==crypto.getRandomValues}(e=r=r||{}).search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect";var B=[r.click,r.custom,r.search,r.view],Q=(i.set=function(e,t,n){var r,n=n?((o=new Date).setTime(o.getTime()+n),"; expires="+o.toGMTString()):"",o=location.hostname;-1===o.indexOf(".")?document.cookie=e+"="+t+n+"; path=/":((r=o.split(".")).shift(),z({name:e,value:t,expires:n,domain:"."+r.join(".")}),null!=i.get(e)&&i.get(e)==t||z({name:e,value:t,expires:n,domain:"."+o}))},i.get=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(0==(o=o.replace(/^\s+/,"")).indexOf(t))return o.substring(t.length,o.length)}return null},i.erase=function(e){i.set(e,"",-1)},i);function i(){}function z(e){var t=e.name,n=e.value,r=e.expires,e=e.domain;document.cookie=t+"="+n+r+"; path=/; domain="+e+"; SameSite=Lax"}function Y(){return D()?localStorage:j()?new W:function(){try{return"undefined"!=typeof sessionStorage}catch(e){return}}()?sessionStorage:new s}n.prototype.getItem=function(e){return Q.get(""+n.prefix+e)},n.prototype.removeItem=function(e){Q.erase(""+n.prefix+e)},n.prototype.setItem=function(e,t){Q.set(""+n.prefix+e,t)},n.prefix="coveo_";var W=n;function n(){}G.prototype.getItem=function(e){return localStorage.getItem(e)||this.cookieStorage.getItem(e)},G.prototype.removeItem=function(e){this.cookieStorage.removeItem(e),localStorage.removeItem(e)},G.prototype.setItem=function(e,t){localStorage.setItem(e,t),this.cookieStorage.setItem(e,t)};var $=G;function G(){this.cookieStorage=new W}K.prototype.getItem=function(e){return null},K.prototype.removeItem=function(e){},K.prototype.setItem=function(e,t){};var s=K;function K(){}var e=Object.freeze({__proto__:null,preferredStorage:null,getAvailableStorage:Y,CookieStorage:W,CookieAndLocalStorage:$,NullStorage:s}),o="__coveo.analytics.history",J=(t.prototype.addElement=function(e){e.internalTime=(new Date).getTime(),e=this.cropQueryElement(this.stripEmptyQuery(e));var t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])},t.prototype.addElementAsync=function(n){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return n.internalTime=(new Date).getTime(),n=this.cropQueryElement(this.stripEmptyQuery(n)),[4,this.getHistoryWithInternalTimeAsync()];case 1:return null!=(t=e.sent())?this.isValidEntry(n)&&this.setHistory([n].concat(t)):this.setHistory([n]),[2]}})})},t.prototype.getHistory=function(){var e=this.getHistoryWithInternalTime();return this.stripEmptyQueries(this.stripInternalTime(e))},t.prototype.getHistoryAsync=function(){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,this.getHistoryWithInternalTimeAsync()];case 1:return t=e.sent(),[2,this.stripEmptyQueries(this.stripInternalTime(t))]}})})},t.prototype.getHistoryWithInternalTime=function(){try{var e=this.store.getItem(o);return e&&"string"==typeof e?JSON.parse(e):[]}catch(e){return[]}},t.prototype.getHistoryWithInternalTimeAsync=function(){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.store.getItem(o)];case 1:return(t=e.sent())?[2,JSON.parse(t)]:[2,[]];case 2:return e.sent(),[2,[]];case 3:return[2]}})})},t.prototype.setHistory=function(e){try{this.store.setItem(o,JSON.stringify(e.slice(0,20)))}catch(e){}},t.prototype.clear=function(){try{this.store.removeItem(o)}catch(e){}},t.prototype.getMostRecentElement=function(){var e=this.getHistoryWithInternalTime();return null!=e?e.sort(function(e,t){return(t.internalTime||0)-(e.internalTime||0)})[0]:null},t.prototype.cropQueryElement=function(e){return e.name&&e.value&&"query"===e.name.toLowerCase()&&(e.value=e.value.slice(0,75)),e},t.prototype.isValidEntry=function(e){var t=this.getMostRecentElement();return!t||t.value!=e.value||6e4<(e.internalTime||0)-(t.internalTime||0)},t.prototype.stripInternalTime=function(e){return e.map(function(e){return{name:e.name,time:e.time,value:e.value}})},t.prototype.stripEmptyQuery=function(e){var t=e.name,n=e.time,r=e.value;return t&&"string"==typeof r&&"query"===t.toLowerCase()&&""===r.trim()?{name:t,time:n}:e},t.prototype.stripEmptyQueries=function(e){var t=this;return e.map(function(e){return t.stripEmptyQuery(e)})},t);function t(e){this.store=e||Y()}function a(e){return e?(Number(e)^function(e){if(U())return crypto.getRandomValues(e);for(var t=0,n=0;t<e.length;t++){if((t&3)===0)n=Math.random()*4294967296;e[t]=n>>>((t&3)<<3)&255}return e}(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,a)}function X(e,a,c){var t=e.impressions.reduce(function(e,t,n){return h(h({},e),(o=a,i=n,s=c,u(r=t).reduce(function(e,t){var n="il"+(o+1)+s+(i+1)+(ce[t]||t);return h(h({},e),((e={})[n]=r[t],e))},{})));var r,o,i,s},{});return e.listName&&(t["il"+(a+1)+"nm"]=e.listName),t}function Z(e){return-1!==Ie.indexOf(e)}function ee(e){return"custom"===e}function te(a){return u(a).reduce(function(e,t){n=t,r=void 0,c(ke).every(function(e){return r=null==(e=e.exec(n))?void 0:e[1],!Boolean(r)});var n,r,o,i,s=r;return h(h({},e),s?(o=s,i=a[t],u(i).reduce(function(e,t){return h(h({},e),((e={})[""+o+t]=i[t],e))},{})):((e={})[t]=a[t],e))},{})}var ne=Object.freeze({__proto__:null,STORE_KEY:o,MAX_NUMBER_OF_HISTORY_ELEMENTS:20,MIN_THRESHOLD_FOR_DUPLICATE_VALUE:6e4,MAX_VALUE_SIZE:75,HistoryStore:J,default:J}),re=function(r){return v(void 0,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return t=new J,n={name:"PageView",value:r,time:JSON.stringify(new Date)},[4,t.addElementAsync(n)];case 1:return e.sent(),[2]}})})},u=Object.keys,oe={id:"svc_ticket_id",subject:"svc_ticket_subject",description:"svc_ticket_description",category:"svc_ticket_category",productId:"svc_ticket_product_id",custom:"svc_ticket_custom"},l=c(u(oe).map(function(e){return oe[e]})).join("|"),ie=new RegExp("^("+l+"$)"),se=[function(e){return ie.test(e)}],ae={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps",group:"group"},ce={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr",group:"group"},p={action:"pa",list:"pal",listSource:"pls"},ue={id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"},le={id:"quoteId",affiliation:"quoteAffiliation"},pe={id:"reviewId",rating:"reviewRating",comment:"reviewComment"},de={add:p,bookmark_add:p,bookmark_remove:p,click:p,checkout:p,checkout_option:p,detail:p,impression:p,remove:p,refund:h(h({},p),ue),purchase:h(h({},p),ue),quickview:p,quote:h(h({},p),le),review:h(h({},p),pe)},l=u(ae).map(function(e){return ae[e]}),d=u(ce).map(function(e){return ce[e]}),he=u(p).map(function(e){return p[e]}),fe=u(ue).map(function(e){return ue[e]}),y=u(pe).map(function(e){return pe[e]}),ve=u(le).map(function(e){return le[e]}),l=c(l,["custom"]).join("|"),d=c(d,["custom"]).join("|"),ge="(pr[0-9]+)",m="(il[0-9]+pi[0-9]+)",ye=new RegExp("^"+ge+"("+l+")$"),me=new RegExp("^("+m+"("+d+"))|(il[0-9]+nm)$"),Se=new RegExp("^("+he.join("|")+")$"),we=new RegExp("^("+fe.join("|")+")$"),l=new RegExp("^"+ge+"custom$"),d=new RegExp("^"+m+"custom$"),Ee=new RegExp("^("+c(["loyaltyCardId","loyaltyTier","thirdPartyPersona","companyName","favoriteStore","storeName","userIndustry","userRole","userDepartment","businessUnit"],y,ve).join("|")+")$"),be=[function(e){return me.test(e)},function(e){return ye.test(e)},function(e){return Se.test(e)},function(e){return we.test(e)},function(e){return Ee.test(e)}],ke=[l,d],he=h(h(h(h({},{anonymizeIp:"aip"}),{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),["contentId","contentIdKey","contentType","searchHub","tab","searchUid","permanentId","contentLocale"].reduce(function(e,t){return h(h({},e),((e={})[t]=t,e))},{})),Ce=h(h({},he),{svcAction:"svc_action",svcActionData:"svc_action_data"}),Ie=u(Ce).map(function(e){return Ce[e]}),Pe=(S.prototype.sendEvent=function(u,l){return v(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c;return g(this,function(e){switch(e.label){case 0:if(navigator.sendBeacon)return n=this.opts,t=n.baseUrl,n=n.preprocessRequest,r=this.encodeForEventType(u,l),[4,this.getQueryParamsForEventType(u)];throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');case 1:return(o=e.sent(),o={url:t+"/analytics/"+u+"?"+o,body:new Blob([r],{type:"application/x-www-form-urlencoded"})},a=[h({},o)],n)?[4,n(o,"analyticsBeacon")]:[3,3];case 2:return c=e.sent(),[3,4];case 3:c={},e.label=4;case 4:return o=h.apply(void 0,a.concat([c])),i=o.url,s=o.body,console.log('Sending beacon for "'+u+'" with: ',JSON.stringify(l)),navigator.sendBeacon(i,s),[2]}})})},S.prototype.encodeForEventType=function(e,t){return this.isEventTypeLegacy(e)?this.encodeForLegacyType(e,t):this.encodeForFormUrlEncoded(h({access_token:this.opts.token},t))},S.prototype.getQueryParamsForEventType=function(r){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return n=this.opts,t=n.token,[4,n.visitorIdProvider.getCurrentVisitorId()];case 1:return n=e.sent(),[2,[t&&this.isEventTypeLegacy(r)?"access_token="+t:"",n?"visitorId="+n:"","discardVisitInfo=true"].filter(function(e){return!!e}).join("&")]}})})},S.prototype.isEventTypeLegacy=function(e){return-1!==[r.click,r.custom,r.search,r.view].indexOf(e)},S.prototype.encodeForLegacyType=function(e,t){return e+"Event="+encodeURIComponent(JSON.stringify(t))},S.prototype.encodeForFormUrlEncoded=function(t){var n=this;return Object.keys(t).filter(function(e){return!!t[e]}).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(n.encodeValue(t[e]))}).join("&")},S.prototype.encodeValue=function(e){return"number"==typeof e||"string"==typeof e||"boolean"==typeof e?e:JSON.stringify(e)},S);function S(e){this.opts=e}Re.prototype.sendEvent=function(e,t){return v(this,void 0,void 0,function(){return g(this,function(e){return[2,Promise.resolve()]})})};var Ae=Re;function Re(){}var xe=window.fetch,Te=(w.prototype.sendEvent=function(p,d){return v(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,l;return g(this,function(e){switch(e.label){case 0:return(r=this.opts,t=r.baseUrl,n=r.visitorIdProvider,r=r.preprocessRequest,this.shouldAppendVisitorId(p))?[4,this.getVisitorIdParam()]:[3,2];case 1:return o=e.sent(),[3,3];case 2:o="",e.label=3;case 3:return(i={url:t+"/analytics/"+p+o,credentials:"include",mode:"cors",headers:this.getHeaders(),method:"POST",body:JSON.stringify(d)},a=[h({},i)],r)?[4,r(i,"analyticsFetch")]:[3,5];case 4:return c=e.sent(),[3,6];case 5:c={},e.label=6;case 6:return i=h.apply(void 0,a.concat([c])),l=i.url,s=f(i,["url"]),[4,xe(l,s)];case 7:return(u=e.sent()).ok?[4,u.json()]:[3,9];case 8:return(l=e.sent()).visitorId&&n.setCurrentVisitorId(l.visitorId),[2,l];case 9:try{u.json()}catch(e){}throw console.error('An error has occured when sending the "'+p+'" event.',u,d),new Error('An error has occurred when sending the "'+p+'" event. Check the console logs for more details.')}})})},w.prototype.shouldAppendVisitorId=function(e){return-1!==[r.click,r.custom,r.search,r.view].indexOf(e)},w.prototype.getVisitorIdParam=function(){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,this.opts.visitorIdProvider.getCurrentVisitorId()];case 1:return[2,(t=e.sent())?"?visitor="+t:""]}})})},w.prototype.getHeaders=function(){var e=this.opts.token;return h(h({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})},w);function w(e){this.opts=e}var Fe=function(e,o){var i=this;D()&&j()?this.storage=new $:D()?this.storage=localStorage:(console.warn("BrowserRuntime detected no valid storage available.",this),this.storage=new s),this.client=new Te(e),this.beaconClient=new Pe(e),window.addEventListener("beforeunload",function(){for(var e=0,t=o();e<t.length;e++){var n=t[e],r=n.eventType,n=n.payload;i.beaconClient.sendEvent(r,n)}})},Oe=function(e,t){this.storage=t||new s,this.client=new Te(e)},_e=function(){this.storage=new s,this.client=new Ae};var Le=["1",1,"yes",!0];function Ve(){return M()&&[navigator.globalPrivacyControl,navigator.doNotTrack,navigator.msDoNotTrack,window.doNotTrack].some(function(e){return-1!==Le.indexOf(e)})}var fe=Object.freeze({__proto__:null,doNotTrack:Ve,default:Ve}),qe={default:"https://analytics.cloud.coveo.com/rest/ua",production:"https://analytics.cloud.coveo.com/rest/ua",hipaa:"https://analyticshipaa.cloud.coveo.com/rest/ua"},E=(Object.defineProperty(b.prototype,"defaultOptions",{get:function(){return{endpoint:qe.default,token:"",version:"v15",beforeSendHooks:[],afterSendHooks:[]}},enumerable:!1,configurable:!0}),b.prototype.initRuntime=function(e){var t=this;return"undefined"!=typeof window&&N()?new Fe(e,function(){var e=c(t.bufferedRequests);return t.bufferedRequests=[],e}):("undefined"!=typeof navigator&&"ReactNative"==navigator.product&&console.warn("\n We've detected you're using React Native but have not provided the corresponding runtime, \n for an optimal experience please install @react-native-async-storage/async-storage and instantiate \n your analytics client as follows:\n \n import {ReactNativeRuntime} from 'coveo.analytics/react-native';\n \n const analytics = new CoveoAnalytics({\n ...your options,\n runtimeEnvironment: new ReactNativeRuntime();\n })\n "),new Oe(e))},Object.defineProperty(b.prototype,"storage",{get:function(){return this.runtime.storage},enumerable:!1,configurable:!0}),b.prototype.determineVisitorId=function(){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.storage.getItem("visitorId")];case 1:return[2,e.sent()||a()];case 2:return t=e.sent(),console.log("Could not get visitor ID from the current runtime environment storage. Using a random ID instead.",t),[2,a()];case 3:return[2]}})})},b.prototype.getCurrentVisitorId=function(){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return this.visitorId?[3,3]:[4,this.determineVisitorId()];case 1:return t=e.sent(),[4,this.setCurrentVisitorId(t)];case 2:e.sent(),e.label=3;case 3:return[2,this.visitorId]}})})},b.prototype.setCurrentVisitorId=function(t){return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return this.visitorId=t,[4,this.storage.setItem("visitorId",t)];case 1:return e.sent(),[2]}})})},b.prototype.getParameters=function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.resolveParameters.apply(this,c([t],n))];case 1:return[2,e.sent()]}})})},b.prototype.getPayload=function(n){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,this.resolveParameters.apply(this,c([n],r))];case 1:return t=e.sent(),[4,this.resolvePayloadForParameters(n,t)];case 2:return[2,e.sent()]}})})},Object.defineProperty(b.prototype,"currentVisitorId",{get:function(){return"string"!=typeof(this.visitorId||this.storage.getItem("visitorId"))&&this.setCurrentVisitorId(a()),this.visitorId},set:function(e){this.visitorId=e,this.storage.setItem("visitorId",e)},enumerable:!1,configurable:!0}),b.prototype.resolveParameters=function(a){for(var c=[],e=1;e<arguments.length;e++)c[e-1]=arguments[e];return v(this,void 0,void 0,function(){var t,n,i,r,o,s=this;return g(this,function(e){switch(e.label){case 0:return t=this.eventTypeMapping[a]||{},r=t.variableLengthArgumentsNames,n=void 0===r?[]:r,r=t.addVisitorIdParameter,i=void 0!==r&&r,r=t.usesMeasurementProtocol,o=void 0!==r&&r,[4,[function(e){return 0<n.length?s.parseVariableArgumentsPayload(n,e):e[0]},function(o){return v(s,void 0,void 0,function(){var t,n,r;return g(this,function(e){switch(e.label){case 0:return(t=[h({},o)],n={},i)?[4,this.getCurrentVisitorId()]:[3,2];case 1:return r=e.sent(),[3,3];case 2:r="",e.label=3;case 3:return[2,h.apply(void 0,t.concat([(n.visitorId=r,n)]))]}})})},function(e){return o?s.ensureAnonymousUserWhenUsingApiKey(e):e},function(e){return s.beforeSendHooks.reduce(function(n,r){return v(s,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(a,t)];case 2:return[2,e.sent()]}})})},e)}].reduce(function(n,r){return v(s,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(t)];case 2:return[2,e.sent()]}})})},Promise.resolve(c))];case 1:return[2,e.sent()]}})})},b.prototype.resolvePayloadForParameters=function(r,i){return v(this,void 0,void 0,function(){var t,n,o=this;return g(this,function(e){switch(e.label){case 0:return t=(this.eventTypeMapping[r]||{}).usesMeasurementProtocol,n=void 0!==t&&t,[4,[function(e){return o.removeEmptyPayloadValues(e,r)},function(e){return o.validateParams(e)},function(e){return n?(o=!!(r=e).action&&de[r.action]||{},u(r).reduce(function(e,t){var n=o[t]||Ce[t]||t;return h(h({},e),((e={})[n]=r[t],e))},{})):e;var r,o},function(e){return n?o.removeUnknownParameters(e):e},function(e){return n?o.processCustomParameters(e):e}].reduce(function(n,r){return v(o,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return[4,n];case 1:return t=e.sent(),[4,r(t)];case 2:return[2,e.sent()]}})})},Promise.resolve(i))];case 1:return[2,e.sent()]}})})},b.prototype.sendEvent=function(o){for(var i=[],e=1;e<arguments.length;e++)i[e-1]=arguments[e];return v(this,void 0,void 0,function(){var t,n,r;return g(this,function(e){switch(e.label){case 0:return t=(this.eventTypeMapping[o]||{}).newEventType,t=void 0===t?o:t,[4,this.resolveParameters.apply(this,c([o],i))];case 1:return n=e.sent(),[4,this.resolvePayloadForParameters(o,n)];case 2:return r=e.sent(),this.bufferedRequests.push({eventType:t,payload:r}),[4,Promise.all(this.afterSendHooks.map(function(e){return e(o,n)}))];case 3:return e.sent(),[4,this.deferExecution()];case 4:return e.sent(),[4,this.sendFromBufferWithFetch()];case 5:return[2,e.sent()]}})})},b.prototype.deferExecution=function(){return new Promise(function(e){return setTimeout(e,0)})},b.prototype.sendFromBufferWithFetch=function(){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){return(n=this.bufferedRequests.shift())?(t=n.eventType,n=n.payload,[2,this.runtime.client.sendEvent(t,n)]):[2]})})},b.prototype.clear=function(){this.storage.removeItem("visitorId"),(new J).clear()},b.prototype.sendSearchEvent=function(t){return v(this,void 0,void 0,function(){return g(this,function(e){return[2,this.sendEvent(r.search,t)]})})},b.prototype.sendClickEvent=function(t){return v(this,void 0,void 0,function(){return g(this,function(e){return[2,this.sendEvent(r.click,t)]})})},b.prototype.sendCustomEvent=function(t){return v(this,void 0,void 0,function(){return g(this,function(e){return[2,this.sendEvent(r.custom,t)]})})},b.prototype.sendViewEvent=function(t){return v(this,void 0,void 0,function(){return g(this,function(e){return[2,this.sendEvent(r.view,t)]})})},b.prototype.getVisit=function(){return v(this,void 0,void 0,function(){var t;return g(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]}})})},b.prototype.getHealth=function(){return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,fetch(this.baseUrl+"/analytics/monitoring/health")];case 1:return[4,e.sent().json()];case 2:return[2,e.sent()]}})})},b.prototype.registerBeforeSendEventHook=function(e){this.beforeSendHooks.push(e)},b.prototype.registerAfterSendEventHook=function(e){this.afterSendHooks.push(e)},b.prototype.addEventTypeMapping=function(e,t){this.eventTypeMapping[e]=t},b.prototype.parseVariableArgumentsPayload=function(e,t){for(var n={},r=0,o=t.length;r<o;r++){var i=t[r];if("string"==typeof i)n[e[r]]=i;else if("object"==typeof i)return h(h({},n),i)}return n},b.prototype.isKeyAllowedEmpty=function(e,t){var n;return(n={})[r.search]=["queryText"],-1!==(n[e]||[]).indexOf(t)},b.prototype.removeEmptyPayloadValues=function(n,t){var r=this;return Object.keys(n).filter(function(e){return r.isKeyAllowedEmpty(t,e)||null!=(e=n[e])&&""!==e}).reduce(function(e,t){return h(h({},e),((e={})[t]=n[t],e))},{})},b.prototype.removeUnknownParameters=function(n){return Object.keys(n).filter(function(e){if(t=e,c(be,se,[Z,ee]).some(function(e){return e(t)}))return!0;var t;console.log(e,"is not processed by coveoua")}).reduce(function(e,t){return h(h({},e),((e={})[t]=n[t],e))},{})},b.prototype.processCustomParameters=function(e){var t=e.custom,e=f(e,["custom"]),t=this.lowercaseKeys(t),e=te(e);return h(h({},t),e)},b.prototype.lowercaseKeys=function(n){return Object.keys(n||{}).reduce(function(e,t){return h(h({},e),((e={})[t.toLowerCase()]=n[t],e))},{})},b.prototype.validateParams=function(e){var t=e.anonymizeIp,e=f(e,["anonymizeIp"]);return void 0!==t&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+t).toLowerCase())&&(e.anonymizeIp=1),e},b.prototype.ensureAnonymousUserWhenUsingApiKey=function(e){var t,n=e.userId,r=f(e,["userId"]);return null!=(t=this.options.token)&&t.startsWith("xx")&&!n?(r.userId="anonymous",r):e},Object.defineProperty(b.prototype,"baseUrl",{get:function(){var e=this.options,t=e.version,e=e.endpoint,n=-1!==e.indexOf(".cloud.coveo.com");return e+(n?"":"/rest")+"/"+t},enumerable:!1,configurable:!0}),b);function b(e){if(!e)throw new Error("You have to pass options to this constructor");this.options=h(h({},this.defaultOptions),e),this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[function(t,n){return v(void 0,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return t!==r.view?[3,2]:[4,re(n.contentIdValue)];case 1:return e.sent(),[2,h({location:window.location.toString(),referrer:document.referrer,title:document.title},n)];case 2:return[2,n]}})})},function(e,t){return-1!==B.indexOf(e)?h({language:N()?document.documentElement.lang:"unknown",userAgent:M()?navigator.userAgent:"unknown"},t):t}].concat(this.options.beforeSendHooks),this.afterSendHooks=this.options.afterSendHooks,this.eventTypeMapping={};e={baseUrl:this.baseUrl,token:this.options.token,visitorIdProvider:this,preprocessRequest:this.options.preprocessRequest};this.runtime=this.options.runtimeEnvironment||this.initRuntime(e),Ve()&&(this.clear(),this.runtime.storage=new s)}function He(e){return e.protocol+"//"+e.hostname+(0===e.pathname.indexOf("/")?e.pathname:"/"+e.pathname)+e.search}var ge=Object.freeze({__proto__:null,Version:"v15",Endpoints:qe,CoveoAnalyticsClient:E,default:E}),k={pageview:"pageview",event:"event"},m=(C.prototype.setAction=function(e,t){this.action=e,this.actionData=t},C.prototype.clearData=function(){this.clearPluginData(),this.action=void 0,this.actionData={}},C.prototype.getLocationInformation=function(e,t){return h({hitType:e},this.getNextValues(e,t))},C.prototype.updateLocationInformation=function(e,t){this.updateLocationForNextPageView(e,t)},C.prototype.getDefaultContextInformation=function(e){var t={title:document.title,encoding:document.characterSet},n={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},r={language:navigator.language,userAgent:navigator.userAgent},o={time:Date.now().toString(),eventId:this.uuidGenerator()};return h(h(h(h({},o),n),r),t)},C.prototype.updateLocationForNextPageView=function(e,t){var t=this.getNextValues(e,t),n=t.pageViewId,r=t.referrer,t=t.location;this.lastReferrer=r,this.pageViewId=n,this.currentLocation=t,e===k.pageview&&(this.nextPageViewId=this.uuidGenerator(),this.hasSentFirstPageView=!0)},C.prototype.getNextValues=function(e,t){return{pageViewId:e===k.pageview?this.nextPageViewId:this.pageViewId,referrer:e===k.pageview&&this.hasSentFirstPageView?this.currentLocation:this.lastReferrer,location:e===k.pageview?this.getCurrentLocationFromPayload(t):this.currentLocation}},C.prototype.getCurrentLocationFromPayload=function(e){return e.page?""+this.currentLocation.split("/").slice(0,3).join("/")+e.page.replace(/^\/?(.*)$/,"/$1"):He(window.location)},C);function C(e){var t=e.client,e=e.uuidGenerator,e=void 0===e?a:e;this.actionData={},this.client=t,this.uuidGenerator=e,this.pageViewId=e(),this.nextPageViewId=this.pageViewId,this.currentLocation=He(window.location),this.lastReferrer=document.referrer,this.addHooks()}var Me,Ne=h({},k),De=Object.keys(Ne).map(function(e){return Ne[e]});function I(e){var t=e.client,e=e.uuidGenerator,t=Me.call(this,{client:t,uuidGenerator:void 0===e?a:e})||this;return t.products=[],t.impressions=[],t}H(I,Me=m),I.prototype.addHooks=function(){this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()},I.prototype.addProduct=function(e){this.products.push(e)},I.prototype.addImpression=function(e){this.impressions.push(e)},I.prototype.clearPluginData=function(){this.products=[],this.impressions=[]},I.prototype.addHooksForECEvents=function(){var o=this;this.client.registerBeforeSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==De.indexOf(e)?o.addECDataToPayload(e,r):r}),this.client.registerAfterSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==De.indexOf(e)&&o.updateLocationInformation(e,r),r})},I.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(Ne.pageview,{newEventType:r.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},I.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(Ne.event,{newEventType:r.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},I.prototype.addECDataToPayload=function(e,t){var e=h(h(h(h({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{action:this.action}:{}),this.actionData||{}),n=this.getProductPayload(),r=this.getImpressionPayload();return this.clearData(),h(h(h(h({},r),n),e),t)},I.prototype.getProductPayload=function(){var t=this;return this.products.map(function(e){return t.assureProductValidity(e)}).reduce(function(e,t,n){return h(h({},e),(o=n,u(r=t).reduce(function(e,t){var n="pr"+(o+1)+(ae[t]||t);return h(h({},e),((e={})[n]=r[t],e))},{})));var r,o},{})},I.prototype.getImpressionPayload=function(){var n=this;return this.getImpressionsByList().map(function(e){var t=e.impressions,e=f(e,["impressions"]);return h(h({},e),{impressions:t.map(function(e){return n.assureBaseImpressionValidity(e)})})}).reduce(function(e,t,n){return h(h({},e),X(t,n,"pi"))},{})},I.prototype.assureProductValidity=function(e){var t=e.position,n=f(e,["position"]);return void 0!==t&&t<1?(console.warn("The position for product '"+(e.name||e.id)+"' must be greater than 0 when provided."),n):e},I.prototype.assureBaseImpressionValidity=function(e){var t=e.position,n=f(e,["position"]);return void 0!==t&&t<1?(console.warn("The position for impression '"+(e.name||e.id)+"' must be greater than 0 when provided."),n):e},I.prototype.getImpressionsByList=function(){return this.impressions.reduce(function(e,t){var n=t.list,t=f(t,["list"]),r=e.find(function(e){return e.listName===n});return r?r.impressions.push(t):e.push({listName:n,impressions:[t]}),e},[])},I.Id="ec";var je,Ue=I,Be=h({},k),Qe=Object.keys(Be).map(function(e){return Be[e]}),ze=(H(P,je=m),P.prototype.addHooks=function(){this.addHooksForEvent(),this.addHooksForPageView(),this.addHooksForSVCEvents()},P.prototype.setTicket=function(e){this.ticket=e},P.prototype.clearPluginData=function(){this.ticket={}},P.prototype.addHooksForSVCEvents=function(){var o=this;this.client.registerBeforeSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==Qe.indexOf(e)?o.addSVCDataToPayload(e,r):r}),this.client.registerAfterSendEventHook(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=t[0];return-1!==Qe.indexOf(e)&&o.updateLocationInformation(e,r),r})},P.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(Be.pageview,{newEventType:r.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},P.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(Be.event,{newEventType:r.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},P.prototype.addSVCDataToPayload=function(e,t){var e=h(h(h(h({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{svcAction:this.action}:{}),0<Object.keys(null!=(e=this.actionData)?e:{}).length?{svcActionData:this.actionData}:{}),n=this.getTicketPayload();return this.clearData(),h(h(h({},n),e),t)},P.prototype.getTicketPayload=function(){return r=this.ticket,u(r).filter(function(e){return void 0!==r[e]}).reduce(function(e,t){var n=oe[t]||t;return h(h({},e),((e={})[n]=r[t],e))},{});var r},P.Id="svc",P);function P(e){var t=e.client,e=e.uuidGenerator,t=je.call(this,{client:t,uuidGenerator:void 0===e?a:e})||this;return t.ticket={},t}var Ye=ze,We=(A.prototype.require=function(e,t){var n=this.registeredPluginsMap[e];if(!n)throw new Error('No plugin named "'+e+"\" is currently registered. If you use a custom plugin, use 'provide' first.");this.requiredPlugins[e]=new n(t)},A.prototype.provide=function(e,t){this.registeredPluginsMap[e]=t},A.prototype.clearRequired=function(){this.requiredPlugins={}},A.prototype.execute=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.requiredPlugins[e];if(!o)throw new Error('The plugin "'+e+'" is not required. Check that you required it on initialization.');var i=o[t];if(!i)throw new Error('The function "'+t+'" does not exists on the plugin "'+e+'".');if("function"!=typeof i)throw new Error('"'+t+'" of the plugin "'+e+'" is not a function.');return i.apply(o,n)},A.DefaultPlugins=[Ue.Id,Ye.Id],A);function A(){var e;this.registeredPluginsMap=((e={})[Ue.Id]=Ue,e[Ye.Id]=Ye,e),this.requiredPlugins={}}R.prototype.init=function(e,t){var n=this;if(!e)throw new Error("You must pass your token when you call 'init'");if("string"==typeof e?this.client=new E({token:e,endpoint:this.getEndpoint(t)}):this.isAnalyticsClient(e)&&(this.client=e),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");var r={client:this.client};this.plugins.clearRequired(),this.getPluginKeys(t).forEach(function(e){return n.plugins.require(e,r)}),this.client.registerBeforeSendEventHook(function(e,t){return h(h({},t),n.params)})},R.prototype.isAnalyticsClient=function(e){return"object"==typeof e&&void 0!==e.sendEvent},R.prototype.getPluginKeys=function(e){return"string"!=typeof e&&Array.isArray(null==e?void 0:e.plugins)?e.plugins:We.DefaultPlugins},R.prototype.getEndpoint=function(e){return"string"==typeof e?e||qe.default:null!=e&&e.endpoint?e.endpoint:qe.default},R.prototype.initForProxy=function(e){if(!e)throw new Error("You must pass your endpoint when you call 'initForProxy'");if("string"!=typeof e)throw new Error("You must pass a string as the endpoint parameter when you call 'initForProxy'");this.client=new E({endpoint:e})},R.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]})},R.prototype.send=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0],o=t.slice(1);if(void 0===this.client)throw new Error("You must call init before sending an event");if(r)return(e=this.client).sendEvent.apply(e,c([r.toLowerCase()],o));throw new Error('You must provide an event type when calling "send".')},R.prototype.onLoad=function(e){if(void 0===e)throw new Error("You must pass a function when you call 'onLoad'");e()},R.prototype.provide=function(e,t){this.plugins.provide(e,t)},R.prototype.require=function(e,t){if(!this.client)throw new Error("You must call init before requiring a plugin");this.plugins.require(e,h(h({},t),{client:this.client}))},R.prototype.callPlugin=function(e,t){for(var n,r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];(n=this.plugins).execute.apply(n,c([e,t],r))},R.prototype.reset=function(){this.client=void 0,this.plugins=new We,this.params={}};y=R;function R(){this.plugins=new We,this.params={}}function $e(){return F.client}function x(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];(o=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(e))[1];var r=o[2],o=o[3],i=F[o];if(r&&o)return F.callPlugin.apply(F,c([r,o],t));if(i)return i.apply(F,t);throw new Error('The action "'+e+'" does not exist. Available actions: '+["init","set","send","onLoad","callPlugin","reset","require","provide"].join(", ")+".")}var T,F=new y,ve=Object.freeze({__proto__:null,CoveoUA:y,coveoua:F,getCurrentClient:$e,handleOneAnalyticsEvent:x,default:x}),Ge=((l=T=T||{}).interfaceLoad="interfaceLoad",l.interfaceChange="interfaceChange",l.didyoumeanAutomatic="didyoumeanAutomatic",l.didyoumeanClick="didyoumeanClick",l.resultsSort="resultsSort",l.searchboxSubmit="searchboxSubmit",l.searchboxClear="searchboxClear",l.searchboxAsYouType="searchboxAsYouType",l.breadcrumbFacet="breadcrumbFacet",l.breadcrumbResetAll="breadcrumbResetAll",l.documentQuickview="documentQuickview",l.documentOpen="documentOpen",l.omniboxAnalytics="omniboxAnalytics",l.omniboxFromLink="omniboxFromLink",l.searchFromLink="searchFromLink",l.triggerNotify="notify",l.triggerExecute="execute",l.triggerQuery="query",l.triggerRedirect="redirect",l.pagerResize="pagerResize",l.pagerNumber="pagerNumber",l.pagerNext="pagerNext",l.pagerPrevious="pagerPrevious",l.pagerScrolling="pagerScrolling",l.staticFilterClearAll="staticFilterClearAll",l.staticFilterSelect="staticFilterSelect",l.staticFilterDeselect="staticFilterDeselect",l.facetClearAll="facetClearAll",l.facetSearch="facetSearch",l.facetSelect="facetSelect",l.facetSelectAll="facetSelectAll",l.facetDeselect="facetDeselect",l.facetExclude="facetExclude",l.facetUnexclude="facetUnexclude",l.facetUpdateSort="facetUpdateSort",l.facetShowMore="showMoreFacetResults",l.facetShowLess="showLessFacetResults",l.queryError="query",l.queryErrorBack="errorBack",l.queryErrorClear="errorClearQuery",l.queryErrorRetry="errorRetry",l.recommendation="recommendation",l.recommendationInterfaceLoad="recommendationInterfaceLoad",l.recommendationOpen="recommendationOpen",l.likeSmartSnippet="likeSmartSnippet",l.dislikeSmartSnippet="dislikeSmartSnippet",l.expandSmartSnippet="expandSmartSnippet",l.collapseSmartSnippet="collapseSmartSnippet",l.openSmartSnippetFeedbackModal="openSmartSnippetFeedbackModal",l.closeSmartSnippetFeedbackModal="closeSmartSnippetFeedbackModal",l.sendSmartSnippetReason="sendSmartSnippetReason",l.expandSmartSnippetSuggestion="expandSmartSnippetSuggestion",l.collapseSmartSnippetSuggestion="collapseSmartSnippetSuggestion",l.openSmartSnippetSource="openSmartSnippetSource",l.recentQueryClick="recentQueriesClick",l.clearRecentQueries="clearRecentQueries",l.recentResultClick="recentResultClick",l.clearRecentResults="clearRecentResults",l.noResultsBack="noResultsBack",(d={})[T.triggerNotify]="queryPipelineTriggers",d[T.triggerExecute]="queryPipelineTriggers",d[T.triggerQuery]="queryPipelineTriggers",d[T.triggerRedirect]="queryPipelineTriggers",d[T.queryError]="errors",d[T.queryErrorBack]="errors",d[T.queryErrorClear]="errors",d[T.queryErrorRetry]="errors",d[T.pagerNext]="getMoreResults",d[T.pagerPrevious]="getMoreResults",d[T.pagerNumber]="getMoreResults",d[T.pagerResize]="getMoreResults",d[T.pagerScrolling]="getMoreResults",d[T.facetSearch]="facet",d[T.facetShowLess]="facet",d[T.facetShowMore]="facet",d[T.recommendation]="recommendation",d[T.likeSmartSnippet]="smartSnippet",d[T.dislikeSmartSnippet]="smartSnippet",d[T.expandSmartSnippet]="smartSnippet",d[T.collapseSmartSnippet]="smartSnippet",d[T.openSmartSnippetFeedbackModal]="smartSnippet",d[T.closeSmartSnippetFeedbackModal]="smartSnippet",d[T.sendSmartSnippetReason]="smartSnippet",d[T.expandSmartSnippetSuggestion]="smartSnippetSuggestions",d[T.collapseSmartSnippetSuggestion]="smartSnippetSuggestions",d[T.clearRecentQueries]="recentQueries",d[T.recentResultClick]="recentlyClickedDocuments",d[T.clearRecentResults]="recentlyClickedDocuments",d),Ke=(O.prototype.getPayload=function(){return Promise.resolve()},O.prototype.getParameters=function(){return Promise.resolve()},O.prototype.sendEvent=function(){return Promise.resolve()},O.prototype.sendSearchEvent=function(){return Promise.resolve()},O.prototype.sendClickEvent=function(){return Promise.resolve()},O.prototype.sendCustomEvent=function(){return Promise.resolve()},O.prototype.sendViewEvent=function(){return Promise.resolve()},O.prototype.getVisit=function(){return Promise.resolve({id:"",visitorId:""})},O.prototype.getHealth=function(){return Promise.resolve({status:""})},O.prototype.registerBeforeSendEventHook=function(){},O.prototype.registerAfterSendEventHook=function(){},O.prototype.addEventTypeMapping=function(){},O);function O(){this.runtime=new _e,this.currentVisitorId=""}function Je(e){var n,e=e.map(function(e){return e.replace(/;/g,"")});return n="",function e(t){var n=t.join(";");return n.length<=256?n:e(t.slice(1))}(e.filter(function(e){var t=e!==n;return n=e,t}))}function Xe(e){var t="string"==typeof e.partialQueries?e.partialQueries:Je(e.partialQueries),n="string"==typeof e.suggestions?e.suggestions:Je(e.suggestions);return h(h({},e),{partialQueries:t,suggestions:n})}L.prototype.disable=function(){this.coveoAnalyticsClient instanceof E&&this.coveoAnalyticsClient.clear(),this.coveoAnalyticsClient=new Ke},L.prototype.enable=function(){this.coveoAnalyticsClient=new E(this.opts)},L.prototype.logInterfaceLoad=function(){return this.logSearchEvent(T.interfaceLoad)},L.prototype.logRecommendationInterfaceLoad=function(){return this.logSearchEvent(T.recommendationInterfaceLoad)},L.prototype.logRecommendation=function(){return this.logCustomEvent(T.recommendation)},L.prototype.logRecommendationOpen=function(e,t){return this.logClickEvent(T.recommendationOpen,e,t)},L.prototype.logStaticFilterClearAll=function(e){return this.logSearchEvent(T.staticFilterClearAll,e)},L.prototype.logStaticFilterSelect=function(e){return this.logSearchEvent(T.staticFilterSelect,e)},L.prototype.logStaticFilterDeselect=function(e){return this.logSearchEvent(T.staticFilterDeselect,e)},L.prototype.logFetchMoreResults=function(){return this.logCustomEvent(T.pagerScrolling,{type:"getMoreResults"})},L.prototype.logInterfaceChange=function(e){return this.logSearchEvent(T.interfaceChange,e)},L.prototype.logDidYouMeanAutomatic=function(){return this.logSearchEvent(T.didyoumeanAutomatic)},L.prototype.logDidYouMeanClick=function(){return this.logSearchEvent(T.didyoumeanClick)},L.prototype.logResultsSort=function(e){return this.logSearchEvent(T.resultsSort,e)},L.prototype.logSearchboxSubmit=function(){return this.logSearchEvent(T.searchboxSubmit)},L.prototype.logSearchboxClear=function(){return this.logSearchEvent(T.searchboxClear)},L.prototype.logSearchboxAsYouType=function(){return this.logSearchEvent(T.searchboxAsYouType)},L.prototype.logBreadcrumbFacet=function(e){return this.logSearchEvent(T.breadcrumbFacet,e)},L.prototype.logBreadcrumbResetAll=function(){return this.logSearchEvent(T.breadcrumbResetAll)},L.prototype.logDocumentQuickview=function(e,t){return this.logClickEvent(T.documentQuickview,e,t)},L.prototype.logDocumentOpen=function(e,t){return this.logClickEvent(T.documentOpen,e,t)},L.prototype.logOmniboxAnalytics=function(e){return this.logSearchEvent(T.omniboxAnalytics,Xe(e))},L.prototype.logOmniboxFromLink=function(e){return this.logSearchEvent(T.omniboxFromLink,Xe(e))},L.prototype.logSearchFromLink=function(){return this.logSearchEvent(T.searchFromLink)},L.prototype.logTriggerNotify=function(e){return this.logCustomEvent(T.triggerNotify,e)},L.prototype.logTriggerExecute=function(e){return this.logCustomEvent(T.triggerExecute,e)},L.prototype.logTriggerQuery=function(){var e={query:this.provider.getSearchEventRequestPayload().queryText};return this.logCustomEvent(T.triggerQuery,e)},L.prototype.logTriggerRedirect=function(e){e=h(h({},e),{query:this.provider.getSearchEventRequestPayload().queryText});return this.logCustomEvent(T.triggerRedirect,e)},L.prototype.logPagerResize=function(e){return this.logCustomEvent(T.pagerResize,e)},L.prototype.logPagerNumber=function(e){return this.logCustomEvent(T.pagerNumber,e)},L.prototype.logPagerNext=function(e){return this.logCustomEvent(T.pagerNext,e)},L.prototype.logPagerPrevious=function(e){return this.logCustomEvent(T.pagerPrevious,e)},L.prototype.logPagerScrolling=function(){return this.logCustomEvent(T.pagerScrolling)},L.prototype.logFacetClearAll=function(e){return this.logSearchEvent(T.facetClearAll,e)},L.prototype.logFacetSearch=function(e){return this.logSearchEvent(T.facetSearch,e)},L.prototype.logFacetSelect=function(e){return this.logSearchEvent(T.facetSelect,e)},L.prototype.logFacetDeselect=function(e){return this.logSearchEvent(T.facetDeselect,e)},L.prototype.logFacetExclude=function(e){return this.logSearchEvent(T.facetExclude,e)},L.prototype.logFacetUnexclude=function(e){return this.logSearchEvent(T.facetUnexclude,e)},L.prototype.logFacetSelectAll=function(e){return this.logSearchEvent(T.facetSelectAll,e)},L.prototype.logFacetUpdateSort=function(e){return this.logSearchEvent(T.facetUpdateSort,e)},L.prototype.logFacetShowMore=function(e){return this.logCustomEvent(T.facetShowMore,e)},L.prototype.logFacetShowLess=function(e){return this.logCustomEvent(T.facetShowLess,e)},L.prototype.logQueryError=function(e){return this.logCustomEvent(T.queryError,e)},L.prototype.logQueryErrorBack=function(){return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(T.queryErrorBack)];case 1:return e.sent(),[2,this.logSearchEvent(T.queryErrorBack)]}})})},L.prototype.logQueryErrorRetry=function(){return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(T.queryErrorRetry)];case 1:return e.sent(),[2,this.logSearchEvent(T.queryErrorRetry)]}})})},L.prototype.logQueryErrorClear=function(){return v(this,void 0,void 0,function(){return g(this,function(e){switch(e.label){case 0:return[4,this.logCustomEvent(T.queryErrorClear)];case 1:return e.sent(),[2,this.logSearchEvent(T.queryErrorClear)]}})})},L.prototype.logLikeSmartSnippet=function(){return this.logCustomEvent(T.likeSmartSnippet)},L.prototype.logDislikeSmartSnippet=function(){return this.logCustomEvent(T.dislikeSmartSnippet)},L.prototype.logExpandSmartSnippet=function(){return this.logCustomEvent(T.expandSmartSnippet)},L.prototype.logCollapseSmartSnippet=function(){return this.logCustomEvent(T.collapseSmartSnippet)},L.prototype.logOpenSmartSnippetFeedbackModal=function(){return this.logCustomEvent(T.openSmartSnippetFeedbackModal)},L.prototype.logCloseSmartSnippetFeedbackModal=function(){return this.logCustomEvent(T.closeSmartSnippetFeedbackModal)},L.prototype.logSmartSnippetFeedbackReason=function(e,t){return this.logCustomEvent(T.sendSmartSnippetReason,{reason:e,details:t})},L.prototype.logExpandSmartSnippetSuggestion=function(e){return this.logCustomEvent(T.expandSmartSnippetSuggestion,{documentId:e})},L.prototype.logCollapseSmartSnippetSuggestion=function(e){return this.logCustomEvent(T.collapseSmartSnippetSuggestion,{documentId:e})},L.prototype.logOpenSmartSnippetSource=function(e,t){return this.logClickEvent(T.openSmartSnippetSource,e,t)},L.prototype.logRecentQueryClick=function(){return this.logSearchEvent(T.recentQueryClick)},L.prototype.logClearRecentQueries=function(){return this.logCustomEvent(T.clearRecentQueries)},L.prototype.logRecentResultClick=function(e,t){return this.logCustomEvent(T.recentResultClick,{info:e,identifier:t})},L.prototype.logClearRecentResults=function(){return this.logCustomEvent(T.clearRecentResults)},L.prototype.logNoResultsBack=function(){return this.logSearchEvent(T.noResultsBack)},L.prototype.logCustomEvent=function(r,o){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return t=h(h({},this.provider.getBaseMetadata()),o),n=[{}],[4,this.getBaseCustomEventRequest(t)];case 1:return t=h.apply(void 0,[h.apply(void 0,n.concat([e.sent()])),{eventType:Ge[r],eventValue:r}]),[2,this.coveoAnalyticsClient.sendCustomEvent(t)]}})})},L.prototype.logCustomEventWithType=function(r,o,i){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return t=h(h({},this.provider.getBaseMetadata()),i),n=[{}],[4,this.getBaseCustomEventRequest(t)];case 1:return t=h.apply(void 0,[h.apply(void 0,n.concat([e.sent()])),{eventType:o,eventValue:r}]),[2,this.coveoAnalyticsClient.sendCustomEvent(t)]}})})},L.prototype.logSearchEvent=function(r,o){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return n=(t=this.coveoAnalyticsClient).sendSearchEvent,[4,this.getBaseSearchEventRequest(r,o)];case 1:return[2,n.apply(t,[e.sent()])]}})})},L.prototype.logClickEvent=function(r,o,i,s){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return n=[h({},o)],[4,this.getBaseEventRequest(h(h({},i),s))];case 1:return t=h.apply(void 0,[h.apply(void 0,n.concat([e.sent()])),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:r}]),[2,this.coveoAnalyticsClient.sendClickEvent(t)]}})})},L.prototype.getBaseSearchEventRequest=function(n,r){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return t=[{}],[4,this.getBaseEventRequest(r)];case 1:return[2,h.apply(void 0,[h.apply(void 0,[h.apply(void 0,t.concat([e.sent()])),this.provider.getSearchEventRequestPayload()]),{searchQueryUid:this.provider.getSearchUID(),queryPipeline:this.provider.getPipeline(),actionCause:n}])]}})})},L.prototype.getBaseCustomEventRequest=function(n){return v(this,void 0,void 0,function(){var t;return g(this,function(e){switch(e.label){case 0:return t=[{}],[4,this.getBaseEventRequest(n)];case 1:return[2,h.apply(void 0,[h.apply(void 0,t.concat([e.sent()])),{lastSearchQueryUid:this.provider.getSearchUID()}])]}})})},L.prototype.getBaseEventRequest=function(r){return v(this,void 0,void 0,function(){var t,n;return g(this,function(e){switch(e.label){case 0:return n=h(h({},this.provider.getBaseMetadata()),r),t=[h({},this.getOrigins())],n={customData:n,language:this.provider.getLanguage(),facetState:this.provider.getFacetState?this.provider.getFacetState():[],anonymous:this.provider.getIsAnonymous()},[4,this.getClientId()];case 1:return[2,h.apply(void 0,t.concat([(n.clientId=e.sent(),n)]))]}})})},L.prototype.getOrigins=function(){var e,t;return{originContext:null==(t=(e=this.provider).getOriginContext)?void 0:t.call(e),originLevel1:this.provider.getOriginLevel1(),originLevel2:this.provider.getOriginLevel2(),originLevel3:this.provider.getOriginLevel3()}},L.prototype.getClientId=function(){return this.coveoAnalyticsClient instanceof E?this.coveoAnalyticsClient.getCurrentVisitorId():void 0};var Ze,_,et,he=L;function L(e,t){this.opts=e,this.provider=t,this.coveoAnalyticsClient=!1===e.enableAnalytics?new Ke:new E(e)}function V(e,t){this.options=e,this.provider=t;t=null==(t=e.enableAnalytics)||t;this.coveoAnalyticsClient=t?new E(e):new Ke,this.svc=new ze({client:this.coveoAnalyticsClient})}(m=Ze=Ze||{}).click="click",m.flowStart="flowStart",(l=_=_||{}).enterInterface="ticket_create_start",l.fieldUpdate="ticket_field_update",l.fieldSuggestionClick="ticket_classification_click",l.suggestionClick="suggestion_click",l.suggestionRate="suggestion_rate",l.nextCaseStep="ticket_next_stage",l.caseCancelled="ticket_cancel",l.caseSolved="ticket_cancel",l.caseCreated="ticket_create",(d=et=et||{}).quit="Quit",d.solved="Solved",V.prototype.disable=function(){this.coveoAnalyticsClient instanceof E&&this.coveoAnalyticsClient.clear(),this.coveoAnalyticsClient=new Ke,this.svc=new ze({client:this.coveoAnalyticsClient})},V.prototype.enable=function(){this.coveoAnalyticsClient=new E(this.options),this.svc=new ze({client:this.coveoAnalyticsClient})},V.prototype.logEnterInterface=function(e){return this.svc.setAction(_.enterInterface),this.svc.setTicket(e.ticket),this.sendFlowStartEvent()},V.prototype.logUpdateCaseField=function(e){return this.svc.setAction(_.fieldUpdate,{fieldName:e.fieldName}),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logSelectFieldSuggestion=function(e){return this.svc.setAction(_.fieldSuggestionClick,e.suggestion),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logSelectDocumentSuggestion=function(e){return this.svc.setAction(_.suggestionClick,e.suggestion),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logRateDocumentSuggestion=function(e){return this.svc.setAction(_.suggestionRate,h({rate:e.rating},e.suggestion)),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logMoveToNextCaseStep=function(e){return this.svc.setAction(_.nextCaseStep,{stage:null==e?void 0:e.stage}),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logCaseCancelled=function(e){return this.svc.setAction(_.caseCancelled,{reason:et.quit}),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logCaseSolved=function(e){return this.svc.setAction(_.caseSolved,{reason:et.solved}),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.logCaseCreated=function(e){return this.svc.setAction(_.caseCreated),this.svc.setTicket(e.ticket),this.sendClickEvent()},V.prototype.sendFlowStartEvent=function(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ze.flowStart,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)},V.prototype.sendClickEvent=function(){return this.coveoAnalyticsClient.sendEvent("event","svc",Ze.click,this.provider?{searchHub:this.provider.getOriginLevel1()}:null)};m=Object.freeze({__proto__:null,analytics:ge,donottrack:fe,history:ne,SimpleAnalytics:ve,storage:e,CoveoAnalyticsClient:E,CoveoUA:y,getCurrentClient:$e,handleOneAnalyticsEvent:x,CoveoSearchPageClient:he,CaseAssistClient:V});window.Promise instanceof Function||console.error('This script uses window.Promise which is not supported in your browser. Consider adding a polyfill like "es6-promise".');window.fetch instanceof Function||console.error('This script uses window.fetch which is not supported in your browser. Consider adding a polyfill like "fetch".');l=self.coveoua||x;return self.coveoua=x,self.coveoanalytics=m,l.q&&c(l.q.filter(function(e){return"init"===e[0]}),l.q.filter(function(e){return"init"!==e[0]})).forEach(function(e){return x.apply(void 0,e)}),self.coveoua}();
|
|
2
2
|
//# sourceMappingURL=coveoua.browser.js.map
|