@shware/analytics 14.1.0 → 15.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +48 -33
  2. package/dist/constants/storage.cjs +7 -1
  3. package/dist/constants/storage.cjs.map +1 -1
  4. package/dist/constants/storage.d.cts +6 -0
  5. package/dist/constants/storage.d.cts.map +1 -1
  6. package/dist/constants/storage.d.mts +6 -0
  7. package/dist/constants/storage.d.mts.map +1 -1
  8. package/dist/constants/storage.mjs +7 -1
  9. package/dist/constants/storage.mjs.map +1 -1
  10. package/dist/index.cjs +2 -1
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.mjs +2 -2
  14. package/dist/schema/index.cjs +1 -1
  15. package/dist/schema/index.cjs.map +1 -1
  16. package/dist/schema/index.mjs +1 -1
  17. package/dist/schema/index.mjs.map +1 -1
  18. package/dist/setup/session.cjs +9 -0
  19. package/dist/setup/session.cjs.map +1 -1
  20. package/dist/setup/session.d.cts +10 -0
  21. package/dist/setup/session.d.cts.map +1 -1
  22. package/dist/setup/session.d.mts +10 -0
  23. package/dist/setup/session.d.mts.map +1 -1
  24. package/dist/setup/session.mjs +9 -0
  25. package/dist/setup/session.mjs.map +1 -1
  26. package/dist/third-parties/google-analytics.cjs.map +1 -1
  27. package/dist/third-parties/google-analytics.mjs.map +1 -1
  28. package/dist/third-parties/posthog.cjs +9 -8
  29. package/dist/third-parties/posthog.cjs.map +1 -1
  30. package/dist/third-parties/posthog.d.cts +9 -8
  31. package/dist/third-parties/posthog.d.cts.map +1 -1
  32. package/dist/third-parties/posthog.d.mts +9 -8
  33. package/dist/third-parties/posthog.d.mts.map +1 -1
  34. package/dist/third-parties/posthog.mjs +9 -8
  35. package/dist/third-parties/posthog.mjs.map +1 -1
  36. package/dist/track/gtag.cjs.map +1 -1
  37. package/dist/track/gtag.d.cts +2 -1
  38. package/dist/track/gtag.d.cts.map +1 -1
  39. package/dist/track/gtag.d.mts +2 -1
  40. package/dist/track/gtag.d.mts.map +1 -1
  41. package/dist/track/gtag.mjs.map +1 -1
  42. package/dist/track/index.cjs +117 -67
  43. package/dist/track/index.cjs.map +1 -1
  44. package/dist/track/index.d.cts +9 -2
  45. package/dist/track/index.d.cts.map +1 -1
  46. package/dist/track/index.d.mts +9 -2
  47. package/dist/track/index.d.mts.map +1 -1
  48. package/dist/track/index.mjs +117 -68
  49. package/dist/track/index.mjs.map +1 -1
  50. package/dist/visitor/id.cjs +5 -0
  51. package/dist/visitor/id.cjs.map +1 -1
  52. package/dist/visitor/id.d.cts +2 -0
  53. package/dist/visitor/id.d.cts.map +1 -1
  54. package/dist/visitor/id.d.mts +2 -0
  55. package/dist/visitor/id.d.mts.map +1 -1
  56. package/dist/visitor/id.mjs +5 -1
  57. package/dist/visitor/id.mjs.map +1 -1
  58. package/dist/visitor/index.cjs +94 -24
  59. package/dist/visitor/index.cjs.map +1 -1
  60. package/dist/visitor/index.d.cts +35 -8
  61. package/dist/visitor/index.d.cts.map +1 -1
  62. package/dist/visitor/index.d.mts +35 -8
  63. package/dist/visitor/index.d.mts.map +1 -1
  64. package/dist/visitor/index.mjs +95 -26
  65. package/dist/visitor/index.mjs.map +1 -1
  66. package/dist/visitor/types.d.cts +3 -19
  67. package/dist/visitor/types.d.cts.map +1 -1
  68. package/dist/visitor/types.d.mts +3 -19
  69. package/dist/visitor/types.d.mts.map +1 -1
  70. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"session.cjs","names":["config","keys","uuidv7"],"sources":["../../src/setup/session.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from './index';\n\nexport const SESSION_TIMEOUT = 30 * 60 * 1000;\n\n/**\n * The part of a session that outlives the page: its identity, and the clock the timeout is\n * measured against. GA4 keeps these in its `_ga_<container>` cookie — alongside the engaged flag,\n * which arrives with `session_engaged` later — and rereads them for every event, which is what\n * makes a session survive a reload, span a whole multipage visit, and stay shared between two\n * tabs of the same site. Holding them in memory instead, as this did, starts a new session on\n * every full navigation and gives every tab one of its own.\n */\ninterface StoredSession {\n id: string;\n /** When the last event was sent. The timeout is measured from here, and only from here. */\n lastEventTime: number;\n}\n\n/** The session an event belongs to, and whether that event is the one that started it. */\ninterface SessionForEvent {\n id: string;\n started: boolean;\n}\n\n/**\n * `<version>.<id>.<lastEventTime>`, compact and cookie-safe rather than JSON: `{`, `\"`\n * and `,` all have to be percent-encoded in a cookie, and a host that wants one session across\n * its subdomains will hand `setupAnalytics` a cookie-backed `storage`, where this has to survive\n * unchanged. A uuidv7 contains no dots, so the record splits cleanly.\n *\n * The version guards a change the parser could not otherwise survive. A field appended to the end\n * does not need one — a short record simply leaves it undefined.\n */\nconst VERSION = '1';\n\nfunction readSession(): StoredSession | undefined {\n const raw = config.storage.getItem(keys.session);\n if (!raw) return undefined;\n\n const [version, id, lastEventTime] = raw.split('.');\n if (version !== VERSION || !id) return undefined;\n\n const parsed = { id, lastEventTime: Number(lastEventTime) };\n if (!Number.isFinite(parsed.lastEventTime)) return undefined;\n return parsed;\n}\n\nfunction writeSession({ id, lastEventTime }: StoredSession) {\n config.storage.setItem(keys.session, `${VERSION}.${id}.${lastEventTime}`);\n}\n\nclass Session {\n /**\n * Engagement is deliberately not stored: it is the time this page has accrued and not yet\n * reported, so it belongs to the page, not to the session. GA4 draws the same line — its cookie\n * carries the session, while the engagement timer lives and dies with the document.\n *\n * `lastTickTime` is where the accumulator last settled up, rewritten on every tick — it is not\n * when the session began, and nothing here needs to know that.\n */\n private lastTickTime: number;\n private accumulatedTime: number;\n\n private active: boolean;\n private visible: boolean;\n private focused: boolean;\n\n constructor() {\n this.lastTickTime = Date.now();\n this.accumulatedTime = 0;\n\n this.active = true;\n this.visible = typeof document !== 'undefined' ? document.visibilityState === 'visible' : true;\n this.focused = typeof document !== 'undefined' ? document.hasFocus() : true;\n }\n\n /**\n * The session a batch of events belongs to: read the stored one, start a new one if it has\n * timed out or there is none, stamp it with when those events happened and write it back. Every\n * event goes through here, exactly as GA4 rereads and rewrites its cookie per event — caching\n * the session in memory would put the tabs back out of step with each other.\n */\n touch = (eventTime: number, lastEventTime = eventTime): SessionForEvent => {\n const stored = readSession();\n\n if (stored && eventTime - stored.lastEventTime <= SESSION_TIMEOUT) {\n // `Math.max`, because a batch that waited in a frozen tab can be older than what another\n // tab has since written, and a session must never be shortened by a late arrival.\n writeSession({ ...stored, lastEventTime: Math.max(stored.lastEventTime, lastEventTime) });\n return { id: stored.id, started: false };\n }\n\n // Engagement the previous session accrued but never reported dies with it rather than being\n // handed to its successor. GA4 does the same on `session_start`.\n this.accumulatedTime = 0;\n // Wall clock, not `eventTime`: this anchors the engagement timer for the page in front of the\n // visitor now, which a batch describing something that happened an hour ago says nothing about.\n this.lastTickTime = Date.now();\n\n const session: StoredSession = { id: uuidv7(), lastEventTime };\n writeSession(session);\n return { id: session.id, started: true };\n };\n\n /**\n * The id for an event that must not start a session — the engagement beacon, which reports what\n * the session accrued. A live session is extended, as any event extends it; one already past its\n * timeout still owns that engagement, so its id comes back without being revived into a session\n * no `session_start` ever announced. With nothing stored, no event was ever queued here, so\n * there is no session to report for, and none is started: it would never be announced.\n */\n extend = (): string | undefined => {\n const stored = readSession();\n if (!stored) return undefined;\n\n const now = Date.now();\n if (now - stored.lastEventTime <= SESSION_TIMEOUT) {\n writeSession({ ...stored, lastEventTime: now });\n }\n return stored.id;\n };\n\n isActive = () => this.active;\n\n updateActive = (active: boolean) => {\n this.active = active;\n };\n\n updateAccumulator = () => {\n const now = Date.now();\n if (this.focused && this.visible && this.active) {\n const delta = now - this.lastTickTime;\n if (delta > 0 && delta < SESSION_TIMEOUT) {\n this.accumulatedTime += delta;\n }\n }\n this.lastTickTime = now;\n };\n\n focus = () => {\n this.updateAccumulator();\n this.focused = true;\n };\n\n blur = () => {\n this.updateAccumulator();\n this.focused = false;\n };\n\n pageshow = () => {\n this.updateAccumulator();\n this.active = true;\n };\n\n pagehide = () => {\n this.updateAccumulator();\n this.active = false;\n };\n\n visibilitychange = (state: DocumentVisibilityState) => {\n this.updateAccumulator();\n this.visible = state === 'visible';\n };\n\n flush = () => {\n this.updateAccumulator();\n const engagementTime = this.accumulatedTime;\n this.accumulatedTime = 0;\n return engagementTime;\n };\n}\n\nlet session: Session | undefined;\n\n/**\n * The session, built the first time something asks for it.\n *\n * Deliberately not a module-scope `new Session()`. The constructor calls\n * `uuidv7()`, `uuid` draws its bytes from `crypto.getRandomValues`, and\n * Cloudflare Workers reject that outside a request handler:\n *\n * Disallowed operation called within global scope. Asynchronous I/O\n * (ex: fetch() or connect()), setting a timeout, and generating random\n * values are not allowed within global scope.\n *\n * Module scope in a Worker is evaluated once when the isolate boots and is\n * then shared by every request that isolate serves, so a random value drawn\n * there would be the same for all of them — which is why the runtime refuses\n * to produce one. A host that server-renders on Workers reaches this module\n * through `track()` on the server as well, and the throw happened as the\n * isolate booted, taking down every route before a component rendered.\n *\n * Everything here is per-visitor browser or app state, so deferring the\n * construction costs nothing and lets the server bundle be evaluated. It does\n * not make any of it safe to use there: this instance, `cache` and `config` are\n * module singletons, so calling `track()` on a server shares one session and one\n * visitor across every request the isolate serves. Import it there; do not track.\n */\nexport function getSession() {\n return (session ??= new Session());\n}\n"],"mappings":";;;;;AAIA,MAAa,kBAAkB;;;;;;;;;;AA+B/B,MAAM,UAAU;AAEhB,SAAS,cAAyC;CAChD,MAAM,MAAMA,oBAAAA,OAAO,QAAQ,QAAQC,0BAAAA,KAAK,OAAO;CAC/C,IAAI,CAAC,KAAK,OAAO,KAAA;CAEjB,MAAM,CAAC,SAAS,IAAI,iBAAiB,IAAI,MAAM,GAAG;CAClD,IAAI,YAAY,WAAW,CAAC,IAAI,OAAO,KAAA;CAEvC,MAAM,SAAS;EAAE;EAAI,eAAe,OAAO,aAAa;CAAE;CAC1D,IAAI,CAAC,OAAO,SAAS,OAAO,aAAa,GAAG,OAAO,KAAA;CACnD,OAAO;AACT;AAEA,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,UAAU;EACjB;EAEiB,KAAA,iBAAA;GACf,KAAK,kBAAkB;GACvB,KAAK,SAAS;EAChB;EAEiB,KAAA,iBAAA;GACf,KAAK,kBAAkB;GACvB,KAAK,SAAS;EAChB;EAEoB,KAAA,oBAAA,UAAmC;GACrD,KAAK,kBAAkB;GACvB,KAAK,UAAU,UAAU;EAC3B;EAEc,KAAA,cAAA;GACZ,KAAK,kBAAkB;GACvB,MAAM,iBAAiB,KAAK;GAC5B,KAAK,kBAAkB;GACvB,OAAO;EACT;EArGE,KAAK,eAAe,KAAK,IAAI;EAC7B,KAAK,kBAAkB;EAEvB,KAAK,SAAS;EACd,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,oBAAoB,YAAY;EAC1F,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,SAAS,IAAI;CACzE;AAgGF;AAEA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,SAAgB,aAAa;CAC3B,OAAQ,YAAY,IAAI,QAAQ;AAClC"}
