{"version":3,"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport type { UpdateVisitorDTO } from '../visitor/types';\n\ndeclare global {\n  // oxlint-disable-next-line typescript/no-empty-object-type\n  interface Window extends Gtag {}\n}\n\nexport function sendGAEvent<T extends EventName>(\n  name: TrackName<T>,\n  properties?: TrackProperties<T>\n) {\n  if (!window.gtag) {\n    console.warn('GA has not been initialized');\n    return;\n  }\n  window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, data, properties }: UpdateVisitorDTO) {\n  if (!window.gtag) {\n    console.warn('GA has not been initialized');\n    return;\n  }\n  if (user_id) window.gtag('set', 'user_id', user_id);\n  if (data) window.gtag('set', 'user_data', data);\n  if (properties) window.gtag('set', 'user_properties', properties);\n}\n"],"mappings":";AASO,SAAS,YACd,MACA,YACA;AACA,MAAI,CAAC,OAAO,MAAM;AAChB,YAAQ,KAAK,6BAA6B;AAC1C;AAAA,EACF;AACA,SAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEO,SAAS,UAAU,EAAE,SAAS,MAAM,WAAW,GAAqB;AACzE,MAAI,CAAC,OAAO,MAAM;AAChB,YAAQ,KAAK,6BAA6B;AAC1C;AAAA,EACF;AACA,MAAI,QAAS,QAAO,KAAK,OAAO,WAAW,OAAO;AAClD,MAAI,KAAM,QAAO,KAAK,OAAO,aAAa,IAAI;AAC9C,MAAI,WAAY,QAAO,KAAK,OAAO,mBAAmB,UAAU;AAClE;","names":[]}