@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.
16 lines • 790 B
JavaScript
/**
* Determines whether a track event is allowed to be sent based on the
* user's tracking plan.
* If the user does not have a tracking plan or the event is allowed based
* on the tracking plan configuration, returns true.
*/
export function isPlanEventEnabled(plan, planEvent) {
var _a, _b;
// Always prioritize the event's `enabled` status
if (typeof (planEvent === null || planEvent === void 0 ? void 0 : planEvent.enabled) === 'boolean') {
return planEvent.enabled;
}
// Assume absence of a tracking plan means events are enabled
return (_b = (_a = plan === null || plan === void 0 ? void 0 : plan.__default) === null || _a === void 0 ? void 0 : _a.enabled) !== null && _b !== void 0 ? _b : true;
}
//# sourceMappingURL=is-plan-event-enabled.js.map