@segment/analytics-next
Version:
Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.
28 lines • 784 B
JavaScript
import { Alias, Facade, Group, Identify, Page, Screen, Track, } from '@segment/facade';
export function toFacade(evt, options) {
var fcd = new Facade(evt, options);
if (evt.type === 'track') {
fcd = new Track(evt, options);
}
if (evt.type === 'identify') {
fcd = new Identify(evt, options);
}
if (evt.type === 'page') {
fcd = new Page(evt, options);
}
if (evt.type === 'alias') {
fcd = new Alias(evt, options);
}
if (evt.type === 'group') {
fcd = new Group(evt, options);
}
if (evt.type === 'screen') {
fcd = new Screen(evt, options);
}
Object.defineProperty(fcd, 'obj', {
value: evt,
writable: true,
});
return fcd;
}
//# sourceMappingURL=to-facade.js.map