1
+ {"version":3,"file":"session.cjs","names":["config","keys","uuidv7"],"sources":["../../src/setup/session.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from './index';\n\nexport const SESSION_TIMEOUT = 30 * 60 * 1000;\n\n/**\n * The part of a session that outlives the page: its identity, and the clock the timeout is\n * measured against. GA4 keeps these in its `_ga_<container>` cookie — alongside the engaged flag,\n * which arrives with `session_engaged` later — and rereads them for every event, which is what\n * makes a session survive a reload, span a whole multipage visit, and stay shared between two\n * tabs of the same site. Holding them in memory instead, as this did, starts a new session on\n * every full navigation and gives every tab one of its own.\n */\ninterface StoredSession {\n id: string;\n /** When the last event was sent. The timeout is measured from here, and only from here. */\n lastEventTime: number;\n}\n\n/** The session an event belongs to, and whether that event is the one that started it. */\ninterface SessionForEvent {\n id: string;\n started: boolean;\n}\n\n/**\n * `<version>.<id>.<lastEventTime>`, compact and cookie-safe rather than JSON: `{`, `\"`\n * and `,` all have to be percent-encoded in a cookie, and a host that wants one session across\n * its subdomains will hand `setupAnalytics` a cookie-backed `storage`, where this has to survive\n * unchanged. A uuidv7 contains no dots, so the record splits cleanly.\n *\n * The version guards a change the parser could not otherwise survive. A field appended to the end\n * does not need one — a short record simply leaves it undefined.\n */\nconst VERSION = '1';\n\nfunction readSession(): StoredSession | undefined {\n const raw = config.storage.getItem(keys.session);\n if (!raw) return undefined;\n\n const [version, id, lastEventTime] = raw.split('.');\n if (version !== VERSION || !id) return undefined;\n\n const parsed = { id, lastEventTime: Number(lastEventTime) };\n if (!Number.isFinite(parsed.lastEventTime)) return undefined;\n return parsed;\n}\n\nfunction writeSession({ id, lastEventTime }: StoredSession) {\n config.storage.setItem(keys.session, `${VERSION}.${id}.${lastEventTime}`);\n}\n\nclass Session {\n /**\n * Engagement is deliberately not stored: it is the time this page has accrued and not yet\n * reported, so it belongs to the page, not to the session. GA4 draws the same line — its cookie\n * carries the session, while the engagement timer lives and dies with the document.\n *\n * `lastTickTime` is where the accumulator last settled up, rewritten on every tick — it is not\n * when the session began, and nothing here needs to know that.\n */\n private lastTickTime: number;\n private accumulatedTime: number;\n\n private active: boolean;\n private visible: boolean;\n private focused: boolean;\n\n constructor() {\n this.lastTickTime = Date.now();\n this.accumulatedTime = 0;\n\n this.active = true;\n this.visible = typeof document !== 'undefined' ? document.visibilityState === 'visible' : true;\n this.focused = typeof document !== 'undefined' ? document.hasFocus() : true;\n }\n\n /**\n * The session a batch of events belongs to: read the stored one, start a new one if it has\n * timed out or there is none, stamp it with when those events happened and write it back. Every\n * event goes through here, exactly as GA4 rereads and rewrites its cookie per event — caching\n * the session in memory would put the tabs back out of step with each other.\n */\n touch = (eventTime: number, lastEventTime = eventTime): SessionForEvent => {\n const stored = readSession();\n\n if (stored && eventTime - stored.lastEventTime <= SESSION_TIMEOUT) {\n // `Math.max`, because a batch that waited in a frozen tab can be older than what another\n // tab has since written, and a session must never be shortened by a late arrival.\n writeSession({ ...stored, lastEventTime: Math.max(stored.lastEventTime, lastEventTime) });\n return { id: stored.id, started: false };\n }\n\n // Engagement the previous session accrued but never reported dies with it rather than being\n // handed to its successor. GA4 does the same on `session_start`.\n this.accumulatedTime = 0;\n // Wall clock, not `eventTime`: this anchors the engagement timer for the page in front of the\n // visitor now, which a batch describing something that happened an hour ago says nothing about.\n this.lastTickTime = Date.now();\n\n const session: StoredSession = { id: uuidv7(), lastEventTime };\n writeSession(session);\n return { id: session.id, started: true };\n };\n\n /**\n * The id for an event that must not start a session — the engagement beacon, which reports what\n * the session accrued. A live session is extended, as any event extends it; one already past its\n * timeout still owns that engagement, so its id comes back without being revived into a session\n * no `session_start` ever announced. With nothing stored, no event was ever queued here, so\n * there is no session to report for, and none is started: it would never be announced.\n */\n extend = (): string | undefined => {\n const stored = readSession();\n if (!stored) return undefined;\n\n const now = Date.now();\n if (now - stored.lastEventTime <= SESSION_TIMEOUT) {\n writeSession({ ...stored, lastEventTime: now });\n }\n return stored.id;\n };\n\n /**\n * Ends the stored session for `reset()`, so the next event starts a new one and announces it.\n * Returns the session's id and the engagement it accrued and has not reported, for the caller\n * to report; one past its timeout still owns that engagement, as in `extend`, and is not\n * revived. The storage has no `removeItem`: an empty record reads as none.\n */\n end = (): { id: string | undefined; engagement_time_msec: number } => {\n const engagement_time_msec = this.flush();\n const id = readSession()?.id;\n config.storage.setItem(keys.session, '');\n return { id, engagement_time_msec };\n };\n\n isActive = () => this.active;\n\n updateActive = (active: boolean) => {\n this.active = active;\n };\n\n updateAccumulator = () => {\n const now = Date.now();\n if (this.focused && this.visible && this.active) {\n const delta = now - this.lastTickTime;\n if (delta > 0 && delta < SESSION_TIMEOUT) {\n this.accumulatedTime += delta;\n }\n }\n this.lastTickTime = now;\n };\n\n focus = () => {\n this.updateAccumulator();\n this.focused = true;\n };\n\n blur = () => {\n this.updateAccumulator();\n this.focused = false;\n };\n\n pageshow = () => {\n this.updateAccumulator();\n this.active = true;\n };\n\n pagehide = () => {\n this.updateAccumulator();\n this.active = false;\n };\n\n visibilitychange = (state: DocumentVisibilityState) => {\n this.updateAccumulator();\n this.visible = state === 'visible';\n };\n\n flush = () => {\n this.updateAccumulator();\n const engagementTime = this.accumulatedTime;\n this.accumulatedTime = 0;\n return engagementTime;\n };\n}\n\nlet session: Session | undefined;\n\n/**\n * The session, built the first time something asks for it.\n *\n * Deliberately not a module-scope `new Session()`. The constructor calls\n * `uuidv7()`, `uuid` draws its bytes from `crypto.getRandomValues`, and\n * Cloudflare Workers reject that outside a request handler:\n *\n * Disallowed operation called within global scope. Asynchronous I/O\n * (ex: fetch() or connect()), setting a timeout, and generating random\n * values are not allowed within global scope.\n *\n * Module scope in a Worker is evaluated once when the isolate boots and is\n * then shared by every request that isolate serves, so a random value drawn\n * there would be the same for all of them — which is why the runtime refuses\n * to produce one. A host that server-renders on Workers reaches this module\n * through `track()` on the server as well, and the throw happened as the\n * isolate booted, taking down every route before a component rendered.\n *\n * Everything here is per-visitor browser or app state, so deferring the\n * construction costs nothing and lets the server bundle be evaluated. It does\n * not make any of it safe to use there: this instance, `cache` and `config` are\n * module singletons, so calling `track()` on a server shares one session and one\n * visitor across every request the isolate serves. Import it there; do not track.\n */\nexport function getSession() {\n return (session ??= new Session());\n}\n"],"mappings":";;;;;AAIA,MAAa,kBAAkB;;;;;;;;;;AA+B/B,MAAM,UAAU;AAEhB,SAAS,cAAyC;CAChD,MAAM,MAAMA,oBAAAA,OAAO,QAAQ,QAAQC,0BAAAA,KAAK,OAAO;CAC/C,IAAI,CAAC,KAAK,OAAO,KAAA;CAEjB,MAAM,CAAC,SAAS,IAAI,iBAAiB,IAAI,MAAM,GAAG;CAClD,IAAI,YAAY,WAAW,CAAC,IAAI,OAAO,KAAA;CAEvC,MAAM,SAAS;EAAE;EAAI,eAAe,OAAO,aAAa;CAAE;CAC1D,IAAI,CAAC,OAAO,SAAS,OAAO,aAAa,GAAG,OAAO,KAAA;CACnD,OAAO;AACT;AAEA,SAAS,aAAa,EAAE,IAAI,iBAAgC;CAC1D,oB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mB;GAE5B;GACA,KAAK,eAAe;EACtB;EAEc,KAAA,cAAA;GACZ,KAAK,kBAAkB;GACvB,KAAK,UAAU;EACjB;EAEa,KAAA,aAAA;GACX,KAAK,kBAAkB;GACvB,KAAK,UAAU;EACjB;EAEiB,KAAA,iBAAA;GACf,KAAK,kBAAkB;GACvB,KAAK,SAAS;EAChB;EAEiB,KAAA,iBAAA;GACf,KAAK,kBAAkB;GACvB,KAAK,SAAS;EAChB;EAEoB,KAAA,oBAAA,UAAmC;GACrD,KAAK,kBAAkB;GACvB,KAAK,UAAU,UAAU;EAC3B;EAEc,KAAA,cAAA;GACZ,KAAK,kBAAkB;GACvB,MAAM,iBAAiB,KAAK;GAC5B,KAAK,kBAAkB;GACvB,OAAO;EACT;EAlHE,KAAK,eAAe,KAAK,IAAI;EAC7B,KAAK,kBAAkB;EAEvB,KAAK,SAAS;EACd,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,oBAAoB,YAAY;EAC1F,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,SAAS,IAAI;CACzE;AA6GF;AAEA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,SAAgB,aAAa;CAC3B,OAAQ,YAAY,IAAI,QAAQ;AAClC"}
@@ -34,6 +34,16 @@ declare class Session {
34
34
  * there is no session to report for, and none is started: it would never be announced.
35
35
  */
36
36
  extend: () => string | undefined;
37
+ /**
38
+ * Ends the stored session for `reset()`, so the next event starts a new one and announces it.
39
+ * Returns the session's id and the engagement it accrued and has not reported, for the caller
40
+ * to report; one past its timeout still owns that engagement, as in `extend`, and is not
41
+ * revived. The storage has no `removeItem`: an empty record reads as none.
42
+ */
43
+ end: () => {
44
+ id: string | undefined;
45
+ engagement_time_msec: number;
46
+ };
37
47
  isActive: () => boolean;
38
48
  updateActive: (active: boolean) => void;
39
49
  updateAccumulator: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.cts","names":[],"sources":["../../src/setup/session.ts"],"mappings":"A,qBAIa;;UAiBH;EACR;EACA;;cA8BI;;;;;;;;;UASI;UACA;UAEA;UACA;UACA;EAER;;;;;;;EAeA,QAAK,mBAAqB,2BAA8B;;;;;;;;EA6BxD;EAWA;EAEA,eAAY;EAIZ;EAWA;EAKA;EAKA;EAKA;EAKA,mBAAgB,OAAW;EAK3B;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCc,cAAU"}
1
+ {"version":3,"file":"session.d.cts","names":[],"sources":["../../src/setup/session.ts"],"mappings":"A,qBAIa;;UAiBH;EACR;EACA;;cA8BI;;;;;;;;;UASI;UACA;UAEA;UACA;UACA;EAER;;;;;;;EAeA,QAAK,mBAAqB,2BAA8B;;;;;;;;EA6BxD;;;;;;;EAiBA;IAAY;IAAwB;;EAOpC;EAEA,eAAY;EAIZ;EAWA;EAKA;EAKA;EAKA;EAKA,mBAAgB,OAAW;EAK3B;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCc,cAAU"}
@@ -34,6 +34,16 @@ declare class Session {
34
34
  * there is no session to report for, and none is started: it would never be announced.
35
35
  */
36
36
  extend: () => string | undefined;
37
+ /**
38
+ * Ends the stored session for `reset()`, so the next event starts a new one and announces it.
39
+ * Returns the session's id and the engagement it accrued and has not reported, for the caller
40
+ * to report; one past its timeout still owns that engagement, as in `extend`, and is not
41
+ * revived. The storage has no `removeItem`: an empty record reads as none.
42
+ */
43
+ end: () => {
44
+ id: string | undefined;
45
+ engagement_time_msec: number;
46
+ };
37
47
  isActive: () => boolean;
38
48
  updateActive: (active: boolean) => void;
39
49
  updateAccumulator: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.mts","names":[],"sources":["../../src/setup/session.ts"],"mappings":"A,qBAIa;;UAiBH;EACR;EACA;;cA8BI;;;;;;;;;UASI;UACA;UAEA;UACA;UACA;EAER;;;;;;;EAeA,QAAK,mBAAqB,2BAA8B;;;;;;;;EA6BxD;EAWA;EAEA,eAAY;EAIZ;EAWA;EAKA;EAKA;EAKA;EAKA,mBAAgB,OAAW;EAK3B;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCc,cAAU"}
1
+ {"version":3,"file":"session.d.mts","names":[],"sources":["../../src/setup/session.ts"],"mappings":"A,qBAIa;;UAiBH;EACR;EACA;;cA8BI;;;;;;;;;UASI;UACA;UAEA;UACA;UACA;EAER;;;;;;;EAeA,QAAK,mBAAqB,2BAA8B;;;;;;;;EA6BxD;;;;;;;EAiBA;IAAY;IAAwB;;EAOpC;EAEA,eAAY;EAIZ;EAWA;EAKA;EAKA;EAKA;EAKA,mBAAgB,OAAW;EAK3B;;;;;;;;;;;;;;;;;;;;;;;;;;wBAkCc,cAAU"}
@@ -64,6 +64,15 @@ var Session = class {
64
64
  });
65
65
  return stored.id;
66
66
  };
67
+ this.end = () => {
68
+ const engagement_time_msec = this.flush();
69
+ const id = readSession()?.id;
70
+ config.storage.setItem(keys.session, "");
71
+ return {
72
+ id,
73
+ engagement_time_msec
74
+ };
75
+ };
67
76
  this.isActive = () => this.active;
