@snowplow/tracker-core
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -1128,2 +1128,18 @@ declare const version: string; | ||
declare function newEventStorePayload({ payload, svrAnon }: EventStorePayload): EventStorePayload; | ||
/** | ||
* Result of the next operation on an EventStoreIterator. | ||
*/ | ||
interface EventStoreIteratorNextResult { | ||
/** | ||
* The next event in the store, or undefined if there are no more events. | ||
*/ | ||
value: EventStorePayload | undefined; | ||
/** | ||
* True if there are no more events in the store. | ||
*/ | ||
done: boolean; | ||
} | ||
/** | ||
* EventStoreIterator allows iterating over all events in the store. | ||
*/ | ||
interface EventStoreIterator { | ||
@@ -1133,6 +1149,3 @@ /** | ||
*/ | ||
next: () => Promise<{ | ||
value: EventStorePayload | undefined; | ||
done: boolean; | ||
}>; | ||
next: () => Promise<EventStoreIteratorNextResult>; | ||
} | ||
@@ -1365,2 +1378,2 @@ /** | ||
declare function newEmitter({ endpoint, eventMethod, protocol, port, maxPostBytes, maxGetBytes, bufferSize, customHeaders, serverAnonymization, connectionTimeout, keepalive, idService, dontRetryStatusCodes, retryStatusCodes, retryFailedRequests, onRequestFailure, onRequestSuccess, customFetch, useStm, eventStore, credentials }: EmitterConfiguration): Emitter; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIteratorNextResult, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; |
@@ -1128,2 +1128,18 @@ declare const version: string; | ||
declare function newEventStorePayload({ payload, svrAnon }: EventStorePayload): EventStorePayload; | ||
/** | ||
* Result of the next operation on an EventStoreIterator. | ||
*/ | ||
interface EventStoreIteratorNextResult { | ||
/** | ||
* The next event in the store, or undefined if there are no more events. | ||
*/ | ||
value: EventStorePayload | undefined; | ||
/** | ||
* True if there are no more events in the store. | ||
*/ | ||
done: boolean; | ||
} | ||
/** | ||
* EventStoreIterator allows iterating over all events in the store. | ||
*/ | ||
interface EventStoreIterator { | ||
@@ -1133,6 +1149,3 @@ /** | ||
*/ | ||
next: () => Promise<{ | ||
value: EventStorePayload | undefined; | ||
done: boolean; | ||
}>; | ||
next: () => Promise<EventStoreIteratorNextResult>; | ||
} | ||
@@ -1365,2 +1378,2 @@ /** | ||
declare function newEmitter({ endpoint, eventMethod, protocol, port, maxPostBytes, maxGetBytes, bufferSize, customHeaders, serverAnonymization, connectionTimeout, keepalive, idService, dontRetryStatusCodes, retryStatusCodes, retryFailedRequests, onRequestFailure, onRequestSuccess, customFetch, useStm, eventStore, credentials }: EmitterConfiguration): Emitter; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIteratorNextResult, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; |
/*! | ||
* Core functionality for Snowplow JavaScript trackers v4.0.0 (http://bit.ly/sp-js) | ||
* Core functionality for Snowplow JavaScript trackers v4.0.1 (http://bit.ly/sp-js) | ||
* Copyright 2022 Snowplow Analytics Ltd, 2010 Anthon Pang | ||
@@ -7,3 +7,3 @@ * Licensed under BSD-3-Clause | ||
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).snowplowTrackerCore={})}(this,(function(e){function t(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?o(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(i,c)}s((r=r.apply(e,t||[])).next())}))}function n(e,t){function n(n){return function(s){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,n[0]&&(i=0)),i;)try{if(r=1,o&&(a=2&n[0]?o.return:n[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return i.label++,{value:n[1],done:!1};case 5:i.label++,o=n[1],n=[0];continue;case 7:n=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=0<a.length&&a[a.length-1])||6!==n[0]&&2!==n[0])){i=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3]))i.label=n[1];else if(6===n[0]&&i.label<a[1])i.label=a[1],a=n;else{if(!(a&&i.label<a[2])){a[2]&&i.ops.pop(),i.trys.pop();continue}i.label=a[2],i.ops.push(n)}}n=t.call(e,i)}catch(e){n=[6,e],o=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}var r,o,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=n(0),c.throw=n(1),c.return=n(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c}function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function o(){var e,t={},n=[],r=[],o=[],a=function(e,n){null!=n&&""!==n&&(t[e]=n)};return{add:a,addDict:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a(t,e[t])},addJson:function(e,t,o){o&&i(o)&&(e={keyIfEncoded:e,keyIfNotEncoded:t,json:o},r.push(e),n.push(e))},addContextEntity:function(e){o.push(e)},getPayload:function(){return t},getJson:function(){return n},withJsonProcessor:function(t){e=t},build:function(){return null==e||e(this,r,o),t}}}function a(e){return function(t,n,o){for(var a=function(n,r,o){if(n=JSON.stringify(n),e){if(o=t.add,n){var a=0,i=0,c=[];if(n){n=unescape(encodeURIComponent(n));do{var s=n.charCodeAt(a++),u=n.charCodeAt(a++),l=n.charCodeAt(a++),d=s<<16|u<<8|l;s=d>>18&63,u=d>>12&63,l=d>>6&63,d&=63,c[i++]=J.charAt(s)+J.charAt(u)+J.charAt(l)+J.charAt(d)}while(a<n.length);a=c.join(""),n=((n=n.length%3)?a.slice(0,n-3):a)+"===".slice(n||3)}n=n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o.call(t,r,n)}else t.add(o,n)},i=function(n,r){if(!n){var o=t.getPayload();if(e?o.cx:o.co){var a=(n=JSON).parse;if(e){if(o=o.cx){switch(4-o.length%4){case 2:o+="==";break;case 3:o+="="}o=function(e){var t,n=0,r=0,o="",a=[];if(!e)return e;e+="";do{var i=J.indexOf(e.charAt(n++)),c=J.indexOf(e.charAt(n++));o=J.indexOf(e.charAt(n++));var s=J.indexOf(e.charAt(n++)),u=i<<18|c<<12|o<<6|s;i=u>>16&255,c=u>>8&255,u&=255,a[r++]=64===o?String.fromCharCode(i):64===s?String.fromCharCode(i,c):String.fromCharCode(i,c,u)}while(n<e.length);return o=a.join(""),t=o.replace(/\0+$/,""),decodeURIComponent(t.split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}(o=o.replace(/-/g,"+").replace(/_/g,"/"))}}else o=o.co;n=a.call(n,o)}else n=void 0}return n?n.data=n.data.concat(r.data):n=r,n},c=void 0,s=0;s<n.length;s++){var u=n[s];"cx"===u.keyIfEncoded?c=i(c,u.json):a(u.json,u.keyIfEncoded,u.keyIfNotEncoded)}n.length=0,o.length&&(c=i(c,n={schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:r([],o,!0)}),o.length=0),c&&a(c,"cx","co")}}function i(e){if(!c(e))return!1;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function c(e){return null!=e&&(e.constructor==={}.constructor||e.constructor===[].constructor)}function s(){var e=[],t=[],n={},r={};return{getGlobalPrimitives:function(){return e.concat(Object.values(n))},getConditionalProviders:function(){return t.concat(Object.values(r))},addGlobalContexts:function(o){if(Array.isArray(o)){for(var a=[],i=[],c=0;c<o.length;c++){var s=o[c];S(s)?a.push(s):b(s)&&i.push(s)}e=e.concat(i),t=t.concat(a)}else for(a=0,o=Object.entries(o);a<o.length;a++)i=(s=o[a])[0],S(s=s[1])?r[i]=s:b(s)&&(n[i]=s)},clearGlobalContexts:function(){t=[],e=[],r={},n={}},removeGlobalContexts:function(o){for(var a=function(o){"string"==typeof o?(delete r[o],delete n[o]):S(o)?t=t.filter((function(e){return!O(o,e)})):b(o)&&(e=e.filter((function(e){return!O(o,e)})))},i=0;i<o.length;i++)a(o[i])},getApplicableContexts:function(o){e:{for(var a=0,i=o.getJson();a<i.length;a++){var c=i[a];if("ue_px"===c.keyIfEncoded&&"object"==typeof c.json.data&&"string"==typeof(c=c.json.data.schema)){a=c;break e}}a=""}c="string"==typeof(i=o.getPayload().e)?i:"",i=[];var s=I(e.concat(Object.values(n)),o,c,a);return i.push.apply(i,s),o=function(e,t,n,r){var o;return e=_(e).map((function(e){e:{if(A(e)){var o=e[0],a=!1;try{a=o({event:t.getPayload(),eventType:n,eventSchema:r})}catch(e){a=!1}if(!0===a){e=I(e[1],t,n,r);break e}}else if(C(e)&&E(e[0],r)){e=I(e[1],t,n,r);break e}e=[]}if(e&&0!==e.length)return e})),(o=[]).concat.apply(o,e.filter((function(e){return null!=e&&e.filter(Boolean)})))}(t.concat(Object.values(r)),o,c,a),i.push.apply(i,o),i}}}function u(e){return{addPluginContexts:function(t){var n=t?r([],t,!0):[];return e.forEach((function(e){try{e.contexts&&n.push.apply(n,e.contexts())}catch(e){D.error("Error adding plugin contexts",e)}})),n}}}function l(e){if(null!==(e=/^iglu:([a-zA-Z0-9-_.]+)\/([a-zA-Z0-9-_]+)\/jsonschema\/([1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)$/.exec(e)))return e.slice(1,6)}function d(e){if("*"===e[0]||"*"===e[1])return!1;if(0<e.slice(2).length){var t=!1,n=0;for(e=e.slice(2);n<e.length;n++)if("*"===e[n])t=!0;else if(t)return!1;return!0}return 2==e.length}function f(e){return!!((e=e.split("."))&&1<e.length)&&d(e)}function p(e){if(null!==(e=/^iglu:((?:(?:[a-zA-Z0-9-_]+|\*).)+(?:[a-zA-Z0-9-_]+|\*))\/([a-zA-Z0-9-_.]+|\*)\/jsonschema\/([1-9][0-9]*|\*)-(0|[1-9][0-9]*|\*)-(0|[1-9][0-9]*|\*)$/.exec(e))&&f(e[1]))return e.slice(1,6)}function v(e){if(e=p(e)){var t=e[0];return 5===e.length&&f(t)}return!1}function y(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))}function m(e){return y(e)?e.every((function(e){return v(e)})):"string"==typeof e&&v(e)}function g(e){return!!(i(e)&&"schema"in e&&"data"in e)&&("string"==typeof e.schema&&"object"==typeof e.data)}function h(e){var t=0;if(null!=e&&"object"==typeof e&&!Array.isArray(e)){if(Object.prototype.hasOwnProperty.call(e,"accept")){if(!m(e.accept))return!1;t+=1}if(Object.prototype.hasOwnProperty.call(e,"reject")){if(!m(e.reject))return!1;t+=1}return 0<t&&2>=t}return!1}function w(e){return"function"==typeof e&&1>=e.length}function b(e){return w(e)||g(e)}function A(e){return!(!Array.isArray(e)||2!==e.length)&&(Array.isArray(e[1])?w(e[0])&&e[1].every(b):w(e[0])&&b(e[1]))}function C(e){return!(!Array.isArray(e)||2!==e.length)&&(!!h(e[0])&&(Array.isArray(e[1])?e[1].every(b):b(e[1])))}function S(e){return A(e)||C(e)}function E(e,t){var n=0,r=0,o=e.accept;return Array.isArray(o)?e.accept.some((function(e){return P(e,t)}))&&r++:"string"==typeof o&&P(o,t)&&r++,o=e.reject,Array.isArray(o)?e.reject.some((function(e){return P(e,t)}))&&n++:"string"==typeof o&&P(o,t)&&n++,0<r&&0===n}function P(e,t){if(!v(e))return!1;if(e=p(e),t=l(t),e&&t){if(!function(e,t){if(t=t.split("."),e=e.split("."),t&&e){if(t.length!==e.length)return!1;for(var n=0;n<e.length;n++)if(!x(t[n],e[n]))return!1;return!0}return!1}(e[0],t[0]))return!1;for(var n=1;5>n;n++)if(!x(e[n],t[n]))return!1;return!0}return!1}function x(e,t){return e&&t&&"*"===e||e===t}function _(e){return Array.isArray(e)?e:[e]}function I(e,t,n,r){var o;return e=_(e).map((function(e){e:if(g(e))e=[e];else{if(w(e)){t:{var o=void 0;try{if(o=e({event:t.getPayload(),eventType:n,eventSchema:r}),Array.isArray(o)&&o.every(g)||g(o)){var a=o;break t}a=void 0;break t}catch(e){}a=void 0}if(g(a)){e=[a];break e}if(Array.isArray(a)){e=a;break e}}e=void 0}if(e&&0!==e.length)return e})),(o=[]).concat.apply(o,e.filter((function(e){return null!=e&&e.filter(Boolean)})))}function j(e,t){return"function"==typeof e?e===t:JSON.stringify(e)===JSON.stringify(t)}function O(e,t){if(S(e)){if(!S(t))return!1;var n=e[1],r=t[1];return!!j(e[0],t[0])&&(Array.isArray(n)?!(!Array.isArray(r)||n.length!==r.length)&&n.reduce((function(e,t,n){return e&&j(t,r[n])}),!0):!Array.isArray(r)&&j(n,r))}return!!b(e)&&(!!b(t)&&j(e,t))}function k(e){var t=e.svrAnon;return{payload:e.payload,svrAnon:void 0!==t&&t}}function T(){if(!H&&!(H="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return H(Z)}function R(e,t,n){if(X.randomUUID&&!t&&!e)return X.randomUUID();if((e=(e=e||{}).random||(e.rng||T)())[6]=15&e[6]|64,e[8]=63&e[8]|128,t){n=n||0;for(var r=0;16>r;++r)t[n+r]=e[r];return t}return function(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}(e)}function L(e){var t=e.event;return e={schema:"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0",data:{schema:e=t.schema,data:t.data}},(t=o()).add("e","ue"),t.addJson("ue_px","ue_pr",e),t}function G(e,t){void 0===t&&(t={});var n,r={};for(n in e)(t[n]||null!==e[n]&&void 0!==e[n])&&(r[n]=e[n]);return r}function q(e){var t=e.maxSize,n=void 0===t?1e3:t,o=r([],void 0===(e=e.events)?[]:e,!0),a=function(){return Promise.resolve(o.length)};return{count:a,add:function(e){for(o.push(e);o.length>n;)o.shift();return a()},removeHead:function(e){for(var t=0;t<e;t++)o.shift();return Promise.resolve()},iterator:function(){var e=0,t=r([],o,!0);return{next:function(){return e<t.length?Promise.resolve({value:t[e++],done:!1}):Promise.resolve({value:void 0,done:!0})}}},getAll:function(){return Promise.resolve(r([],o,!0))},getAllPayloads:function(){return Promise.resolve(o.map((function(e){return e.payload})))}}}function U(e){function t(){var e=A.reduce((function(e,t){return e+(C?t.getPOSTRequestBytesCount():t.getGETRequestBytesCount())}),0);return C&&(e+=88),e}function n(){var e=new Headers;return C&&e.append("Content-Type","application/json; charset=UTF-8"),p&&Object.keys(p).forEach((function(t){e.append(t,p[t])})),0<A.length&&A[0].getServerAnonymization()&&e.append("SP-Anonymous","*"),e}function r(){var e=c;return c.includes("://")||(e="".concat(u,"://").concat(c)),l&&(e="".concat(e,":").concat(l)),e+(C?g:"/i")}function o(e,t){return i(!1),f=new AbortController,d=setTimeout((function(){console.error("Request timed out"),d=void 0,i(!1,"Request timed out")}),null!=v?v:5e3),t=B({headers:n(),signal:f.signal,keepalive:m,credentials:b},t),new Request(e,t)}function a(){var e=function(e){for(var t=(new Date).getTime().toString(),n=0;n<e.length;n++)e[n].stm=t;return e}(A.map((function(e){return e.getPOSTRequestBody()})));return o(r(),{method:"POST",body:JSON.stringify({schema:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4",data:e})})}function i(e,t){if(void 0!==d&&(clearTimeout(d),d=void 0),void 0!==f){var n=f;f=void 0,e||n.abort(t)}}var c=e.endpoint,s=e.protocol,u=void 0===s?"https":s,l=e.port;s=e.eventMethod;var d,f,p=e.customHeaders,v=e.connectionTimeout,y=e.keepalive,m=void 0!==y&&y,g=void 0===(y=e.postPath)?"/com.snowplowanalytics.snowplow/tp2":y,h=void 0===(y=e.useStm)||y,w=void 0===(y=e.maxPostBytes)?4e4:y,b=void 0===(e=e.credentials)?"include":e,A=[],C="post"===(void 0===s?"post":s).toLowerCase();return{addEvent:function(e){return!(0<A.length&&(0<A.length?A[0].getServerAnonymization():void 0)!==e.getServerAnonymization())&&(A.push(e),!0)},getEvents:function(){return A},toRequest:function(){if(0!==A.length){if(C)return a();if(1!==A.length)throw Error("Only one event can be sent in a GET request");return o(A[0].getGETRequestURL(r(),h),{method:"GET"})}},countBytes:t,countEvents:function(){return A.length},isFull:function(){return C?t()>=w:1<=A.length},closeRequest:i}}function N(e){for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);127>=r?t+=1:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,n++):t=65535>r?t+3:t+4}return t}function V(e){function t(){return e.payload}function n(e){if(null===o){var t,n={co:!0,cx:!0},r=[];for(t in e)e.hasOwnProperty(t)&&!n[t]&&r.push(t+"="+encodeURIComponent(e[t]));for(var a in n)e.hasOwnProperty(a)&&n[a]&&r.push(a+"="+encodeURIComponent(e[a]));o="?"+r.join("&")}return o}function r(){return null===a&&(a=function(e){return Object.keys(e).map((function(t){return[t,e[t]]})).reduce((function(e,t){return e[t[0]]=t[1].toString(),e}),{})}(t())),a}var o=null,a=null,i=null,c=null;return{getPayload:t,getServerAnonymization:function(){var t;return null!==(t=e.svrAnon)&&void 0!==t&&t},getGETRequestURL:function(e,r){var o=n(t());return r?e+o.replace("?","?stm="+(new Date).getTime()+"&"):e+o},getGETRequestBytesCount:function(){if(null===i){var e=n(t());i=N(e)}return i},getPOSTRequestBody:r,getPOSTRequestBytesCount:function(){return null===c&&(c=N(JSON.stringify(r()))),c}}}var B=function(){return B=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},B.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var z,J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.LOG_LEVEL=void 0,(z=e.LOG_LEVEL||(e.LOG_LEVEL={}))[z.none=0]="none",z[z.error=1]="error",z[z.warn=2]="warn",z[z.debug=3]="debug",z[z.info=4]="info";for(var D=function(t){return void 0===t&&(t=e.LOG_LEVEL.warn),{setLogLevel:function(n){t=e.LOG_LEVEL[n]?n:e.LOG_LEVEL.warn},warn:function(n,o){for(var a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];t>=e.LOG_LEVEL.warn&&"undefined"!=typeof console&&(i="Snowplow: "+n,o?console.warn.apply(console,r([i+"\n",o],a,!1)):console.warn.apply(console,r([i],a,!1)))},error:function(n,o){for(var a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];t>=e.LOG_LEVEL.error&&"undefined"!=typeof console&&(i="Snowplow: "+n+"\n",o?console.error.apply(console,r([i+"\n",o],a,!1)):console.error.apply(console,r([i],a,!1)))},debug:function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];t>=e.LOG_LEVEL.debug&&"undefined"!=typeof console&&console.debug.apply(console,r(["Snowplow: "+n],o,!1))},info:function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];t>=e.LOG_LEVEL.info&&"undefined"!=typeof console&&console.info.apply(console,r(["Snowplow: "+n],o,!1))}}}(),F=[],M=0;256>M;++M)F.push((M+256).toString(16).slice(1));var H,Z=new Uint8Array(16),X={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};e.LOG=D,e.buildAdClick=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_click/jsonschema/1-0-0",data:G({targetUrl:e.targetUrl,clickId:e.clickId,costModel:e.costModel,cost:e.cost,bannerId:e.bannerId,zoneId:e.zoneId,impressionId:e.impressionId,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAdConversion=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_conversion/jsonschema/1-0-0",data:G({conversionId:e.conversionId,costModel:e.costModel,cost:e.cost,category:e.category,action:e.action,property:e.property,initialValue:e.initialValue,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAdImpression=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0",data:G({impressionId:e.impressionId,costModel:e.costModel,cost:e.cost,targetUrl:e.targetUrl,bannerId:e.bannerId,zoneId:e.zoneId,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAddToCart=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/add_to_cart/jsonschema/1-0-0",data:G({sku:e.sku,quantity:e.quantity,name:e.name,category:e.category,unitPrice:e.unitPrice,currency:e.currency})}})},e.buildConsentGranted=function(e){var t=e.expiry;return e={schema:"iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0",data:G({id:e.id,version:e.version,name:e.name,description:e.description})},{event:L({event:{schema:"iglu:com.snowplowanalytics.snowplow/consent_granted/jsonschema/1-0-0",data:G({expiry:t})}}),context:[e]}},e.buildConsentWithdrawn=function(e){var t=e.all;return e={schema:"iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0",data:G({id:e.id,version:e.version,name:e.name,description:e.description})},{event:L({event:{schema:"iglu:com.snowplowanalytics.snowplow/consent_withdrawn/jsonschema/1-0-0",data:G({all:t})}}),context:[e]}},e.buildEcommerceTransaction=function(e){var t=e.orderId,n=e.total,r=e.affiliation,a=e.tax,i=e.shipping,c=e.city,s=e.state,u=e.country;e=e.currency;var l=o();return l.add("e","tr"),l.add("tr_id",t),l.add("tr_af",r),l.add("tr_tt",n),l.add("tr_tx",a),l.add("tr_sh",i),l.add("tr_ci",c),l.add("tr_st",s),l.add("tr_co",u),l.add("tr_cu",e),l},e.buildEcommerceTransactionItem=function(e){var t=e.orderId,n=e.sku,r=e.price,a=e.name,i=e.category,c=e.quantity;e=e.currency;var s=o();return s.add("e","ti"),s.add("ti_id",t),s.add("ti_sk",n),s.add("ti_nm",a),s.add("ti_ca",i),s.add("ti_pr",r),s.add("ti_qu",c),s.add("ti_cu",e),s},e.buildFormFocusOrChange=function(e){var t="",n=e.schema,r=e.type;return e={formId:e.formId,elementId:e.elementId,nodeName:e.nodeName,elementClasses:e.elementClasses,value:e.value},"change_form"===n?(t="iglu:com.snowplowanalytics.snowplow/change_form/jsonschema/1-0-0",e.type=r):"focus_form"===n&&(t="iglu:com.snowplowanalytics.snowplow/focus_form/jsonschema/1-0-0",e.elementType=r),L({event:{schema:t,data:G(e,{value:!0})}})},e.buildFormSubmission=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/submit_form/jsonschema/1-0-0",data:G({formId:e.formId,formClasses:e.formClasses,elements:e.elements})}})},e.buildLinkClick=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1",data:G({targetUrl:e.targetUrl,elementId:e.elementId,elementClasses:e.elementClasses,elementTarget:e.elementTarget,elementContent:e.elementContent})}})},e.buildPagePing=function(e){var t=e.pageUrl,n=e.pageTitle,r=e.referrer,a=e.minXOffset,i=e.maxXOffset,c=e.minYOffset;e=e.maxYOffset;var s=o();return s.add("e","pp"),s.add("url",t),s.add("page",n),s.add("refr",r),a&&!isNaN(Number(a))&&s.add("pp_mix",a.toString()),i&&!isNaN(Number(i))&&s.add("pp_max",i.toString()),c&&!isNaN(Number(c))&&s.add("pp_miy",c.toString()),e&&!isNaN(Number(e))&&s.add("pp_may",e.toString()),s},e.buildPageView=function(e){var t=e.pageUrl,n=e.pageTitle;e=e.referrer;var r=o();return r.add("e","pv"),r.add("url",t),r.add("page",n),r.add("refr",e),r},e.buildRemoveFromCart=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/remove_from_cart/jsonschema/1-0-0",data:G({sku:e.sku,quantity:e.quantity,name:e.name,category:e.category,unitPrice:e.unitPrice,currency:e.currency})}})},e.buildScreenView=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/screen_view/jsonschema/1-0-0",data:G({name:e.name,id:e.id})}})},e.buildSelfDescribingEvent=L,e.buildSiteSearch=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/site_search/jsonschema/1-0-0",data:G({terms:e.terms,filters:e.filters,totalResults:e.totalResults,pageResults:e.pageResults})}})},e.buildSocialInteraction=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/social_interaction/jsonschema/1-0-0",data:G({action:e.action,network:e.network,target:e.target})}})},e.buildStructEvent=function(e){var t=e.category,n=e.action,r=e.label,a=e.property;e=e.value;var i=o();return i.add("e","se"),i.add("se_ca",t),i.add("se_ac",n),i.add("se_la",r),i.add("se_pr",a),i.add("se_va",null==e?void 0:e.toString()),i},e.getRuleParts=p,e.getSchemaParts=l,e.globalContexts=s,e.isConditionalContextProvider=S,e.isContextCallbackFunction=w,e.isContextPrimitive=b,e.isFilterProvider=A,e.isJson=c,e.isNonEmptyJson=i,e.isRuleSet=h,e.isRuleSetProvider=C,e.isSelfDescribingJson=g,e.isStringArray=y,e.isValidRule=v,e.isValidRuleSetArg=m,e.matchSchemaAgainstRule=P,e.matchSchemaAgainstRuleSet=E,e.newEmitter=function(e){function r(e,t){void 0!==P&&setTimeout((function(){try{null==P||P(e,t)}catch(e){D.error("Error in onRequestFailure",e)}}),0)}function o(e){return t(this,void 0,void 0,(function(){var t,o,a,i,c,s;return n(this,(function(n){switch(n.label){case 0:if(void 0===(t=e.toRequest()))throw Error("Empty batch");o=e.getEvents().map((function(e){return e.getPayload()})),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,_(t)];case 2:return[4,(a=n.sent()).text()];case 3:return n.sent(),e.closeRequest(!0),a.ok?(function(e,t){void 0!==x&&setTimeout((function(){try{null==x||x(e,t)}catch(e){D.error("Error in onRequestSuccess",e)}}),0)}(o,a),[2,{success:!0,retry:!1,status:a.status}]):(i=function(e){return!(200<=e&&300>e||!E||!S.includes(e)&&C.includes(e))}(a.status),r({events:o,status:a.status,message:a.statusText,willRetry:i},a),[2,{success:!1,retry:i,status:a.status}]);case 4:return c=n.sent(),e.closeRequest(!1),s="string"==typeof c?c:c?c.message:"Unknown error",r({events:o,message:s,willRetry:!0}),[2,{success:!1,retry:!0}];case 5:return[2]}}))}))}function a(){return U({endpoint:u,protocol:f,port:p,eventMethod:d,customHeaders:g,connectionTimeout:w,keepalive:b,maxPostBytes:v,useStm:I,credentials:O})}function i(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return!A||T?[3,2]:(T=!0,e=new Request(A,{method:"GET"}),[4,_(e)]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}function c(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:if(R)return[3,5];R=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,s()];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),D.error("Error sending events",e),[3,5];case 4:return R=!1,[7];case 5:return[2]}}))}))}function s(){return t(this,void 0,void 0,(function(){var e,t,r,c,u,l,d,f,p;return n(this,(function(n){switch(n.label){case 0:return[4,i()];case 1:n.sent(),e=a(),t=j.iterator(),n.label=2;case 2:return e.isFull()?[3,4]:[4,t.next()];case 3:return r=n.sent(),c=r.value,r.done||void 0===c?[3,4]:(u=V(c),e.addEvent(u)?[3,2]:[3,4]);case 4:return 0===e.countEvents()?[2]:[4,o(e)];case 5:return l=n.sent(),d=l.success,f=l.retry,p=l.status,!d&&f?[3,7]:(d||D.error("Status ".concat(p,", will not retry.")),[4,j.removeHead(e.countEvents())]);case 6:n.sent(),n.label=7;case 7:return d?[4,s()]:[3,9];case 8:n.sent(),n.label=9;case 9:return[2]}}))}))}var u=e.endpoint,l=e.eventMethod,d=void 0===l?"post":l,f=e.protocol,p=e.port,v=void 0===(l=e.maxPostBytes)?4e4:l,y=e.maxGetBytes,m=void 0===(l=e.bufferSize)?1:l,g=e.customHeaders,h=e.serverAnonymization,w=e.connectionTimeout,b=e.keepalive,A=e.idService,C=void 0===(l=e.dontRetryStatusCodes)?[]:l,S=void 0===(l=e.retryStatusCodes)?[]:l,E=void 0===(l=e.retryFailedRequests)||l,P=e.onRequestFailure,x=e.onRequestSuccess,_=void 0===(l=e.customFetch)?fetch:l,I=e.useStm,j=void 0===(l=e.eventStore)?q({}):l,O=e.credentials,T=!1,R=!1,L="post"===d.toLowerCase();return C=C.concat([400,401,403,410,422]),{flush:c,input:function(e){return t(this,void 0,void 0,(function(){var t,r,i;return n(this,(function(n){switch(n.label){case 0:t=k({payload:e,svrAnon:h});e:{if(n=r=V(t),L){var s=(n=n.getPOSTRequestBytesCount()+88)>v;s&&D.warn("Event ("+n+"B) too big, max is "+v)}else{if(void 0===y){n=!1;break e}(s=(n=n.getGETRequestBytesCount())>y)&&D.warn("Event ("+n+"B) too big, max is "+y)}n=s}return n?((i=a()).addEvent(r),[4,o(i)]):[3,2];case 1:return n.sent(),[3,5];case 2:return[4,j.add(t)];case 3:return n.sent()>=m?[4,c()]:[3,5];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},setCollectorUrl:function(e){u=e},setAnonymousTracking:function(e){h=e},setBufferSize:function(e){m=e}}},e.newEventStorePayload=k,e.newInMemoryEventStore=q,e.payloadBuilder=o,e.payloadJsonProcessor=a,e.pluginContexts=u,e.removeEmptyProperties=G,e.resolveDynamicContext=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return null!==(t=null==e?void 0:e.map((function(e){if("function"!=typeof e)return e;try{return e.apply(void 0,n)}catch(e){}})).filter(Boolean))&&void 0!==t?t:[]},e.trackerCore=function(e){void 0===e&&(e={});var t,n,r,o,i,l,d,f=e.base64,p=e.corePlugins,v=null!=p?p:[];t=null==f||f,n=v,r=e.callback,o=u(n),i=s(),l=t,d={};var y=B(B({},e={track:function(e,t,c){if(e.withJsonProcessor(a(l)),e.add("eid",R()),e.addDict(d),c=function(e){return null==e?{type:"dtm",value:(new Date).getTime()}:"number"==typeof e?{type:"dtm",value:e}:"ttm"===e.type?{type:"ttm",value:e.value}:{type:"dtm",value:e.value||(new Date).getTime()}}(c),e.add(c.type,c.value.toString()),t=function(e,t){e=i.getApplicableContexts(e);var n=[];return t&&t.length&&n.push.apply(n,t),e&&e.length&&n.push.apply(n,e),n}(e,o.addPluginContexts(t)),void 0!==(t=t&&t.length?{schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:t}:void 0)&&e.addJson("cx","co",t),n.forEach((function(t){try{t.beforeTrack&&t.beforeTrack(e)}catch(e){D.error("Plugin beforeTrack",e)}})),!n.find((function(t){try{return t.filter&&!1===t.filter(e.build())}catch(e){return D.error("Plugin filter",e),!1}}))){"function"==typeof r&&r(e);var s=e.build();return n.forEach((function(e){try{e.afterTrack&&e.afterTrack(s)}catch(e){D.error("Plugin afterTrack",e)}})),s}},addPayloadPair:function(e,t){d[e]=t},getBase64Encoding:function(){return l},setBase64Encoding:function(e){l=e},addPayloadDict:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])},resetPayloadPairs:function(e){d=c(e)?e:{}},setTrackerVersion:function(e){d.tv=e},setTrackerNamespace:function(e){d.tna=e},setAppId:function(e){d.aid=e},setPlatform:function(e){d.p=e},setUserId:function(e){d.uid=e},setScreenResolution:function(e,t){d.res=e+"x"+t},setViewport:function(e,t){d.vp=e+"x"+t},setColorDepth:function(e){d.cd=e},setTimezone:function(e){d.tz=e},setLang:function(e){d.lang=e},setIpAddress:function(e){d.ip=e},setUseragent:function(e){d.ua=e},addGlobalContexts:function(e){i.addGlobalContexts(e)},clearGlobalContexts:function(){i.clearGlobalContexts()},removeGlobalContexts:function(e){i.removeGlobalContexts(e)}}),{addPlugin:function(e){var t,n;e=e.plugin,v.push(e),null===(t=e.logger)||void 0===t||t.call(e,D),null===(n=e.activateCorePlugin)||void 0===n||n.call(e,y)}});return null==v||v.forEach((function(e){var t,n;null===(t=e.logger)||void 0===t||t.call(e,D),null===(n=e.activateCorePlugin)||void 0===n||n.call(e,y)})),y},e.validateVendor=f,e.validateVendorParts=d,e.version="4.0.0",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).snowplowTrackerCore={})}(this,(function(e){function t(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){e.done?o(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(i,c)}s((r=r.apply(e,t||[])).next())}))}function n(e,t){function n(n){return function(s){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;c&&(c=0,n[0]&&(i=0)),i;)try{if(r=1,o&&(a=2&n[0]?o.return:n[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,a&&(n=[2&n[0],a.value]),n[0]){case 0:case 1:a=n;break;case 4:return i.label++,{value:n[1],done:!1};case 5:i.label++,o=n[1],n=[0];continue;case 7:n=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=0<a.length&&a[a.length-1])||6!==n[0]&&2!==n[0])){i=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3]))i.label=n[1];else if(6===n[0]&&i.label<a[1])i.label=a[1],a=n;else{if(!(a&&i.label<a[2])){a[2]&&i.ops.pop(),i.trys.pop();continue}i.label=a[2],i.ops.push(n)}}n=t.call(e,i)}catch(e){n=[6,e],o=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,s])}}var r,o,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return c.next=n(0),c.throw=n(1),c.return=n(2),"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c}function r(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function o(){var e,t={},n=[],r=[],o=[],a=function(e,n){null!=n&&""!==n&&(t[e]=n)};return{add:a,addDict:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&a(t,e[t])},addJson:function(e,t,o){o&&i(o)&&(e={keyIfEncoded:e,keyIfNotEncoded:t,json:o},r.push(e),n.push(e))},addContextEntity:function(e){o.push(e)},getPayload:function(){return t},getJson:function(){return n},withJsonProcessor:function(t){e=t},build:function(){return null==e||e(this,r,o),t}}}function a(e){return function(t,n,o){for(var a=function(n,r,o){if(n=JSON.stringify(n),e){if(o=t.add,n){var a=0,i=0,c=[];if(n){n=unescape(encodeURIComponent(n));do{var s=n.charCodeAt(a++),u=n.charCodeAt(a++),l=n.charCodeAt(a++),d=s<<16|u<<8|l;s=d>>18&63,u=d>>12&63,l=d>>6&63,d&=63,c[i++]=J.charAt(s)+J.charAt(u)+J.charAt(l)+J.charAt(d)}while(a<n.length);a=c.join(""),n=((n=n.length%3)?a.slice(0,n-3):a)+"===".slice(n||3)}n=n.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}o.call(t,r,n)}else t.add(o,n)},i=function(n,r){if(!n){var o=t.getPayload();if(e?o.cx:o.co){var a=(n=JSON).parse;if(e){if(o=o.cx){switch(4-o.length%4){case 2:o+="==";break;case 3:o+="="}o=function(e){var t,n=0,r=0,o="",a=[];if(!e)return e;e+="";do{var i=J.indexOf(e.charAt(n++)),c=J.indexOf(e.charAt(n++));o=J.indexOf(e.charAt(n++));var s=J.indexOf(e.charAt(n++)),u=i<<18|c<<12|o<<6|s;i=u>>16&255,c=u>>8&255,u&=255,a[r++]=64===o?String.fromCharCode(i):64===s?String.fromCharCode(i,c):String.fromCharCode(i,c,u)}while(n<e.length);return o=a.join(""),t=o.replace(/\0+$/,""),decodeURIComponent(t.split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}(o=o.replace(/-/g,"+").replace(/_/g,"/"))}}else o=o.co;n=a.call(n,o)}else n=void 0}return n?n.data=n.data.concat(r.data):n=r,n},c=void 0,s=0;s<n.length;s++){var u=n[s];"cx"===u.keyIfEncoded?c=i(c,u.json):a(u.json,u.keyIfEncoded,u.keyIfNotEncoded)}n.length=0,o.length&&(c=i(c,n={schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:r([],o,!0)}),o.length=0),c&&a(c,"cx","co")}}function i(e){if(!c(e))return!1;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function c(e){return null!=e&&(e.constructor==={}.constructor||e.constructor===[].constructor)}function s(){var e=[],t=[],n={},r={};return{getGlobalPrimitives:function(){return e.concat(Object.values(n))},getConditionalProviders:function(){return t.concat(Object.values(r))},addGlobalContexts:function(o){if(Array.isArray(o)){for(var a=[],i=[],c=0;c<o.length;c++){var s=o[c];S(s)?a.push(s):b(s)&&i.push(s)}e=e.concat(i),t=t.concat(a)}else for(a=0,o=Object.entries(o);a<o.length;a++)i=(s=o[a])[0],S(s=s[1])?r[i]=s:b(s)&&(n[i]=s)},clearGlobalContexts:function(){t=[],e=[],r={},n={}},removeGlobalContexts:function(o){for(var a=function(o){"string"==typeof o?(delete r[o],delete n[o]):S(o)?t=t.filter((function(e){return!O(o,e)})):b(o)&&(e=e.filter((function(e){return!O(o,e)})))},i=0;i<o.length;i++)a(o[i])},getApplicableContexts:function(o){e:{for(var a=0,i=o.getJson();a<i.length;a++){var c=i[a];if("ue_px"===c.keyIfEncoded&&"object"==typeof c.json.data&&"string"==typeof(c=c.json.data.schema)){a=c;break e}}a=""}c="string"==typeof(i=o.getPayload().e)?i:"",i=[];var s=I(e.concat(Object.values(n)),o,c,a);return i.push.apply(i,s),o=function(e,t,n,r){var o;return e=_(e).map((function(e){e:{if(A(e)){var o=e[0],a=!1;try{a=o({event:t.getPayload(),eventType:n,eventSchema:r})}catch(e){a=!1}if(!0===a){e=I(e[1],t,n,r);break e}}else if(C(e)&&E(e[0],r)){e=I(e[1],t,n,r);break e}e=[]}if(e&&0!==e.length)return e})),(o=[]).concat.apply(o,e.filter((function(e){return null!=e&&e.filter(Boolean)})))}(t.concat(Object.values(r)),o,c,a),i.push.apply(i,o),i}}}function u(e){return{addPluginContexts:function(t){var n=t?r([],t,!0):[];return e.forEach((function(e){try{e.contexts&&n.push.apply(n,e.contexts())}catch(e){D.error("Error adding plugin contexts",e)}})),n}}}function l(e){if(null!==(e=/^iglu:([a-zA-Z0-9-_.]+)\/([a-zA-Z0-9-_]+)\/jsonschema\/([1-9][0-9]*)-(0|[1-9][0-9]*)-(0|[1-9][0-9]*)$/.exec(e)))return e.slice(1,6)}function d(e){if("*"===e[0]||"*"===e[1])return!1;if(0<e.slice(2).length){var t=!1,n=0;for(e=e.slice(2);n<e.length;n++)if("*"===e[n])t=!0;else if(t)return!1;return!0}return 2==e.length}function f(e){return!!((e=e.split("."))&&1<e.length)&&d(e)}function p(e){if(null!==(e=/^iglu:((?:(?:[a-zA-Z0-9-_]+|\*).)+(?:[a-zA-Z0-9-_]+|\*))\/([a-zA-Z0-9-_.]+|\*)\/jsonschema\/([1-9][0-9]*|\*)-(0|[1-9][0-9]*|\*)-(0|[1-9][0-9]*|\*)$/.exec(e))&&f(e[1]))return e.slice(1,6)}function v(e){if(e=p(e)){var t=e[0];return 5===e.length&&f(t)}return!1}function y(e){return Array.isArray(e)&&e.every((function(e){return"string"==typeof e}))}function m(e){return y(e)?e.every((function(e){return v(e)})):"string"==typeof e&&v(e)}function g(e){return!!(i(e)&&"schema"in e&&"data"in e)&&("string"==typeof e.schema&&"object"==typeof e.data)}function h(e){var t=0;if(null!=e&&"object"==typeof e&&!Array.isArray(e)){if(Object.prototype.hasOwnProperty.call(e,"accept")){if(!m(e.accept))return!1;t+=1}if(Object.prototype.hasOwnProperty.call(e,"reject")){if(!m(e.reject))return!1;t+=1}return 0<t&&2>=t}return!1}function w(e){return"function"==typeof e&&1>=e.length}function b(e){return w(e)||g(e)}function A(e){return!(!Array.isArray(e)||2!==e.length)&&(Array.isArray(e[1])?w(e[0])&&e[1].every(b):w(e[0])&&b(e[1]))}function C(e){return!(!Array.isArray(e)||2!==e.length)&&(!!h(e[0])&&(Array.isArray(e[1])?e[1].every(b):b(e[1])))}function S(e){return A(e)||C(e)}function E(e,t){var n=0,r=0,o=e.accept;return Array.isArray(o)?e.accept.some((function(e){return P(e,t)}))&&r++:"string"==typeof o&&P(o,t)&&r++,o=e.reject,Array.isArray(o)?e.reject.some((function(e){return P(e,t)}))&&n++:"string"==typeof o&&P(o,t)&&n++,0<r&&0===n}function P(e,t){if(!v(e))return!1;if(e=p(e),t=l(t),e&&t){if(!function(e,t){if(t=t.split("."),e=e.split("."),t&&e){if(t.length!==e.length)return!1;for(var n=0;n<e.length;n++)if(!x(t[n],e[n]))return!1;return!0}return!1}(e[0],t[0]))return!1;for(var n=1;5>n;n++)if(!x(e[n],t[n]))return!1;return!0}return!1}function x(e,t){return e&&t&&"*"===e||e===t}function _(e){return Array.isArray(e)?e:[e]}function I(e,t,n,r){var o;return e=_(e).map((function(e){e:if(g(e))e=[e];else{if(w(e)){t:{var o=void 0;try{if(o=e({event:t.getPayload(),eventType:n,eventSchema:r}),Array.isArray(o)&&o.every(g)||g(o)){var a=o;break t}a=void 0;break t}catch(e){}a=void 0}if(g(a)){e=[a];break e}if(Array.isArray(a)){e=a;break e}}e=void 0}if(e&&0!==e.length)return e})),(o=[]).concat.apply(o,e.filter((function(e){return null!=e&&e.filter(Boolean)})))}function j(e,t){return"function"==typeof e?e===t:JSON.stringify(e)===JSON.stringify(t)}function O(e,t){if(S(e)){if(!S(t))return!1;var n=e[1],r=t[1];return!!j(e[0],t[0])&&(Array.isArray(n)?!(!Array.isArray(r)||n.length!==r.length)&&n.reduce((function(e,t,n){return e&&j(t,r[n])}),!0):!Array.isArray(r)&&j(n,r))}return!!b(e)&&(!!b(t)&&j(e,t))}function k(e){var t=e.svrAnon;return{payload:e.payload,svrAnon:void 0!==t&&t}}function T(){if(!H&&!(H="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return H(Z)}function R(e,t,n){if(X.randomUUID&&!t&&!e)return X.randomUUID();if((e=(e=e||{}).random||(e.rng||T)())[6]=15&e[6]|64,e[8]=63&e[8]|128,t){n=n||0;for(var r=0;16>r;++r)t[n+r]=e[r];return t}return function(e,t=0){return(F[e[t+0]]+F[e[t+1]]+F[e[t+2]]+F[e[t+3]]+"-"+F[e[t+4]]+F[e[t+5]]+"-"+F[e[t+6]]+F[e[t+7]]+"-"+F[e[t+8]]+F[e[t+9]]+"-"+F[e[t+10]]+F[e[t+11]]+F[e[t+12]]+F[e[t+13]]+F[e[t+14]]+F[e[t+15]]).toLowerCase()}(e)}function L(e){var t=e.event;return e={schema:"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0",data:{schema:e=t.schema,data:t.data}},(t=o()).add("e","ue"),t.addJson("ue_px","ue_pr",e),t}function G(e,t){void 0===t&&(t={});var n,r={};for(n in e)(t[n]||null!==e[n]&&void 0!==e[n])&&(r[n]=e[n]);return r}function q(e){var t=e.maxSize,n=void 0===t?1e3:t,o=r([],void 0===(e=e.events)?[]:e,!0),a=function(){return Promise.resolve(o.length)};return{count:a,add:function(e){for(o.push(e);o.length>n;)o.shift();return a()},removeHead:function(e){for(var t=0;t<e;t++)o.shift();return Promise.resolve()},iterator:function(){var e=0,t=r([],o,!0);return{next:function(){return e<t.length?Promise.resolve({value:t[e++],done:!1}):Promise.resolve({value:void 0,done:!0})}}},getAll:function(){return Promise.resolve(r([],o,!0))},getAllPayloads:function(){return Promise.resolve(o.map((function(e){return e.payload})))}}}function U(e){function t(){var e=A.reduce((function(e,t){return e+(C?t.getPOSTRequestBytesCount():t.getGETRequestBytesCount())}),0);return C&&(e+=88),e}function n(){var e=new Headers;return C&&e.append("Content-Type","application/json; charset=UTF-8"),p&&Object.keys(p).forEach((function(t){e.append(t,p[t])})),0<A.length&&A[0].getServerAnonymization()&&e.append("SP-Anonymous","*"),e}function r(){var e=c;return c.includes("://")||(e="".concat(u,"://").concat(c)),l&&(e="".concat(e,":").concat(l)),e+(C?g:"/i")}function o(e,t){return i(!1),f=new AbortController,d=setTimeout((function(){console.error("Request timed out"),d=void 0,i(!1,"Request timed out")}),null!=v?v:5e3),t=B({headers:n(),signal:f.signal,keepalive:m,credentials:b},t),new Request(e,t)}function a(){var e=function(e){for(var t=(new Date).getTime().toString(),n=0;n<e.length;n++)e[n].stm=t;return e}(A.map((function(e){return e.getPOSTRequestBody()})));return o(r(),{method:"POST",body:JSON.stringify({schema:"iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4",data:e})})}function i(e,t){if(void 0!==d&&(clearTimeout(d),d=void 0),void 0!==f){var n=f;f=void 0,e||n.abort(t)}}var c=e.endpoint,s=e.protocol,u=void 0===s?"https":s,l=e.port;s=e.eventMethod;var d,f,p=e.customHeaders,v=e.connectionTimeout,y=e.keepalive,m=void 0!==y&&y,g=void 0===(y=e.postPath)?"/com.snowplowanalytics.snowplow/tp2":y,h=void 0===(y=e.useStm)||y,w=void 0===(y=e.maxPostBytes)?4e4:y,b=void 0===(e=e.credentials)?"include":e,A=[],C="post"===(void 0===s?"post":s).toLowerCase();return{addEvent:function(e){return!(0<A.length&&(0<A.length?A[0].getServerAnonymization():void 0)!==e.getServerAnonymization())&&(A.push(e),!0)},getEvents:function(){return A},toRequest:function(){if(0!==A.length){if(C)return a();if(1!==A.length)throw Error("Only one event can be sent in a GET request");return o(A[0].getGETRequestURL(r(),h),{method:"GET"})}},countBytes:t,countEvents:function(){return A.length},isFull:function(){return C?t()>=w:1<=A.length},closeRequest:i}}function N(e){for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);127>=r?t+=1:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,n++):t=65535>r?t+3:t+4}return t}function V(e){function t(){return e.payload}function n(e){if(null===o){var t,n={co:!0,cx:!0},r=[];for(t in e)e.hasOwnProperty(t)&&!n[t]&&r.push(t+"="+encodeURIComponent(e[t]));for(var a in n)e.hasOwnProperty(a)&&n[a]&&r.push(a+"="+encodeURIComponent(e[a]));o="?"+r.join("&")}return o}function r(){return null===a&&(a=function(e){return Object.keys(e).map((function(t){return[t,e[t]]})).reduce((function(e,t){return e[t[0]]=t[1].toString(),e}),{})}(t())),a}var o=null,a=null,i=null,c=null;return{getPayload:t,getServerAnonymization:function(){var t;return null!==(t=e.svrAnon)&&void 0!==t&&t},getGETRequestURL:function(e,r){var o=n(t());return r?e+o.replace("?","?stm="+(new Date).getTime()+"&"):e+o},getGETRequestBytesCount:function(){if(null===i){var e=n(t());i=N(e)}return i},getPOSTRequestBody:r,getPOSTRequestBytesCount:function(){return null===c&&(c=N(JSON.stringify(r()))),c}}}var B=function(){return B=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},B.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var z,J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.LOG_LEVEL=void 0,(z=e.LOG_LEVEL||(e.LOG_LEVEL={}))[z.none=0]="none",z[z.error=1]="error",z[z.warn=2]="warn",z[z.debug=3]="debug",z[z.info=4]="info";for(var D=function(t){return void 0===t&&(t=e.LOG_LEVEL.warn),{setLogLevel:function(n){t=e.LOG_LEVEL[n]?n:e.LOG_LEVEL.warn},warn:function(n,o){for(var a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];t>=e.LOG_LEVEL.warn&&"undefined"!=typeof console&&(i="Snowplow: "+n,o?console.warn.apply(console,r([i+"\n",o],a,!1)):console.warn.apply(console,r([i],a,!1)))},error:function(n,o){for(var a=[],i=2;i<arguments.length;i++)a[i-2]=arguments[i];t>=e.LOG_LEVEL.error&&"undefined"!=typeof console&&(i="Snowplow: "+n+"\n",o?console.error.apply(console,r([i+"\n",o],a,!1)):console.error.apply(console,r([i],a,!1)))},debug:function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];t>=e.LOG_LEVEL.debug&&"undefined"!=typeof console&&console.debug.apply(console,r(["Snowplow: "+n],o,!1))},info:function(n){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];t>=e.LOG_LEVEL.info&&"undefined"!=typeof console&&console.info.apply(console,r(["Snowplow: "+n],o,!1))}}}(),F=[],M=0;256>M;++M)F.push((M+256).toString(16).slice(1));var H,Z=new Uint8Array(16),X={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};e.LOG=D,e.buildAdClick=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_click/jsonschema/1-0-0",data:G({targetUrl:e.targetUrl,clickId:e.clickId,costModel:e.costModel,cost:e.cost,bannerId:e.bannerId,zoneId:e.zoneId,impressionId:e.impressionId,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAdConversion=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_conversion/jsonschema/1-0-0",data:G({conversionId:e.conversionId,costModel:e.costModel,cost:e.cost,category:e.category,action:e.action,property:e.property,initialValue:e.initialValue,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAdImpression=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/ad_impression/jsonschema/1-0-0",data:G({impressionId:e.impressionId,costModel:e.costModel,cost:e.cost,targetUrl:e.targetUrl,bannerId:e.bannerId,zoneId:e.zoneId,advertiserId:e.advertiserId,campaignId:e.campaignId})}})},e.buildAddToCart=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/add_to_cart/jsonschema/1-0-0",data:G({sku:e.sku,quantity:e.quantity,name:e.name,category:e.category,unitPrice:e.unitPrice,currency:e.currency})}})},e.buildConsentGranted=function(e){var t=e.expiry;return e={schema:"iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0",data:G({id:e.id,version:e.version,name:e.name,description:e.description})},{event:L({event:{schema:"iglu:com.snowplowanalytics.snowplow/consent_granted/jsonschema/1-0-0",data:G({expiry:t})}}),context:[e]}},e.buildConsentWithdrawn=function(e){var t=e.all;return e={schema:"iglu:com.snowplowanalytics.snowplow/consent_document/jsonschema/1-0-0",data:G({id:e.id,version:e.version,name:e.name,description:e.description})},{event:L({event:{schema:"iglu:com.snowplowanalytics.snowplow/consent_withdrawn/jsonschema/1-0-0",data:G({all:t})}}),context:[e]}},e.buildEcommerceTransaction=function(e){var t=e.orderId,n=e.total,r=e.affiliation,a=e.tax,i=e.shipping,c=e.city,s=e.state,u=e.country;e=e.currency;var l=o();return l.add("e","tr"),l.add("tr_id",t),l.add("tr_af",r),l.add("tr_tt",n),l.add("tr_tx",a),l.add("tr_sh",i),l.add("tr_ci",c),l.add("tr_st",s),l.add("tr_co",u),l.add("tr_cu",e),l},e.buildEcommerceTransactionItem=function(e){var t=e.orderId,n=e.sku,r=e.price,a=e.name,i=e.category,c=e.quantity;e=e.currency;var s=o();return s.add("e","ti"),s.add("ti_id",t),s.add("ti_sk",n),s.add("ti_nm",a),s.add("ti_ca",i),s.add("ti_pr",r),s.add("ti_qu",c),s.add("ti_cu",e),s},e.buildFormFocusOrChange=function(e){var t="",n=e.schema,r=e.type;return e={formId:e.formId,elementId:e.elementId,nodeName:e.nodeName,elementClasses:e.elementClasses,value:e.value},"change_form"===n?(t="iglu:com.snowplowanalytics.snowplow/change_form/jsonschema/1-0-0",e.type=r):"focus_form"===n&&(t="iglu:com.snowplowanalytics.snowplow/focus_form/jsonschema/1-0-0",e.elementType=r),L({event:{schema:t,data:G(e,{value:!0})}})},e.buildFormSubmission=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/submit_form/jsonschema/1-0-0",data:G({formId:e.formId,formClasses:e.formClasses,elements:e.elements})}})},e.buildLinkClick=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/link_click/jsonschema/1-0-1",data:G({targetUrl:e.targetUrl,elementId:e.elementId,elementClasses:e.elementClasses,elementTarget:e.elementTarget,elementContent:e.elementContent})}})},e.buildPagePing=function(e){var t=e.pageUrl,n=e.pageTitle,r=e.referrer,a=e.minXOffset,i=e.maxXOffset,c=e.minYOffset;e=e.maxYOffset;var s=o();return s.add("e","pp"),s.add("url",t),s.add("page",n),s.add("refr",r),a&&!isNaN(Number(a))&&s.add("pp_mix",a.toString()),i&&!isNaN(Number(i))&&s.add("pp_max",i.toString()),c&&!isNaN(Number(c))&&s.add("pp_miy",c.toString()),e&&!isNaN(Number(e))&&s.add("pp_may",e.toString()),s},e.buildPageView=function(e){var t=e.pageUrl,n=e.pageTitle;e=e.referrer;var r=o();return r.add("e","pv"),r.add("url",t),r.add("page",n),r.add("refr",e),r},e.buildRemoveFromCart=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/remove_from_cart/jsonschema/1-0-0",data:G({sku:e.sku,quantity:e.quantity,name:e.name,category:e.category,unitPrice:e.unitPrice,currency:e.currency})}})},e.buildScreenView=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/screen_view/jsonschema/1-0-0",data:G({name:e.name,id:e.id})}})},e.buildSelfDescribingEvent=L,e.buildSiteSearch=function(e){return L({event:{schema:"iglu:com.snowplowanalytics.snowplow/site_search/jsonschema/1-0-0",data:G({terms:e.terms,filters:e.filters,totalResults:e.totalResults,pageResults:e.pageResults})}})},e.buildSocialInteraction=function(e){return L({event:e={schema:"iglu:com.snowplowanalytics.snowplow/social_interaction/jsonschema/1-0-0",data:G({action:e.action,network:e.network,target:e.target})}})},e.buildStructEvent=function(e){var t=e.category,n=e.action,r=e.label,a=e.property;e=e.value;var i=o();return i.add("e","se"),i.add("se_ca",t),i.add("se_ac",n),i.add("se_la",r),i.add("se_pr",a),i.add("se_va",null==e?void 0:e.toString()),i},e.getRuleParts=p,e.getSchemaParts=l,e.globalContexts=s,e.isConditionalContextProvider=S,e.isContextCallbackFunction=w,e.isContextPrimitive=b,e.isFilterProvider=A,e.isJson=c,e.isNonEmptyJson=i,e.isRuleSet=h,e.isRuleSetProvider=C,e.isSelfDescribingJson=g,e.isStringArray=y,e.isValidRule=v,e.isValidRuleSetArg=m,e.matchSchemaAgainstRule=P,e.matchSchemaAgainstRuleSet=E,e.newEmitter=function(e){function r(e,t){void 0!==P&&setTimeout((function(){try{null==P||P(e,t)}catch(e){D.error("Error in onRequestFailure",e)}}),0)}function o(e){return t(this,void 0,void 0,(function(){var t,o,a,i,c,s;return n(this,(function(n){switch(n.label){case 0:if(void 0===(t=e.toRequest()))throw Error("Empty batch");o=e.getEvents().map((function(e){return e.getPayload()})),n.label=1;case 1:return n.trys.push([1,4,,5]),[4,_(t)];case 2:return[4,(a=n.sent()).text()];case 3:return n.sent(),e.closeRequest(!0),a.ok?(function(e,t){void 0!==x&&setTimeout((function(){try{null==x||x(e,t)}catch(e){D.error("Error in onRequestSuccess",e)}}),0)}(o,a),[2,{success:!0,retry:!1,status:a.status}]):(i=function(e){return!(200<=e&&300>e||!E||!S.includes(e)&&C.includes(e))}(a.status),r({events:o,status:a.status,message:a.statusText,willRetry:i},a),[2,{success:!1,retry:i,status:a.status}]);case 4:return c=n.sent(),e.closeRequest(!1),s="string"==typeof c?c:c?c.message:"Unknown error",r({events:o,message:s,willRetry:!0}),[2,{success:!1,retry:!0}];case 5:return[2]}}))}))}function a(){return U({endpoint:u,protocol:f,port:p,eventMethod:d,customHeaders:g,connectionTimeout:w,keepalive:b,maxPostBytes:v,useStm:I,credentials:O})}function i(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return!A||T?[3,2]:(T=!0,e=new Request(A,{method:"GET"}),[4,_(e)]);case 1:t.sent(),t.label=2;case 2:return[2]}}))}))}function c(){return t(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:if(R)return[3,5];R=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,s()];case 2:return t.sent(),[3,5];case 3:return e=t.sent(),D.error("Error sending events",e),[3,5];case 4:return R=!1,[7];case 5:return[2]}}))}))}function s(){return t(this,void 0,void 0,(function(){var e,t,r,c,u,l,d,f,p;return n(this,(function(n){switch(n.label){case 0:return[4,i()];case 1:n.sent(),e=a(),t=j.iterator(),n.label=2;case 2:return e.isFull()?[3,4]:[4,t.next()];case 3:return r=n.sent(),c=r.value,r.done||void 0===c?[3,4]:(u=V(c),e.addEvent(u)?[3,2]:[3,4]);case 4:return 0===e.countEvents()?[2]:[4,o(e)];case 5:return l=n.sent(),d=l.success,f=l.retry,p=l.status,!d&&f?[3,7]:(d||D.error("Status ".concat(p,", will not retry.")),[4,j.removeHead(e.countEvents())]);case 6:n.sent(),n.label=7;case 7:return d?[4,s()]:[3,9];case 8:n.sent(),n.label=9;case 9:return[2]}}))}))}var u=e.endpoint,l=e.eventMethod,d=void 0===l?"post":l,f=e.protocol,p=e.port,v=void 0===(l=e.maxPostBytes)?4e4:l,y=e.maxGetBytes,m=void 0===(l=e.bufferSize)?1:l,g=e.customHeaders,h=e.serverAnonymization,w=e.connectionTimeout,b=e.keepalive,A=e.idService,C=void 0===(l=e.dontRetryStatusCodes)?[]:l,S=void 0===(l=e.retryStatusCodes)?[]:l,E=void 0===(l=e.retryFailedRequests)||l,P=e.onRequestFailure,x=e.onRequestSuccess,_=void 0===(l=e.customFetch)?fetch:l,I=e.useStm,j=void 0===(l=e.eventStore)?q({}):l,O=e.credentials,T=!1,R=!1,L="post"===d.toLowerCase();return C=C.concat([400,401,403,410,422]),{flush:c,input:function(e){return t(this,void 0,void 0,(function(){var t,r,i;return n(this,(function(n){switch(n.label){case 0:t=k({payload:e,svrAnon:h});e:{if(n=r=V(t),L){var s=(n=n.getPOSTRequestBytesCount()+88)>v;s&&D.warn("Event ("+n+"B) too big, max is "+v)}else{if(void 0===y){n=!1;break e}(s=(n=n.getGETRequestBytesCount())>y)&&D.warn("Event ("+n+"B) too big, max is "+y)}n=s}return n?((i=a()).addEvent(r),[4,o(i)]):[3,2];case 1:return n.sent(),[3,5];case 2:return[4,j.add(t)];case 3:return n.sent()>=m?[4,c()]:[3,5];case 4:n.sent(),n.label=5;case 5:return[2]}}))}))},setCollectorUrl:function(e){u=e},setAnonymousTracking:function(e){h=e},setBufferSize:function(e){m=e}}},e.newEventStorePayload=k,e.newInMemoryEventStore=q,e.payloadBuilder=o,e.payloadJsonProcessor=a,e.pluginContexts=u,e.removeEmptyProperties=G,e.resolveDynamicContext=function(e){for(var t,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return null!==(t=null==e?void 0:e.map((function(e){if("function"!=typeof e)return e;try{return e.apply(void 0,n)}catch(e){}})).filter(Boolean))&&void 0!==t?t:[]},e.trackerCore=function(e){void 0===e&&(e={});var t,n,r,o,i,l,d,f=e.base64,p=e.corePlugins,v=null!=p?p:[];t=null==f||f,n=v,r=e.callback,o=u(n),i=s(),l=t,d={};var y=B(B({},e={track:function(e,t,c){if(e.withJsonProcessor(a(l)),e.add("eid",R()),e.addDict(d),c=function(e){return null==e?{type:"dtm",value:(new Date).getTime()}:"number"==typeof e?{type:"dtm",value:e}:"ttm"===e.type?{type:"ttm",value:e.value}:{type:"dtm",value:e.value||(new Date).getTime()}}(c),e.add(c.type,c.value.toString()),t=function(e,t){e=i.getApplicableContexts(e);var n=[];return t&&t.length&&n.push.apply(n,t),e&&e.length&&n.push.apply(n,e),n}(e,o.addPluginContexts(t)),void 0!==(t=t&&t.length?{schema:"iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0",data:t}:void 0)&&e.addJson("cx","co",t),n.forEach((function(t){try{t.beforeTrack&&t.beforeTrack(e)}catch(e){D.error("Plugin beforeTrack",e)}})),!n.find((function(t){try{return t.filter&&!1===t.filter(e.build())}catch(e){return D.error("Plugin filter",e),!1}}))){"function"==typeof r&&r(e);var s=e.build();return n.forEach((function(e){try{e.afterTrack&&e.afterTrack(s)}catch(e){D.error("Plugin afterTrack",e)}})),s}},addPayloadPair:function(e,t){d[e]=t},getBase64Encoding:function(){return l},setBase64Encoding:function(e){l=e},addPayloadDict:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(d[t]=e[t])},resetPayloadPairs:function(e){d=c(e)?e:{}},setTrackerVersion:function(e){d.tv=e},setTrackerNamespace:function(e){d.tna=e},setAppId:function(e){d.aid=e},setPlatform:function(e){d.p=e},setUserId:function(e){d.uid=e},setScreenResolution:function(e,t){d.res=e+"x"+t},setViewport:function(e,t){d.vp=e+"x"+t},setColorDepth:function(e){d.cd=e},setTimezone:function(e){d.tz=e},setLang:function(e){d.lang=e},setIpAddress:function(e){d.ip=e},setUseragent:function(e){d.ua=e},addGlobalContexts:function(e){i.addGlobalContexts(e)},clearGlobalContexts:function(){i.clearGlobalContexts()},removeGlobalContexts:function(e){i.removeGlobalContexts(e)}}),{addPlugin:function(e){var t,n;e=e.plugin,v.push(e),null===(t=e.logger)||void 0===t||t.call(e,D),null===(n=e.activateCorePlugin)||void 0===n||n.call(e,y)}});return null==v||v.forEach((function(e){var t,n;null===(t=e.logger)||void 0===t||t.call(e,D),null===(n=e.activateCorePlugin)||void 0===n||n.call(e,y)})),y},e.validateVendor=f,e.validateVendorParts=d,e.version="4.0.1",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.min.js.map |
@@ -1128,2 +1128,18 @@ declare const version: string; | ||
declare function newEventStorePayload({ payload, svrAnon }: EventStorePayload): EventStorePayload; | ||
/** | ||
* Result of the next operation on an EventStoreIterator. | ||
*/ | ||
interface EventStoreIteratorNextResult { | ||
/** | ||
* The next event in the store, or undefined if there are no more events. | ||
*/ | ||
value: EventStorePayload | undefined; | ||
/** | ||
* True if there are no more events in the store. | ||
*/ | ||
done: boolean; | ||
} | ||
/** | ||
* EventStoreIterator allows iterating over all events in the store. | ||
*/ | ||
interface EventStoreIterator { | ||
@@ -1133,6 +1149,3 @@ /** | ||
*/ | ||
next: () => Promise<{ | ||
value: EventStorePayload | undefined; | ||
done: boolean; | ||
}>; | ||
next: () => Promise<EventStoreIteratorNextResult>; | ||
} | ||
@@ -1365,2 +1378,2 @@ /** | ||
declare function newEmitter({ endpoint, eventMethod, protocol, port, maxPostBytes, maxGetBytes, bufferSize, customHeaders, serverAnonymization, connectionTimeout, keepalive, idService, dontRetryStatusCodes, retryStatusCodes, retryFailedRequests, onRequestFailure, onRequestSuccess, customFetch, useStm, eventStore, credentials }: EmitterConfiguration): Emitter; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; | ||
export { version, ContextEvent, ContextGenerator, ContextFilter, ContextPrimitive, FilterProvider, RuleSet, RuleSetProvider, ConditionalContextProvider, DynamicContext, GlobalContexts, globalContexts, PluginContexts, pluginContexts, resolveDynamicContext, getSchemaParts, validateVendorParts, validateVendor, getRuleParts, isValidRule, isStringArray, isValidRuleSetArg, isSelfDescribingJson, isRuleSet, isContextCallbackFunction, isContextPrimitive, isFilterProvider, isRuleSetProvider, isConditionalContextProvider, matchSchemaAgainstRuleSet, matchSchemaAgainstRule, CorePlugin, Payload, EventJsonWithKeys, EventJson, JsonProcessor, PayloadBuilder, payloadBuilder, payloadJsonProcessor, isNonEmptyJson, isJson, EventStorePayload, newEventStorePayload, SelfDescribingJson, SelfDescribingJsonArray, Timestamp, TrueTimestamp, DeviceTimestamp, CommonEventProperties, TrackerCore, CoreConfiguration, CorePluginConfiguration, trackerCore, SelfDescribingEvent, buildSelfDescribingEvent, PageViewEvent, buildPageView, PagePingEvent, buildPagePing, StructuredEvent, buildStructEvent, EcommerceTransactionEvent, buildEcommerceTransaction, EcommerceTransactionItemEvent, buildEcommerceTransactionItem, ScreenViewEvent, buildScreenView, LinkClickEvent, buildLinkClick, AdImpressionEvent, buildAdImpression, AdClickEvent, buildAdClick, AdConversionEvent, buildAdConversion, SocialInteractionEvent, buildSocialInteraction, AddToCartEvent, buildAddToCart, RemoveFromCartEvent, buildRemoveFromCart, FormFocusOrChangeEvent, buildFormFocusOrChange, FormElement, FormSubmissionEvent, buildFormSubmission, SiteSearchEvent, buildSiteSearch, ConsentWithdrawnEvent, EventPayloadAndContext, buildConsentWithdrawn, ConsentGrantedEvent, buildConsentGranted, removeEmptyProperties, LOG_LEVEL, Logger, LOG, EventBatch, RequestFailure, EventMethod, EmitterConfigurationBase, EmitterConfiguration, Emitter, newEmitter, EventStoreIteratorNextResult, EventStoreIterator, EventStore, EventStoreConfiguration, InMemoryEventStoreConfiguration, newInMemoryEventStore }; |
{ | ||
"name": "@snowplow/tracker-core", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Core functionality for Snowplow JavaScript trackers", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1446435
8987