@splitbee/core
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -29,2 +29,3 @@ 'use strict'; | ||
try { | ||
console.log('Sending Splitbee Data'); | ||
return Promise.resolve(fetch("https://hive.splitbee.io" + path, { | ||
@@ -31,0 +32,0 @@ method: 'POST', |
@@ -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 n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t){var r=t.path,n=t.context,o=t.body;try{return Promise.resolve(fetch("https://hive.splitbee.io"+r,{method:"POST",headers:e({},(null==n?void 0:n.userId)&&{userId:n.userId},(null==n?void 0:n.anonymousId)&&{uid:n.anonymousId},(null==n?void 0:n.projectId)&&{sbp:n.projectId},(null==n?void 0:n.userAgent)&&{"user-agent":n.userAgent}),body:JSON.stringify(o)})).then((function(e){var t=function(){if(void 0!==typeof process.env&&200!==e.status)return Promise.resolve(e.json()).then((function(e){console.log("Splitbee Error: ",e)}))}();return t&&t.then?t.then((function(){return e})):e}))}catch(e){return Promise.reject(e)}};exports.analytics={track:function(e){var r=e.event,n=e.data,o=e.context;try{return Promise.resolve(t({path:"/track",context:o,body:{event:r,data:n}})).then((function(){}))}catch(e){return Promise.reject(e)}},page:function(r){var n=r.page,o=r.data,u=r.context;try{return Promise.resolve(t({path:"/i",context:u,body:e({origin:n},(null==o?void 0:o.referrer)&&{referrer:o.referrer},(null==o?void 0:o.requestId)&&{requestId:o.requestId})})).then((function(){}))}catch(e){return Promise.reject(e)}},identify:function(e){var r=e.userData,n=e.context;try{return Promise.resolve(t({path:"/user",context:n,body:r})).then((function(){}))}catch(e){return Promise.reject(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 n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var t=function(t){var r=t.path,n=t.context,o=t.body;try{return console.log("Sending Splitbee Data"),Promise.resolve(fetch("https://hive.splitbee.io"+r,{method:"POST",headers:e({},(null==n?void 0:n.userId)&&{userId:n.userId},(null==n?void 0:n.anonymousId)&&{uid:n.anonymousId},(null==n?void 0:n.projectId)&&{sbp:n.projectId},(null==n?void 0:n.userAgent)&&{"user-agent":n.userAgent}),body:JSON.stringify(o)})).then((function(e){var t=function(){if(void 0!==typeof process.env&&200!==e.status)return Promise.resolve(e.json()).then((function(e){console.log("Splitbee Error: ",e)}))}();return t&&t.then?t.then((function(){return e})):e}))}catch(e){return Promise.reject(e)}};exports.analytics={track:function(e){var r=e.event,n=e.data,o=e.context;try{return Promise.resolve(t({path:"/track",context:o,body:{event:r,data:n}})).then((function(){}))}catch(e){return Promise.reject(e)}},page:function(r){var n=r.page,o=r.data,i=r.context;try{return Promise.resolve(t({path:"/i",context:i,body:e({origin:n},(null==o?void 0:o.referrer)&&{referrer:o.referrer},(null==o?void 0:o.requestId)&&{requestId:o.requestId})})).then((function(){}))}catch(e){return Promise.reject(e)}},identify:function(e){var r=e.userData,n=e.context;try{return Promise.resolve(t({path:"/user",context:n,body:r})).then((function(){}))}catch(e){return Promise.reject(e)}}}; | ||
//# sourceMappingURL=core.cjs.production.min.js.map |
@@ -25,2 +25,3 @@ function _extends() { | ||
try { | ||
console.log('Sending Splitbee Data'); | ||
return Promise.resolve(fetch("https://hive.splitbee.io" + path, { | ||
@@ -27,0 +28,0 @@ method: 'POST', |
{ | ||
"name": "@splitbee/core", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -39,2 +39,3 @@ export interface RequestContext { | ||
export const splitbeeRequest = async ({ path, context, body }: Requests) => { | ||
console.log('Sending Splitbee Data'); | ||
const res = await fetch(`https://hive.splitbee.io` + path, { | ||
@@ -41,0 +42,0 @@ method: 'POST', |
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
28864
377