68
77
  this.updateActive = (active) => {
69
78
  this.active = active;
@@ -1 +1 @@
1
- {"version":3,"file":"session.mjs","names":["uuidv7"],"sources":["../../src/setup/session.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from './index';\n\nexport const SESSION_TIMEOUT = 30 * 60 * 1000;\n\n/**\n * The part of a session that outlives the page: its identity, and the clock the timeout is\n * measured against. GA4 keeps these in its `_ga_<container>` cookie — alongside the engaged flag,\n * which arrives with `session_engaged` later — and rereads them for every event, which is what\n * makes a session survive a reload, span a whole multipage visit, and stay shared between two\n * tabs of the same site. Holding them in memory instead, as this did, starts a new session on\n * every full navigation and gives every tab one of its own.\n */\ninterface StoredSession {\n id: string;\n /** When the last event was sent. The timeout is measured from here, and only from here. */\n lastEventTime: number;\n}\n\n/** The session an event belongs to, and whether that event is the one that started it. */\ninterface SessionForEvent {\n id: string;\n started: boolean;\n}\n\n/**\n * `<version>.<id>.<lastEventTime>`, compact and cookie-safe rather than JSON: `{`, `\"`\n * and `,` all have to be percent-encoded in a cookie, and a host that wants one session across\n * its subdomains will hand `setupAnalytics` a cookie-backed `storage`, where this has to survive\n * unchanged. A uuidv7 contains no dots, so the record splits cleanly.\n *\n * The version guards a change the parser could not otherwise survive. A field appended to the end\n * does not need one — a short record simply leaves it undefined.\n */\nconst VERSION = '1';\n\nfunction readSession(): StoredSession | undefined {\n const raw = config.storage.getItem(keys.session);\n if (!raw) return undefined;\n\n const [version, id, lastEventTime] = raw.split('.');\n if (version !== VERSION || !id) return undefined;\n\n const parsed = { id, lastEventTime: Number(lastEventTime) };\n if (!Number.isFinite(parsed.lastEventTime)) return undefined;\n return parsed;\n}\n\nfunction writeSession({ id, lastEventTime }: StoredSession) {\n config.storage.setItem(keys.session, `${VERSION}.${id}.${lastEventTime}`);\n}\n\nclass Session {\n /**\n * Engagement is deliberately not stored: it is the time this page has accrued and not yet\n * reported, so it belongs to the page, not to the session. GA4 draws the same line — its cookie\n * carries the session, while the engagement timer lives and dies with the document.\n *\n * `lastTickTime` is where the accumulator last settled up, rewritten on every tick — it is not\n * when the session began, and nothing here needs to know that.\n */\n private lastTickTime: number;\n private accumulatedTime: number;\n\n private active: boolean;\n private visible: boolean;\n private focused: boolean;\n\n constructor() {\n this.lastTickTime = Date.now();\n this.accumulatedTime = 0;\n\n this.active = true;\n this.visible = typeof document !== 'undefined' ? document.visibilityState === 'visible' : true;\n this.focused = typeof document !== 'undefined' ? document.hasFocus() : true;\n }\n\n /**\n * The session a batch of events belongs to: read the stored one, start a new one if it has\n * timed out or there is none, stamp it with when those events happened and write it back. Every\n * event goes through here, exactly as GA4 rereads and rewrites its cookie per event — caching\n * the session in memory would put the tabs back out of step with each other.\n */\n touch = (eventTime: number, lastEventTime = eventTime): SessionForEvent => {\n const stored = readSession();\n\n if (stored && eventTime - stored.lastEventTime <= SESSION_TIMEOUT) {\n // `Math.max`, because a batch that waited in a frozen tab can be older than what another\n // tab has since written, and a session must never be shortened by a late arrival.\n writeSession({ ...stored, lastEventTime: Math.max(stored.lastEventTime, lastEventTime) });\n return { id: stored.id, started: false };\n }\n\n // Engagement the previous session accrued but never reported dies with it rather than being\n // handed to its successor. GA4 does the same on `session_start`.\n this.accumulatedTime = 0;\n // Wall clock, not `eventTime`: this anchors the engagement timer for the page in front of the\n // visitor now, which a batch describing something that happened an hour ago says nothing about.\n this.lastTickTime = Date.now();\n\n const session: StoredSession = { id: uuidv7(), lastEventTime };\n writeSession(session);\n return { id: session.id, started: true };\n };\n\n /**\n * The id for an event that must not start a session — the engagement beacon, which reports what\n * the session accrued. A live session is extended, as any event extends it; one already past its\n * timeout still owns that engagement, so its id comes back without being revived into a session\n * no `session_start` ever announced. With nothing stored, no event was ever queued here, so\n * there is no session to report for, and none is started: it would never be announced.\n */\n extend = (): string | undefined => {\n const stored = readSession();\n if (!stored) return undefined;\n\n const now = Date.now();\n if (now - stored.lastEventTime <= SESSION_TIMEOUT) {\n writeSession({ ...stored, lastEventTime: now });\n }\n return stored.id;\n };\n\n isActive = () => this.active;\n\n updateActive = (active: boolean) => {\n this.active = active;\n };\n\n updateAccumulator = () => {\n const now = Date.now();\n if (this.focused && this.visible && this.active) {\n const delta = now - this.lastTickTime;\n if (delta > 0 && delta < SESSION_TIMEOUT) {\n this.accumulatedTime += delta;\n }\n }\n this.lastTickTime = now;\n };\n\n focus = () => {\n this.updateAccumulator();\n this.focused = true;\n };\n\n blur = () => {\n this.updateAccumulator();\n this.focused = false;\n };\n\n pageshow = () => {\n this.updateAccumulator();\n this.active = true;\n };\n\n pagehide = () => {\n this.updateAccumulator();\n this.active = false;\n };\n\n visibilitychange = (state: DocumentVisibilityState) => {\n this.updateAccumulator();\n this.visible = state === 'visible';\n };\n\n flush = () => {\n this.updateAccumulator();\n const engagementTime = this.accumulatedTime;\n this.accumulatedTime = 0;\n return engagementTime;\n };\n}\n\nlet session: Session | undefined;\n\n/**\n * The session, built the first time something asks for it.\n *\n * Deliberately not a module-scope `new Session()`. The constructor calls\n * `uuidv7()`, `uuid` draws its bytes from `crypto.getRandomValues`, and\n * Cloudflare Workers reject that outside a request handler:\n *\n * Disallowed operation called within global scope. Asynchronous I/O\n * (ex: fetch() or connect()), setting a timeout, and generating random\n * values are not allowed within global scope.\n *\n * Module scope in a Worker is evaluated once when the isolate boots and is\n * then shared by every request that isolate serves, so a random value drawn\n * there would be the same for all of them — which is why the runtime refuses\n * to produce one. A host that server-renders on Workers reaches this module\n * through `track()` on the server as well, and the throw happened as the\n * isolate booted, taking down every route before a component rendered.\n *\n * Everything here is per-visitor browser or app state, so deferring the\n * construction costs nothing and lets the server bundle be evaluated. It does\n * not make any of it safe to use there: this instance, `cache` and `config` are\n * module singletons, so calling `track()` on a server shares one session and one\n * visitor across every request the isolate serves. Import it there; do not track.\n */\nexport function getSession() {\n return (session ??= new Session());\n}\n"],"mappings":";;;;AAIA,MAAa,kBAAkB;;;;;;;;;;AA+B/B,MAAM,UAAU;AAEhB,SAAS,cAAyC;CAChD,MAAM,MAAM,OAAO,QAAQ,QAAQ,KAAK,OAAO;CAC/C,IAAI,CAAC,KAAK,OAAO,KAAA;CAEjB,MAAM,CAAC,SAAS,IAAI,iBAAiB,IAAI,MAAM,GAAG;CAClD,IAAI,YAAY,WAAW,CAAC,IAAI,OAAO,KAAA;CAEvC,MAAM,SAAS;EAAE;EAAI,eAAe,OAAO,aAAa;CAAE;CAC1D,IAAI,CAAC,OAAO,SAAS,OAAO,aAAa,GAAG,OAAO,KAAA;CACnD,OAAO;AACT;AAEA,SAAS,aAAa,EAAE,IAAI,iBAAgC;CAC1D,OAAO,QAAQ,QAAQ,KAAK,SAAS,GAAG,QAAQ,GAAG,GAAG,GAAG,eAAe;AAC1E;AAEA,IAAM,UAAN,MAAc;CAgBZ,cAAc;EAeL,KAAA,SAAA,WAAmB,gBAAgB,cAA+B;GACzE,MAAM,SAAS,YAAY;GAE3B,IAAI,UAAU,YAAY,OAAO,iBAAA,MAAkC;IAGjE,aAAa;KAAE,GAAG;KAAQ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K,eAAe,KAAK,IAAI;EAC7B,KAAK,kBAAkB;EAEvB,KAAK,SAAS;EACd,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,oBAAoB,YAAY;EAC1F,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,SAAS,IAAI;CACzE;AAgGF;AAEA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,SAAgB,aAAa;CAC3B,OAAQ,YAAY,IAAI,QAAQ;AAClC"}
1
+ {"version":3,"file":"session.mjs","names":["uuidv7"],"sources":["../../src/setup/session.ts"],"sourcesContent":["import { v7 as uuidv7 } from 'uuid';\nimport { keys } from '../constants/storage';\nimport { config } from './index';\n\nexport const SESSION_TIMEOUT = 30 * 60 * 1000;\n\n/**\n * The part of a session that outlives the page: its identity, and the clock the timeout is\n * measured against. GA4 keeps these in its `_ga_<container>` cookie — alongside the engaged flag,\n * which arrives with `session_engaged` later — and rereads them for every event, which is what\n * makes a session survive a reload, span a whole multipage visit, and stay shared between two\n * tabs of the same site. Holding them in memory instead, as this did, starts a new session on\n * every full navigation and gives every tab one of its own.\n */\ninterface StoredSession {\n id: string;\n /** When the last event was sent. The timeout is measured from here, and only from here. */\n lastEventTime: number;\n}\n\n/** The session an event belongs to, and whether that event is the one that started it. */\ninterface SessionForEvent {\n id: string;\n started: boolean;\n}\n\n/**\n * `<version>.<id>.<lastEventTime>`, compact and cookie-safe rather than JSON: `{`, `\"`\n * and `,` all have to be percent-encoded in a cookie, and a host that wants one session across\n * its subdomains will hand `setupAnalytics` a cookie-backed `storage`, where this has to survive\n * unchanged. A uuidv7 contains no dots, so the record splits cleanly.\n *\n * The version guards a change the parser could not otherwise survive. A field appended to the end\n * does not need one — a short record simply leaves it undefined.\n */\nconst VERSION = '1';\n\nfunction readSession(): StoredSession | undefined {\n const raw = config.storage.getItem(keys.session);\n if (!raw) return undefined;\n\n const [version, id, lastEventTime] = raw.split('.');\n if (version !== VERSION || !id) return undefined;\n\n const parsed = { id, lastEventTime: Number(lastEventTime) };\n if (!Number.isFinite(parsed.lastEventTime)) return undefined;\n return parsed;\n}\n\nfunction writeSession({ id, lastEventTime }: StoredSession) {\n config.storage.setItem(keys.session, `${VERSION}.${id}.${lastEventTime}`);\n}\n\nclass Session {\n /**\n * Engagement is deliberately not stored: it is the time this page has accrued and not yet\n * reported, so it belongs to the page, not to the session. GA4 draws the same line — its cookie\n * carries the session, while the engagement timer lives and dies with the document.\n *\n * `lastTickTime` is where the accumulator last settled up, rewritten on every tick — it is not\n * when the session began, and nothing here needs to know that.\n */\n private lastTickTime: number;\n private accumulatedTime: number;\n\n private active: boolean;\n private visible: boolean;\n private focused: boolean;\n\n constructor() {\n this.lastTickTime = Date.now();\n this.accumulatedTime = 0;\n\n this.active = true;\n this.visible = typeof document !== 'undefined' ? document.visibilityState === 'visible' : true;\n this.focused = typeof document !== 'undefined' ? document.hasFocus() : true;\n }\n\n /**\n * The session a batch of events belongs to: read the stored one, start a new one if it has\n * timed out or there is none, stamp it with when those events happened and write it back. Every\n * event goes through here, exactly as GA4 rereads and rewrites its cookie per event — caching\n * the session in memory would put the tabs back out of step with each other.\n */\n touch = (eventTime: number, lastEventTime = eventTime): SessionForEvent => {\n const stored = readSession();\n\n if (stored && eventTime - stored.lastEventTime <= SESSION_TIMEOUT) {\n // `Math.max`, because a batch that waited in a frozen tab can be older than what another\n // tab has since written, and a session must never be shortened by a late arrival.\n writeSession({ ...stored, lastEventTime: Math.max(stored.lastEventTime, lastEventTime) });\n return { id: stored.id, started: false };\n }\n\n // Engagement the previous session accrued but never reported dies with it rather than being\n // handed to its successor. GA4 does the same on `session_start`.\n this.accumulatedTime = 0;\n // Wall clock, not `eventTime`: this anchors the engagement timer for the page in front of the\n // visitor now, which a batch describing something that happened an hour ago says nothing about.\n this.lastTickTime = Date.now();\n\n const session: StoredSession = { id: uuidv7(), lastEventTime };\n writeSession(session);\n return { id: session.id, started: true };\n };\n\n /**\n * The id for an event that must not start a session — the engagement beacon, which reports what\n * the session accrued. A live session is extended, as any event extends it; one already past its\n * timeout still owns that engagement, so its id comes back without being revived into a session\n * no `session_start` ever announced. With nothing stored, no event was ever queued here, so\n * there is no session to report for, and none is started: it would never be announced.\n */\n extend = (): string | undefined => {\n const stored = readSession();\n if (!stored) return undefined;\n\n const now = Date.now();\n if (now - stored.lastEventTime <= SESSION_TIMEOUT) {\n writeSession({ ...stored, lastEventTime: now });\n }\n return stored.id;\n };\n\n /**\n * Ends the stored session for `reset()`, so the next event starts a new one and announces it.\n * Returns the session's id and the engagement it accrued and has not reported, for the caller\n * to report; one past its timeout still owns that engagement, as in `extend`, and is not\n * revived. The storage has no `removeItem`: an empty record reads as none.\n */\n end = (): { id: string | undefined; engagement_time_msec: number } => {\n const engagement_time_msec = this.flush();\n const id = readSession()?.id;\n config.storage.setItem(keys.session, '');\n return { id, engagement_time_msec };\n };\n\n isActive = () => this.active;\n\n updateActive = (active: boolean) => {\n this.active = active;\n };\n\n updateAccumulator = () => {\n const now = Date.now();\n if (this.focused && this.visible && this.active) {\n const delta = now - this.lastTickTime;\n if (delta > 0 && delta < SESSION_TIMEOUT) {\n this.accumulatedTime += delta;\n }\n }\n this.lastTickTime = now;\n };\n\n focus = () => {\n this.updateAccumulator();\n this.focused = true;\n };\n\n blur = () => {\n this.updateAccumulator();\n this.focused = false;\n };\n\n pageshow = () => {\n this.updateAccumulator();\n this.active = true;\n };\n\n pagehide = () => {\n this.updateAccumulator();\n this.active = false;\n };\n\n visibilitychange = (state: DocumentVisibilityState) => {\n this.updateAccumulator();\n this.visible = state === 'visible';\n };\n\n flush = () => {\n this.updateAccumulator();\n const engagementTime = this.accumulatedTime;\n this.accumulatedTime = 0;\n return engagementTime;\n };\n}\n\nlet session: Session | undefined;\n\n/**\n * The session, built the first time something asks for it.\n *\n * Deliberately not a module-scope `new Session()`. The constructor calls\n * `uuidv7()`, `uuid` draws its bytes from `crypto.getRandomValues`, and\n * Cloudflare Workers reject that outside a request handler:\n *\n * Disallowed operation called within global scope. Asynchronous I/O\n * (ex: fetch() or connect()), setting a timeout, and generating random\n * values are not allowed within global scope.\n *\n * Module scope in a Worker is evaluated once when the isolate boots and is\n * then shared by every request that isolate serves, so a random value drawn\n * there would be the same for all of them — which is why the runtime refuses\n * to produce one. A host that server-renders on Workers reaches this module\n * through `track()` on the server as well, and the throw happened as the\n * isolate booted, taking down every route before a component rendered.\n *\n * Everything here is per-visitor browser or app state, so deferring the\n * construction costs nothing and lets the server bundle be evaluated. It does\n * not make any of it safe to use there: this instance, `cache` and `config` are\n * module singletons, so calling `track()` on a server shares one session and one\n * visitor across every request the isolate serves. Import it there; do not track.\n */\nexport function getSession() {\n return (session ??= new Session());\n}\n"],"mappings":";;;;AAIA,MAAa,kBAAkB;;;;;;;;;;AA+B/B,MAAM,UAAU;AAEhB,SAAS,cAAyC;CAChD,MAAM,MAAM,OAAO,QAAQ,QAAQ,KAAK,OAAO;CAC/C,IAAI,CAAC,KAAK,OAAO,KAAA;CAEjB,MAAM,CAAC,SAAS,IAAI,iBAAiB,IAAI,MAAM,GAAG;CAClD,IAAI,YAAY,WAAW,CAAC,IAAI,OAAO,KAAA;CAEvC,MAAM,SAAS;EAAE;EAAI,eAAe,OAAO,aAAa;CAAE;CAC1D,IAAI,CAAC,OAAO,SAAS,OAAO,aAAa,GAAG,OAAO,KAAA;CACnD,OAAO;AACT;AAEA,SAAS,aAAa,EAAE,IAAI,iBAAgC;CAC1D,OAAO,QAAQ,QAAQ,KAAK,SAAS,GAAG,QAAQ,GAAG,GAAG,GAAG,eAAe;AAC1E;AAEA,IAAM,UAAN,MAAc;CAgBZ,cAAc;EAeL,KAAA,SAAA,WAAmB,gBAAgB,cAA+B;GACzE,MAAM,SAAS,YAAY;GAE3B,IAAI,UAAU,YAAY,OAAO,iBAAA,MAAkC;IAGjE,aAAa;KAAE,GAAG;KAAQ,eAAe,KAAK,IAAI,OAAO,eAAe,aAAa;IAAE,CAAC;IACxF,OAAO;KAAE,IAAI,OAAO;KAAI,SAAS;IAAM;GACzC;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AAM,iBAAiB,KAAK;GAC5B,KAAK,kBAAkB;GACvB,OAAO;EACT;EAlHE,KAAK,eAAe,KAAK,IAAI;EAC7B,KAAK,kBAAkB;EAEvB,KAAK,SAAS;EACd,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,oBAAoB,YAAY;EAC1F,KAAK,UAAU,OAAO,aAAa,cAAc,SAAS,SAAS,IAAI;CACzE;AA6GF;AAEA,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;AA0BJ,SAAgB,aAAa;CAC3B,OAAQ,YAAY,IAAI,QAAQ;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-analytics.cjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window {\n /** Undefined until the Google tag (gtag.js) script has loaded. */\n gtag?: Gtag['gtag'];\n }\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return false;\n }\n window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, user_data }: UpdateVisitorDTO) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n // No user is sign-out (`setVisitor({})`): GA keeps a set user_id for every later event on the\n // page, so it is cleared explicitly.\n window.gtag('set', 'user_id', user_id || null);\n if (user_data) window.gtag('set', 'user_data', user_data);\n}\n"],"mappings":";;AAWA,SAAgB,YACd,MACA,YACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C,OAAO;CACT;CACA,OAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEA,SAAgB,UAAU,EAAE,SAAS,aAA+B;CAClE,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CAGA,OAAO,KAAK,OAAO,WAAW,WAAW,IAAI;CAC7C,IAAI,WAAW,OAAO,KAAK,OAAO,aAAa,SAAS;AAC1D"}
1
+ {"version":3,"file":"google-analytics.cjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window {\n /** Undefined until the Google tag (gtag.js) script has loaded. */\n gtag?: Gtag['gtag'];\n }\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return false;\n }\n window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, user_data }: UpdateVisitorDTO) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n // No user is sign-out (`reset()`): GA keeps a set user_id for every later event on the page, so\n // it is cleared explicitly.\n window.gtag('set', 'user_id', user_id || null);\n if (user_data) window.gtag('set', 'user_data', user_data);\n}\n"],"mappings":";;AAWA,SAAgB,YACd,MACA,YACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C,OAAO;CACT;CACA,OAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEA,SAAgB,UAAU,EAAE,SAAS,aAA+B;CAClE,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CAGA,OAAO,KAAK,OAAO,WAAW,WAAW,IAAI;CAC7C,IAAI,WAAW,OAAO,KAAK,OAAO,aAAa,SAAS;AAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"google-analytics.mjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window {\n /** Undefined until the Google tag (gtag.js) script has loaded. */\n gtag?: Gtag['gtag'];\n }\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return false;\n }\n window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, user_data }: UpdateVisitorDTO) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n // No user is sign-out (`setVisitor({})`): GA keeps a set user_id for every later event on the\n // page, so it is cleared explicitly.\n window.gtag('set', 'user_id', user_id || null);\n if (user_data) window.gtag('set', 'user_data', user_data);\n}\n"],"mappings":";AAWA,SAAgB,YACd,MACA,YACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C,OAAO;CACT;CACA,OAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEA,SAAgB,UAAU,EAAE,SAAS,aAA+B;CAClE,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CAGA,OAAO,KAAK,OAAO,WAAW,WAAW,IAAI;CAC7C,IAAI,WAAW,OAAO,KAAK,OAAO,aAAa,SAAS;AAC1D"}
1
+ {"version":3,"file":"google-analytics.mjs","names":[],"sources":["../../src/third-parties/google-analytics.ts"],"sourcesContent":["import type { UpdateVisitorDTO } from '../schema/index';\nimport type { Gtag } from '../track/gtag';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\n\ndeclare global {\n interface Window {\n /** Undefined until the Google tag (gtag.js) script has loaded. */\n gtag?: Gtag['gtag'];\n }\n}\n\nexport function sendGAEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return false;\n }\n window.gtag('event', name, properties);\n}\n\nexport function setGAUser({ user_id, user_data }: UpdateVisitorDTO) {\n if (typeof window === 'undefined' || !window.gtag) {\n console.warn('GA has not been initialized');\n return;\n }\n // No user is sign-out (`reset()`): GA keeps a set user_id for every later event on the page, so\n // it is cleared explicitly.\n window.gtag('set', 'user_id', user_id || null);\n if (user_data) window.gtag('set', 'user_data', user_data);\n}\n"],"mappings":";AAWA,SAAgB,YACd,MACA,YACA;CACA,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C,OAAO;CACT;CACA,OAAO,KAAK,SAAS,MAAM,UAAU;AACvC;AAEA,SAAgB,UAAU,EAAE,SAAS,aAA+B;CAClE,IAAI,OAAO,WAAW,eAAe,CAAC,OAAO,MAAM;EACjD,QAAQ,KAAK,6BAA6B;EAC1C;CACF;CAGA,OAAO,KAAK,OAAO,WAAW,WAAW,IAAI;CAC7C,IAAI,WAAW,OAAO,KAAK,OAAO,aAAa,SAAS;AAC1D"}
@@ -18,20 +18,21 @@ function sendPosthogEvent(name, properties) {
18
18
  posthog_js.posthog.capture(name, properties);
19
19
  }
