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

coveo.analytics

Package Overview
Dependencies
Maintainers
3
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coveo.analytics - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

dist/coveoua.js

@@ -1,2 +0,2 @@

!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=18)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.search="search",t.click="click",t.custom="custom",t.view="view",t.collect="collect"}(e.EventType||(e.EventType={}))},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(e,"__esModule",{value:!0});var s=n(9),u=n(10),c=n(0),l=n(2),p=n(3),f=n(12),d=n(13),h=n(6),v=n(7);e.Version="v15",e.Endpoints={default:"https://usageanalytics.coveo.com",production:"https://usageanalytics.coveo.com",hipaa:"https://usageanalyticshipaa.coveo.com"};var y=function(){function t(t){var e=this;if(!t)throw new Error("You have to pass options to this constructor");this.options=r(r({},this.defaultOptions),t);var n=this.options.token;this.cookieStorage=new l.CookieStorage,this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[d.enhanceViewEvent,f.addDefaultValues],this.eventTypeMapping={},this.initVisitorId();var o={baseUrl:this.baseUrl,token:n,visitorIdProvider:this};this.analyticsBeaconClient=new s.AnalyticsBeaconClient(o),this.analyticsFetchClient=new u.AnalyticsFetchClient(o),window.addEventListener("beforeunload",(function(){return e.flushBufferWithBeacon()}))}return Object.defineProperty(t.prototype,"defaultOptions",{get:function(){return{endpoint:e.Endpoints.default,token:"",version:e.Version}},enumerable:!0,configurable:!0}),t.prototype.initVisitorId=function(){var t=this.visitorId||p.hasCookieStorage()&&this.cookieStorage.getItem("visitorId")||p.hasLocalStorage()&&localStorage.getItem("visitorId")||"";this.currentVisitorId=t||h.uuidv4()},Object.defineProperty(t.prototype,"currentVisitorId",{get:function(){return this.visitorId},set:function(t){this.visitorId=t,p.hasCookieStorage()&&this.cookieStorage.setItem("visitorId",t),p.hasLocalStorage()&&localStorage.setItem("visitorId",t)},enumerable:!0,configurable:!0}),t.prototype.sendEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return o(this,void 0,void 0,(function(){var n,o,a,s,u,c,l,p,f,d,h=this;return i(this,(function(i){switch(i.label){case 0:return n=this.eventTypeMapping[t]||{},o=n.newEventType,a=void 0===o?t:o,s=n.variableLengthArgumentsNames,u=void 0===s?[]:s,c=n.addVisitorIdParameter,l=void 0!==c&&c,p=n.usesMeasurementProtocol,f=void 0!==p&&p,d=[function(t){return u.length>0?h.parseVariableArgumentsPayload(u,t):t[0]},function(t){return r({visitorId:l?h.visitorId:""},t)},function(e){return h.beforeSendHooks.reduce((function(e,n){return n(t,e)}),e)},function(t){return h.removeEmptyPayloadValues(t)},function(t){return h.validateParams(t)},function(t){return f?v.convertKeysToMeasurementProtocol(t):t}].reduce((function(t,e){return e(t)}),e),this.bufferedRequests.push({eventType:a,payload:d,handled:!1}),[4,this.deferExecution()];case 1:return i.sent(),[4,this.sendFromBufferWithFetch()];case 2:return[2,i.sent()]}}))}))},t.prototype.deferExecution=function(){return new Promise((function(t){return setTimeout(t,0)}))},t.prototype.flushBufferWithBeacon=function(){for(;this.hasPendingRequests();){var t=this.bufferedRequests.pop(),e=t.eventType,n=t.payload;this.analyticsBeaconClient.sendEvent(e,n)}},t.prototype.sendFromBufferWithFetch=function(){return o(this,void 0,void 0,(function(){var t,e,n;return i(this,(function(r){return(t=this.bufferedRequests.shift())?(e=t.eventType,n=t.payload,[2,this.analyticsFetchClient.sendEvent(e,n)]):[2]}))}))},t.prototype.hasPendingRequests=function(){return this.bufferedRequests.length>0},t.prototype.sendSearchEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.search,t)]}))}))},t.prototype.sendClickEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.click,t)]}))}))},t.prototype.sendCustomEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.custom,t)]}))}))},t.prototype.sendViewEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.view,t)]}))}))},t.prototype.getVisit=function(){return o(this,void 0,void 0,(function(){var t;return i(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]}}))}))},t.prototype.getHealth=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,fetch(this.baseUrl+"/analytics/monitoring/health")];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()]}}))}))},t.prototype.registerBeforeSendEventHook=function(t){this.beforeSendHooks.push(t)},t.prototype.addEventTypeMapping=function(t,e){this.eventTypeMapping[t]=e},t.prototype.parseVariableArgumentsPayload=function(t,e){for(var n={},o=0,i=e.length;o<i;o++){var a=e[o];if("string"==typeof a)n[t[o]]=a;else if("object"==typeof a)return r(r({},n),a)}return n},t.prototype.removeEmptyPayloadValues=function(t){return Object.keys(t).filter((function(e){return null!=(n=t[e])&&""!==n;var n})).reduce((function(e,n){var o;return r(r({},e),((o={})[n]=t[n],o))}),{})},t.prototype.validateParams=function(t){var e=t.anonymizeIp,n=a(t,["anonymizeIp"]);return void 0!==e&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+e).toLowerCase())&&(n.anonymizeIp=1),n},Object.defineProperty(t.prototype,"baseUrl",{get:function(){var t=this.options,e=t.version;return t.endpoint+"/rest/"+e},enumerable:!0,configurable:!0}),t}();e.CoveoAnalyticsClient=y,e.default=y},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(11);e.preferredStorage=null,e.getAvailableStorage=function(){return e.preferredStorage?e.preferredStorage:r.hasLocalStorage()?localStorage:r.hasCookieStorage()?new i:r.hasSessionStorage()?sessionStorage:new a};var i=function(){function t(){}return t.prototype.getItem=function(e){return o.Cookie.get(""+t.prefix+e)},t.prototype.removeItem=function(e){o.Cookie.erase(""+t.prefix+e)},t.prototype.setItem=function(e,n){o.Cookie.set(""+t.prefix+e,n)},t.prefix="coveo_",t}();e.CookieStorage=i;var a=function(){function t(){}return t.prototype.getItem=function(t){return null},t.prototype.removeItem=function(t){},t.prototype.setItem=function(t,e){},t}();e.NullStorage=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hasLocalStorage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}},e.hasSessionStorage=function(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(t){return!1}},e.hasCookieStorage=function(){return navigator.cookieEnabled}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=n(15),s=n(16),u=function(){function t(){this.plugins=new a.Plugins,this.params={}}return t.prototype.init=function(t,e){var n=this;if(!t)throw new Error("You must pass your token when you call 'init'");if("string"==typeof t?(e=e||i.Endpoints.default,this.client=new i.CoveoAnalyticsClient({token:t,endpoint:e})):"object"==typeof t&&void 0!==t.sendEvent&&(this.client=t),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");this.plugins.register("ec",new s.EC({client:this.client})),this.client.registerBeforeSendEventHook((function(t,e){return r(r({},e),n.params)}))},t.prototype.initForProxy=function(t){if(!t)throw new Error("You must pass your endpoint when you call 'initForProxy'");if("string"!=typeof t)throw new Error("You must pass a string as the endpoint parameter when you call 'initForProxy'");this.client=new i.CoveoAnalyticsClient({endpoint:t})},t.prototype.set=function(t,e){var n=this;"string"==typeof t?this.params[t]=e:Object.keys(t).map((function(e){n.params[e]=t[e]}))},t.prototype.send=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0],i=e.slice(1);if(void 0===this.client)throw new Error("You must call init before sending an event");if(!r)throw new Error('You must provide an event type when calling "send".');return(t=this.client).sendEvent.apply(t,o([r.toLowerCase()],i))},t.prototype.onLoad=function(t){if(void 0===t)throw new Error("You must pass a function when you call 'onLoad'");t()},t.prototype.callPlugin=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];(n=this.plugins).execute.apply(n,o([t,e],r))},t.prototype.reset=function(){this.client=void 0,this.plugins=new a.Plugins,this.params={}},t}();e.CoveoUA=u,e.coveoua=new u,e.handleOneAnalyticsEvent=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(t),a=(i[1],i[2]),s=i[3],u=e.coveoua[s];if(a&&s)return e.coveoua.callPlugin.apply(e.coveoua,o([a,s],n));if(u)return u.apply(e.coveoua,n);var c=["init","set","send","onLoad","callPlugin"];throw new Error('The action "'+t+'" does not exist. Available actions: '+c.join(", ")+".")},e.default=e.handleOneAnalyticsEvent},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(2);e.STORE_KEY="__coveo.analytics.history",e.MAX_NUMBER_OF_HISTORY_ELEMENTS=20,e.MIN_THRESHOLD_FOR_DUPLICATE_VALUE=6e4,e.MAX_VALUE_SIZE=75;var i=function(){function t(t){this.store=t||o.getAvailableStorage(),this.store instanceof o.CookieStorage||!r.hasCookieStorage()||(new o.CookieStorage).removeItem(e.STORE_KEY)}return t.prototype.addElement=function(t){t.internalTime=(new Date).getTime(),this.cropQueryElement(t);var e=this.getHistoryWithInternalTime();null!=e?this.isValidEntry(t)&&this.setHistory([t].concat(e)):this.setHistory([t])},t.prototype.getHistory=function(){var t=this.getHistoryWithInternalTime();return this.stripInternalTime(t)},t.prototype.getHistoryWithInternalTime=function(){try{var t=this.store.getItem(e.STORE_KEY);return t?JSON.parse(t):[]}catch(t){return[]}},t.prototype.setHistory=function(t){try{this.store.setItem(e.STORE_KEY,JSON.stringify(t.slice(0,e.MAX_NUMBER_OF_HISTORY_ELEMENTS)))}catch(t){}},t.prototype.clear=function(){try{this.store.removeItem(e.STORE_KEY)}catch(t){}},t.prototype.getMostRecentElement=function(){var t=this.getHistoryWithInternalTime();return null!=t?t.sort((function(t,e){return(e.internalTime||0)-(t.internalTime||0)}))[0]:null},t.prototype.cropQueryElement=function(t){t.name&&"query"==t.name.toLowerCase()&&null!=t.value&&(t.value=t.value.slice(0,e.MAX_VALUE_SIZE))},t.prototype.isValidEntry=function(t){var n=this.getMostRecentElement();return!n||n.value!=t.value||(t.internalTime||0)-(n.internalTime||0)>e.MIN_THRESHOLD_FOR_DUPLICATE_VALUE},t.prototype.stripInternalTime=function(t){return t.map((function(t){return{name:t.name,time:t.time,value:t.value}}))},t}();e.HistoryStore=i,e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=function(t){return t?(Number(t)^r(new Uint8Array(1))[0]%16>>Number(t)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e.uuidv4)};var r=function(t){if(void 0!==typeof crypto&&crypto.getRandomValues)return crypto.getRandomValues(t);for(var e=0,n=0;e<t.length;e++)0==(3&e)&&(n=4294967296*Math.random()),t[e]=n>>>((3&e)<<3)&255;return t}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},i={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},a=r(r(r(r(r({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"});e.keysOf=Object.keys,e.convertKeysToMeasurementProtocol=function(t){return e.keysOf(t).reduce((function(e,n){var o,i=a[n]||n;return r(r({},e),((o={})[i]=t[n],o))}),{})},e.convertProductToMeasurementProtocol=function(t,n){return e.keysOf(t).reduce((function(e,i){var a,s="pr"+(n+1)+(o[i]||i);return r(r({},e),((a={})[s]=t[i],a))}),{})},e.convertImpressionListToMeasurementProtocol=function(t,e){var n=t.impressions.reduce((function(t,n,o){return r(r({},t),s(n,e,o))}),{});t.listName&&(n["il"+(e+1)+"nm"]=t.listName);return n};var s=function(t,n,o){return e.keysOf(t).reduce((function(e,a){var s,u="il"+(n+1)+"pi"+(o+1)+(i[a]||a);return r(r({},e),((s={})[u]=t[a],s))}),{})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);e.analytics=r;var o=n(14);e.donottrack=o;var i=n(5);e.history=i;var a=n(4);e.SimpleAnalytics=a;var s=n(2);e.storage=s;var u=n(1);e.CoveoAnalyticsClient=u.CoveoAnalyticsClient;var c=n(4);e.CoveoUA=c.CoveoUA,e.handleOneAnalyticsEvent=c.handleOneAnalyticsEvent},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.opts=t}return t.prototype.sendEvent=function(t,e){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,p;return o(this,(function(o){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return n=this.opts,r=n.baseUrl,i=n.token,a=n.visitorIdProvider,s=this.getParsedRequestDataKey(t),u=s+"="+encodeURIComponent(JSON.stringify(e)),c=a.currentVisitorId,l=[i?"access_token="+i:"",c?"visitorId="+c:""].filter((function(t){return!!t})).join("&"),p=r+"/analytics/"+t+"?"+l,console.log('Sending beacon for "'+t+'" with: ',JSON.stringify(e)),navigator.sendBeacon(p,new Blob([u],{type:"application/x-www-form-urlencoded"})),[2]}))}))},t.prototype.getParsedRequestDataKey=function(t){return t+"Event"},t}();e.AnalyticsBeaconClient=i},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),s=function(){function t(t){this.opts=t}return t.prototype.sendEvent=function(t,e){return o(this,void 0,void 0,(function(){var n,r,o,a,s,u;return i(this,(function(i){switch(i.label){case 0:return n=this.opts,r=n.baseUrl,o=n.visitorIdProvider,a=this.shouldAppendVisitorId(t)?this.visitorIdParam:"",[4,fetch(r+"/analytics/"+t+a,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(e),credentials:"include"})];case 1:return(s=i.sent()).ok?[4,s.json()]:[3,3];case 2:return(u=i.sent()).visitorId&&(o.currentVisitorId=u.visitorId),[2,u];case 3:try{s.json()}catch(t){}throw console.error('An error has occured when sending the "'+t+'" event.',s,e),new Error('An error has occurred when sending the "'+t+'" event. Check the console logs for more details.')}}))}))},t.prototype.shouldAppendVisitorId=function(t){return-1!==[a.EventType.click,a.EventType.custom,a.EventType.search,a.EventType.view].indexOf(t)},Object.defineProperty(t.prototype,"visitorIdParam",{get:function(){var t=this.opts.visitorIdProvider.currentVisitorId;return t?"?visitor="+t:""},enumerable:!0,configurable:!0}),t.prototype.getHeaders=function(){var t=this.opts.token;return r(r({},t?{Authorization:"Bearer "+t}:{}),{"Content-Type":"application/json"})},t}();e.AnalyticsFetchClient=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){}return t.set=function(e,n,r){var o,i,a,s,u;r?((a=new Date).setTime(a.getTime()+r),s="; expires="+a.toGMTString()):s="",-1===(u=location.hostname).indexOf(".")?document.cookie=e+"="+n+s+"; path=/":((i=u.split(".")).shift(),o="."+i.join("."),document.cookie=e+"="+n+s+"; path=/; domain="+o,null!=t.get(e)&&t.get(e)==n||(o="."+u,document.cookie=e+"="+n+s+"; path=/; domain="+o))},t.get=function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(0==(o=o.replace(/^\s+/,"")).indexOf(e))return o.substring(e.length,o.length)}return null},t.erase=function(e){t.set(e,"",-1)},t}();e.Cookie=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=[o.EventType.click,o.EventType.custom,o.EventType.search,o.EventType.view];e.addDefaultValues=function(t,e){return-1!==i.indexOf(t)?r({language:document.documentElement.lang,userAgent:navigator.userAgent},e):e}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=n(5);e.enhanceViewEvent=function(t,e){return t===o.EventType.view?(a(e.contentIdValue),r({location:window.location.toString(),referrer:document.referrer,title:document.title},e)):e};var a=function(t){var e=new i.HistoryStore,n={name:"PageView",value:t,time:JSON.stringify(new Date)};e.addElement(n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),e.default=e.doNotTrack},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this.plugins={}}return t.prototype.register=function(t,e){this.plugins[t]=e},t.prototype.execute=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.plugins[t],i=o[e];return i.apply(o,n)},t}();e.Plugins=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(6),s=n(17),u=n(7);e.ECPluginEventTypes={pageview:"pageview",event:"event"};var c=Object.keys(e.ECPluginEventTypes).map((function(t){return e.ECPluginEventTypes[t]})),l=function(){function t(t){var e=t.client,n=t.uuidGenerator,r=void 0===n?a.uuidv4:n;this.products=[],this.impressions=[],this.actionData={},this.client=e,this.uuidGenerator=r,this.pageViewId=r(),this.lastLocation=s.getFormattedLocation(window.location),this.lastReferrer=document.referrer,this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()}return t.prototype.addProduct=function(t){this.products.push(t)},t.prototype.addImpression=function(t){this.impressions.push(t)},t.prototype.setAction=function(t,e){this.action=t,this.actionData=e},t.prototype.clearData=function(){this.products=[],this.impressions=[],this.action=void 0,this.actionData={}},t.prototype.addHooksForECEvents=function(){var t=this;this.client.registerBeforeSendEventHook((function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=n[0];return-1!==c.indexOf(e)?t.addECDataToPayload(e,o):o}))},t.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(e.ECPluginEventTypes.pageview,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},t.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(e.ECPluginEventTypes.event,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},t.prototype.addECDataToPayload=function(t,e){var n=r(r(r(r({},this.getLocationInformation(t,e)),this.getDefaultContextInformation(t)),this.action?{action:this.action}:{}),this.actionData||{}),o=this.products.reduce((function(t,e,n){return r(r({},t),u.convertProductToMeasurementProtocol(e,n))}),{}),i=this.getImpressionsByList().reduce((function(t,e,n){return r(r({},t),u.convertImpressionListToMeasurementProtocol(e,n))}),{});return this.clearData(),r(r(r(r({},i),o),n),e)},t.prototype.getImpressionsByList=function(){return this.impressions.reduce((function(t,e){var n=e.list,r=o(e,["list"]),i=t.find((function(t){return t.listName===n}));return i?i.impressions.push(r):t.push({listName:n,impressions:[r]}),t}),[])},t.prototype.updateStateForNewPageView=function(t){if(this.hasSentFirstPageView&&(this.pageViewId=this.uuidGenerator(),this.lastReferrer=this.lastLocation),t.page){this.lastLocation=""+function(t){return t.split("/").slice(0,3).join("/")}(this.lastLocation)+t.page.replace(/^\/?(.*)$/,"/$1")}else this.lastLocation=s.getFormattedLocation(window.location);this.hasSentFirstPageView=!0},t.prototype.getLocationInformation=function(t,n){return t===e.ECPluginEventTypes.pageview&&this.updateStateForNewPageView(n),{referrer:this.lastReferrer,location:this.lastLocation}},t.prototype.getDefaultContextInformation=function(t){var e={hitType:t,pageViewId:this.pageViewId},n={title:document.title,encoding:document.characterSet},o={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},i={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now().toString(),eventId:this.uuidGenerator()};return r(r(r(r(r({},e),a),o),i),n)},t}();e.EC=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFormattedLocation=function(t){return t.protocol+"//"+t.hostname+(0===t.pathname.indexOf("/")?t.pathname:"/"+t.pathname)+t.search}},function(t,e,n){"use strict";(function(t){var r=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(e,"__esModule",{value:!0});var o=n(8),i=n(4);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 a=t.coveoua||i.default;(t.coveoua=i.default,t.coveoanalytics=o,a.q)&&r(a.q.filter((function(t){return"init"===t[0]})),a.q.filter((function(t){return"init"!==t[0]}))).forEach((function(t){return i.default.apply(void 0,t)}));e.default=a}).call(this,n(19))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"}(t.EventType||(t.EventType={}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=this&&this.__rest||function(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};Object.defineProperty(t,"__esModule",{value:!0});var s=n(9),u=n(10),c=n(0),l=n(2),p=n(3),f=n(12),d=n(13),h=n(6),v=n(7);t.Version="v15",t.Endpoints={default:"https://usageanalytics.coveo.com",production:"https://usageanalytics.coveo.com",hipaa:"https://usageanalyticshipaa.coveo.com"};var y=function(){function e(e){var t=this;if(!e)throw new Error("You have to pass options to this constructor");this.options=r(r({},this.defaultOptions),e);var n=this.options.token;this.cookieStorage=new l.CookieStorage,this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[d.enhanceViewEvent,f.addDefaultValues],this.eventTypeMapping={},this.initVisitorId();var o={baseUrl:this.baseUrl,token:n,visitorIdProvider:this};this.analyticsBeaconClient=new s.AnalyticsBeaconClient(o),this.analyticsFetchClient=new u.AnalyticsFetchClient(o),window.addEventListener("beforeunload",(function(){return t.flushBufferWithBeacon()}))}return Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return{endpoint:t.Endpoints.default,token:"",version:t.Version}},enumerable:!0,configurable:!0}),e.prototype.initVisitorId=function(){var e=this.visitorId||p.hasCookieStorage()&&this.cookieStorage.getItem("visitorId")||p.hasLocalStorage()&&localStorage.getItem("visitorId")||"";this.currentVisitorId=e||h.uuidv4()},Object.defineProperty(e.prototype,"currentVisitorId",{get:function(){return this.visitorId},set:function(e){this.visitorId=e,p.hasCookieStorage()&&this.cookieStorage.setItem("visitorId",e),p.hasLocalStorage()&&localStorage.setItem("visitorId",e)},enumerable:!0,configurable:!0}),e.prototype.sendEvent=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return o(this,void 0,void 0,(function(){var n,o,a,s,u,c,l,p,f,d,h=this;return i(this,(function(i){switch(i.label){case 0:return n=this.eventTypeMapping[e]||{},o=n.newEventType,a=void 0===o?e:o,s=n.variableLengthArgumentsNames,u=void 0===s?[]:s,c=n.addVisitorIdParameter,l=void 0!==c&&c,p=n.usesMeasurementProtocol,f=void 0!==p&&p,d=[function(e){return u.length>0?h.parseVariableArgumentsPayload(u,e):e[0]},function(e){return r({visitorId:l?h.visitorId:""},e)},function(t){return h.beforeSendHooks.reduce((function(t,n){return n(e,t)}),t)},function(e){return h.removeEmptyPayloadValues(e)},function(e){return h.validateParams(e)},function(e){return f?v.convertKeysToMeasurementProtocol(e):e},function(e){return f?h.removeUnknownParameters(e):e}].reduce((function(e,t){return t(e)}),t),this.bufferedRequests.push({eventType:a,payload:d,handled:!1}),[4,this.deferExecution()];case 1:return i.sent(),[4,this.sendFromBufferWithFetch()];case 2:return[2,i.sent()]}}))}))},e.prototype.deferExecution=function(){return new Promise((function(e){return setTimeout(e,0)}))},e.prototype.flushBufferWithBeacon=function(){for(;this.hasPendingRequests();){var e=this.bufferedRequests.pop(),t=e.eventType,n=e.payload;this.analyticsBeaconClient.sendEvent(t,n)}},e.prototype.sendFromBufferWithFetch=function(){return o(this,void 0,void 0,(function(){var e,t,n;return i(this,(function(r){return(e=this.bufferedRequests.shift())?(t=e.eventType,n=e.payload,[2,this.analyticsFetchClient.sendEvent(t,n)]):[2]}))}))},e.prototype.hasPendingRequests=function(){return this.bufferedRequests.length>0},e.prototype.sendSearchEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.search,e)]}))}))},e.prototype.sendClickEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.click,e)]}))}))},e.prototype.sendCustomEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.custom,e)]}))}))},e.prototype.sendViewEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.view,e)]}))}))},e.prototype.getVisit=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,fetch(this.baseUrl+"/analytics/visit")];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),this.visitorId=e.visitorId,[2,e]}}))}))},e.prototype.getHealth=function(){return o(this,void 0,void 0,(function(){return i(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.addEventTypeMapping=function(e,t){this.eventTypeMapping[e]=t},e.prototype.parseVariableArgumentsPayload=function(e,t){for(var n={},o=0,i=t.length;o<i;o++){var a=t[o];if("string"==typeof a)n[e[o]]=a;else if("object"==typeof a)return r(r({},n),a)}return n},e.prototype.removeEmptyPayloadValues=function(e){return Object.keys(e).filter((function(t){return null!=(n=e[t])&&""!==n;var n})).reduce((function(t,n){var o;return r(r({},t),((o={})[n]=e[n],o))}),{})},e.prototype.removeUnknownParameters=function(e){return Object.keys(e).filter((function(e){if(v.isMeasurementProtocolKey(e))return!0;console.log(e,"is not processsed by coveoua")})).reduce((function(t,n){var o;return r(r({},t),((o={})[n]=e[n],o))}),{})},e.prototype.validateParams=function(e){var t=e.anonymizeIp,n=a(e,["anonymizeIp"]);return void 0!==t&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+t).toLowerCase())&&(n.anonymizeIp=1),n},Object.defineProperty(e.prototype,"baseUrl",{get:function(){var e=this.options,t=e.version;return e.endpoint+"/rest/"+t},enumerable:!0,configurable:!0}),e}();t.CoveoAnalyticsClient=y,t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(11);t.preferredStorage=null,t.getAvailableStorage=function(){return t.preferredStorage?t.preferredStorage:r.hasLocalStorage()?localStorage:r.hasCookieStorage()?new i:r.hasSessionStorage()?sessionStorage:new a};var i=function(){function e(){}return e.prototype.getItem=function(t){return o.Cookie.get(""+e.prefix+t)},e.prototype.removeItem=function(t){o.Cookie.erase(""+e.prefix+t)},e.prototype.setItem=function(t,n){o.Cookie.set(""+e.prefix+t,n)},e.prefix="coveo_",e}();t.CookieStorage=i;var a=function(){function e(){}return e.prototype.getItem=function(e){return null},e.prototype.removeItem=function(e){},e.prototype.setItem=function(e,t){},e}();t.NullStorage=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasLocalStorage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},t.hasSessionStorage=function(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(e){return!1}},t.hasCookieStorage=function(){return navigator.cookieEnabled}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__spreadArrays||function(){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],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(15),s=n(16),u=function(){function e(){this.plugins=new a.Plugins,this.params={}}return e.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?(t=t||i.Endpoints.default,this.client=new i.CoveoAnalyticsClient({token:e,endpoint:t})):"object"==typeof e&&void 0!==e.sendEvent&&(this.client=e),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");this.plugins.register("ec",new s.EC({client:this.client})),this.client.registerBeforeSendEventHook((function(e,t){return r(r({},t),n.params)}))},e.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 i.CoveoAnalyticsClient({endpoint:e})},e.prototype.set=function(e,t){var n=this;"string"==typeof e?this.params[e]=t:Object.keys(e).map((function(t){n.params[t]=e[t]}))},e.prototype.send=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0],i=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,o([r.toLowerCase()],i))},e.prototype.onLoad=function(e){if(void 0===e)throw new Error("You must pass a function when you call 'onLoad'");e()},e.prototype.callPlugin=function(e,t){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];(n=this.plugins).execute.apply(n,o([e,t],r))},e.prototype.reset=function(){this.client=void 0,this.plugins=new a.Plugins,this.params={}},e}();t.CoveoUA=u,t.coveoua=new u,t.handleOneAnalyticsEvent=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(e),a=(i[1],i[2]),s=i[3],u=t.coveoua[s];if(a&&s)return t.coveoua.callPlugin.apply(t.coveoua,o([a,s],n));if(u)return u.apply(t.coveoua,n);var c=["init","set","send","onLoad","callPlugin"];throw new Error('The action "'+e+'" does not exist. Available actions: '+c.join(", ")+".")},t.default=t.handleOneAnalyticsEvent},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(2);t.STORE_KEY="__coveo.analytics.history",t.MAX_NUMBER_OF_HISTORY_ELEMENTS=20,t.MIN_THRESHOLD_FOR_DUPLICATE_VALUE=6e4,t.MAX_VALUE_SIZE=75;var i=function(){function e(e){this.store=e||o.getAvailableStorage(),this.store instanceof o.CookieStorage||!r.hasCookieStorage()||(new o.CookieStorage).removeItem(t.STORE_KEY)}return e.prototype.addElement=function(e){e.internalTime=(new Date).getTime(),this.cropQueryElement(e);var t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])},e.prototype.getHistory=function(){var e=this.getHistoryWithInternalTime();return this.stripInternalTime(e)},e.prototype.getHistoryWithInternalTime=function(){try{var e=this.store.getItem(t.STORE_KEY);return e?JSON.parse(e):[]}catch(e){return[]}},e.prototype.setHistory=function(e){try{this.store.setItem(t.STORE_KEY,JSON.stringify(e.slice(0,t.MAX_NUMBER_OF_HISTORY_ELEMENTS)))}catch(e){}},e.prototype.clear=function(){try{this.store.removeItem(t.STORE_KEY)}catch(e){}},e.prototype.getMostRecentElement=function(){var e=this.getHistoryWithInternalTime();return null!=e?e.sort((function(e,t){return(t.internalTime||0)-(e.internalTime||0)}))[0]:null},e.prototype.cropQueryElement=function(e){e.name&&"query"==e.name.toLowerCase()&&null!=e.value&&(e.value=e.value.slice(0,t.MAX_VALUE_SIZE))},e.prototype.isValidEntry=function(e){var n=this.getMostRecentElement();return!n||n.value!=e.value||(e.internalTime||0)-(n.internalTime||0)>t.MIN_THRESHOLD_FOR_DUPLICATE_VALUE},e.prototype.stripInternalTime=function(e){return e.map((function(e){return{name:e.name,time:e.time,value:e.value}}))},e}();t.HistoryStore=i,t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=function(e){return e?(Number(e)^r(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t.uuidv4)};var r=function(e){if(void 0!==typeof crypto&&crypto.getRandomValues)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}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},i={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},a=r(r(r(r(r({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"});t.keysOf=Object.keys,t.convertKeysToMeasurementProtocol=function(e){return t.keysOf(e).reduce((function(t,n){var o,i=a[n]||n;return r(r({},t),((o={})[i]=e[n],o))}),{})},t.convertProductToMeasurementProtocol=function(e,n){return t.keysOf(e).reduce((function(t,i){var a,s="pr"+(n+1)+(o[i]||i);return r(r({},t),((a={})[s]=e[i],a))}),{})},t.convertImpressionListToMeasurementProtocol=function(e,t){var n=e.impressions.reduce((function(e,n,o){return r(r({},e),s(n,t,o))}),{});e.listName&&(n["il"+(t+1)+"nm"]=e.listName);return n};var s=function(e,n,o){return t.keysOf(e).reduce((function(t,a){var s,u="il"+(n+1)+"pi"+(o+1)+(i[a]||a);return r(r({},t),((s={})[u]=e[a],s))}),{})},u=t.keysOf(a).map((function(e){return a[e]})),c=t.keysOf(o).map((function(e){return o[e]})),l=t.keysOf(i).map((function(e){return i[e]})),p=c.join("|"),f=l.join("|"),d=new RegExp("^(pr[0-9]+)("+p+")$"),h=new RegExp("^((il[0-9]+pi[0-9]+)("+f+"))|(il[0-9]+nm)$");t.isMeasurementProtocolKey=function(e){return d.test(e)||h.test(e)||-1!=u.indexOf(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.analytics=r;var o=n(14);t.donottrack=o;var i=n(5);t.history=i;var a=n(4);t.SimpleAnalytics=a;var s=n(2);t.storage=s;var u=n(1);t.CoveoAnalyticsClient=u.CoveoAnalyticsClient;var c=n(4);t.CoveoUA=c.CoveoUA,t.handleOneAnalyticsEvent=c.handleOneAnalyticsEvent},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.opts=e}return e.prototype.sendEvent=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,p;return o(this,(function(o){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return n=this.opts,r=n.baseUrl,i=n.token,a=n.visitorIdProvider,s=this.getParsedRequestDataKey(e),u=s+"="+encodeURIComponent(JSON.stringify(t)),c=a.currentVisitorId,l=[i?"access_token="+i:"",c?"visitorId="+c:""].filter((function(e){return!!e})).join("&"),p=r+"/analytics/"+e+"?"+l,console.log('Sending beacon for "'+e+'" with: ',JSON.stringify(t)),navigator.sendBeacon(p,new Blob([u],{type:"application/x-www-form-urlencoded"})),[2]}))}))},e.prototype.getParsedRequestDataKey=function(e){return e+"Event"},e}();t.AnalyticsBeaconClient=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),s=function(){function e(e){this.opts=e}return e.prototype.sendEvent=function(e,t){return o(this,void 0,void 0,(function(){var n,r,o,a,s,u;return i(this,(function(i){switch(i.label){case 0:return n=this.opts,r=n.baseUrl,o=n.visitorIdProvider,a=this.shouldAppendVisitorId(e)?this.visitorIdParam:"",[4,fetch(r+"/analytics/"+e+a,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(t),credentials:"include"})];case 1:return(s=i.sent()).ok?[4,s.json()]:[3,3];case 2:return(u=i.sent()).visitorId&&(o.currentVisitorId=u.visitorId),[2,u];case 3:try{s.json()}catch(e){}throw console.error('An error has occured when sending the "'+e+'" event.',s,t),new Error('An error has occurred when sending the "'+e+'" event. Check the console logs for more details.')}}))}))},e.prototype.shouldAppendVisitorId=function(e){return-1!==[a.EventType.click,a.EventType.custom,a.EventType.search,a.EventType.view].indexOf(e)},Object.defineProperty(e.prototype,"visitorIdParam",{get:function(){var e=this.opts.visitorIdProvider.currentVisitorId;return e?"?visitor="+e:""},enumerable:!0,configurable:!0}),e.prototype.getHeaders=function(){var e=this.opts.token;return r(r({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})},e}();t.AnalyticsFetchClient=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.set=function(t,n,r){var o,i,a,s,u;r?((a=new Date).setTime(a.getTime()+r),s="; expires="+a.toGMTString()):s="",-1===(u=location.hostname).indexOf(".")?document.cookie=t+"="+n+s+"; path=/":((i=u.split(".")).shift(),o="."+i.join("."),document.cookie=t+"="+n+s+"; path=/; domain="+o,null!=e.get(t)&&e.get(t)==n||(o="."+u,document.cookie=t+"="+n+s+"; path=/; domain="+o))},e.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},e.erase=function(t){e.set(t,"",-1)},e}();t.Cookie=r},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=[o.EventType.click,o.EventType.custom,o.EventType.search,o.EventType.view];t.addDefaultValues=function(e,t){return-1!==i.indexOf(e)?r({language:document.documentElement.lang,userAgent:navigator.userAgent},t):t}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(5);t.enhanceViewEvent=function(e,t){return e===o.EventType.view?(a(t.contentIdValue),r({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t};var a=function(e){var t=new i.HistoryStore,n={name:"PageView",value:e,time:JSON.stringify(new Date)};t.addElement(n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),t.default=t.doNotTrack},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.plugins={}}return e.prototype.register=function(e,t){this.plugins[e]=t},e.prototype.execute=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.plugins[e],i=o[t];return i.apply(o,n)},e}();t.Plugins=r},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__rest||function(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};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),a=n(6),s=n(17),u=n(7);t.ECPluginEventTypes={pageview:"pageview",event:"event"};var c=Object.keys(t.ECPluginEventTypes).map((function(e){return t.ECPluginEventTypes[e]})),l=function(){function e(e){var t=e.client,n=e.uuidGenerator,r=void 0===n?a.uuidv4:n;this.products=[],this.impressions=[],this.actionData={},this.client=t,this.uuidGenerator=r,this.pageViewId=r(),this.lastLocation=s.getFormattedLocation(window.location),this.lastReferrer=document.referrer,this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()}return e.prototype.addProduct=function(e){this.products.push(e)},e.prototype.addImpression=function(e){this.impressions.push(e)},e.prototype.setAction=function(e,t){this.action=e,this.actionData=t},e.prototype.clearData=function(){this.products=[],this.impressions=[],this.action=void 0,this.actionData={}},e.prototype.addHooksForECEvents=function(){var e=this;this.client.registerBeforeSendEventHook((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=n[0];return-1!==c.indexOf(t)?e.addECDataToPayload(t,o):o}))},e.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(t.ECPluginEventTypes.pageview,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},e.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(t.ECPluginEventTypes.event,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},e.prototype.addECDataToPayload=function(e,t){var n=r(r(r(r({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{action:this.action}:{}),this.actionData||{}),o=this.products.reduce((function(e,t,n){return r(r({},e),u.convertProductToMeasurementProtocol(t,n))}),{}),i=this.getImpressionsByList().reduce((function(e,t,n){return r(r({},e),u.convertImpressionListToMeasurementProtocol(t,n))}),{});return this.clearData(),r(r(r(r({},i),o),n),t)},e.prototype.getImpressionsByList=function(){return this.impressions.reduce((function(e,t){var n=t.list,r=o(t,["list"]),i=e.find((function(e){return e.listName===n}));return i?i.impressions.push(r):e.push({listName:n,impressions:[r]}),e}),[])},e.prototype.updateStateForNewPageView=function(e){if(this.hasSentFirstPageView&&(this.pageViewId=this.uuidGenerator(),this.lastReferrer=this.lastLocation),e.page){this.lastLocation=""+function(e){return e.split("/").slice(0,3).join("/")}(this.lastLocation)+e.page.replace(/^\/?(.*)$/,"/$1")}else this.lastLocation=s.getFormattedLocation(window.location);this.hasSentFirstPageView=!0},e.prototype.getLocationInformation=function(e,n){return e===t.ECPluginEventTypes.pageview&&this.updateStateForNewPageView(n),{referrer:this.lastReferrer,location:this.lastLocation}},e.prototype.getDefaultContextInformation=function(e){var t={hitType:e,pageViewId:this.pageViewId},n={title:document.title,encoding:document.characterSet},o={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},i={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now().toString(),eventId:this.uuidGenerator()};return r(r(r(r(r({},t),a),o),i),n)},e}();t.EC=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFormattedLocation=function(e){return e.protocol+"//"+e.hostname+(0===e.pathname.indexOf("/")?e.pathname:"/"+e.pathname)+e.search}},function(e,t,n){"use strict";(function(e){var r=this&&this.__spreadArrays||function(){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],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var o=n(8),i=n(4);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 a=e.coveoua||i.default;(e.coveoua=i.default,e.coveoanalytics=o,a.q)&&r(a.q.filter((function(e){return"init"===e[0]})),a.q.filter((function(e){return"init"!==e[0]}))).forEach((function(e){return i.default.apply(void 0,e)}));t.default=a}).call(this,n(19))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n}]);
//# sourceMappingURL=coveoua.js.map

@@ -61,2 +61,3 @@ import { AnyEventResponse, ClickEventRequest, ClickEventResponse, CustomEventRequest, CustomEventResponse, EventType, HealthResponse, SearchEventRequest, SearchEventResponse, ViewEventRequest, ViewEventResponse, VisitResponse, VariableArgumentsPayload } from '../events';

private removeEmptyPayloadValues;
private removeUnknownParameters;
private validateParams;

@@ -63,0 +64,0 @@ private get baseUrl();

@@ -8,1 +8,2 @@ import { ImpressionList } from '../plugins/ec';

};
export declare const isMeasurementProtocolKey: (key: string) => boolean;

