@splitbee/core
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -60,2 +60,4 @@ 'use strict'; | ||
'user-agent': context.userAgent | ||
}, (context === null || context === void 0 ? void 0 : context.device) && { | ||
device: JSON.stringify(context.device) | ||
}), | ||
@@ -62,0 +64,0 @@ body: JSON.stringify(body) |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var t="https://hive.splitbee.io",r=function(r){var o=r.path,n=r.context,i=r.body;return Promise.resolve(function(e,t){try{var r=e()}catch(e){return}return r&&r.then?r.then(void 0,(function(){})):r}((function(){return Promise.resolve(fetch(t+o,{method:"POST",headers:e({},(null==n?void 0:n.userId)&&""!==n.userId&&{userId:n.userId},(null==n?void 0:n.uid)&&{uid:n.uid},(null==n?void 0:n.projectId)&&{sbp:n.projectId},(null==n?void 0:n.userAgent)&&{"user-agent":n.userAgent}),body:JSON.stringify(i)})).then((function(e){function t(){return{uid:e.headers.get("uid")}}var r=function(){if(void 0!==typeof process.env&&200!==e.status)return Promise.resolve(e.json()).then((function(e){console.log("Splitbee Error: ",e)}))}();return r&&r.then?r.then(t):t()}))})))};exports.analytics={track:function(e){var t=e.event,o=e.data,n=e.context,i=e.options;try{return Promise.resolve(r({path:"/t",context:n,body:{event:t,data:o,options:i}}))}catch(e){return Promise.reject(e)}},page:function(t){var o=t.page,n=t.data,i=t.context,u=t.options;try{return Promise.resolve(r({path:"/i",context:i,body:e({page:o},(null==n?void 0:n.referrer)&&{referrer:n.referrer},(null==n?void 0:n.requestId)&&{requestId:n.requestId},{options:u})}))}catch(e){return Promise.reject(e)}},identify:function(e){var t=e.userData,o=e.context;try{return Promise.resolve(r({path:"/user",context:o,body:t}))}catch(e){return Promise.reject(e)}},end:function(e){var t=e.requestId,o=e.data,n=e.context;try{return Promise.resolve(r({path:"/end",context:n,body:{requestId:t,data:o}}))}catch(e){return Promise.reject(e)}}},exports.setEndpoint=function(e){return t=e}; | ||
"use strict";function e(){return(e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0}),"undefined"!=typeof Symbol&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator"))),"undefined"!=typeof Symbol&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));var t="https://hive.splitbee.io",r=function(r){var o=r.path,n=r.context,i=r.body;return Promise.resolve(function(e,t){try{var r=e()}catch(e){return}return r&&r.then?r.then(void 0,(function(){})):r}((function(){return Promise.resolve(fetch(t+o,{method:"POST",headers:e({},(null==n?void 0:n.userId)&&""!==n.userId&&{userId:n.userId},(null==n?void 0:n.uid)&&{uid:n.uid},(null==n?void 0:n.projectId)&&{sbp:n.projectId},(null==n?void 0:n.userAgent)&&{"user-agent":n.userAgent},(null==n?void 0:n.device)&&{device:JSON.stringify(n.device)}),body:JSON.stringify(i)})).then((function(e){function t(){return{uid:e.headers.get("uid")}}var r=function(){if(void 0!==typeof process.env&&200!==e.status)return Promise.resolve(e.json()).then((function(e){console.log("Splitbee Error: ",e)}))}();return r&&r.then?r.then(t):t()}))})))};exports.analytics={track:function(e){var t=e.event,o=e.data,n=e.context,i=e.options;try{return Promise.resolve(r({path:"/t",context:n,body:{event:t,data:o,options:i}}))}catch(e){return Promise.reject(e)}},page:function(t){var o=t.page,n=t.data,i=t.context,u=t.options;try{return Promise.resolve(r({path:"/i",context:i,body:e({page:o},(null==n?void 0:n.referrer)&&{referrer:n.referrer},(null==n?void 0:n.requestId)&&{requestId:n.requestId},{options:u})}))}catch(e){return Promise.reject(e)}},identify:function(e){var t=e.userData,o=e.context;try{return Promise.resolve(r({path:"/user",context:o,body:t}))}catch(e){return Promise.reject(e)}},end:function(e){var t=e.requestId,o=e.data,n=e.context;try{return Promise.resolve(r({path:"/end",context:n,body:{requestId:t,data:o}}))}catch(e){return Promise.reject(e)}}},exports.setEndpoint=function(e){return t=e}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -56,2 +56,4 @@ function _extends() { | ||
'user-agent': context.userAgent | ||
}, (context === null || context === void 0 ? void 0 : context.device) && { | ||
device: JSON.stringify(context.device) | ||
}), | ||
@@ -58,0 +60,0 @@ body: JSON.stringify(body) |
{ | ||
"name": "@splitbee/core", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -110,2 +110,3 @@ export type Device = { | ||
...(context?.userAgent && { 'user-agent': context.userAgent }), | ||
...(context?.device && { device: JSON.stringify(context.device) }), | ||
// ...(event.context.page && { origin: event.context.page.url }), | ||
@@ -112,0 +113,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
112631
609