20
20
  /**
21
- * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's
22
- * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would
23
- * make PostHog treat it as an identified person, and PostHog does not merge one identified person
24
- * into another when the user later signs in, so the pre-sign-in events would stay split off.
21
+ * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's
22
+ * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an
23
+ * anonymous visitor by its own id would make PostHog treat it as an identified person, and
24
+ * PostHog does not merge one identified person into another when the user later signs in, so the
25
+ * pre-sign-in events would stay split off.
25
26
  *
26
- * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next
27
- * person on this page starts anonymous instead of merging into the one who left.
27
+ * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on
28
+ * this page starts anonymous instead of merging into the one who left.
28
29
  */
29
- function setPosthogUser({ user_id, distinct_id, user_data }) {
30
+ function setPosthogUser({ user_id, user_data }) {
30
31
  if (!user_id) {
31
32
  posthog_js.posthog.reset();
32
33
  return;
33
34
  }
34
- posthog_js.posthog.identify(distinct_id ?? user_id, { email: require_utils_field.getFirst(user_data?.email) });
35
+ posthog_js.posthog.identify(user_id, { email: require_utils_field.getFirst(user_data?.email) });
35
36
  }
36
37
  exports.sendPosthogEvent = sendPosthogEvent;
37
38
  exports.setPosthogUser = setPosthogUser;
@@ -1 +1 @@
1
- {"version":3,"file":"posthog.cjs","names":["getFirst"],"sources":["../../src/third-parties/posthog.ts"],"sourcesContent":["import { posthog } from 'posthog-js';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport type { VisitorIdentity } from '../visitor/types';\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendPosthogEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n // `document`, not `window`: React Native defines `window` as an alias of `global`, so a\n // window check would pass there and then throw on `window.location`, which it has no such\n // alias for. `posthog-js` is the browser SDK and cannot run there anyway.\n if (typeof document === 'undefined') return;\n if (metrics.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n posthog.capture(name, properties);\n}\n\n/**\n * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's\n * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would\n * make PostHog treat it as an identified person, and PostHog does not merge one identified person\n * into another when the user later signs in, so the pre-sign-in events would stay split off.\n *\n * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next\n * person on this page starts anonymous instead of merging into the one who left.\n */\nexport function setPosthogUser({ user_id, distinct_id, user_data }: VisitorIdentity) {\n if (!user_id) {\n posthog.reset();\n return;\n }\n posthog.identify(distinct_id ?? user_id, { email: getFirst(user_data?.email) });\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,iBACd,MACA,YACA;CAIA,IAAI,OAAO,aAAa,aAAa;CACrC,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,WAAA,QAAQ,QAAQ,MAAM,UAAU;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,EAAE,SAAS,aAAa,aAA8B;CACnF,IAAI,CAAC,SAAS;EACZ,WAAA,QAAQ,MAAM;EACd;CACF;CACA,WAAA,QAAQ,SAAS,eAAe,SAAS,EAAE,OAAOA,oBAAAA,SAAS,WAAW,KAAK,EAAE,CAAC;AAChF"}
1
+ {"version":3,"file":"posthog.cjs","names":["getFirst"],"sources":["../../src/third-parties/posthog.ts"],"sourcesContent":["import { posthog } from 'posthog-js';\nimport type { UpdateVisitorDTO } from '../schema/index';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendPosthogEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n // `document`, not `window`: React Native defines `window` as an alias of `global`, so a\n // window check would pass there and then throw on `window.location`, which it has no such\n // alias for. `posthog-js` is the browser SDK and cannot run there anyway.\n if (typeof document === 'undefined') return;\n if (metrics.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n posthog.capture(name, properties);\n}\n\n/**\n * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's\n * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an\n * anonymous visitor by its own id would make PostHog treat it as an identified person, and\n * PostHog does not merge one identified person into another when the user later signs in, so the\n * pre-sign-in events would stay split off.\n *\n * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on\n * this page starts anonymous instead of merging into the one who left.\n */\nexport function setPosthogUser({ user_id, user_data }: Omit<UpdateVisitorDTO, 'tags'>) {\n if (!user_id) {\n posthog.reset();\n return;\n }\n posthog.identify(user_id, { email: getFirst(user_data?.email) });\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,iBACd,MACA,YACA;CAIA,IAAI,OAAO,aAAa,aAAa;CACrC,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,WAAA,QAAQ,QAAQ,MAAM,UAAU;AAClC;;;;;;;;;;;AAYA,SAAgB,eAAe,EAAE,SAAS,aAA6C;CACrF,IAAI,CAAC,SAAS;EACZ,WAAA,QAAQ,MAAM;EACd;CACF;CACA,WAAA,QAAQ,SAAS,SAAS,EAAE,OAAOA,oBAAAA,SAAS,WAAW,KAAK,EAAE,CAAC;AACjE"}
@@ -1,14 +1,15 @@
1
1
  import { EventName, TrackName, TrackProperties } from "../track/types.cjs";
2
- import { VisitorIdentity } from "../visitor/types.cjs";
2
+ import { UpdateVisitorDTO } from "../schema/index.cjs";
3
3
  export declare function sendPosthogEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
4
4
  /**
5
- * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's
6
- * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would
7
- * make PostHog treat it as an identified person, and PostHog does not merge one identified person
8
- * into another when the user later signs in, so the pre-sign-in events would stay split off.
5
+ * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's
6
+ * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an
7
+ * anonymous visitor by its own id would make PostHog treat it as an identified person, and
8
+ * PostHog does not merge one identified person into another when the user later signs in, so the
9
+ * pre-sign-in events would stay split off.
9
10
  *
10
- * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next
11
- * person on this page starts anonymous instead of merging into the one who left.
11
+ * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on
12
+ * this page starts anonymous instead of merging into the one who left.
12
13
  */
13
- export declare function setPosthogUser({ user_id, distinct_id, user_data }: VisitorIdentity): void;
14
+ export declare function setPosthogUser({ user_id, user_data }: Omit<UpdateVisitorDTO, 'tags'>): void;
14
15
  //# sourceMappingURL=posthog.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"posthog.d.cts","names":[],"sources":["../../src/third-parties/posthog.ts"],"mappings":";;wBAOgB,iBAAiB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB;;;;;;;;;;wBAsBf,iBAAiB,SAAS,aAAa,aAAa"}
1
+ {"version":3,"file":"posthog.d.cts","names":[],"sources":["../../src/third-parties/posthog.ts"],"mappings":";;wBAOgB,iBAAiB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB;;;;;;;;;;;wBAuBf,iBAAiB,SAAS,aAAa,KAAK"}
@@ -1,14 +1,15 @@
1
1
  import { EventName, TrackName, TrackProperties } from "../track/types.mjs";
2
- import { VisitorIdentity } from "../visitor/types.mjs";
2
+ import { UpdateVisitorDTO } from "../schema/index.mjs";
3
3
  export declare function sendPosthogEvent<T extends EventName>(name: TrackName<T>, properties?: TrackProperties<T>): void;
4
4
  /**
5
- * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's
6
- * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would
7
- * make PostHog treat it as an identified person, and PostHog does not merge one identified person
8
- * into another when the user later signs in, so the pre-sign-in events would stay split off.
5
+ * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's
6
+ * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an
7
+ * anonymous visitor by its own id would make PostHog treat it as an identified person, and
8
+ * PostHog does not merge one identified person into another when the user later signs in, so the
9
+ * pre-sign-in events would stay split off.
9
10
  *
10
- * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next
11
- * person on this page starts anonymous instead of merging into the one who left.
11
+ * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on
12
+ * this page starts anonymous instead of merging into the one who left.
12
13
  */
13
- export declare function setPosthogUser({ user_id, distinct_id, user_data }: VisitorIdentity): void;
14
+ export declare function setPosthogUser({ user_id, user_data }: Omit<UpdateVisitorDTO, 'tags'>): void;
14
15
  //# sourceMappingURL=posthog.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"posthog.d.mts","names":[],"sources":["../../src/third-parties/posthog.ts"],"mappings":";;wBAOgB,iBAAiB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB;;;;;;;;;;wBAsBf,iBAAiB,SAAS,aAAa,aAAa"}
1
+ {"version":3,"file":"posthog.d.mts","names":[],"sources":["../../src/third-parties/posthog.ts"],"mappings":";;wBAOgB,iBAAiB,UAAU,WACzC,MAAM,UAAU,IAChB,aAAa,gBAAgB;;;;;;;;;;;wBAuBf,iBAAiB,SAAS,aAAa,KAAK"}
@@ -17,20 +17,21 @@ function sendPosthogEvent(name, properties) {
17
17
  posthog.capture(name, properties);
18
18
  }
19
19
  /**
20
- * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's
21
- * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would
22
- * make PostHog treat it as an identified person, and PostHog does not merge one identified person
23
- * into another when the user later signs in, so the pre-sign-in events would stay split off.
20
+ * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's
21
+ * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an
22
+ * anonymous visitor by its own id would make PostHog treat it as an identified person, and
23
+ * PostHog does not merge one identified person into another when the user later signs in, so the
24
+ * pre-sign-in events would stay split off.
24
25
  *
25
- * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next
26
- * person on this page starts anonymous instead of merging into the one who left.
26
+ * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on
27
+ * this page starts anonymous instead of merging into the one who left.
27
28
  */
28
- function setPosthogUser({ user_id, distinct_id, user_data }) {
29
+ function setPosthogUser({ user_id, user_data }) {
29
30
  if (!user_id) {
30
31
  posthog.reset();
31
32
  return;
32
33
  }
33
- posthog.identify(distinct_id ?? user_id, { email: getFirst(user_data?.email) });
34
+ posthog.identify(user_id, { email: getFirst(user_data?.email) });
34
35
  }
35
36
  export { sendPosthogEvent, setPosthogUser };
36
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"posthog.mjs","names":[],"sources":["../../src/third-parties/posthog.ts"],"sourcesContent":["import { posthog } from 'posthog-js';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\nimport type { VisitorIdentity } from '../visitor/types';\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendPosthogEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n // `document`, not `window`: React Native defines `window` as an alias of `global`, so a\n // window check would pass there and then throw on `window.location`, which it has no such\n // alias for. `posthog-js` is the browser SDK and cannot run there anyway.\n if (typeof document === 'undefined') return;\n if (metrics.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n posthog.capture(name, properties);\n}\n\n/**\n * Identify the visitor to PostHog as the person the server says it is — `distinct_id`, the user's\n * id once someone has signed in. Only then: identifying an anonymous visitor by its own id would\n * make PostHog treat it as an identified person, and PostHog does not merge one identified person\n * into another when the user later signs in, so the pre-sign-in events would stay split off.\n *\n * Without a user it is sign-out (`setVisitor({})`): PostHog's identity is reset, so the next\n * person on this page starts anonymous instead of merging into the one who left.\n */\nexport function setPosthogUser({ user_id, distinct_id, user_data }: VisitorIdentity) {\n if (!user_id) {\n posthog.reset();\n return;\n }\n posthog.identify(distinct_id ?? user_id, { email: getFirst(user_data?.email) });\n}\n"],"mappings":";;;AAKA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,iBACd,MACA,YACA;CAIA,IAAI,OAAO,aAAa,aAAa;CACrC,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,QAAQ,QAAQ,MAAM,UAAU;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,EAAE,SAAS,aAAa,aAA8B;CACnF,IAAI,CAAC,SAAS;EACZ,QAAQ,MAAM;EACd;CACF;CACA,QAAQ,SAAS,eAAe,SAAS,EAAE,OAAO,SAAS,WAAW,KAAK,EAAE,CAAC;AAChF"}
1
+ {"version":3,"file":"posthog.mjs","names":[],"sources":["../../src/third-parties/posthog.ts"],"sourcesContent":["import { posthog } from 'posthog-js';\nimport type { UpdateVisitorDTO } from '../schema/index';\nimport type { EventName, TrackName, TrackProperties } from '../track/types';\nimport { getFirst } from '../utils/field';\n\nconst metrics = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'];\n\nexport function sendPosthogEvent<T extends EventName>(\n name: TrackName<T>,\n properties?: TrackProperties<T>\n) {\n // `document`, not `window`: React Native defines `window` as an alias of `global`, so a\n // window check would pass there and then throw on `window.location`, which it has no such\n // alias for. `posthog-js` is the browser SDK and cannot run there anyway.\n if (typeof document === 'undefined') return;\n if (metrics.includes(name)) return;\n if (window.location.host.includes('127.0.0.1')) return;\n if (window.location.host.includes('localhost')) return;\n\n posthog.capture(name, properties);\n}\n\n/**\n * Identifies the visitor to PostHog as the signed-in user, by the user's id — the server's\n * `distinct_id` for the visitor once someone has signed in on it. Only a user: identifying an\n * anonymous visitor by its own id would make PostHog treat it as an identified person, and\n * PostHog does not merge one identified person into another when the user later signs in, so the\n * pre-sign-in events would stay split off.\n *\n * Without a user it is sign-out (`reset()`): PostHog's identity is reset, so the next person on\n * this page starts anonymous instead of merging into the one who left.\n */\nexport function setPosthogUser({ user_id, user_data }: Omit<UpdateVisitorDTO, 'tags'>) {\n if (!user_id) {\n posthog.reset();\n return;\n }\n posthog.identify(user_id, { email: getFirst(user_data?.email) });\n}\n"],"mappings":";;;AAKA,MAAM,UAAU;CAAC;CAAO;CAAO;CAAO;CAAO;CAAO;AAAM;AAE1D,SAAgB,iBACd,MACA,YACA;CAIA,IAAI,OAAO,aAAa,aAAa;CACrC,IAAI,QAAQ,SAAS,IAAI,GAAG;CAC5B,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAChD,IAAI,OAAO,SAAS,KAAK,SAAS,WAAW,GAAG;CAEhD,QAAQ,QAAQ,MAAM,UAAU;AAClC;;;;;;;;;;;AAYA,SAAgB,eAAe,EAAE,SAAS,aAA6C;CACrF,IAAI,CAAC,SAAS;EACZ,QAAQ,MAAM;EACd;CACF;CACA,QAAQ,SAAS,SAAS,EAAE,OAAO,SAAS,WAAW,KAAK,EAAE,CAAC;AACjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"gtag.cjs","names":[],"sources":["../../src/track/gtag.ts"],"sourcesContent":["/** reference: https://support.google.com/analytics/answer/13316687 */\nconst reservedWebEventNames = [\n 'app_remove',\n 'app_store_refund',\n 'app_store_subscription_cancel',\n 'app_store_subscription_renew',\n 'click',\n 'error',\n 'file_download',\n 'first_open',\n 'first_visit',\n 'form_start',\n 'form_submit',\n 'in_app_purchase',\n 'page_view',\n 'scroll',\n 'session_start',\n 'user_engagement',\n 'view_complete',\n 'video_progress',\n 'video_start',\n 'view_search_results',\n] as const;\n\nconst reservedAppEventNames = [\n 'ad_activeview',\n 'ad_click',\n 'ad_exposure',\n 'ad_impression',\n 'ad_query',\n 'ad_reward',\n 'adunit_exposure',\n 'app_clear_data',\n 'app_exception',\n 'app_install',\n 'app_remove',\n 'app_store_refund',\n 'app_update',\n 'app_upgrade',\n 'dynamic_link_app_open',\n 'dynamic_link_app_update',\n 'dynamic_link_first_open',\n 'error',\n 'firebase_campaign',\n 'firebase_in_app_message_action',\n 'firebase_in_app_message_dismiss',\n 'firebase_in_app_message_impression',\n 'first_open',\n 'first_visit',\n 'in_app_purchase',\n 'notification_dismiss',\n 'notification_foreground',\n 'notification_open',\n 'notification_receive',\n 'notification_send',\n 'os_update',\n 'screen_view',\n 'session_start',\n 'user_engagement',\n] as const;\n\nexport const reservedEventNames = [...reservedWebEventNames, ...reservedAppEventNames] as const;\n\ntype ReservedWebEventNames = (typeof reservedWebEventNames)[number];\ntype ReservedAppEventNames = (typeof reservedAppEventNames)[number];\nexport type ReservedEventNames = ReservedWebEventNames | ReservedAppEventNames;\n\nexport type ReservedEventValues =\n | 'cid'\n | 'currency'\n | 'customer_id'\n | 'customerid'\n | 'dclid'\n | 'gclid'\n | 'session_id'\n | 'sessionid'\n | 'sfmc_id'\n | 'sid'\n | 'srsltid'\n | 'uid'\n | 'user_id'\n | 'userid'\n | `_${string}`\n | `firebase_${string}`\n | `ga_${string}`\n | `google_${string}`\n | `gtag.${string}`;\n\nexport type ReservedUserPropertiesNames =\n | 'cid'\n | 'customer_id'\n | 'customerid'\n | 'first_open_after_install'\n | 'first_open_time'\n | 'first_visit_time'\n | 'google_allow_ad_personalization_signals'\n | 'last_advertising_id_reset'\n | 'last_deep_link_referrer'\n | 'last_gclid'\n | 'lifetime_user_engagement'\n | 'non_personalized_ads'\n | 'session_id'\n | 'session_number'\n | 'sessionid'\n | 'sfmc_id'\n | 'sid'\n | 'uid'\n | 'user_id'\n | 'userid'\n | `_${string}`\n | `firebase_${string}`\n | `ga_${string}`\n | `google_${string}`;\n\nexport type UserPropertiesValue = string | boolean | number | null | undefined;\nexport type UserProperties = {\n [key: string]: UserPropertiesValue;\n} & {\n [key in ReservedUserPropertiesNames]?: never;\n};\n\n/**\n * reference: https://support.google.com/analytics/answer/14078702\n * You must turn on user-provided data collection in Google Analytics.\n *\n * Validate your user-provided data implementation: https://support.google.com/analytics/answer/14171683\n *\n * Usage: gtag('set', 'user_data', { email: 'abc@abc.com' })\n *\n * To standardize the hash results, before hashing one of these values, you must:\n *\n * - Remove leading and trailing whitespaces.\n * - Convert the text to lowercase.\n * - Format phone numbers according to the E164 standard.\n * - Remove all periods (.) that precede the domain name in gmail.com and googlemail.com email addresses.\n * */\ntype UserProvidedDataAddress = {\n first_name?: string;\n last_name?: string;\n street?: string;\n city?: string;\n /** User province, state, or region. Example: `Hampshire` */\n region?: string;\n postal_code?: string;\n /**\n * User country code.\n * Example: 'UK'. Use 2-letter country codes, per the ISO 3166-1 alpha-2 standard.\n */\n country?: string;\n};\n\n/**\n * To standardize the hash results, before hashing one of these values, you must:\n *\n * - Remove leading and trailing whitespaces.\n * - Convert the text to lowercase.\n * - Format phone numbers according to the E164 standard.\n * - Remove all periods (.) that precede the domain name in gmail.com and googlemail.com email addresses.\n */\nexport type UserProvidedData = {\n email?: string | string[];\n /**\n * User phone number. Must be in E.164 format, which means it must be 11 to 15 digits including a\n * plus sign (+) prefix and country code with no dashes, parentheses, or spaces.\n *\n * Example: ‘+11231234567’\n */\n phone_number?: string | string[];\n address?: UserProvidedDataAddress | UserProvidedDataAddress[];\n};\n\nexport type GaId = `G-${Uppercase<string>}`;\n\nexport type CampaignMedium =\n | 'email'\n | 'organic'\n | 'cpc'\n | 'banner'\n | 'social'\n | 'referral'\n | 'affiliate'\n | 'video'\n | 'display'\n | 'sms'\n | 'push'\n | 'qr'\n | 'audio'\n | (string & {});\n\nexport type CampaignSource =\n | 'google' // don't need to set\n | 'googleads'\n | 'bing'\n | 'bingads'\n | 'metaads'\n | 'facebook'\n | 'twitter'\n | 'linkedin'\n | 'instagram'\n | 'tiktok'\n | 'youtube'\n | 'newsletter'\n | `website_${string}`\n | `affiliate_${string}`\n | (string & {});\n\nexport type Campaign = {\n id?: string;\n name?: string;\n term?: string;\n content?: string;\n medium?: CampaignMedium;\n source?: CampaignSource;\n};\n\nexport type Config = {\n allow_google_signals?: boolean;\n allow_ad_personalization_signals?: boolean;\n\n campaign_content?: string;\n campaign_id?: string;\n campaign_medium?: CampaignMedium;\n campaign_name?: string;\n campaign_source?: CampaignSource;\n campaign_term?: string;\n\n /**\n * @deprecated\n * Key Point: Use the campaign_ prefixed version of each campaign value instead of this field.\n */\n campaign?: Campaign;\n\n client_id?: string;\n content_group?: string;\n\n cookie_domain?: 'none' | 'auto' | (string & {});\n cookie_expires?: number;\n cookie_flags?: string;\n cookie_path?: string;\n cookie_prefix?: string;\n cookie_update?: boolean;\n\n ignore_referrer?: boolean;\n language?: string;\n\n page_location?: string;\n page_referrer?: string;\n page_title?: string;\n\n send_page_view?: boolean;\n screen_resolution?: `${number}x${number}`;\n user_id?: string;\n user_properties?: UserProperties;\n};\n\n/** GA4 wants one of `item_id` / `item_name` on every item; the rest is optional. */\ntype ItemIdentity =\n | { item_id: string; item_name?: string }\n | { item_id?: string; item_name: string };\n\n/** The id an item is reported under elsewhere: `item_id`, or `item_name` when that is all it has. */\nexport function itemKey(item: Item): string {\n // One of the two is required by ItemIdentity; TypeScript cannot see that through the union.\n return item.item_id ?? (item.item_name as string);\n}\n\nexport type Item = ItemIdentity & {\n affiliation?: 'Google Store' | (string & {});\n coupon?: string;\n discount?: number;\n index?: number;\n item_brand?: string;\n item_category?: string;\n item_category2?: string;\n item_category3?: string;\n item_category4?: string;\n item_category5?: string;\n item_list_id?: string;\n item_list_name?: string;\n item_variant?: string;\n location_id?: string;\n price?: number;\n quantity?: number;\n};\n\nexport type PromotionItem = {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n};\n\nexport type SurveyProperties = {\n id?: string;\n feature?: Lowercase<string>;\n trigger?: Lowercase<string>;\n};\n\nexport type SurveyQA = {\n q1: string;\n a1: string;\n q2?: string;\n a2?: string;\n q3?: string;\n a3?: string;\n q4?: string;\n a4?: string;\n q5?: string;\n a5?: string;\n q6?: string;\n a6?: string;\n completed?: boolean;\n};\n\nexport type NPSScore = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | (number & {});\nexport type CASTScore = 1 | 2 | 3 | 4 | 5 | (number & {});\nexport type CESScore = 1 | 2 | 3 | 4 | 5 | (number & {});\n\n/** ref: https://support.google.com/analytics/answer/9216061 */\nexport type EnhancedMeasurementEvents = {\n page_view: {\n page_path: string;\n page_title: string;\n page_referrer?: string;\n page_location?: string;\n previous_page_path?: string;\n engagement_time_msec?: number;\n };\n // Scrolls: the first time a user reaches the bottom of each page\n // (i.e., when a 90% vertical depth becomes visible)\n scroll: {\n engagement_time_msec: number;\n };\n // Outbound clicks\n click: {\n link_id: string;\n link_url: string;\n link_text: string; // added\n link_domain: string;\n link_classes: string;\n outbound: boolean;\n };\n // Site search\n view_search_results: {\n search_term: string;\n };\n // Video engagement\n video_start: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n video_progress: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n video_complete: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n // File downloads:\n file_download: {\n file_extension: string;\n file_name: string;\n link_classes: string;\n link_id: string;\n link_text: string;\n link_url: string;\n };\n // Form interactions\n form_start: {\n form_id: string;\n form_name: string;\n form_destination: string;\n };\n form_submit: {\n form_id: string;\n form_name: string;\n form_destination: string;\n form_submit_text: string;\n };\n};\n\n/** ref: https://support.google.com/analytics/answer/9234069 */\nexport type AutomaticallyCollectedEvents = EnhancedMeasurementEvents & {\n first_visit: {\n page_path: string;\n page_title: string;\n page_referrer?: string;\n page_location?: string;\n };\n first_open: {\n screen_name: string;\n screen_class: string;\n };\n in_app_purchase: {\n product_id: string;\n price: number;\n value: number;\n currency: string;\n quantity: number;\n subscription?: boolean;\n free_trial?: boolean;\n introductory_price?: number;\n };\n notification_dismiss: {\n // Android only\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_foreground: {\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_type: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_open: {\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_receive: {\n // Android only\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_type: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n // Note: The 'screen_view' event is automatically sent only when using Android or iOS native SDKs.\n // If you are using React Native, you need to send this event manually; it should not be ignored.\n session_start: undefined;\n user_engagement: {\n engagement_time_msec: number;\n trigger: 'pagehide' | 'visibilitychange' | 'background';\n };\n};\n\n/**\n * ref: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag\n * ref: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event\n * */\nexport type RecommendedEvents = {\n // Google Analytics 4 Recommended Events\n add_payment_info: {\n currency: string;\n value: number;\n coupon?: string;\n payment_type?: string;\n items: Item[];\n };\n add_shipping_info: {\n currency: string;\n value: number;\n coupon?: string;\n shipping_tier?: string;\n items: Item[];\n };\n add_to_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n add_to_wishlist: {\n currency: string;\n value: number;\n items: Item[];\n };\n begin_checkout: {\n currency: string;\n value: number;\n coupon?: string;\n items: Item[];\n source?: string; // added\n };\n // The one lead event GA4 lists with both optional (each required if the other is set).\n close_convert_lead: {\n currency?: string;\n value?: number;\n };\n close_unconvert_lead: {\n currency: string;\n value: number;\n unconvert_lead_reason?: string;\n };\n disqualify_lead: {\n currency: string;\n value: number;\n disqualified_lead_reason?: string;\n };\n earn_virtual_currency: {\n virtual_currency_name?: string;\n value?: number;\n };\n generate_lead: {\n currency: string;\n value: number;\n lead_source?: string;\n };\n join_group: {\n group_id?: string;\n };\n level_end: {\n level_name?: string;\n success?: boolean;\n };\n level_start: {\n level_name?: string;\n };\n level_up: {\n level?: number;\n level_name?: string;\n character?: string;\n };\n login: {\n method?:\n | 'google'\n | 'apple'\n | 'facebook'\n | 'twitter'\n | 'linkedin'\n | 'github'\n | 'microsoft'\n | 'wechat'\n | 'onetap'\n | 'phone'\n | 'email'\n | (string & {});\n source?: string; // added\n };\n post_score: {\n score: number;\n level?: number;\n character?: string;\n };\n purchase: {\n currency: string;\n value: number;\n transaction_id: string;\n /**\n * `new`: no purchase in the lookback window (GA4 defaults to 540 days); `returning`:\n * one within it. Leave unset when unsure, e.g. a guest checkout.\n */\n customer_type?: 'new' | 'returning';\n coupon?: string;\n shipping?: number; // Shipping cost associated with a transaction.\n tax?: number;\n items?: Item[];\n source?: string; // added\n };\n qualify_lead: {\n currency: string;\n value: number;\n };\n refund: {\n currency: string;\n value: number;\n transaction_id: string;\n coupon?: string;\n shipping?: number;\n tax?: number;\n items?: Item[];\n };\n remove_from_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n search: {\n search_term: string;\n };\n select_content: {\n content_type?: string;\n content_id?: string;\n };\n select_item: {\n item_list_id?: string;\n item_list_name?: string;\n items: Item[];\n };\n select_promotion: {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n items?: (Item & PromotionItem)[];\n };\n share: {\n method?: string;\n content_type?: string;\n item_id?: string;\n system_activity_type?: string; // added\n platform_post_id?: string; // added\n };\n sign_up: {\n method?: string;\n source?: string; // added\n };\n spend_virtual_currency: {\n value: number;\n virtual_currency_name: string;\n item_name?: string;\n };\n tutorial_begin: undefined;\n tutorial_complete: undefined;\n unlock_achievement: {\n achievement_id: string;\n };\n view_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n view_item: {\n currency: string;\n value: number;\n items: Item[];\n };\n view_item_list: {\n currency: string;\n item_list_id?: string;\n item_list_name?: string;\n items: Item[];\n };\n view_promotion: {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n items: (Item & PromotionItem)[];\n };\n working_lead: {\n currency: string;\n value: number;\n lead_status?: string;\n };\n\n // Firebase Analytics events, event_name 40 characters limit, 25 parameters limit\n ad_impression: {\n value?: number;\n currency?: string;\n ad_format?: string;\n ad_platform?: string;\n ad_source?: string;\n ad_unit_name?: string;\n };\n app_open: undefined;\n campaign_details: {\n source: string;\n medium: string;\n campaign: string;\n term?: string;\n content?: string;\n aclid?: string;\n cp1?: string;\n };\n screen_view: {\n screen_name?: string;\n screen_class?: string;\n previous_screen_class?: string; // added\n engagement_time_msec?: number;\n };\n};\n\n/**\n * Extra commonly used events that are NOT part of the GA standard event set.\n * Added to satisfy additional analytics needs.\n */\nexport type AddedRecommendedEvents = {\n logout: undefined;\n trial_begin: {\n currency: string;\n value: number;\n source?: string; // added\n items?: Item[]; // added, the plan(s) enrolled (first item's id maps to OpenAI plan_id)\n };\n subscribe: {\n currency: string;\n value: number;\n source?: string; // added\n items?: Item[]; // added, the plan(s) enrolled (first item's id maps to OpenAI plan_id)\n };\n // survey\n survey_shown: SurveyProperties;\n survey_sent: SurveyProperties & SurveyQA;\n survey_dismissed: SurveyProperties;\n /**\n * Net promoter score: Get an industry-recognized benchmark\n * How likely are you to recommend us to a friend?\n * */\n nps_shown: SurveyProperties;\n nps_sent: SurveyProperties & { score: NPSScore; feedback?: string };\n nps_dismissed: SurveyProperties;\n /**\n * Customer satisfaction score: Works best after a checkout or support flow\n * How satisfied are you with xxx?\n * */\n cast_shown: SurveyProperties;\n cast_sent: SurveyProperties & { score: CASTScore; feedback?: string };\n cast_dismissed: SurveyProperties;\n /**\n * Customer effort score: Works well with churn surveys\n * How easy is it to use the feature?\n * */\n ces_shown: SurveyProperties;\n ces_sent: SurveyProperties & { score: CESScore; feedback?: string };\n ces_dismissed: SurveyProperties;\n};\n\nexport type StandardEvents = AutomaticallyCollectedEvents &\n RecommendedEvents &\n AddedRecommendedEvents;\n\n/**\n * reference: https://developers.google.com/analytics/devguides/collection/ga4/reference/config\n * reference: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag\n */\nexport interface Gtag {\n /**\n * To disable advertising features based on third-party advertising identifiers, set\n * allow_google_signals to false.\n *\n * @param event\n * @param option\n * @param allow - Whether to allow Google signals.\n * @default true\n */\n gtag(event: 'set', option: 'allow_google_signals', allow: boolean): void;\n\n /**\n * Set to false to disable advertising personalization features.\n *\n * @param event\n * @param option\n * @param allow - Whether to allow ad personalization signals.\n * @default true\n */\n gtag(event: 'set', option: 'allow_ad_personalization_signals', allow: boolean): void;\n\n /**\n * Used for A/B testing and content-targeted ads. Use campaign_content to differentiate ads or\n * links that point to the same URL.\n */\n gtag(event: 'set', option: 'campaign_content', content: string): void;\n\n /**\n * Used to identify which campaign this referral references. Use campaign_id to identify a\n * specific campaign.\n */\n gtag(event: 'set', option: 'campaign_id', id: string): void;\n\n /** Use campaign_medium to identify a medium such as email or cost-per-click. */\n gtag(event: 'set', option: 'campaign_medium', medium: CampaignMedium): void;\n\n /**\n * Used for keyword analysis. Use campaign_name to identify a specific product promotion or\n * strategic campaign.\n */\n gtag(event: 'set', option: 'campaign_name', name: string): void;\n\n /** Use campaign_source to identify a search engine, newsletter name, or other source. */\n gtag(event: 'set', option: 'campaign_source', source: CampaignSource): void;\n\n /** Used for paid search. Use campaign_term to note the keywords for this ad. */\n gtag(event: 'set', option: 'campaign_term', term: string): void;\n\n /**\n * @deprecated\n * Key Point: Use the campaign_ prefixed version of each campaign value instead of this field.\n */\n gtag(event: 'set', option: 'campaign', params: Campaign): void;\n\n /**\n * Pseudonymously identifies a browser instance. By default, this value is stored as part of the\n * first-party Analytics cookie with a two-year expiration.\n */\n gtag(event: 'set', option: 'client_id', id: string): void;\n\n /** example: gtag('set', 'content_group', '/news/sports'); */\n gtag(event: 'set', option: 'content_group', group: string): void;\n\n /**\n * Specifies the domain used to store the analytics cookie.\n * Set to 'none' to set the cookie without specifying a domain.\n * Set to 'auto' (the default value) to set the cookie to the top level domain plus one\n * subdomain (eTLD +1). For example, if cookie_domain is set to 'auto' https://example.com would\n * use example.com for the domain, and https://subdomain.example.com would also use example.com\n * for the domain.\n *\n * @param event\n * @param option\n * @param domain - The domain used to store the analytics cookie.\n * @default 'auto'\n */\n gtag(event: 'set', option: 'cookie_domain', domain: 'none' | 'auto' | (string & {})): void;\n\n /**\n * Every time a hit is sent to Google Analytics, the cookie expiration time is updated to be the\n * current time plus the value of the cookie_expires field. This means that if you use the default\n * value time of two years (63,072,000 seconds), and a user visits your site every month, their\n * cookie will never expire.\n *\n * If you set the cookie_expires time to 0 (zero) seconds, the cookie turns into a session-based\n * cookie and expires once the current browser session ends.\n *\n * Caution: If you set the cookie to expire too quickly, you will inflate your user count and\n * decrease the quality of your measurement.\n *\n * @param event\n * @param option\n * @param expires - The number of seconds until the cookie expires.\n * @default 63072000\n */\n gtag(event: 'set', option: 'cookie_expires', expires: number): void;\n\n /**\n * Appends additional flags to the cookie when set. Flags must be separated by semicolons. See\n * [write a new cookie](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#write_a_new_cookie) for some examples of flags to set.\n */\n gtag(event: 'set', option: 'cookie_flags', flags: string): void;\n\n /** Specifies the subpath used to store the analytics cookie. */\n gtag(event: 'set', option: 'cookie_path', path: string): void;\n\n /** Specifies a prefix to prepend to analytics cookie names. */\n gtag(event: 'set', option: 'cookie_prefix', prefix: string): void;\n\n /**\n * When cookie_update is set to true, gtag.js will update cookies on each page load. This will\n * update the cookie expiration to be set relative to the most recent visit to the site. For\n * example, if cookie expiration is set to one week, and a user visits using the same browser\n * every five days, the cookie expiration will be updated on each visit and will effectively\n * never expire.\n *\n * When set to false, cookies are not updated on each page load. This has the effect of cookie\n * expiration being relative to the first time a user visited the site.\n *\n * @param event\n * @param option\n * @param update - Whether to update the cookie on each page load.\n * @default true\n */\n gtag(event: 'set', option: 'cookie_update', update: boolean): void;\n\n /**\n * Set to true to indicate to Analytics that the referrer shouldn't be displayed as a traffic\n * source. [Learn when to use this field](https://support.google.com/analytics/answer/10327750#set-parameter)\n *\n * @param event\n * @param option\n * @param ignore - Whether to ignore the referrer.\n * @default false\n */\n gtag(event: 'set', option: 'ignore_referrer', ignore: boolean): void;\n\n /**\n * Specifies the language preference of the user. Defaults to the user's `navigator.language` value.\n *\n * @param event\n * @param option\n * @param language - The language preference of the user.\n * @default navigator.language\n */\n gtag(event: 'set', option: 'language', language: string): void;\n\n /**\n * Specifies the full URL of the page. Defaults to the user's `document.location` value.\n *\n * @param event\n * @param option\n * @param location - The full URL of the page. Character limit 1000\n * @default document.location\n */\n gtag(event: 'set', option: 'page_location', location: string): void;\n\n /**\n * Specifies which referral source brought traffic to a page. This value is also used to compute\n * the traffic source. The format of this value is a URL. Defaults to the user's `document.referrer`\n * value.\n *\n * @param event\n * @param option\n * @param referrer - The referral source. Character limit 420\n * @default document.referrer\n */\n gtag(event: 'set', option: 'page_referrer', referrer: string): void;\n\n /**\n * The title of the page or document. Defaults to the user's `document.title` value.\n *\n * @param event\n * @param option\n * @param title - The title of the page or document. Character limit 300\n * @default document.title\n */\n gtag(event: 'set', option: 'page_title', title: string): void;\n\n /**\n * Set to false to prevent the default snippet from sending a page_view.\n *\n * @param event\n * @param option\n * @param send - Whether to send a page_view.\n * @default true\n */\n gtag(event: 'set', option: 'send_page_view', send: boolean): void;\n\n /**\n * Specifies the resolution of the screen. Should be two positive integers separated by an x. For\n * example, for an 800px by 600px screen, the value would be 800x600. Calculated from the user's\n * window.screen value.\n *\n * @param event\n * @param option\n * @param resolution - The resolution of the screen.\n * @default window.screen\n */\n gtag(event: 'set', option: 'screen_resolution', resolution: `${number}x${number}`): void;\n\n /**\n * Specifies a known identifier for a user provided by the site owner/library user. It must not\n * itself be PII (personally identifiable information). The value should never be persisted in\n * Google Analytics cookies or other Analytics-provided storage.\n *\n * @param event\n * @param option\n * @param userId - The user ID. Character limit 256. `null` clears it on sign-out.\n */\n gtag(event: 'set', option: 'user_id', userId: string | null): void;\n\n /**\n * User properties are attributes that can be used to describe segments of your user base, such\n * as language preference or geographic location. Up to 25 additional user properties can be set\n * per project.\n *\n * @param event\n * @param option\n * @param properties\n */\n gtag(event: 'set', option: 'user_properties', properties: UserProperties): void;\n\n gtag(event: 'set', option: 'user_data', data: UserProvidedData): void;\n\n /**\n * gtag('config', ...) Set for a single stream\n * gtag('set', ...) Set globally\n */\n gtag(event: 'config', gaId: GaId, config?: Config): void;\n\n gtag<T extends string>(\n event: 'event',\n eventName: T extends keyof StandardEvents ? T : string,\n eventParams?: T extends keyof StandardEvents\n ? StandardEvents[T]\n : Record<string, string | number | boolean | null | undefined>\n ): void;\n}\n"],"mappings":";;;AACA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,qBAAqB,CAAC,GAAG,uBAAuB,GAAG,qBAAqB;;AAwMrF,SAAgB,QAAQ,MAAoB;CAE1C,OAAO,KAAK,WAAY,KAAK;AAC/B"}
1
+ {"version":3,"file":"gtag.cjs","names":[],"sources":["../../src/track/gtag.ts"],"sourcesContent":["/** reference: https://support.google.com/analytics/answer/13316687 */\nconst reservedWebEventNames = [\n 'app_remove',\n 'app_store_refund',\n 'app_store_subscription_cancel',\n 'app_store_subscription_renew',\n 'click',\n 'error',\n 'file_download',\n 'first_open',\n 'first_visit',\n 'form_start',\n 'form_submit',\n 'in_app_purchase',\n 'page_view',\n 'scroll',\n 'session_start',\n 'user_engagement',\n 'view_complete',\n 'video_progress',\n 'video_start',\n 'view_search_results',\n] as const;\n\nconst reservedAppEventNames = [\n 'ad_activeview',\n 'ad_click',\n 'ad_exposure',\n 'ad_impression',\n 'ad_query',\n 'ad_reward',\n 'adunit_exposure',\n 'app_clear_data',\n 'app_exception',\n 'app_install',\n 'app_remove',\n 'app_store_refund',\n 'app_update',\n 'app_upgrade',\n 'dynamic_link_app_open',\n 'dynamic_link_app_update',\n 'dynamic_link_first_open',\n 'error',\n 'firebase_campaign',\n 'firebase_in_app_message_action',\n 'firebase_in_app_message_dismiss',\n 'firebase_in_app_message_impression',\n 'first_open',\n 'first_visit',\n 'in_app_purchase',\n 'notification_dismiss',\n 'notification_foreground',\n 'notification_open',\n 'notification_receive',\n 'notification_send',\n 'os_update',\n 'screen_view',\n 'session_start',\n 'user_engagement',\n] as const;\n\nexport const reservedEventNames = [...reservedWebEventNames, ...reservedAppEventNames] as const;\n\ntype ReservedWebEventNames = (typeof reservedWebEventNames)[number];\ntype ReservedAppEventNames = (typeof reservedAppEventNames)[number];\nexport type ReservedEventNames = ReservedWebEventNames | ReservedAppEventNames;\n\nexport type ReservedEventValues =\n | 'cid'\n | 'currency'\n | 'customer_id'\n | 'customerid'\n | 'dclid'\n | 'gclid'\n | 'session_id'\n | 'sessionid'\n | 'sfmc_id'\n | 'sid'\n | 'srsltid'\n | 'uid'\n | 'user_id'\n | 'userid'\n | `_${string}`\n | `firebase_${string}`\n | `ga_${string}`\n | `google_${string}`\n | `gtag.${string}`;\n\nexport type ReservedUserPropertiesNames =\n | 'cid'\n | 'customer_id'\n | 'customerid'\n | 'first_open_after_install'\n | 'first_open_time'\n | 'first_visit_time'\n | 'google_allow_ad_personalization_signals'\n | 'last_advertising_id_reset'\n | 'last_deep_link_referrer'\n | 'last_gclid'\n | 'lifetime_user_engagement'\n | 'non_personalized_ads'\n | 'session_id'\n | 'session_number'\n | 'sessionid'\n | 'sfmc_id'\n | 'sid'\n | 'uid'\n | 'user_id'\n | 'userid'\n | `_${string}`\n | `firebase_${string}`\n | `ga_${string}`\n | `google_${string}`;\n\nexport type UserPropertiesValue = string | boolean | number | null | undefined;\nexport type UserProperties = {\n [key: string]: UserPropertiesValue;\n} & {\n [key in ReservedUserPropertiesNames]?: never;\n};\n\n/**\n * reference: https://support.google.com/analytics/answer/14078702\n * You must turn on user-provided data collection in Google Analytics.\n *\n * Validate your user-provided data implementation: https://support.google.com/analytics/answer/14171683\n *\n * Usage: gtag('set', 'user_data', { email: 'abc@abc.com' })\n *\n * To standardize the hash results, before hashing one of these values, you must:\n *\n * - Remove leading and trailing whitespaces.\n * - Convert the text to lowercase.\n * - Format phone numbers according to the E164 standard.\n * - Remove all periods (.) that precede the domain name in gmail.com and googlemail.com email addresses.\n * */\ntype UserProvidedDataAddress = {\n first_name?: string;\n last_name?: string;\n street?: string;\n city?: string;\n /** User province, state, or region. Example: `Hampshire` */\n region?: string;\n postal_code?: string;\n /**\n * User country code.\n * Example: 'UK'. Use 2-letter country codes, per the ISO 3166-1 alpha-2 standard.\n */\n country?: string;\n};\n\n/**\n * To standardize the hash results, before hashing one of these values, you must:\n *\n * - Remove leading and trailing whitespaces.\n * - Convert the text to lowercase.\n * - Format phone numbers according to the E164 standard.\n * - Remove all periods (.) that precede the domain name in gmail.com and googlemail.com email addresses.\n */\nexport type UserProvidedData = {\n email?: string | string[];\n /**\n * User phone number. Must be in E.164 format, which means it must be 11 to 15 digits including a\n * plus sign (+) prefix and country code with no dashes, parentheses, or spaces.\n *\n * Example: ‘+11231234567’\n */\n phone_number?: string | string[];\n address?: UserProvidedDataAddress | UserProvidedDataAddress[];\n};\n\nexport type GaId = `G-${Uppercase<string>}`;\n\nexport type CampaignMedium =\n | 'email'\n | 'organic'\n | 'cpc'\n | 'banner'\n | 'social'\n | 'referral'\n | 'affiliate'\n | 'video'\n | 'display'\n | 'sms'\n | 'push'\n | 'qr'\n | 'audio'\n | (string & {});\n\nexport type CampaignSource =\n | 'google' // don't need to set\n | 'googleads'\n | 'bing'\n | 'bingads'\n | 'metaads'\n | 'facebook'\n | 'twitter'\n | 'linkedin'\n | 'instagram'\n | 'tiktok'\n | 'youtube'\n | 'newsletter'\n | `website_${string}`\n | `affiliate_${string}`\n | (string & {});\n\nexport type Campaign = {\n id?: string;\n name?: string;\n term?: string;\n content?: string;\n medium?: CampaignMedium;\n source?: CampaignSource;\n};\n\nexport type Config = {\n allow_google_signals?: boolean;\n allow_ad_personalization_signals?: boolean;\n\n campaign_content?: string;\n campaign_id?: string;\n campaign_medium?: CampaignMedium;\n campaign_name?: string;\n campaign_source?: CampaignSource;\n campaign_term?: string;\n\n /**\n * @deprecated\n * Key Point: Use the campaign_ prefixed version of each campaign value instead of this field.\n */\n campaign?: Campaign;\n\n client_id?: string;\n content_group?: string;\n\n cookie_domain?: 'none' | 'auto' | (string & {});\n cookie_expires?: number;\n cookie_flags?: string;\n cookie_path?: string;\n cookie_prefix?: string;\n cookie_update?: boolean;\n\n ignore_referrer?: boolean;\n language?: string;\n\n page_location?: string;\n page_referrer?: string;\n page_title?: string;\n\n send_page_view?: boolean;\n screen_resolution?: `${number}x${number}`;\n user_id?: string;\n user_properties?: UserProperties;\n};\n\n/** GA4 wants one of `item_id` / `item_name` on every item; the rest is optional. */\ntype ItemIdentity =\n | { item_id: string; item_name?: string }\n | { item_id?: string; item_name: string };\n\n/** The id an item is reported under elsewhere: `item_id`, or `item_name` when that is all it has. */\nexport function itemKey(item: Item): string {\n // One of the two is required by ItemIdentity; TypeScript cannot see that through the union.\n return item.item_id ?? (item.item_name as string);\n}\n\nexport type Item = ItemIdentity & {\n affiliation?: 'Google Store' | (string & {});\n coupon?: string;\n discount?: number;\n index?: number;\n item_brand?: string;\n item_category?: string;\n item_category2?: string;\n item_category3?: string;\n item_category4?: string;\n item_category5?: string;\n item_list_id?: string;\n item_list_name?: string;\n item_variant?: string;\n location_id?: string;\n price?: number;\n quantity?: number;\n};\n\nexport type PromotionItem = {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n};\n\nexport type SurveyProperties = {\n id?: string;\n feature?: Lowercase<string>;\n trigger?: Lowercase<string>;\n};\n\nexport type SurveyQA = {\n q1: string;\n a1: string;\n q2?: string;\n a2?: string;\n q3?: string;\n a3?: string;\n q4?: string;\n a4?: string;\n q5?: string;\n a5?: string;\n q6?: string;\n a6?: string;\n completed?: boolean;\n};\n\nexport type NPSScore = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | (number & {});\nexport type CASTScore = 1 | 2 | 3 | 4 | 5 | (number & {});\nexport type CESScore = 1 | 2 | 3 | 4 | 5 | (number & {});\n\n/** ref: https://support.google.com/analytics/answer/9216061 */\nexport type EnhancedMeasurementEvents = {\n page_view: {\n page_path: string;\n page_title: string;\n page_referrer?: string;\n page_location?: string;\n previous_page_path?: string;\n engagement_time_msec?: number;\n };\n // Scrolls: the first time a user reaches the bottom of each page\n // (i.e., when a 90% vertical depth becomes visible)\n scroll: {\n engagement_time_msec: number;\n };\n // Outbound clicks\n click: {\n link_id: string;\n link_url: string;\n link_text: string; // added\n link_domain: string;\n link_classes: string;\n outbound: boolean;\n };\n // Site search\n view_search_results: {\n search_term: string;\n };\n // Video engagement\n video_start: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n video_progress: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n video_complete: {\n video_current_time: number;\n video_duration: number;\n video_percent: number;\n video_provider: 'youtube' | 'vimeo' | 'html5' | (string & {});\n video_title: string;\n video_url: string;\n visible: boolean;\n };\n // File downloads:\n file_download: {\n file_extension: string;\n file_name: string;\n link_classes: string;\n link_id: string;\n link_text: string;\n link_url: string;\n };\n // Form interactions\n form_start: {\n form_id: string;\n form_name: string;\n form_destination: string;\n };\n form_submit: {\n form_id: string;\n form_name: string;\n form_destination: string;\n form_submit_text: string;\n };\n};\n\n/** ref: https://support.google.com/analytics/answer/9234069 */\nexport type AutomaticallyCollectedEvents = EnhancedMeasurementEvents & {\n first_visit: {\n page_path: string;\n page_title: string;\n page_referrer?: string;\n page_location?: string;\n };\n first_open: {\n screen_name: string;\n screen_class: string;\n };\n in_app_purchase: {\n product_id: string;\n price: number;\n value: number;\n currency: string;\n quantity: number;\n subscription?: boolean;\n free_trial?: boolean;\n introductory_price?: number;\n };\n notification_dismiss: {\n // Android only\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_foreground: {\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_type: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_open: {\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n notification_receive: {\n // Android only\n topic: string;\n label: string;\n message_id: string;\n message_name: string;\n message_type: string;\n message_time: number;\n message_device_time: number;\n message_channel: string;\n };\n // Note: The 'screen_view' event is automatically sent only when using Android or iOS native SDKs.\n // If you are using React Native, you need to send this event manually; it should not be ignored.\n session_start: undefined;\n user_engagement: {\n engagement_time_msec: number;\n /** `reset`: the session ended at sign-out, its last engagement reported by `reset()`. */\n trigger: 'pagehide' | 'visibilitychange' | 'background' | 'reset';\n };\n};\n\n/**\n * ref: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag\n * ref: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event\n * */\nexport type RecommendedEvents = {\n // Google Analytics 4 Recommended Events\n add_payment_info: {\n currency: string;\n value: number;\n coupon?: string;\n payment_type?: string;\n items: Item[];\n };\n add_shipping_info: {\n currency: string;\n value: number;\n coupon?: string;\n shipping_tier?: string;\n items: Item[];\n };\n add_to_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n add_to_wishlist: {\n currency: string;\n value: number;\n items: Item[];\n };\n begin_checkout: {\n currency: string;\n value: number;\n coupon?: string;\n items: Item[];\n source?: string; // added\n };\n // The one lead event GA4 lists with both optional (each required if the other is set).\n close_convert_lead: {\n currency?: string;\n value?: number;\n };\n close_unconvert_lead: {\n currency: string;\n value: number;\n unconvert_lead_reason?: string;\n };\n disqualify_lead: {\n currency: string;\n value: number;\n disqualified_lead_reason?: string;\n };\n earn_virtual_currency: {\n virtual_currency_name?: string;\n value?: number;\n };\n generate_lead: {\n currency: string;\n value: number;\n lead_source?: string;\n };\n join_group: {\n group_id?: string;\n };\n level_end: {\n level_name?: string;\n success?: boolean;\n };\n level_start: {\n level_name?: string;\n };\n level_up: {\n level?: number;\n level_name?: string;\n character?: string;\n };\n login: {\n method?:\n | 'google'\n | 'apple'\n | 'facebook'\n | 'twitter'\n | 'linkedin'\n | 'github'\n | 'microsoft'\n | 'wechat'\n | 'onetap'\n | 'phone'\n | 'email'\n | (string & {});\n source?: string; // added\n };\n post_score: {\n score: number;\n level?: number;\n character?: string;\n };\n purchase: {\n currency: string;\n value: number;\n transaction_id: string;\n /**\n * `new`: no purchase in the lookback window (GA4 defaults to 540 days); `returning`:\n * one within it. Leave unset when unsure, e.g. a guest checkout.\n */\n customer_type?: 'new' | 'returning';\n coupon?: string;\n shipping?: number; // Shipping cost associated with a transaction.\n tax?: number;\n items?: Item[];\n source?: string; // added\n };\n qualify_lead: {\n currency: string;\n value: number;\n };\n refund: {\n currency: string;\n value: number;\n transaction_id: string;\n coupon?: string;\n shipping?: number;\n tax?: number;\n items?: Item[];\n };\n remove_from_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n search: {\n search_term: string;\n };\n select_content: {\n content_type?: string;\n content_id?: string;\n };\n select_item: {\n item_list_id?: string;\n item_list_name?: string;\n items: Item[];\n };\n select_promotion: {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n items?: (Item & PromotionItem)[];\n };\n share: {\n method?: string;\n content_type?: string;\n item_id?: string;\n system_activity_type?: string; // added\n platform_post_id?: string; // added\n };\n sign_up: {\n method?: string;\n source?: string; // added\n };\n spend_virtual_currency: {\n value: number;\n virtual_currency_name: string;\n item_name?: string;\n };\n tutorial_begin: undefined;\n tutorial_complete: undefined;\n unlock_achievement: {\n achievement_id: string;\n };\n view_cart: {\n currency: string;\n value: number;\n items: Item[];\n };\n view_item: {\n currency: string;\n value: number;\n items: Item[];\n };\n view_item_list: {\n currency: string;\n item_list_id?: string;\n item_list_name?: string;\n items: Item[];\n };\n view_promotion: {\n creative_name?: string;\n creative_slot?: string;\n promotion_id?: string;\n promotion_name?: string;\n items: (Item & PromotionItem)[];\n };\n working_lead: {\n currency: string;\n value: number;\n lead_status?: string;\n };\n\n // Firebase Analytics events, event_name 40 characters limit, 25 parameters limit\n ad_impression: {\n value?: number;\n currency?: string;\n ad_format?: string;\n ad_platform?: string;\n ad_source?: string;\n ad_unit_name?: string;\n };\n app_open: undefined;\n campaign_details: {\n source: string;\n medium: string;\n campaign: string;\n term?: string;\n content?: string;\n aclid?: string;\n cp1?: string;\n };\n screen_view: {\n screen_name?: string;\n screen_class?: string;\n previous_screen_class?: string; // added\n engagement_time_msec?: number;\n };\n};\n\n/**\n * Extra commonly used events that are NOT part of the GA standard event set.\n * Added to satisfy additional analytics needs.\n */\nexport type AddedRecommendedEvents = {\n logout: undefined;\n trial_begin: {\n currency: string;\n value: number;\n source?: string; // added\n items?: Item[]; // added, the plan(s) enrolled (first item's id maps to OpenAI plan_id)\n };\n subscribe: {\n currency: string;\n value: number;\n source?: string; // added\n items?: Item[]; // added, the plan(s) enrolled (first item's id maps to OpenAI plan_id)\n };\n // survey\n survey_shown: SurveyProperties;\n survey_sent: SurveyProperties & SurveyQA;\n survey_dismissed: SurveyProperties;\n /**\n * Net promoter score: Get an industry-recognized benchmark\n * How likely are you to recommend us to a friend?\n * */\n nps_shown: SurveyProperties;\n nps_sent: SurveyProperties & { score: NPSScore; feedback?: string };\n nps_dismissed: SurveyProperties;\n /**\n * Customer satisfaction score: Works best after a checkout or support flow\n * How satisfied are you with xxx?\n * */\n cast_shown: SurveyProperties;\n cast_sent: SurveyProperties & { score: CASTScore; feedback?: string };\n cast_dismissed: SurveyProperties;\n /**\n * Customer effort score: Works well with churn surveys\n * How easy is it to use the feature?\n * */\n ces_shown: SurveyProperties;\n ces_sent: SurveyProperties & { score: CESScore; feedback?: string };\n ces_dismissed: SurveyProperties;\n};\n\nexport type StandardEvents = AutomaticallyCollectedEvents &\n RecommendedEvents &\n AddedRecommendedEvents;\n\n/**\n * reference: https://developers.google.com/analytics/devguides/collection/ga4/reference/config\n * reference: https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag\n */\nexport interface Gtag {\n /**\n * To disable advertising features based on third-party advertising identifiers, set\n * allow_google_signals to false.\n *\n * @param event\n * @param option\n * @param allow - Whether to allow Google signals.\n * @default true\n */\n gtag(event: 'set', option: 'allow_google_signals', allow: boolean): void;\n\n /**\n * Set to false to disable advertising personalization features.\n *\n * @param event\n * @param option\n * @param allow - Whether to allow ad personalization signals.\n * @default true\n */\n gtag(event: 'set', option: 'allow_ad_personalization_signals', allow: boolean): void;\n\n /**\n * Used for A/B testing and content-targeted ads. Use campaign_content to differentiate ads or\n * links that point to the same URL.\n */\n gtag(event: 'set', option: 'campaign_content', content: string): void;\n\n /**\n * Used to identify which campaign this referral references. Use campaign_id to identify a\n * specific campaign.\n */\n gtag(event: 'set', option: 'campaign_id', id: string): void;\n\n /** Use campaign_medium to identify a medium such as email or cost-per-click. */\n gtag(event: 'set', option: 'campaign_medium', medium: CampaignMedium): void;\n\n /**\n * Used for keyword analysis. Use campaign_name to identify a specific product promotion or\n * strategic campaign.\n */\n gtag(event: 'set', option: 'campaign_name', name: string): void;\n\n /** Use campaign_source to identify a search engine, newsletter name, or other source. */\n gtag(event: 'set', option: 'campaign_source', source: CampaignSource): void;\n\n /** Used for paid search. Use campaign_term to note the keywords for this ad. */\n gtag(event: 'set', option: 'campaign_term', term: string): void;\n\n /**\n * @deprecated\n * Key Point: Use the campaign_ prefixed version of each campaign value instead of this field.\n */\n gtag(event: 'set', option: 'campaign', params: Campaign): void;\n\n /**\n * Pseudonymously identifies a browser instance. By default, this value is stored as part of the\n * first-party Analytics cookie with a two-year expiration.\n */\n gtag(event: 'set', option: 'client_id', id: string): void;\n\n /** example: gtag('set', 'content_group', '/news/sports'); */\n gtag(event: 'set', option: 'content_group', group: string): void;\n\n /**\n * Specifies the domain used to store the analytics cookie.\n * Set to 'none' to set the cookie without specifying a domain.\n * Set to 'auto' (the default value) to set the cookie to the top level domain plus one\n * subdomain (eTLD +1). For example, if cookie_domain is set to 'auto' https://example.com would\n * use example.com for the domain, and https://subdomain.example.com would also use example.com\n * for the domain.\n *\n * @param event\n * @param option\n * @param domain - The domain used to store the analytics cookie.\n * @default 'auto'\n */\n gtag(event: 'set', option: 'cookie_domain', domain: 'none' | 'auto' | (string & {})): void;\n\n /**\n * Every time a hit is sent to Google Analytics, the cookie expiration time is updated to be the\n * current time plus the value of the cookie_expires field. This means that if you use the default\n * value time of two years (63,072,000 seconds), and a user visits your site every month, their\n * cookie will never expire.\n *\n * If you set the cookie_expires time to 0 (zero) seconds, the cookie turns into a session-based\n * cookie and expires once the current browser session ends.\n *\n * Caution: If you set the cookie to expire too quickly, you will inflate your user count and\n * decrease the quality of your measurement.\n *\n * @param event\n * @param option\n * @param expires - The number of seconds until the cookie expires.\n * @default 63072000\n */\n gtag(event: 'set', option: 'cookie_expires', expires: number): void;\n\n /**\n * Appends additional flags to the cookie when set. Flags must be separated by semicolons. See\n * [write a new cookie](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#write_a_new_cookie) for some examples of flags to set.\n */\n gtag(event: 'set', option: 'cookie_flags', flags: string): void;\n\n /** Specifies the subpath used to store the analytics cookie. */\n gtag(event: 'set', option: 'cookie_path', path: string): void;\n\n /** Specifies a prefix to prepend to analytics cookie names. */\n gtag(event: 'set', option: 'cookie_prefix', prefix: string): void;\n\n /**\n * When cookie_update is set to true, gtag.js will update cookies on each page load. This will\n * update the cookie expiration to be set relative to the most recent visit to the site. For\n * example, if cookie expiration is set to one week, and a user visits using the same browser\n * every five days, the cookie expiration will be updated on each visit and will effectively\n * never expire.\n *\n * When set to false, cookies are not updated on each page load. This has the effect of cookie\n * expiration being relative to the first time a user visited the site.\n *\n * @param event\n * @param option\n * @param update - Whether to update the cookie on each page load.\n * @default true\n */\n gtag(event: 'set', option: 'cookie_update', update: boolean): void;\n\n /**\n * Set to true to indicate to Analytics that the referrer shouldn't be displayed as a traffic\n * source. [Learn when to use this field](https://support.google.com/analytics/answer/10327750#set-parameter)\n *\n * @param event\n * @param option\n * @param ignore - Whether to ignore the referrer.\n * @default false\n */\n gtag(event: 'set', option: 'ignore_referrer', ignore: boolean): void;\n\n /**\n * Specifies the language preference of the user. Defaults to the user's `navigator.language` value.\n *\n * @param event\n * @param option\n * @param language - The language preference of the user.\n * @default navigator.language\n */\n gtag(event: 'set', option: 'language', language: string): void;\n\n /**\n * Specifies the full URL of the page. Defaults to the user's `document.location` value.\n *\n * @param event\n * @param option\n * @param location - The full URL of the page. Character limit 1000\n * @default document.location\n */\n gtag(event: 'set', option: 'page_location', location: string): void;\n\n /**\n * Specifies which referral source brought traffic to a page. This value is also used to compute\n * the traffic source. The format of this value is a URL. Defaults to the user's `document.referrer`\n * value.\n *\n * @param event\n * @param option\n * @param referrer - The referral source. Character limit 420\n * @default document.referrer\n */\n gtag(event: 'set', option: 'page_referrer', referrer: string): void;\n\n /**\n * The title of the page or document. Defaults to the user's `document.title` value.\n *\n * @param event\n * @param option\n * @param title - The title of the page or document. Character limit 300\n * @default document.title\n */\n gtag(event: 'set', option: 'page_title', title: string): void;\n\n /**\n * Set to false to prevent the default snippet from sending a page_view.\n *\n * @param event\n * @param option\n * @param send - Whether to send a page_view.\n * @default true\n */\n gtag(event: 'set', option: 'send_page_view', send: boolean): void;\n\n /**\n * Specifies the resolution of the screen. Should be two positive integers separated by an x. For\n * example, for an 800px by 600px screen, the value would be 800x600. Calculated from the user's\n * window.screen value.\n *\n * @param event\n * @param option\n * @param resolution - The resolution of the screen.\n * @default window.screen\n */\n gtag(event: 'set', option: 'screen_resolution', resolution: `${number}x${number}`): void;\n\n /**\n * Specifies a known identifier for a user provided by the site owner/library user. It must not\n * itself be PII (personally identifiable information). The value should never be persisted in\n * Google Analytics cookies or other Analytics-provided storage.\n *\n * @param event\n * @param option\n * @param userId - The user ID. Character limit 256. `null` clears it on sign-out.\n */\n gtag(event: 'set', option: 'user_id', userId: string | null): void;\n\n /**\n * User properties are attributes that can be used to describe segments of your user base, such\n * as language preference or geographic location. Up to 25 additional user properties can be set\n * per project.\n *\n * @param event\n * @param option\n * @param properties\n */\n gtag(event: 'set', option: 'user_properties', properties: UserProperties): void;\n\n gtag(event: 'set', option: 'user_data', data: UserProvidedData): void;\n\n /**\n * gtag('config', ...) Set for a single stream\n * gtag('set', ...) Set globally\n */\n gtag(event: 'config', gaId: GaId, config?: Config): void;\n\n gtag<T extends string>(\n event: 'event',\n eventName: T extends keyof StandardEvents ? T : string,\n eventParams?: T extends keyof StandardEvents\n ? StandardEvents[T]\n : Record<string, string | number | boolean | null | undefined>\n ): void;\n}\n"],"mappings":";;;AACA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,wBAAwB;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,qBAAqB,CAAC,GAAG,uBAAuB,GAAG,qBAAqB;;AAwMrF,SAAgB,QAAQ,MAAoB;CAE1C,OAAO,KAAK,WAAY,KAAK;AAC/B"}
@@ -293,7 +293,8 @@ export type AutomaticallyCollectedEvents = EnhancedMeasurementEvents & {
293
293
  session_start: undefined;
294
294
  user_engagement: {
295
295
  engagement_time_msec: number;
296
- trigger: 'pagehide' | 'visibilitychange' | 'background';
296
+ /** `reset`: the session ended at sign-out, its last engagement reported by `reset()`. */
297
+ trigger: 'pagehide' | 'visibilitychange' | 'background' | 'reset';
297
298
  };
298
299
  };
299
300
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gtag.d.cts","names":[],"sources":["../../src/track/gtag.ts"],"mappings":";cACM;cAuBA;qBAqCO;KAER,gCAAgC;KAChC,gCAAgC;YACzB,qBAAqB,wBAAwB;YAE7C;YAqBA;YA0BA;YACA;GACT,cAAc;OAEd,OAAO;;;;;;;;;;;;;;;;KAkBL;EACH;EACA;EACA;EACA;;EAEA;EACA;;;;;EAKA;;;;;;;;;;YAWU;EACV;;;;;;;EAOA;EACA,UAAU,0BAA0B;;YAG1B,YAAY;YAEZ;YAgBA;YAiBA;EACV;EACA;EACA;EACA;EACA,SAAS;EACT,SAAS;;YAGC;EACV;EACA;EAEA;EACA;EACA,kBAAkB;EAClB;EACA,kBAAkB;EAClB;;;;;EAMA,WAAW;EAEX;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA,kBAAkB;;;KAIf;EACC;EAAiB;;EACjB;EAAkB;;;wBAGR,QAAQ,MAAM;YAKlB,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;;YAGU;EACV;EACA,UAAU;EACV,UAAU;;YAGA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;YACA;YACA;;YAGA;EACV;IACE;IACA;IACA;IACA;IACA;IACA;;EAIF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;;;;YAKQ,+BAA+B;EACzC;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAIF;EACA;IACE;IACA;;;;;;;YAQQ;EAEV;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;IACP;;EAGF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;;EAEF;IACE;IACA;;EAEF;IACE;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IAaA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;;;IAKA;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;;EAEV;IACE;IACA;IACA,OAAO;;EAET;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,SAAS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lB,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;;YAGU;EACV;EACA,UAAU;EACV,UAAU;;YAGA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;YACA;YACA;;YAGA;EACV;IACE;IACA;IACA;IACA;IACA;IACA;;EAIF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;;;;YAKQ,+BAA+B;EACzC;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAIF;EACA;IACE;;IAEA;;;;;;;YAQQ;EAEV;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;IACP;;EAGF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;;EAEF;IACE;IACA;;EAEF;IACE;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IAaA;;EAEF;IACE;IACA;IACA;;EAEF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;;;;EAM5C,KAAK,cAAc,oBAAoB,QAAQ;;;;;EAM/C,KAAK,cAAc,qBAAqB;;EAGxC,KAAK,cAAc,yBAAyB;;;;;;;;;;;;;;EAe5C,KAAK,cAAc,yBAAyB;;;;;;;;;;;;;;;;;;EAmB5C,KAAK,cAAc,0BAA0B;;;;;EAM7C,KAAK,cAAc,wBAAwB;;EAG3C,KAAK,cAAc,uBAAuB;;EAG1C,KAAK,cAAc,yBAAyB;;;;;;;;;;;;;;;;EAiB5C,KAAK,cAAc,yBAAyB;;;;;;;;;;EAW5C,KAAK,cAAc,2BAA2B;;;;;;;;;EAU9C,KAAK,cAAc,oBAAoB;;;;;;;;;EAUvC,KAAK,cAAc,yBAAyB;;;;;;;;;;;EAY5C,KAAK,cAAc,yBAAyB;;;;;;;;;EAU5C,KAAK,cAAc,sBAAsB;;;;;;;;;EAUzC,KAAK,cAAc,0BAA0B;;;;;;;;;;;EAY7C,KAAK,cAAc,6BAA6B;;;;;;;;;;EAWhD,KAAK,cAAc,mBAAmB;;;;;;;;;;EAWtC,KAAK,cAAc,2BAA2B,YAAY;EAE1D,KAAK,cAAc,qBAAqB,MAAM;;;;;EAM9C,KAAK,iBAAiB,MAAM,MAAM,SAAS;EAE3C,KAAK,kBACH,gBACA,WAAW,gBAAgB,iBAAiB,YAC5C,cAAc,gBAAgB,iBAC1B,eAAe,KACf"}
@@ -293,7 +293,8 @@ export type AutomaticallyCollectedEvents = EnhancedMeasurementEvents & {
293
293
  session_start: undefined;
294
294
  user_engagement: {
295
295
  engagement_time_msec: number;
296
- trigger: 'pagehide' | 'visibilitychange' | 'background';
296
+ /** `reset`: the session ended at sign-out, its last engagement reported by `reset()`. */
297
+ trigger: 'pagehide' | 'visibilitychange' | 'background' | 'reset';
297
298
  };
298
299
  };
299
300
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gtag.d.mts","names":[],"sources":["../../src/track/gtag.ts"],"mappings":";cACM;cAuBA;qBAqCO;KAER,gCAAgC;KAChC,gCAAgC;YACzB,qBAAqB,wBAAwB;YAE7C;YAqBA;YA0BA;YACA;GACT,cAAc;OAEd,OAAO;;;;;;;;;;;;;;;;KAkBL;EACH;EACA;EACA;EACA;;EAEA;EACA;;;;;EAKA;;;;;;;;;;YAWU;EACV;;;;;;;EAOA;EACA,UAAU,0BAA0B;;YAG1B,YAAY;YAEZ;YAgBA;YAiBA;EACV;EACA;EACA;EACA;EACA,SAAS;EACT,SAAS;;YAGC;EACV;EACA;EAEA;EACA;EACA,kBAAkB;EAClB;EACA,kBAAkB;EAClB;;;;;EAMA,WAAW;EAEX;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA,kBAAkB;;;KAIf;EACC;EAAiB;;EACjB;EAAkB;;;wBAGR,QAAQ,MAAM;YAKlB,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;;YAGU;EACV;EACA,UAAU;EACV,UAAU;;YAGA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;YACA;YACA;;YAGA;EACV;IACE;IACA;IACA;IACA;IACA;IACA;;EAIF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;;;;YAKQ,+BAA+B;EACzC;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAIF;EACA;IACE;IACA;;;;;;;YAQQ;EAEV;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;IACP;;EAGF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;;EAEF;IACE;IACA;;EAEF;IACE;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IAaA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;;;IAKA;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;;EAEV;IACE;IACA;IACA,OAAO;;EAET;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,SAAS,OAAO;;EAElB;IACE;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;EACA;EACA;IACE;;EAEF;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,QAAQ,OAAO;;EAEjB;IACE;IACA;IACA;;EAIF;IACE;IACA;IACA;IACA;IACA;IACA;;EAEF;EACA;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;;;;;;;YAQQ;EACV;EACA;IACE;IACA;IACA;IACA,QAAQ;;EAEV;IACE;IACA;IACA;IACA,QAAQ;;EAGV,cAAc;EACd,aAAa,mBAAmB;E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;;EAM9C,KAAK,iBAAiB,MAAM,MAAM,SAAS;EAE3C,KAAK,kBACH,gBACA,WAAW,gBAAgB,iBAAiB,YAC5C,cAAc,gBAAgB,iBAC1B,eAAe,KACf"}
1
+ {"version":3,"file":"gtag.d.mts","names":[],"sources":["../../src/track/gtag.ts"],"mappings":";cACM;cAuBA;qBAqCO;KAER,gCAAgC;KAChC,gCAAgC;YACzB,qBAAqB,wBAAwB;YAE7C;YAqBA;YA0BA;YACA;GACT,cAAc;OAEd,OAAO;;;;;;;;;;;;;;;;KAkBL;EACH;EACA;EACA;EACA;;EAEA;EACA;;;;;EAKA;;;;;;;;;;YAWU;EACV;;;;;;;EAOA;EACA,UAAU,0BAA0B;;YAG1B,YAAY;YAEZ;YAgBA;YAiBA;EACV;EACA;EACA;EACA;EACA,SAAS;EACT,SAAS;;YAGC;EACV;EACA;EAEA;EACA;EACA,kBAAkB;EAClB;EACA,kBAAkB;EAClB;;;;;EAMA,WAAW;EAEX;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;EACA,kBAAkB;;;KAIf;EACC;EAAiB;;EACjB;EAAkB;;;wBAGR,QAAQ,MAAM;YAKlB,OAAO;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV;EACA;EACA;EACA;;YAGU;EACV;EACA,UAAU;EACV,UAAU;;YAGA;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;YACA;YACA;;YAGA;EACV;IACE;IACA;IACA;IACA;IACA;IACA;;EAIF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;;;;YAKQ,+BAA+B;EACzC;IACE;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAIF;EACA;IACE;;IAEA;;;;;;;YAQQ;EAEV;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;IACP;;EAGF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;;EAEF;IACE;IACA;;EAEF;IACE;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IAaA;;EAEF;IACE;IACA;IACA;;EAEF;IACE;IACA;IACA;;;;;IAKA;IACA;IACA;IACA;IACA,QAAQ;IACR;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA,QAAQ;;EAEV;IACE;IACA;IACA,OAAO;;EAET;IACE;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,SAAS,OAAO;;EAElB;IACE;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;IACA;;EAEF;EACA;EACA;IACE;;EAEF;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA,OAAO;;EAET;IACE;IACA;IACA;IACA;IACA,QAAQ,OAAO;;EAEjB;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