UNPKG

@objectiv/transport-snowplow-browser

Version:

Allows sending events directly via Snowplow's Browser Tracker without the need of the Objectiv Collector

1 lines 5.28 kB
"use strict";function e(e,t,r,n,o,i,s){try{var a=e[i](s);var c=a.value}catch(l){r(l);return}if(a.done){t(c)}else{Promise.resolve(c).then(n,o)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var s=t.apply(r,n);function a(t){e(s,o,i,a,c,"next",t)}function c(t){e(s,o,i,a,c,"throw",t)}a(undefined)})}}function r(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}function o(e,t,r){if(t)n(e.prototype,t);if(r)n(e,r);return e}var i=function(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e};var s=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(i){if(r)throw new TypeError("Generator is already executing.");while(s)try{if(r=1,n&&(o=i[0]&2?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;if(n=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:s.label++;return{value:i[1],done:false};case 5:s.label++;n=i[1];i=[0];continue;case 7:i=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){s=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(i[0]===6&&s.label<o[1]){s.label=o[1];o=i;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(i);break}if(o[2])s.ops.pop();s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a];n=0}finally{r=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=function(e,t){for(var r in t)a(e,r,{get:t[r],enumerable:!0})},f=function(e,t,r,n){var o=true,i=false,s=undefined;if(t&&typeof t=="object"||typeof t=="function")try{var p=function(){var o=v.value;!u.call(e,o)&&o!==r&&a(e,o,{get:function(){return t[o]},enumerable:!(n=c(t,o))||n.enumerable})};for(var f=l(t)[Symbol.iterator](),v;!(o=(v=f.next()).done);o=true)p()}catch(b){i=true;s=b}finally{try{if(!o&&f.return!=null){f.return()}}finally{if(i){throw s}}}return e};var v=function(e){return f(a({},"__esModule",{value:!0}),e)};var b={};p(b,{SnowplowBrowserTransport:function(){return y}});module.exports=v(b);var w={name:"@objectiv/transport-snowplow-browser",version:"0.0.27-experimental.6",description:"Allows sending events directly via Snowplow's Browser Tracker without the need of the Objectiv Collector",license:"Apache-2.0",homepage:"https://objectiv.io",keywords:["objectiv","tracking","web","analytics","events","taxonomy","transport","snowplow","browser","tracker"],repository:{type:"git",url:"https://github.com/objectiv/objectiv-analytics.git",directory:"tracker/transports/snowplow-browser"},bugs:"https://github.com/objectiv/objectiv-analytics/issues",contributors:[{name:"Surai Di Rosa",email:"surai.dirosa@gmail.com",url:"https://github.com/sdirosa"}],main:"./dist/index.js",module:"./dist/esm/index.js",types:"./dist/index.d.ts",files:["dist"],exports:{".":{require:"./dist/index.js",import:"./dist/esm/index.js",types:"./dist/index.d.ts"}},scripts:{build:"tsup src/index.ts --target es5 --format cjs,esm --legacy-output --minify --dts --sourcemap --clean","deploy:verdaccio":"npm publish",prettify:"prettier --write .",tsc:"tsc --noEmit",test:"jest --silent","test:ci":"jest --silent --ci","test:coverage":"jest --silent --coverage",depcheck:"npx depcheck"},devDependencies:{"@objectiv/developer-tools":"^0.0.27-experimental.6","@objectiv/testing-tools":"^0.0.27-experimental.6","@snowplow/browser-tracker":"^3.7.0",jest:"^28.1.3",prettier:"^2.7.1","ts-jest":"^28.0.7",tsup:"^6.2.1",typescript:"^4.7.4"},peerDependencies:{"@objectiv/schema":"^0.0.27-experimental.6","@objectiv/tracker-core":"^0.0.27-experimental.6","@snowplow/browser-tracker":">=3.0.0"},dependencies:{"@objectiv/transport-snowplow-common":"^0.0.27-experimental.6"}};var d=require("@objectiv/transport-snowplow-common"),h=require("@snowplow/browser-tracker"),y=function(){function e(){r(this,e);this.transportName="SnowplowBrowserTransport"}o(e,[{key:"initialize",value:function e(e){(0,d.initializeTransport)(this,e)}},{key:"handle",value:function e(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++){r[n]=arguments[n]}return t(function(){return s(this,function(e){switch(e.label){case 0:return[4,Promise.all(r)];case 1:e.sent().forEach(function(e){(0,h.trackStructEvent)((0,d.makeSnowplowStructuredEvent)(e))});return[2]}})})()}},{key:"isUsable",value:function e(){return i(h.trackStructEvent)<"u"}}]);return e}();var m;globalThis.objectiv=(m=globalThis.objectiv)!==null&&m!==void 0?m:{};var j;globalThis.objectiv.versions=(j=globalThis.objectiv.versions)!==null&&j!==void 0?j:new Map;globalThis.objectiv.versions.set(w.name,w.version);0&&(module.exports={SnowplowBrowserTransport:SnowplowBrowserTransport});//# sourceMappingURL=index.js.map