Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// clone traits before we manipulate so we don't do anything uncouth, and take
// from `user` so that we carryover anonymous traits
user.identify(id, traits);
var msg = this.normalize({
options: options,
traits: user.traits(),
userId: user.id()
});
// Add the initialize integrations so the server-side ones can be disabled too
if (this.options.integrations) {
defaults(msg.integrations, this.options.integrations);
}
this._invoke('identify', new Identify(msg));
// emit
this.emit('identify', id, traits, options);
this._callback(fn);
return this;
};
HubSpot.prototype.identify = function(identify) {
// use newer version of Identify to have access to `companyName`
var newIdentify = new Identify({
traits: identify.traits(),
userId: identify.userId()
});
if (!newIdentify.email()) {
return;
}
var traits = newIdentify.traits({
firstName: 'firstname',
lastName: 'lastname'
});
traits = convertDates(traits);
traits = formatTraits(traits);
if (newIdentify.companyName() !== undefined) {
function email(user) {
var identify = new Identify({ userId: user.id(), traits: user.traits() });
return identify.email();
}