@@ -1,2 +0,2 @@

!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.search="search",t.click="click",t.custom="custom",t.view="view",t.collect="collect"}(e.EventType||(e.EventType={}))},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(e,"__esModule",{value:!0});var s=n(9),u=n(10),c=n(0),l=n(2),p=n(3),f=n(12),d=n(13),h=n(6),v=n(7);e.Version="v15",e.Endpoints={default:"https://usageanalytics.coveo.com",production:"https://usageanalytics.coveo.com",hipaa:"https://usageanalyticshipaa.coveo.com"};var y=function(){function t(t){var e=this;if(!t)throw new Error("You have to pass options to this constructor");this.options=r(r({},this.defaultOptions),t);var n=this.options.token;this.cookieStorage=new l.CookieStorage,this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[d.enhanceViewEvent,f.addDefaultValues],this.eventTypeMapping={},this.initVisitorId();var o={baseUrl:this.baseUrl,token:n,visitorIdProvider:this};this.analyticsBeaconClient=new s.AnalyticsBeaconClient(o),this.analyticsFetchClient=new u.AnalyticsFetchClient(o),window.addEventListener("beforeunload",(function(){return e.flushBufferWithBeacon()}))}return Object.defineProperty(t.prototype,"defaultOptions",{get:function(){return{endpoint:e.Endpoints.default,token:"",version:e.Version}},enumerable:!0,configurable:!0}),t.prototype.initVisitorId=function(){var t=this.visitorId||p.hasCookieStorage()&&this.cookieStorage.getItem("visitorId")||p.hasLocalStorage()&&localStorage.getItem("visitorId")||"";this.currentVisitorId=t||h.uuidv4()},Object.defineProperty(t.prototype,"currentVisitorId",{get:function(){return this.visitorId},set:function(t){this.visitorId=t,p.hasCookieStorage()&&this.cookieStorage.setItem("visitorId",t),p.hasLocalStorage()&&localStorage.setItem("visitorId",t)},enumerable:!0,configurable:!0}),t.prototype.sendEvent=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return o(this,void 0,void 0,(function(){var n,o,a,s,u,c,l,p,f,d,h=this;return i(this,(function(i){switch(i.label){case 0:return n=this.eventTypeMapping[t]||{},o=n.newEventType,a=void 0===o?t:o,s=n.variableLengthArgumentsNames,u=void 0===s?[]:s,c=n.addVisitorIdParameter,l=void 0!==c&&c,p=n.usesMeasurementProtocol,f=void 0!==p&&p,d=[function(t){return u.length>0?h.parseVariableArgumentsPayload(u,t):t[0]},function(t){return r({visitorId:l?h.visitorId:""},t)},function(e){return h.beforeSendHooks.reduce((function(e,n){return n(t,e)}),e)},function(t){return h.removeEmptyPayloadValues(t)},function(t){return h.validateParams(t)},function(t){return f?v.convertKeysToMeasurementProtocol(t):t}].reduce((function(t,e){return e(t)}),e),this.bufferedRequests.push({eventType:a,payload:d,handled:!1}),[4,this.deferExecution()];case 1:return i.sent(),[4,this.sendFromBufferWithFetch()];case 2:return[2,i.sent()]}}))}))},t.prototype.deferExecution=function(){return new Promise((function(t){return setTimeout(t,0)}))},t.prototype.flushBufferWithBeacon=function(){for(;this.hasPendingRequests();){var t=this.bufferedRequests.pop(),e=t.eventType,n=t.payload;this.analyticsBeaconClient.sendEvent(e,n)}},t.prototype.sendFromBufferWithFetch=function(){return o(this,void 0,void 0,(function(){var t,e,n;return i(this,(function(r){return(t=this.bufferedRequests.shift())?(e=t.eventType,n=t.payload,[2,this.analyticsFetchClient.sendEvent(e,n)]):[2]}))}))},t.prototype.hasPendingRequests=function(){return this.bufferedRequests.length>0},t.prototype.sendSearchEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.search,t)]}))}))},t.prototype.sendClickEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.click,t)]}))}))},t.prototype.sendCustomEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.custom,t)]}))}))},t.prototype.sendViewEvent=function(t){return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.sendEvent(c.EventType.view,t)]}))}))},t.prototype.getVisit=function(){return o(this,void 0,void 0,(function(){var t;return i(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]}}))}))},t.prototype.getHealth=function(){return o(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,fetch(this.baseUrl+"/analytics/monitoring/health")];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()]}}))}))},t.prototype.registerBeforeSendEventHook=function(t){this.beforeSendHooks.push(t)},t.prototype.addEventTypeMapping=function(t,e){this.eventTypeMapping[t]=e},t.prototype.parseVariableArgumentsPayload=function(t,e){for(var n={},o=0,i=e.length;o<i;o++){var a=e[o];if("string"==typeof a)n[t[o]]=a;else if("object"==typeof a)return r(r({},n),a)}return n},t.prototype.removeEmptyPayloadValues=function(t){return Object.keys(t).filter((function(e){return null!=(n=t[e])&&""!==n;var n})).reduce((function(e,n){var o;return r(r({},e),((o={})[n]=t[n],o))}),{})},t.prototype.validateParams=function(t){var e=t.anonymizeIp,n=a(t,["anonymizeIp"]);return void 0!==e&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+e).toLowerCase())&&(n.anonymizeIp=1),n},Object.defineProperty(t.prototype,"baseUrl",{get:function(){var t=this.options,e=t.version;return t.endpoint+"/rest/"+e},enumerable:!0,configurable:!0}),t}();e.CoveoAnalyticsClient=y,e.default=y},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(11);e.preferredStorage=null,e.getAvailableStorage=function(){return e.preferredStorage?e.preferredStorage:r.hasLocalStorage()?localStorage:r.hasCookieStorage()?new i:r.hasSessionStorage()?sessionStorage:new a};var i=function(){function t(){}return t.prototype.getItem=function(e){return o.Cookie.get(""+t.prefix+e)},t.prototype.removeItem=function(e){o.Cookie.erase(""+t.prefix+e)},t.prototype.setItem=function(e,n){o.Cookie.set(""+t.prefix+e,n)},t.prefix="coveo_",t}();e.CookieStorage=i;var a=function(){function t(){}return t.prototype.getItem=function(t){return null},t.prototype.removeItem=function(t){},t.prototype.setItem=function(t,e){},t}();e.NullStorage=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hasLocalStorage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(t){return!1}},e.hasSessionStorage=function(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(t){return!1}},e.hasCookieStorage=function(){return navigator.cookieEnabled}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),a=n(15),s=n(16),u=function(){function t(){this.plugins=new a.Plugins,this.params={}}return t.prototype.init=function(t,e){var n=this;if(!t)throw new Error("You must pass your token when you call 'init'");if("string"==typeof t?(e=e||i.Endpoints.default,this.client=new i.CoveoAnalyticsClient({token:t,endpoint:e})):"object"==typeof t&&void 0!==t.sendEvent&&(this.client=t),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");this.plugins.register("ec",new s.EC({client:this.client})),this.client.registerBeforeSendEventHook((function(t,e){return r(r({},e),n.params)}))},t.prototype.initForProxy=function(t){if(!t)throw new Error("You must pass your endpoint when you call 'initForProxy'");if("string"!=typeof t)throw new Error("You must pass a string as the endpoint parameter when you call 'initForProxy'");this.client=new i.CoveoAnalyticsClient({endpoint:t})},t.prototype.set=function(t,e){var n=this;"string"==typeof t?this.params[t]=e:Object.keys(t).map((function(e){n.params[e]=t[e]}))},t.prototype.send=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=e[0],i=e.slice(1);if(void 0===this.client)throw new Error("You must call init before sending an event");if(!r)throw new Error('You must provide an event type when calling "send".');return(t=this.client).sendEvent.apply(t,o([r.toLowerCase()],i))},t.prototype.onLoad=function(t){if(void 0===t)throw new Error("You must pass a function when you call 'onLoad'");t()},t.prototype.callPlugin=function(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];(n=this.plugins).execute.apply(n,o([t,e],r))},t.prototype.reset=function(){this.client=void 0,this.plugins=new a.Plugins,this.params={}},t}();e.CoveoUA=u,e.coveoua=new u,e.handleOneAnalyticsEvent=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(t),a=(i[1],i[2]),s=i[3],u=e.coveoua[s];if(a&&s)return e.coveoua.callPlugin.apply(e.coveoua,o([a,s],n));if(u)return u.apply(e.coveoua,n);var c=["init","set","send","onLoad","callPlugin"];throw new Error('The action "'+t+'" does not exist. Available actions: '+c.join(", ")+".")},e.default=e.handleOneAnalyticsEvent},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(2);e.STORE_KEY="__coveo.analytics.history",e.MAX_NUMBER_OF_HISTORY_ELEMENTS=20,e.MIN_THRESHOLD_FOR_DUPLICATE_VALUE=6e4,e.MAX_VALUE_SIZE=75;var i=function(){function t(t){this.store=t||o.getAvailableStorage(),this.store instanceof o.CookieStorage||!r.hasCookieStorage()||(new o.CookieStorage).removeItem(e.STORE_KEY)}return t.prototype.addElement=function(t){t.internalTime=(new Date).getTime(),this.cropQueryElement(t);var e=this.getHistoryWithInternalTime();null!=e?this.isValidEntry(t)&&this.setHistory([t].concat(e)):this.setHistory([t])},t.prototype.getHistory=function(){var t=this.getHistoryWithInternalTime();return this.stripInternalTime(t)},t.prototype.getHistoryWithInternalTime=function(){try{var t=this.store.getItem(e.STORE_KEY);return t?JSON.parse(t):[]}catch(t){return[]}},t.prototype.setHistory=function(t){try{this.store.setItem(e.STORE_KEY,JSON.stringify(t.slice(0,e.MAX_NUMBER_OF_HISTORY_ELEMENTS)))}catch(t){}},t.prototype.clear=function(){try{this.store.removeItem(e.STORE_KEY)}catch(t){}},t.prototype.getMostRecentElement=function(){var t=this.getHistoryWithInternalTime();return null!=t?t.sort((function(t,e){return(e.internalTime||0)-(t.internalTime||0)}))[0]:null},t.prototype.cropQueryElement=function(t){t.name&&"query"==t.name.toLowerCase()&&null!=t.value&&(t.value=t.value.slice(0,e.MAX_VALUE_SIZE))},t.prototype.isValidEntry=function(t){var n=this.getMostRecentElement();return!n||n.value!=t.value||(t.internalTime||0)-(n.internalTime||0)>e.MIN_THRESHOLD_FOR_DUPLICATE_VALUE},t.prototype.stripInternalTime=function(t){return t.map((function(t){return{name:t.name,time:t.time,value:t.value}}))},t}();e.HistoryStore=i,e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=function(t){return t?(Number(t)^r(new Uint8Array(1))[0]%16>>Number(t)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,e.uuidv4)};var r=function(t){if(void 0!==typeof crypto&&crypto.getRandomValues)return crypto.getRandomValues(t);for(var e=0,n=0;e<t.length;e++)0==(3&e)&&(n=4294967296*Math.random()),t[e]=n>>>((3&e)<<3)&255;return t}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},i={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},a=r(r(r(r(r({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"});e.keysOf=Object.keys,e.convertKeysToMeasurementProtocol=function(t){return e.keysOf(t).reduce((function(e,n){var o,i=a[n]||n;return r(r({},e),((o={})[i]=t[n],o))}),{})},e.convertProductToMeasurementProtocol=function(t,n){return e.keysOf(t).reduce((function(e,i){var a,s="pr"+(n+1)+(o[i]||i);return r(r({},e),((a={})[s]=t[i],a))}),{})},e.convertImpressionListToMeasurementProtocol=function(t,e){var n=t.impressions.reduce((function(t,n,o){return r(r({},t),s(n,e,o))}),{});t.listName&&(n["il"+(e+1)+"nm"]=t.listName);return n};var s=function(t,n,o){return e.keysOf(t).reduce((function(e,a){var s,u="il"+(n+1)+"pi"+(o+1)+(i[a]||a);return r(r({},e),((s={})[u]=t[a],s))}),{})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);e.analytics=r;var o=n(14);e.donottrack=o;var i=n(5);e.history=i;var a=n(4);e.SimpleAnalytics=a;var s=n(2);e.storage=s;var u=n(1);e.CoveoAnalyticsClient=u.CoveoAnalyticsClient;var c=n(4);e.CoveoUA=c.CoveoUA,e.handleOneAnalyticsEvent=c.handleOneAnalyticsEvent},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.opts=t}return t.prototype.sendEvent=function(t,e){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,p;return o(this,(function(o){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return n=this.opts,r=n.baseUrl,i=n.token,a=n.visitorIdProvider,s=this.getParsedRequestDataKey(t),u=s+"="+encodeURIComponent(JSON.stringify(e)),c=a.currentVisitorId,l=[i?"access_token="+i:"",c?"visitorId="+c:""].filter((function(t){return!!t})).join("&"),p=r+"/analytics/"+t+"?"+l,console.log('Sending beacon for "'+t+'" with: ',JSON.stringify(e)),navigator.sendBeacon(p,new Blob([u],{type:"application/x-www-form-urlencoded"})),[2]}))}))},t.prototype.getParsedRequestDataKey=function(t){return t+"Event"},t}();e.AnalyticsBeaconClient=i},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),s=function(){function t(t){this.opts=t}return t.prototype.sendEvent=function(t,e){return o(this,void 0,void 0,(function(){var n,r,o,a,s,u;return i(this,(function(i){switch(i.label){case 0:return n=this.opts,r=n.baseUrl,o=n.visitorIdProvider,a=this.shouldAppendVisitorId(t)?this.visitorIdParam:"",[4,fetch(r+"/analytics/"+t+a,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(e),credentials:"include"})];case 1:return(s=i.sent()).ok?[4,s.json()]:[3,3];case 2:return(u=i.sent()).visitorId&&(o.currentVisitorId=u.visitorId),[2,u];case 3:try{s.json()}catch(t){}throw console.error('An error has occured when sending the "'+t+'" event.',s,e),new Error('An error has occurred when sending the "'+t+'" event. Check the console logs for more details.')}}))}))},t.prototype.shouldAppendVisitorId=function(t){return-1!==[a.EventType.click,a.EventType.custom,a.EventType.search,a.EventType.view].indexOf(t)},Object.defineProperty(t.prototype,"visitorIdParam",{get:function(){var t=this.opts.visitorIdProvider.currentVisitorId;return t?"?visitor="+t:""},enumerable:!0,configurable:!0}),t.prototype.getHeaders=function(){var t=this.opts.token;return r(r({},t?{Authorization:"Bearer "+t}:{}),{"Content-Type":"application/json"})},t}();e.AnalyticsFetchClient=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){}return t.set=function(e,n,r){var o,i,a,s,u;r?((a=new Date).setTime(a.getTime()+r),s="; expires="+a.toGMTString()):s="",-1===(u=location.hostname).indexOf(".")?document.cookie=e+"="+n+s+"; path=/":((i=u.split(".")).shift(),o="."+i.join("."),document.cookie=e+"="+n+s+"; path=/; domain="+o,null!=t.get(e)&&t.get(e)==n||(o="."+u,document.cookie=e+"="+n+s+"; path=/; domain="+o))},t.get=function(t){for(var e=t+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){var o=n[r];if(0==(o=o.replace(/^\s+/,"")).indexOf(e))return o.substring(e.length,o.length)}return null},t.erase=function(e){t.set(e,"",-1)},t}();e.Cookie=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=[o.EventType.click,o.EventType.custom,o.EventType.search,o.EventType.view];e.addDefaultValues=function(t,e){return-1!==i.indexOf(t)?r({language:document.documentElement.lang,userAgent:navigator.userAgent},e):e}},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),i=n(5);e.enhanceViewEvent=function(t,e){return t===o.EventType.view?(a(e.contentIdValue),r({location:window.location.toString(),referrer:document.referrer,title:document.title},e)):e};var a=function(t){var e=new i.HistoryStore,n={name:"PageView",value:t,time:JSON.stringify(new Date)};e.addElement(n)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),e.default=e.doNotTrack},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(){this.plugins={}}return t.prototype.register=function(t,e){this.plugins[t]=e},t.prototype.execute=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.plugins[t],i=o[e];return i.apply(o,n)},t}();e.Plugins=r},function(t,e,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},o=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),a=n(6),s=n(17),u=n(7);e.ECPluginEventTypes={pageview:"pageview",event:"event"};var c=Object.keys(e.ECPluginEventTypes).map((function(t){return e.ECPluginEventTypes[t]})),l=function(){function t(t){var e=t.client,n=t.uuidGenerator,r=void 0===n?a.uuidv4:n;this.products=[],this.impressions=[],this.actionData={},this.client=e,this.uuidGenerator=r,this.pageViewId=r(),this.lastLocation=s.getFormattedLocation(window.location),this.lastReferrer=document.referrer,this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()}return t.prototype.addProduct=function(t){this.products.push(t)},t.prototype.addImpression=function(t){this.impressions.push(t)},t.prototype.setAction=function(t,e){this.action=t,this.actionData=e},t.prototype.clearData=function(){this.products=[],this.impressions=[],this.action=void 0,this.actionData={}},t.prototype.addHooksForECEvents=function(){var t=this;this.client.registerBeforeSendEventHook((function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=n[0];return-1!==c.indexOf(e)?t.addECDataToPayload(e,o):o}))},t.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(e.ECPluginEventTypes.pageview,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},t.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(e.ECPluginEventTypes.event,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},t.prototype.addECDataToPayload=function(t,e){var n=r(r(r(r({},this.getLocationInformation(t,e)),this.getDefaultContextInformation(t)),this.action?{action:this.action}:{}),this.actionData||{}),o=this.products.reduce((function(t,e,n){return r(r({},t),u.convertProductToMeasurementProtocol(e,n))}),{}),i=this.getImpressionsByList().reduce((function(t,e,n){return r(r({},t),u.convertImpressionListToMeasurementProtocol(e,n))}),{});return this.clearData(),r(r(r(r({},i),o),n),e)},t.prototype.getImpressionsByList=function(){return this.impressions.reduce((function(t,e){var n=e.list,r=o(e,["list"]),i=t.find((function(t){return t.listName===n}));return i?i.impressions.push(r):t.push({listName:n,impressions:[r]}),t}),[])},t.prototype.updateStateForNewPageView=function(t){if(this.hasSentFirstPageView&&(this.pageViewId=this.uuidGenerator(),this.lastReferrer=this.lastLocation),t.page){this.lastLocation=""+function(t){return t.split("/").slice(0,3).join("/")}(this.lastLocation)+t.page.replace(/^\/?(.*)$/,"/$1")}else this.lastLocation=s.getFormattedLocation(window.location);this.hasSentFirstPageView=!0},t.prototype.getLocationInformation=function(t,n){return t===e.ECPluginEventTypes.pageview&&this.updateStateForNewPageView(n),{referrer:this.lastReferrer,location:this.lastLocation}},t.prototype.getDefaultContextInformation=function(t){var e={hitType:t,pageViewId:this.pageViewId},n={title:document.title,encoding:document.characterSet},o={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},i={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now().toString(),eventId:this.uuidGenerator()};return r(r(r(r(r({},e),a),o),i),n)},t}();e.EC=l},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getFormattedLocation=function(t){return t.protocol+"//"+t.hostname+(0===t.pathname.indexOf("/")?t.pathname:"/"+t.pathname)+t.search}}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.search="search",e.click="click",e.custom="custom",e.view="view",e.collect="collect"}(t.EventType||(t.EventType={}))},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},a=this&&this.__rest||function(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};Object.defineProperty(t,"__esModule",{value:!0});var s=n(9),u=n(10),c=n(0),l=n(2),p=n(3),f=n(12),d=n(13),h=n(6),v=n(7);t.Version="v15",t.Endpoints={default:"https://usageanalytics.coveo.com",production:"https://usageanalytics.coveo.com",hipaa:"https://usageanalyticshipaa.coveo.com"};var y=function(){function e(e){var t=this;if(!e)throw new Error("You have to pass options to this constructor");this.options=r(r({},this.defaultOptions),e);var n=this.options.token;this.cookieStorage=new l.CookieStorage,this.visitorId="",this.bufferedRequests=[],this.beforeSendHooks=[d.enhanceViewEvent,f.addDefaultValues],this.eventTypeMapping={},this.initVisitorId();var o={baseUrl:this.baseUrl,token:n,visitorIdProvider:this};this.analyticsBeaconClient=new s.AnalyticsBeaconClient(o),this.analyticsFetchClient=new u.AnalyticsFetchClient(o),window.addEventListener("beforeunload",(function(){return t.flushBufferWithBeacon()}))}return Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return{endpoint:t.Endpoints.default,token:"",version:t.Version}},enumerable:!0,configurable:!0}),e.prototype.initVisitorId=function(){var e=this.visitorId||p.hasCookieStorage()&&this.cookieStorage.getItem("visitorId")||p.hasLocalStorage()&&localStorage.getItem("visitorId")||"";this.currentVisitorId=e||h.uuidv4()},Object.defineProperty(e.prototype,"currentVisitorId",{get:function(){return this.visitorId},set:function(e){this.visitorId=e,p.hasCookieStorage()&&this.cookieStorage.setItem("visitorId",e),p.hasLocalStorage()&&localStorage.setItem("visitorId",e)},enumerable:!0,configurable:!0}),e.prototype.sendEvent=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return o(this,void 0,void 0,(function(){var n,o,a,s,u,c,l,p,f,d,h=this;return i(this,(function(i){switch(i.label){case 0:return n=this.eventTypeMapping[e]||{},o=n.newEventType,a=void 0===o?e:o,s=n.variableLengthArgumentsNames,u=void 0===s?[]:s,c=n.addVisitorIdParameter,l=void 0!==c&&c,p=n.usesMeasurementProtocol,f=void 0!==p&&p,d=[function(e){return u.length>0?h.parseVariableArgumentsPayload(u,e):e[0]},function(e){return r({visitorId:l?h.visitorId:""},e)},function(t){return h.beforeSendHooks.reduce((function(t,n){return n(e,t)}),t)},function(e){return h.removeEmptyPayloadValues(e)},function(e){return h.validateParams(e)},function(e){return f?v.convertKeysToMeasurementProtocol(e):e},function(e){return f?h.removeUnknownParameters(e):e}].reduce((function(e,t){return t(e)}),t),this.bufferedRequests.push({eventType:a,payload:d,handled:!1}),[4,this.deferExecution()];case 1:return i.sent(),[4,this.sendFromBufferWithFetch()];case 2:return[2,i.sent()]}}))}))},e.prototype.deferExecution=function(){return new Promise((function(e){return setTimeout(e,0)}))},e.prototype.flushBufferWithBeacon=function(){for(;this.hasPendingRequests();){var e=this.bufferedRequests.pop(),t=e.eventType,n=e.payload;this.analyticsBeaconClient.sendEvent(t,n)}},e.prototype.sendFromBufferWithFetch=function(){return o(this,void 0,void 0,(function(){var e,t,n;return i(this,(function(r){return(e=this.bufferedRequests.shift())?(t=e.eventType,n=e.payload,[2,this.analyticsFetchClient.sendEvent(t,n)]):[2]}))}))},e.prototype.hasPendingRequests=function(){return this.bufferedRequests.length>0},e.prototype.sendSearchEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.search,e)]}))}))},e.prototype.sendClickEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.click,e)]}))}))},e.prototype.sendCustomEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.custom,e)]}))}))},e.prototype.sendViewEvent=function(e){return o(this,void 0,void 0,(function(){return i(this,(function(t){return[2,this.sendEvent(c.EventType.view,e)]}))}))},e.prototype.getVisit=function(){return o(this,void 0,void 0,(function(){var e;return i(this,(function(t){switch(t.label){case 0:return[4,fetch(this.baseUrl+"/analytics/visit")];case 1:return[4,t.sent().json()];case 2:return e=t.sent(),this.visitorId=e.visitorId,[2,e]}}))}))},e.prototype.getHealth=function(){return o(this,void 0,void 0,(function(){return i(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.addEventTypeMapping=function(e,t){this.eventTypeMapping[e]=t},e.prototype.parseVariableArgumentsPayload=function(e,t){for(var n={},o=0,i=t.length;o<i;o++){var a=t[o];if("string"==typeof a)n[e[o]]=a;else if("object"==typeof a)return r(r({},n),a)}return n},e.prototype.removeEmptyPayloadValues=function(e){return Object.keys(e).filter((function(t){return null!=(n=e[t])&&""!==n;var n})).reduce((function(t,n){var o;return r(r({},t),((o={})[n]=e[n],o))}),{})},e.prototype.removeUnknownParameters=function(e){return Object.keys(e).filter((function(e){if(v.isMeasurementProtocolKey(e))return!0;console.log(e,"is not processsed by coveoua")})).reduce((function(t,n){var o;return r(r({},t),((o={})[n]=e[n],o))}),{})},e.prototype.validateParams=function(e){var t=e.anonymizeIp,n=a(e,["anonymizeIp"]);return void 0!==t&&-1==["0","false","undefined","null","{}","[]",""].indexOf((""+t).toLowerCase())&&(n.anonymizeIp=1),n},Object.defineProperty(e.prototype,"baseUrl",{get:function(){var e=this.options,t=e.version;return e.endpoint+"/rest/"+t},enumerable:!0,configurable:!0}),e}();t.CoveoAnalyticsClient=y,t.default=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(11);t.preferredStorage=null,t.getAvailableStorage=function(){return t.preferredStorage?t.preferredStorage:r.hasLocalStorage()?localStorage:r.hasCookieStorage()?new i:r.hasSessionStorage()?sessionStorage:new a};var i=function(){function e(){}return e.prototype.getItem=function(t){return o.Cookie.get(""+e.prefix+t)},e.prototype.removeItem=function(t){o.Cookie.erase(""+e.prefix+t)},e.prototype.setItem=function(t,n){o.Cookie.set(""+e.prefix+t,n)},e.prefix="coveo_",e}();t.CookieStorage=i;var a=function(){function e(){}return e.prototype.getItem=function(e){return null},e.prototype.removeItem=function(e){},e.prototype.setItem=function(e,t){},e}();t.NullStorage=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasLocalStorage=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},t.hasSessionStorage=function(){try{return"sessionStorage"in window&&null!==window.sessionStorage}catch(e){return!1}},t.hasCookieStorage=function(){return navigator.cookieEnabled}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__spreadArrays||function(){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],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r};Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=n(15),s=n(16),u=function(){function e(){this.plugins=new a.Plugins,this.params={}}return e.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?(t=t||i.Endpoints.default,this.client=new i.CoveoAnalyticsClient({token:e,endpoint:t})):"object"==typeof e&&void 0!==e.sendEvent&&(this.client=e),!this.client)throw new Error("You must pass either your token or a valid object when you call 'init'");this.plugins.register("ec",new s.EC({client:this.client})),this.client.registerBeforeSendEventHook((function(e,t){return r(r({},t),n.params)}))},e.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 i.CoveoAnalyticsClient({endpoint:e})},e.prototype.set=function(e,t){var n=this;"string"==typeof e?this.params[e]=t:Object.keys(e).map((function(t){n.params[t]=e[t]}))},e.prototype.send=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0],i=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,o([r.toLowerCase()],i))},e.prototype.onLoad=function(e){if(void 0===e)throw new Error("You must pass a function when you call 'onLoad'");e()},e.prototype.callPlugin=function(e,t){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];(n=this.plugins).execute.apply(n,o([e,t],r))},e.prototype.reset=function(){this.client=void 0,this.plugins=new a.Plugins,this.params={}},e}();t.CoveoUA=u,t.coveoua=new u,t.handleOneAnalyticsEvent=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=/^(?:(\w+)\.)?(?:(\w+):)?(\w+)$/.exec(e),a=(i[1],i[2]),s=i[3],u=t.coveoua[s];if(a&&s)return t.coveoua.callPlugin.apply(t.coveoua,o([a,s],n));if(u)return u.apply(t.coveoua,n);var c=["init","set","send","onLoad","callPlugin"];throw new Error('The action "'+e+'" does not exist. Available actions: '+c.join(", ")+".")},t.default=t.handleOneAnalyticsEvent},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(2);t.STORE_KEY="__coveo.analytics.history",t.MAX_NUMBER_OF_HISTORY_ELEMENTS=20,t.MIN_THRESHOLD_FOR_DUPLICATE_VALUE=6e4,t.MAX_VALUE_SIZE=75;var i=function(){function e(e){this.store=e||o.getAvailableStorage(),this.store instanceof o.CookieStorage||!r.hasCookieStorage()||(new o.CookieStorage).removeItem(t.STORE_KEY)}return e.prototype.addElement=function(e){e.internalTime=(new Date).getTime(),this.cropQueryElement(e);var t=this.getHistoryWithInternalTime();null!=t?this.isValidEntry(e)&&this.setHistory([e].concat(t)):this.setHistory([e])},e.prototype.getHistory=function(){var e=this.getHistoryWithInternalTime();return this.stripInternalTime(e)},e.prototype.getHistoryWithInternalTime=function(){try{var e=this.store.getItem(t.STORE_KEY);return e?JSON.parse(e):[]}catch(e){return[]}},e.prototype.setHistory=function(e){try{this.store.setItem(t.STORE_KEY,JSON.stringify(e.slice(0,t.MAX_NUMBER_OF_HISTORY_ELEMENTS)))}catch(e){}},e.prototype.clear=function(){try{this.store.removeItem(t.STORE_KEY)}catch(e){}},e.prototype.getMostRecentElement=function(){var e=this.getHistoryWithInternalTime();return null!=e?e.sort((function(e,t){return(t.internalTime||0)-(e.internalTime||0)}))[0]:null},e.prototype.cropQueryElement=function(e){e.name&&"query"==e.name.toLowerCase()&&null!=e.value&&(e.value=e.value.slice(0,t.MAX_VALUE_SIZE))},e.prototype.isValidEntry=function(e){var n=this.getMostRecentElement();return!n||n.value!=e.value||(e.internalTime||0)-(n.internalTime||0)>t.MIN_THRESHOLD_FOR_DUPLICATE_VALUE},e.prototype.stripInternalTime=function(e){return e.map((function(e){return{name:e.name,time:e.time,value:e.value}}))},e}();t.HistoryStore=i,t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=function(e){return e?(Number(e)^r(new Uint8Array(1))[0]%16>>Number(e)/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,t.uuidv4)};var r=function(e){if(void 0!==typeof crypto&&crypto.getRandomValues)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}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",price:"pr",quantity:"qt",coupon:"cc",position:"ps"},i={id:"id",name:"nm",brand:"br",category:"ca",variant:"va",position:"ps",price:"pr"},a=r(r(r(r(r({},{eventCategory:"ec",eventAction:"ea",eventLabel:"el",eventValue:"ev",page:"dp",visitorId:"cid",clientId:"cid",userId:"uid",currencyCode:"cu"}),{action:"pa",list:"pal",listSource:"pls"}),{id:"ti",revenue:"tr",tax:"tt",shipping:"ts",coupon:"tcc",affiliation:"ta",step:"cos",option:"col"}),{hitType:"t",pageViewId:"pid",encoding:"de",location:"dl",referrer:"dr",screenColor:"sd",screenResolution:"sr",title:"dt",userAgent:"ua",language:"ul",eventId:"z",time:"tm"}),{anonymizeIp:"aip"});t.keysOf=Object.keys,t.convertKeysToMeasurementProtocol=function(e){return t.keysOf(e).reduce((function(t,n){var o,i=a[n]||n;return r(r({},t),((o={})[i]=e[n],o))}),{})},t.convertProductToMeasurementProtocol=function(e,n){return t.keysOf(e).reduce((function(t,i){var a,s="pr"+(n+1)+(o[i]||i);return r(r({},t),((a={})[s]=e[i],a))}),{})},t.convertImpressionListToMeasurementProtocol=function(e,t){var n=e.impressions.reduce((function(e,n,o){return r(r({},e),s(n,t,o))}),{});e.listName&&(n["il"+(t+1)+"nm"]=e.listName);return n};var s=function(e,n,o){return t.keysOf(e).reduce((function(t,a){var s,u="il"+(n+1)+"pi"+(o+1)+(i[a]||a);return r(r({},t),((s={})[u]=e[a],s))}),{})},u=t.keysOf(a).map((function(e){return a[e]})),c=t.keysOf(o).map((function(e){return o[e]})),l=t.keysOf(i).map((function(e){return i[e]})),p=c.join("|"),f=l.join("|"),d=new RegExp("^(pr[0-9]+)("+p+")$"),h=new RegExp("^((il[0-9]+pi[0-9]+)("+f+"))|(il[0-9]+nm)$");t.isMeasurementProtocolKey=function(e){return d.test(e)||h.test(e)||-1!=u.indexOf(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.analytics=r;var o=n(14);t.donottrack=o;var i=n(5);t.history=i;var a=n(4);t.SimpleAnalytics=a;var s=n(2);t.storage=s;var u=n(1);t.CoveoAnalyticsClient=u.CoveoAnalyticsClient;var c=n(4);t.CoveoUA=c.CoveoUA,t.handleOneAnalyticsEvent=c.handleOneAnalyticsEvent},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e){this.opts=e}return e.prototype.sendEvent=function(e,t){return r(this,void 0,void 0,(function(){var n,r,i,a,s,u,c,l,p;return o(this,(function(o){if(!navigator.sendBeacon)throw new Error('navigator.sendBeacon is not supported in this browser. Consider adding a polyfill like "sendbeacon-polyfill".');return n=this.opts,r=n.baseUrl,i=n.token,a=n.visitorIdProvider,s=this.getParsedRequestDataKey(e),u=s+"="+encodeURIComponent(JSON.stringify(t)),c=a.currentVisitorId,l=[i?"access_token="+i:"",c?"visitorId="+c:""].filter((function(e){return!!e})).join("&"),p=r+"/analytics/"+e+"?"+l,console.log('Sending beacon for "'+e+'" with: ',JSON.stringify(t)),navigator.sendBeacon(p,new Blob([u],{type:"application/x-www-form-urlencoded"})),[2]}))}))},e.prototype.getParsedRequestDataKey=function(e){return e+"Event"},e}();t.AnalyticsBeaconClient=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),s=function(){function e(e){this.opts=e}return e.prototype.sendEvent=function(e,t){return o(this,void 0,void 0,(function(){var n,r,o,a,s,u;return i(this,(function(i){switch(i.label){case 0:return n=this.opts,r=n.baseUrl,o=n.visitorIdProvider,a=this.shouldAppendVisitorId(e)?this.visitorIdParam:"",[4,fetch(r+"/analytics/"+e+a,{method:"POST",headers:this.getHeaders(),mode:"cors",body:JSON.stringify(t),credentials:"include"})];case 1:return(s=i.sent()).ok?[4,s.json()]:[3,3];case 2:return(u=i.sent()).visitorId&&(o.currentVisitorId=u.visitorId),[2,u];case 3:try{s.json()}catch(e){}throw console.error('An error has occured when sending the "'+e+'" event.',s,t),new Error('An error has occurred when sending the "'+e+'" event. Check the console logs for more details.')}}))}))},e.prototype.shouldAppendVisitorId=function(e){return-1!==[a.EventType.click,a.EventType.custom,a.EventType.search,a.EventType.view].indexOf(e)},Object.defineProperty(e.prototype,"visitorIdParam",{get:function(){var e=this.opts.visitorIdProvider.currentVisitorId;return e?"?visitor="+e:""},enumerable:!0,configurable:!0}),e.prototype.getHeaders=function(){var e=this.opts.token;return r(r({},e?{Authorization:"Bearer "+e}:{}),{"Content-Type":"application/json"})},e}();t.AnalyticsFetchClient=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.set=function(t,n,r){var o,i,a,s,u;r?((a=new Date).setTime(a.getTime()+r),s="; expires="+a.toGMTString()):s="",-1===(u=location.hostname).indexOf(".")?document.cookie=t+"="+n+s+"; path=/":((i=u.split(".")).shift(),o="."+i.join("."),document.cookie=t+"="+n+s+"; path=/; domain="+o,null!=e.get(t)&&e.get(t)==n||(o="."+u,document.cookie=t+"="+n+s+"; path=/; domain="+o))},e.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},e.erase=function(t){e.set(t,"",-1)},e}();t.Cookie=r},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=[o.EventType.click,o.EventType.custom,o.EventType.search,o.EventType.view];t.addDefaultValues=function(e,t){return-1!==i.indexOf(e)?r({language:document.documentElement.lang,userAgent:navigator.userAgent},t):t}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)};Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(5);t.enhanceViewEvent=function(e,t){return e===o.EventType.view?(a(t.contentIdValue),r({location:window.location.toString(),referrer:document.referrer,title:document.title},t)):t};var a=function(e){var t=new i.HistoryStore,n={name:"PageView",value:e,time:JSON.stringify(new Date)};t.addElement(n)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.doNotTrack=[!0,"yes","1"].indexOf(navigator.doNotTrack||navigator.msDoNotTrack||window.doNotTrack),t.default=t.doNotTrack},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.plugins={}}return e.prototype.register=function(e,t){this.plugins[e]=t},e.prototype.execute=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var o=this.plugins[e],i=o[t];return i.apply(o,n)},e}();t.Plugins=r},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=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)},o=this&&this.__rest||function(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};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),a=n(6),s=n(17),u=n(7);t.ECPluginEventTypes={pageview:"pageview",event:"event"};var c=Object.keys(t.ECPluginEventTypes).map((function(e){return t.ECPluginEventTypes[e]})),l=function(){function e(e){var t=e.client,n=e.uuidGenerator,r=void 0===n?a.uuidv4:n;this.products=[],this.impressions=[],this.actionData={},this.client=t,this.uuidGenerator=r,this.pageViewId=r(),this.lastLocation=s.getFormattedLocation(window.location),this.lastReferrer=document.referrer,this.addHooksForPageView(),this.addHooksForEvent(),this.addHooksForECEvents()}return e.prototype.addProduct=function(e){this.products.push(e)},e.prototype.addImpression=function(e){this.impressions.push(e)},e.prototype.setAction=function(e,t){this.action=e,this.actionData=t},e.prototype.clearData=function(){this.products=[],this.impressions=[],this.action=void 0,this.actionData={}},e.prototype.addHooksForECEvents=function(){var e=this;this.client.registerBeforeSendEventHook((function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var o=n[0];return-1!==c.indexOf(t)?e.addECDataToPayload(t,o):o}))},e.prototype.addHooksForPageView=function(){this.client.addEventTypeMapping(t.ECPluginEventTypes.pageview,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["page"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},e.prototype.addHooksForEvent=function(){this.client.addEventTypeMapping(t.ECPluginEventTypes.event,{newEventType:i.EventType.collect,variableLengthArgumentsNames:["eventCategory","eventAction","eventLabel","eventValue"],addVisitorIdParameter:!0,usesMeasurementProtocol:!0})},e.prototype.addECDataToPayload=function(e,t){var n=r(r(r(r({},this.getLocationInformation(e,t)),this.getDefaultContextInformation(e)),this.action?{action:this.action}:{}),this.actionData||{}),o=this.products.reduce((function(e,t,n){return r(r({},e),u.convertProductToMeasurementProtocol(t,n))}),{}),i=this.getImpressionsByList().reduce((function(e,t,n){return r(r({},e),u.convertImpressionListToMeasurementProtocol(t,n))}),{});return this.clearData(),r(r(r(r({},i),o),n),t)},e.prototype.getImpressionsByList=function(){return this.impressions.reduce((function(e,t){var n=t.list,r=o(t,["list"]),i=e.find((function(e){return e.listName===n}));return i?i.impressions.push(r):e.push({listName:n,impressions:[r]}),e}),[])},e.prototype.updateStateForNewPageView=function(e){if(this.hasSentFirstPageView&&(this.pageViewId=this.uuidGenerator(),this.lastReferrer=this.lastLocation),e.page){this.lastLocation=""+function(e){return e.split("/").slice(0,3).join("/")}(this.lastLocation)+e.page.replace(/^\/?(.*)$/,"/$1")}else this.lastLocation=s.getFormattedLocation(window.location);this.hasSentFirstPageView=!0},e.prototype.getLocationInformation=function(e,n){return e===t.ECPluginEventTypes.pageview&&this.updateStateForNewPageView(n),{referrer:this.lastReferrer,location:this.lastLocation}},e.prototype.getDefaultContextInformation=function(e){var t={hitType:e,pageViewId:this.pageViewId},n={title:document.title,encoding:document.characterSet},o={screenResolution:screen.width+"x"+screen.height,screenColor:screen.colorDepth+"-bit"},i={language:navigator.language,userAgent:navigator.userAgent},a={time:Date.now().toString(),eventId:this.uuidGenerator()};return r(r(r(r(r({},t),a),o),i),n)},e}();t.EC=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getFormattedLocation=function(e){return e.protocol+"//"+e.hostname+(0===e.pathname.indexOf("/")?e.pathname:"/"+e.pathname)+e.search}}]);
//# sourceMappingURL=library.js.map
{
"name": "coveo.analytics",
"version": "2.0.0",
"version": "2.0.1",
"description": "📈 Coveo analytics client (node and browser compatible) ",

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

@@ -25,3 +25,3 @@ import {AnalyticsBeaconClient} from './analyticsBeaconClient';

import {uuidv4} from './crypto';
import {convertKeysToMeasurementProtocol} from './measurementProtocolMapper';
import {convertKeysToMeasurementProtocol, isMeasurementProtocolKey} from './measurementProtocolMapper';

@@ -165,2 +165,4 @@ export const Version = 'v15';

usesMeasurementProtocol ? convertKeysToMeasurementProtocol(currentPayload) : currentPayload;
const removeUnknownParameters: ProcessPayloadStep = (currentPayload) =>
usesMeasurementProtocol ? this.removeUnknownParameters(currentPayload) : currentPayload;

@@ -174,2 +176,3 @@ const payloadToSend = [

processMeasurementProtocolConversionStep,
removeUnknownParameters,
].reduce((payload, step) => step(payload), payload);

@@ -276,5 +279,23 @@

private removeUnknownParameters(payload: IRequestPayload): IRequestPayload {
const newPayload = Object.keys(payload)
.filter((key) => {
if (isMeasurementProtocolKey(key)) {
return true;
} else {
console.log(key, 'is not processsed by coveoua');
}
})
.reduce(
(newPayload, key) => ({
...newPayload,
[key]: payload[key],
}),
{}
);
return newPayload;
}
private validateParams(payload: IRequestPayload): IRequestPayload {
const {anonymizeIp, ...rest} = payload;
if (anonymizeIp !== undefined) {

@@ -285,3 +306,2 @@ if (['0', 'false', 'undefined', 'null', '{}', '[]', ''].indexOf(`${anonymizeIp}`.toLowerCase()) == -1) {

}
return rest;

@@ -288,0 +308,0 @@ }

@@ -139,1 +139,20 @@ import {EC, Product, ImpressionList, BaseImpression} from '../plugins/ec';

};
const measurementProtocolKeysMappingValues = keysOf(measurementProtocolKeysMapping).map(
(key) => measurementProtocolKeysMapping[key]
);
const productKeysMappingValues = keysOf(productKeysMapping).map((key) => productKeysMapping[key]);
const impressionKeysMappingValues = keysOf(impressionKeysMapping).map((key) => impressionKeysMapping[key]);
const productSubKeysMatchGroup = productKeysMappingValues.join('|');
const impressSubKeysMatchGroup = impressionKeysMappingValues.join('|');
const productKeyRegex = new RegExp(`^(pr[0-9]+)(${productSubKeysMatchGroup})$`);
const impressionKeyRegex = new RegExp(`^((il[0-9]+pi[0-9]+)(${impressSubKeysMatchGroup}))|(il[0-9]+nm)$`);
export const isMeasurementProtocolKey = (key: string): boolean => {
return (
productKeyRegex.test(key) ||
impressionKeyRegex.test(key) ||
measurementProtocolKeysMappingValues.indexOf(key) != -1
);
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc