@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.
20 lines • 946 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPlanEventEnabled = void 0;
/**
* 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.
*/
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;
}
exports.isPlanEventEnabled = isPlanEventEnabled;
//# sourceMappingURL=is-plan-event-enabled.js.map