2021-04-05 05:47:06 -04:00
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
|
|
|
/* eslint-disable camelcase */
|
2021-04-10 09:01:55 -04:00
|
|
|
export const handleTalkingDataEvent = (data: ITalkingDataOptions) => {
|
|
|
|
const { EventId, Label = '', MapKv = {} } = data
|
|
|
|
MapKv.from = window.location.href
|
|
|
|
window.TDAPP.onEvent(EventId, Label, MapKv)
|
2021-04-05 05:47:06 -04:00
|
|
|
if (isDevelopment) {
|
2021-04-10 09:01:55 -04:00
|
|
|
console.log('talkingData', data)
|
2021-04-05 05:47:06 -04:00
|
|
|
}
|
|
|
|
}
|
2022-06-12 08:20:08 -04:00
|
|
|
|
|
|
|
export const trimValues = (obj: IStringKeyMap) => {
|
|
|
|
const newObj = {} as IStringKeyMap
|
|
|
|
Object.keys(obj).forEach(key => {
|
|
|
|
newObj[key] = typeof obj[key] === 'string' ? obj[key].trim() : obj[key]
|
|
|
|
})
|
|
|
|
return newObj
|
|
|
|
}
|