Repository URL to install this package:
|
Version:
1.2.1-rc.0 ▾
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var utils = require('../helpers/utils.js');
/**
* Returns an object with tracking-related data attributes to be spread over a JSX element
*
* @param {TrackingIntent} trackingIntent An object that holds the values that should be tracked
* @return {Object} An object with data attributes as keys
*/
var getTrackingDataAttrs = function getTrackingDataAttrs(_ref) {
var track = _ref.track,
identify = _ref.identify,
page = _ref.page,
_ref$options = _ref.options;
_ref$options = _ref$options === void 0 ? {} : _ref$options;
var services = _ref$options.services,
setOnce = _ref$options.setOnce,
autoTracking = _ref$options.autoTracking;
var trackingOptions = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, !utils.isUndefined(services) && {
services: services
}), !utils.isUndefined(setOnce) && {
setOnce: setOnce
}), !utils.isUndefined(autoTracking) && {
autoTracking: autoTracking
});
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, trackingOptions && {
'data-tracking-options': JSON.stringify(trackingOptions)
}), track && {
'data-track': JSON.stringify(track)
}), identify && {
'data-identify': JSON.stringify(identify)
}), page && {
'data-page': JSON.stringify(page)
});
};
exports.getTrackingDataAttrs = getTrackingDataAttrs;
//# sourceMappingURL=getTrackingDataAttrs.js.map