@koda-sl/baker-cli 0.449.0-dev.bd86e5817 → 0.450.0-dev.b454c3dd2

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 (443) hide show
  1. package/README.md +11 -6
  2. package/dist/{account-AL2ZDSR7.js → account-XQXC7BR6.js} +5 -4
  3. package/dist/{account-AL2ZDSR7.js.map → account-XQXC7BR6.js.map} +1 -1
  4. package/dist/{accounts-HAFCLSR5.js → accounts-722UY53A.js} +4 -3
  5. package/dist/{accounts-HAFCLSR5.js.map → accounts-722UY53A.js.map} +1 -1
  6. package/dist/{accounts-O5MFO3QQ.js → accounts-E67BMK7T.js} +6 -5
  7. package/dist/{accounts-O5MFO3QQ.js.map → accounts-E67BMK7T.js.map} +1 -1
  8. package/dist/{actions-P35MEMGN.js → actions-6TQMSVWD.js} +18 -18
  9. package/dist/{add-5GAN6CVO.js → add-2BEGRHUX.js} +28 -5
  10. package/dist/add-2BEGRHUX.js.map +1 -0
  11. package/dist/{add-6DTC6X5G.js → add-LEMKEOPO.js} +3 -2
  12. package/dist/{add-6DTC6X5G.js.map → add-LEMKEOPO.js.map} +1 -1
  13. package/dist/{ads-73PGA4YC.js → ads-AGYCVD62.js} +4 -4
  14. package/dist/{advertisers-AE75CGVE.js → advertisers-2VQKAYKG.js} +4 -3
  15. package/dist/{advertisers-AE75CGVE.js.map → advertisers-2VQKAYKG.js.map} +1 -1
  16. package/dist/{analytics-FKCXIMPO.js → analytics-IFELDWLL.js} +24 -20
  17. package/dist/analytics-IFELDWLL.js.map +1 -0
  18. package/dist/{analytics-FPWQQGRM.js → analytics-OH5QEH7F.js} +4 -3
  19. package/dist/{analytics-FPWQQGRM.js.map → analytics-OH5QEH7F.js.map} +1 -1
  20. package/dist/{assign-ABN2AQ4J.js → assign-PTUJUCEL.js} +4 -3
  21. package/dist/{assign-ABN2AQ4J.js.map → assign-PTUJUCEL.js.map} +1 -1
  22. package/dist/{audience-size-GNBJY35X.js → audience-size-LRI6GJRT.js} +4 -3
  23. package/dist/{audience-size-GNBJY35X.js.map → audience-size-LRI6GJRT.js.map} +1 -1
  24. package/dist/{audit-3VS63TBW.js → audit-HWP7OPB7.js} +4 -3
  25. package/dist/{audit-3VS63TBW.js.map → audit-HWP7OPB7.js.map} +1 -1
  26. package/dist/{autocomplete-VS3XG3B7.js → autocomplete-J6DHU6MR.js} +4 -3
  27. package/dist/{autocomplete-VS3XG3B7.js.map → autocomplete-J6DHU6MR.js.map} +1 -1
  28. package/dist/{avatars-EKCKHCC3.js → avatars-467OSBD6.js} +4 -4
  29. package/dist/{bid-pricing-Q72B65AY.js → bid-pricing-EO5WLHGV.js} +4 -3
  30. package/dist/{bid-pricing-Q72B65AY.js.map → bid-pricing-EO5WLHGV.js.map} +1 -1
  31. package/dist/{brand-C6PFGGQN.js → brand-YRTEPGBK.js} +2 -2
  32. package/dist/{brief-YFJHQ5VQ.js → brief-OSFJ2V7F.js} +8 -7
  33. package/dist/{brief-YFJHQ5VQ.js.map → brief-OSFJ2V7F.js.map} +1 -1
  34. package/dist/{campaign-groups-KFFYQPU3.js → campaign-groups-PQ6KSQJR.js} +9 -8
  35. package/dist/{campaign-groups-KFFYQPU3.js.map → campaign-groups-PQ6KSQJR.js.map} +1 -1
  36. package/dist/{campaign-writes-FHOS5XZY.js → campaign-writes-5OVLUD5E.js} +4 -3
  37. package/dist/{campaign-writes-FHOS5XZY.js.map → campaign-writes-5OVLUD5E.js.map} +1 -1
  38. package/dist/{campaigns-2NHWBF5C.js → campaigns-6T3NSUT2.js} +12 -11
  39. package/dist/{campaigns-2NHWBF5C.js.map → campaigns-6T3NSUT2.js.map} +1 -1
  40. package/dist/{campaigns-KZYZTXDS.js → campaigns-OYMXDGWX.js} +5 -5
  41. package/dist/{canvas-UJNSHD3B.js → canvas-YQFG52IG.js} +13 -13
  42. package/dist/{capabilities-DJFTRJKS.js → capabilities-PXBKUN2G.js} +4 -3
  43. package/dist/{capabilities-DJFTRJKS.js.map → capabilities-PXBKUN2G.js.map} +1 -1
  44. package/dist/{catalog-ZQX6BGXS.js → catalog-XLXIM7IW.js} +4 -4
  45. package/dist/{chats-D2CSDX5Q.js → chats-UK47UE7C.js} +4 -3
  46. package/dist/{chats-D2CSDX5Q.js.map → chats-UK47UE7C.js.map} +1 -1
  47. package/dist/{chunk-7YCRFMXF.js → chunk-24EB7EDR.js} +3 -3
  48. package/dist/{chunk-5ZDLTE5T.js → chunk-2AOE2MZQ.js} +3 -3
  49. package/dist/{chunk-4SG4RW2P.js → chunk-2VPBIT65.js} +8 -8
  50. package/dist/chunk-4PDHHHUJ.js +537 -0
  51. package/dist/chunk-4PDHHHUJ.js.map +1 -0
  52. package/dist/{chunk-NPY4QUMQ.js → chunk-54C6YDGJ.js} +2 -2
  53. package/dist/{chunk-LZ73CZGP.js → chunk-5WCSKQ7Z.js} +6 -6
  54. package/dist/{chunk-3G3ZDLMI.js → chunk-5ZNTADVR.js} +2 -2
  55. package/dist/{chunk-AEOSAVVL.js → chunk-6F7DVPOS.js} +3 -3
  56. package/dist/{chunk-CJCVIEJ5.js → chunk-6NY2GPR4.js} +3 -3
  57. package/dist/{chunk-CXWFX2AM.js → chunk-6Y7ZBENQ.js} +6 -6
  58. package/dist/{chunk-M242LHLX.js → chunk-7CTMH5AK.js} +3 -3
  59. package/dist/{chunk-XF4JUKVF.js → chunk-7EPXVICM.js} +38 -5
  60. package/dist/chunk-7EPXVICM.js.map +1 -0
  61. package/dist/{chunk-T2PC5AVH.js → chunk-ASI4P6X2.js} +6 -6
  62. package/dist/chunk-ASI4P6X2.js.map +1 -0
  63. package/dist/{chunk-QD7ESRLN.js → chunk-C46GUI2S.js} +2 -2
  64. package/dist/{chunk-6N6WKAJM.js → chunk-CWYAELVG.js} +2 -2
  65. package/dist/{chunk-MXYBTMKB.js → chunk-DCRPXOJJ.js} +2 -2
  66. package/dist/{chunk-GKZ2WU75.js → chunk-FPOGPFAG.js} +3 -14
  67. package/dist/chunk-FPOGPFAG.js.map +1 -0
  68. package/dist/{chunk-JQJDXPCO.js → chunk-FUHN4MFY.js} +2 -2
  69. package/dist/{chunk-S77PZVYM.js → chunk-FYGR3I2A.js} +3 -3
  70. package/dist/{chunk-OZRUJVIQ.js → chunk-H3427GPU.js} +2 -2
  71. package/dist/{chunk-RPUSTYHL.js → chunk-HDLYPC6K.js} +5 -3
  72. package/dist/{chunk-RPUSTYHL.js.map → chunk-HDLYPC6K.js.map} +1 -1
  73. package/dist/{chunk-SSJK7FEV.js → chunk-HR6IWNKE.js} +1196 -1140
  74. package/dist/chunk-HR6IWNKE.js.map +1 -0
  75. package/dist/{chunk-YRQYA2LR.js → chunk-HROZYQ5H.js} +63 -5
  76. package/dist/chunk-HROZYQ5H.js.map +1 -0
  77. package/dist/{chunk-IR6D7K4H.js → chunk-I3ZR655O.js} +2 -2
  78. package/dist/{chunk-YK32GUBN.js → chunk-KMKEYI37.js} +3 -3
  79. package/dist/{chunk-W3ZHJJVT.js → chunk-KS2QY6MK.js} +4 -4
  80. package/dist/{chunk-WNRV4QH7.js → chunk-LYQJ4PZW.js} +5 -5
  81. package/dist/{chunk-B5SCU7MJ.js → chunk-MACCF4JZ.js} +16 -22
  82. package/dist/{chunk-B5SCU7MJ.js.map → chunk-MACCF4JZ.js.map} +1 -1
  83. package/dist/{chunk-CSYSX4D2.js → chunk-N4LAYIIN.js} +2 -2
  84. package/dist/{chunk-4AUMTNVB.js → chunk-NA63BH7V.js} +3 -3
  85. package/dist/{chunk-4BQXAE7Z.js → chunk-NDEE6G2J.js} +2 -2
  86. package/dist/{chunk-EDLZGTGN.js → chunk-NYIGXDUG.js} +1 -39
  87. package/dist/chunk-NYIGXDUG.js.map +1 -0
  88. package/dist/{chunk-DWHIOO7E.js → chunk-QE7W555R.js} +163 -12
  89. package/dist/chunk-QE7W555R.js.map +1 -0
  90. package/dist/{chunk-MELOSESI.js → chunk-R25YLW6H.js} +2 -2
  91. package/dist/{chunk-Y6O7EWYY.js → chunk-RL5CP7N6.js} +5 -5
  92. package/dist/{chunk-DGUNI37S.js → chunk-RX2DKU3W.js} +2 -2
  93. package/dist/{chunk-3HJLHTWP.js → chunk-SJYEY5MV.js} +12 -3
  94. package/dist/{chunk-3HJLHTWP.js.map → chunk-SJYEY5MV.js.map} +1 -1
  95. package/dist/{chunk-VTDMKARH.js → chunk-ULG4QRTV.js} +2 -2
  96. package/dist/{chunk-QRP3PXWN.js → chunk-VL43TNIP.js} +2 -2
  97. package/dist/{chunk-SHL7LOC3.js → chunk-VLMBTPXU.js} +3 -3
  98. package/dist/{chunk-KHRXPQID.js → chunk-VYQ3QJ3C.js} +2 -2
  99. package/dist/{chunk-A4LOJ2VD.js → chunk-WGUQHAJY.js} +2 -2
  100. package/dist/{chunk-ZEYEWPK6.js → chunk-WKQG6TER.js} +2 -2
  101. package/dist/{chunk-3IBYKLXR.js → chunk-ZDMTXQ2Q.js} +2 -2
  102. package/dist/{claim-FZ5OQLMU.js → claim-W6G6VEG5.js} +4 -3
  103. package/dist/{claim-FZ5OQLMU.js.map → claim-W6G6VEG5.js.map} +1 -1
  104. package/dist/cli.js +30 -30
  105. package/dist/{companies-DNI634RC.js → companies-TS6KBATJ.js} +4 -3
  106. package/dist/{companies-DNI634RC.js.map → companies-TS6KBATJ.js.map} +1 -1
  107. package/dist/{complete-2FZMGJV5.js → complete-LYR2HMQU.js} +4 -3
  108. package/dist/{complete-2FZMGJV5.js.map → complete-LYR2HMQU.js.map} +1 -1
  109. package/dist/{connect-QCOGEPP4.js → connect-FCXNVTXG.js} +13 -6
  110. package/dist/{conversation-6IOGV7B7.js → conversation-6ZJGPCXM.js} +4 -3
  111. package/dist/{conversation-6IOGV7B7.js.map → conversation-6ZJGPCXM.js.map} +1 -1
  112. package/dist/{conversions-4SRZPBBX.js → conversions-UHB55MMQ.js} +8 -7
  113. package/dist/{conversions-4SRZPBBX.js.map → conversions-UHB55MMQ.js.map} +1 -1
  114. package/dist/{create-BJNMO6HT.js → create-EX6OWLNM.js} +3 -2
  115. package/dist/{create-BJNMO6HT.js.map → create-EX6OWLNM.js.map} +1 -1
  116. package/dist/{create-RM7HV77Y.js → create-JCA7JPLP.js} +4 -3
  117. package/dist/{create-RM7HV77Y.js.map → create-JCA7JPLP.js.map} +1 -1
  118. package/dist/{create-FX4OJ2XF.js → create-JFSK4BOP.js} +4 -3
  119. package/dist/{create-FX4OJ2XF.js.map → create-JFSK4BOP.js.map} +1 -1
  120. package/dist/{create-VXM34ZWH.js → create-WU22YYU2.js} +4 -3
  121. package/dist/{create-VXM34ZWH.js.map → create-WU22YYU2.js.map} +1 -1
  122. package/dist/{creatives-NJF2U763.js → creatives-FXUQ5WSD.js} +10 -10
  123. package/dist/{creatives-JSWBFQ5R.js → creatives-KGXUOYPE.js} +9 -8
  124. package/dist/{creatives-JSWBFQ5R.js.map → creatives-KGXUOYPE.js.map} +1 -1
  125. package/dist/{credentials-C33K6XCJ.js → credentials-MJC7PGKR.js} +4 -3
  126. package/dist/{credentials-C33K6XCJ.js.map → credentials-MJC7PGKR.js.map} +1 -1
  127. package/dist/{critique-YDKPYZLD.js → critique-GS5VV5ZC.js} +7 -6
  128. package/dist/{critique-YDKPYZLD.js.map → critique-GS5VV5ZC.js.map} +1 -1
  129. package/dist/{critique-ZS4ON3SU.js → critique-TPHR27KH.js} +4 -3
  130. package/dist/{critique-ZS4ON3SU.js.map → critique-TPHR27KH.js.map} +1 -1
  131. package/dist/{crm-R5IXIFIV.js → crm-AVCM5D4G.js} +5 -4
  132. package/dist/{crm-R5IXIFIV.js.map → crm-AVCM5D4G.js.map} +1 -1
  133. package/dist/{crm-52ROSWH5.js → crm-VK44O3ED.js} +5 -4
  134. package/dist/{crm-52ROSWH5.js.map → crm-VK44O3ED.js.map} +1 -1
  135. package/dist/{customers-A36LOZOB.js → customers-XH2DMTFH.js} +6 -5
  136. package/dist/{delete-M2GDLPYN.js → delete-E3R3TKIL.js} +3 -2
  137. package/dist/{delete-M2GDLPYN.js.map → delete-E3R3TKIL.js.map} +1 -1
  138. package/dist/{delete-HGHXY24R.js → delete-KRH2YMSZ.js} +4 -3
  139. package/dist/{delete-HGHXY24R.js.map → delete-KRH2YMSZ.js.map} +1 -1
  140. package/dist/{delete-AIGE4Y4H.js → delete-WI5E3DR3.js} +4 -3
  141. package/dist/{delete-AIGE4Y4H.js.map → delete-WI5E3DR3.js.map} +1 -1
  142. package/dist/{demographics-NTWB2IMG.js → demographics-XV5PBA77.js} +4 -3
  143. package/dist/{demographics-NTWB2IMG.js.map → demographics-XV5PBA77.js.map} +1 -1
  144. package/dist/{discard-2WWQG6OU.js → discard-HTQUUHJR.js} +4 -3
  145. package/dist/{discard-2WWQG6OU.js.map → discard-HTQUUHJR.js.map} +1 -1
  146. package/dist/{domain-Y2LT6JLT.js → domain-RECGZXJB.js} +4 -3
  147. package/dist/{domain-Y2LT6JLT.js.map → domain-RECGZXJB.js.map} +1 -1
  148. package/dist/{draft-SLHAKJ2A.js → draft-2IBSJEKC.js} +4 -3
  149. package/dist/{draft-SLHAKJ2A.js.map → draft-2IBSJEKC.js.map} +1 -1
  150. package/dist/{draft-FJ7WHIXW.js → draft-PVTX6QT6.js} +4 -3
  151. package/dist/{draft-FJ7WHIXW.js.map → draft-PVTX6QT6.js.map} +1 -1
  152. package/dist/{draft-EJXNNJ3Y.js → draft-Q546QPPU.js} +5 -4
  153. package/dist/{draft-EJXNNJ3Y.js.map → draft-Q546QPPU.js.map} +1 -1
  154. package/dist/engine/index.js +3 -3
  155. package/dist/{facets-U7AQC4H6.js → facets-7EVPJMKS.js} +4 -3
  156. package/dist/{facets-U7AQC4H6.js.map → facets-7EVPJMKS.js.map} +1 -1
  157. package/dist/{feedback-PPQMOQ46.js → feedback-EIZKS4JU.js} +2 -2
  158. package/dist/{feedback-record-V66HWVRR.js → feedback-record-TKO54BOE.js} +9 -8
  159. package/dist/{feedback-record-V66HWVRR.js.map → feedback-record-TKO54BOE.js.map} +1 -1
  160. package/dist/{fetch-W7NULDEO.js → fetch-4BY6HYUM.js} +4 -3
  161. package/dist/{fetch-W7NULDEO.js.map → fetch-4BY6HYUM.js.map} +1 -1
  162. package/dist/{find-OTDIX6V4.js → find-FRRHAPWX.js} +4 -4
  163. package/dist/{flows-KABCBS3S.js → flows-KTFAML22.js} +21 -17
  164. package/dist/flows-KTFAML22.js.map +1 -0
  165. package/dist/{fonts-EMMX3KII.js → fonts-MXR3ZKDX.js} +6 -5
  166. package/dist/{forecast-GNODEIIC.js → forecast-3QTJYVND.js} +4 -3
  167. package/dist/{forecast-GNODEIIC.js.map → forecast-3QTJYVND.js.map} +1 -1
  168. package/dist/{funnel-AAX27NH4.js → funnel-I6XIAEHG.js} +11 -455
  169. package/dist/funnel-I6XIAEHG.js.map +1 -0
  170. package/dist/{ga4-UDQ2HA2J.js → ga4-DV2AXCSL.js} +1 -1
  171. package/dist/{get-QEYJRLV3.js → get-5PKNKJ5S.js} +7 -4
  172. package/dist/get-5PKNKJ5S.js.map +1 -0
  173. package/dist/{get-RTVUZM6E.js → get-72YPHJGV.js} +4 -3
  174. package/dist/{get-RTVUZM6E.js.map → get-72YPHJGV.js.map} +1 -1
  175. package/dist/{google-M7KEXVK5.js → google-6OGZX47I.js} +2 -2
  176. package/dist/{google-KTO3PLEU.js → google-QYYYSSXI.js} +5 -5
  177. package/dist/{google-ads-OK6IG3UV.js → google-ads-QGMQKZQD.js} +4 -3
  178. package/dist/{google-ads-OK6IG3UV.js.map → google-ads-QGMQKZQD.js.map} +1 -1
  179. package/dist/{gsc-P3QYGDV2.js → gsc-TAKOF7J5.js} +1 -1
  180. package/dist/{history-PQUJKK26.js → history-6AVQX2OQ.js} +4 -3
  181. package/dist/{history-PQUJKK26.js.map → history-6AVQX2OQ.js.map} +1 -1
  182. package/dist/{hubspot-Y77VLY6Y.js → hubspot-SVEMFK5S.js} +9 -8
  183. package/dist/{hubspot-Y77VLY6Y.js.map → hubspot-SVEMFK5S.js.map} +1 -1
  184. package/dist/{icon-I43F77FV.js → icon-L4RSS6PZ.js} +4 -4
  185. package/dist/{ideas-MIDU7YOA.js → ideas-NFOW3HKJ.js} +3 -2
  186. package/dist/{images-S254MS6O.js → images-2EFFUNNV.js} +9 -9
  187. package/dist/{ingest-YV2NLDBE.js → ingest-2EIKN4QC.js} +4 -3
  188. package/dist/{ingest-J4I3HKM3.js → ingest-2SO62RRI.js} +3 -2
  189. package/dist/{ingest-J4I3HKM3.js.map → ingest-2SO62RRI.js.map} +1 -1
  190. package/dist/{inspect-Q5NHBBHX.js → inspect-4OOS4APT.js} +4 -3
  191. package/dist/{inspect-Q5NHBBHX.js.map → inspect-4OOS4APT.js.map} +1 -1
  192. package/dist/{inspiration-P265QJ2H.js → inspiration-S3DU4CMQ.js} +1 -1
  193. package/dist/{keyword-metrics-PDY4ZXSP.js → keyword-metrics-SF4CSNZ2.js} +4 -3
  194. package/dist/{keyword-metrics-PDY4ZXSP.js.map → keyword-metrics-SF4CSNZ2.js.map} +1 -1
  195. package/dist/{keywords-for-site-GALSCV77.js → keywords-for-site-WDAOPNKC.js} +4 -3
  196. package/dist/{keywords-for-site-GALSCV77.js.map → keywords-for-site-WDAOPNKC.js.map} +1 -1
  197. package/dist/{landing-CJYGWCK4.js → landing-2ZB46LXH.js} +3 -3
  198. package/dist/{leads-PHKG6CP3.js → leads-A4W5KTWB.js} +4 -3
  199. package/dist/{leads-PHKG6CP3.js.map → leads-A4W5KTWB.js.map} +1 -1
  200. package/dist/{learn-FUQSY7DN.js → learn-IPULBCOD.js} +5 -4
  201. package/dist/{learn-FUQSY7DN.js.map → learn-IPULBCOD.js.map} +1 -1
  202. package/dist/{line-item-writes-E6MZPIZZ.js → line-item-writes-EMYSOJKM.js} +4 -3
  203. package/dist/{line-item-writes-E6MZPIZZ.js.map → line-item-writes-EMYSOJKM.js.map} +1 -1
  204. package/dist/{line-items-7ZGIKEF2.js → line-items-5NECXUZT.js} +5 -5
  205. package/dist/{link-QYAW6A2W.js → link-CI45HWFN.js} +4 -3
  206. package/dist/{link-QYAW6A2W.js.map → link-CI45HWFN.js.map} +1 -1
  207. package/dist/{linkedin-FFSDSGGS.js → linkedin-B7SYR75X.js} +27 -26
  208. package/dist/{linkedin-FFSDSGGS.js.map → linkedin-B7SYR75X.js.map} +1 -1
  209. package/dist/{list-NVQC5SNY.js → list-2BARXOT5.js} +3 -2
  210. package/dist/{list-NVQC5SNY.js.map → list-2BARXOT5.js.map} +1 -1
  211. package/dist/{list-SAV3LQHY.js → list-BIEVLEHS.js} +4 -3
  212. package/dist/{list-SAV3LQHY.js.map → list-BIEVLEHS.js.map} +1 -1
  213. package/dist/{list-5IC6KIKO.js → list-ZBT3EBVZ.js} +4 -3
  214. package/dist/{list-5IC6KIKO.js.map → list-ZBT3EBVZ.js.map} +1 -1
  215. package/dist/{log-XZPVOALD.js → log-C23OOAJZ.js} +4 -3
  216. package/dist/{log-XZPVOALD.js.map → log-C23OOAJZ.js.map} +1 -1
  217. package/dist/{logo-2IP663QO.js → logo-Q5D7PZY6.js} +3 -3
  218. package/dist/{lookup-XK45W2SH.js → lookup-ETWY47F7.js} +6 -5
  219. package/dist/{make-J3WBO62B.js → make-TPKKJXGL.js} +18 -17
  220. package/dist/{make-J3WBO62B.js.map → make-TPKKJXGL.js.map} +1 -1
  221. package/dist/{map-4J5WIWIG.js → map-SYZMPHLL.js} +5 -4
  222. package/dist/{map-4J5WIWIG.js.map → map-SYZMPHLL.js.map} +1 -1
  223. package/dist/{mcp-XXD7ZQCP.js → mcp-6FQBVJ6F.js} +3 -2
  224. package/dist/{mcp-XXD7ZQCP.js.map → mcp-6FQBVJ6F.js.map} +1 -1
  225. package/dist/{media-sources-O6ZRUA3N.js → media-sources-ZXHEEP6T.js} +2 -2
  226. package/dist/{members-D5ZYLS4Y.js → members-UDY4OOJW.js} +4 -3
  227. package/dist/{members-D5ZYLS4Y.js.map → members-UDY4OOJW.js.map} +1 -1
  228. package/dist/{normalize-PCNC6E2N.js → normalize-DAKHYS3V.js} +7 -3
  229. package/dist/{normalize-PCNC6E2N.js.map → normalize-DAKHYS3V.js.map} +1 -1
  230. package/dist/{options-MQ65VEVD.js → options-QL3ULED5.js} +7 -6
  231. package/dist/{options-MQ65VEVD.js.map → options-QL3ULED5.js.map} +1 -1
  232. package/dist/{performance-6QW2KEEQ.js → performance-UF5VTY2U.js} +5 -4
  233. package/dist/plan-FT632COT.js +51 -0
  234. package/dist/plan-FT632COT.js.map +1 -0
  235. package/dist/{promoted-tweet-writes-JPLHY3GM.js → promoted-tweet-writes-7HGESJ46.js} +4 -3
  236. package/dist/{promoted-tweet-writes-JPLHY3GM.js.map → promoted-tweet-writes-7HGESJ46.js.map} +1 -1
  237. package/dist/{promoted-tweets-SURKMHFI.js → promoted-tweets-LZKS5JIF.js} +3 -3
  238. package/dist/{publish-HCQ6MXLB.js → publish-NPD3SMZL.js} +4 -3
  239. package/dist/{publish-HCQ6MXLB.js.map → publish-NPD3SMZL.js.map} +1 -1
  240. package/dist/questionnaire-JNGYJTAY.js +37 -0
  241. package/dist/questionnaire-JNGYJTAY.js.map +1 -0
  242. package/dist/{reddit-GIP3ADMS.js → reddit-NU2N3LZD.js} +5 -4
  243. package/dist/{refresh-UXQSLCR3.js → refresh-EBVJ2C6L.js} +3 -2
  244. package/dist/{refresh-UXQSLCR3.js.map → refresh-EBVJ2C6L.js.map} +1 -1
  245. package/dist/{release-5KVLXNP6.js → release-V43YB2PY.js} +4 -3
  246. package/dist/{release-5KVLXNP6.js.map → release-V43YB2PY.js.map} +1 -1
  247. package/dist/{remove-6FIVKCJI.js → remove-QPSWLFI4.js} +3 -2
  248. package/dist/{remove-6FIVKCJI.js.map → remove-QPSWLFI4.js.map} +1 -1
  249. package/dist/{reopen-YM5LNOLB.js → reopen-GQ66NMWF.js} +4 -3
  250. package/dist/{reopen-YM5LNOLB.js.map → reopen-GQ66NMWF.js.map} +1 -1
  251. package/dist/{rerun-WYDRHIUJ.js → rerun-PZK275DY.js} +18 -17
  252. package/dist/{rerun-WYDRHIUJ.js.map → rerun-PZK275DY.js.map} +1 -1
  253. package/dist/{research-2BLEISBG.js → research-FMM6AWZC.js} +10 -10
  254. package/dist/{research-YOGE7GT2.js → research-GEOCUBXB.js} +3 -2
  255. package/dist/{research-YOGE7GT2.js.map → research-GEOCUBXB.js.map} +1 -1
  256. package/dist/{reset-C4UHQ3EU.js → reset-REXJ6AUK.js} +3 -2
  257. package/dist/{reset-C4UHQ3EU.js.map → reset-REXJ6AUK.js.map} +1 -1
  258. package/dist/{reset-OLVB6AE6.js → reset-Y72IVESB.js} +3 -2
  259. package/dist/{reset-OLVB6AE6.js.map → reset-Y72IVESB.js.map} +1 -1
  260. package/dist/{resolve-XYH2GDAE.js → resolve-OGX7C4TV.js} +4 -3
  261. package/dist/{resolve-XYH2GDAE.js.map → resolve-OGX7C4TV.js.map} +1 -1
  262. package/dist/{retry-7EELDEQP.js → retry-CD6JAQ3F.js} +3 -2
  263. package/dist/{retry-7EELDEQP.js.map → retry-CD6JAQ3F.js.map} +1 -1
  264. package/dist/{retry-726GKI6V.js → retry-TCUBBFR5.js} +3 -2
  265. package/dist/{retry-726GKI6V.js.map → retry-TCUBBFR5.js.map} +1 -1
  266. package/dist/{run-P4KR2MXC.js → run-A5ZDXTOI.js} +4 -3
  267. package/dist/{run-P4KR2MXC.js.map → run-A5ZDXTOI.js.map} +1 -1
  268. package/dist/{run-MODGUNGT.js → run-EUO34T2J.js} +18 -17
  269. package/dist/{scaffold-ad-5ZE7KE62.js → scaffold-ad-SW2HEWM3.js} +13 -12
  270. package/dist/{scaffold-ad-5ZE7KE62.js.map → scaffold-ad-SW2HEWM3.js.map} +1 -1
  271. package/dist/{scaffold-static-ad-HJY5HFDL.js → scaffold-static-ad-ECTJL54Y.js} +37 -36
  272. package/dist/scaffold-static-ad-ECTJL54Y.js.map +1 -0
  273. package/dist/{scaffold-video-P2PYPWG2.js → scaffold-video-EI7U7RBK.js} +12 -11
  274. package/dist/{scaffold-video-P2PYPWG2.js.map → scaffold-video-EI7U7RBK.js.map} +1 -1
  275. package/dist/{schedule-RDK4GEPI.js → schedule-S5YZJZ5U.js} +3 -2
  276. package/dist/{schedule-RDK4GEPI.js.map → schedule-S5YZJZ5U.js.map} +1 -1
  277. package/dist/{scheduled-agents-6U44QE76.js → scheduled-agents-N4LJRM4C.js} +11 -11
  278. package/dist/{schema-CHJDC7GQ.js → schema-R7JWWOF4.js} +8 -4
  279. package/dist/{schema-CHJDC7GQ.js.map → schema-R7JWWOF4.js.map} +1 -1
  280. package/dist/{search-PMJRU3C4.js → search-KHMQH3AT.js} +3 -2
  281. package/dist/{search-PMJRU3C4.js.map → search-KHMQH3AT.js.map} +1 -1
  282. package/dist/{select-AB2L4GAA.js → select-O2FN2JEQ.js} +9 -8
  283. package/dist/{select-AB2L4GAA.js.map → select-O2FN2JEQ.js.map} +1 -1
  284. package/dist/{sends-WGJVQUMF.js → sends-BQZM5PLS.js} +5 -4
  285. package/dist/{sends-WGJVQUMF.js.map → sends-BQZM5PLS.js.map} +1 -1
  286. package/dist/{set-prompt-DU2G2WTB.js → set-prompt-2HASHGWC.js} +9 -8
  287. package/dist/{set-prompt-DU2G2WTB.js.map → set-prompt-2HASHGWC.js.map} +1 -1
  288. package/dist/{setup-links-REPREN3C.js → setup-links-GYSE56GX.js} +4 -3
  289. package/dist/{setup-links-REPREN3C.js.map → setup-links-GYSE56GX.js.map} +1 -1
  290. package/dist/{site-WFSWIA3S.js → site-4SKM7RKG.js} +5 -4
  291. package/dist/{site-WFSWIA3S.js.map → site-4SKM7RKG.js.map} +1 -1
  292. package/dist/{sources-YBQ6KPFM.js → sources-FQ2UZTHL.js} +6 -6
  293. package/dist/{sources-AMI2AWKZ.js → sources-R2NKNC6J.js} +10 -9
  294. package/dist/{sources-AMI2AWKZ.js.map → sources-R2NKNC6J.js.map} +1 -1
  295. package/dist/{stale-6MJHVEG4.js → stale-W756ACKC.js} +8 -7
  296. package/dist/{stale-6MJHVEG4.js.map → stale-W756ACKC.js.map} +1 -1
  297. package/dist/{status-7F2KHFGA.js → status-SE2VZJJB.js} +4 -3
  298. package/dist/{status-7F2KHFGA.js.map → status-SE2VZJJB.js.map} +1 -1
  299. package/dist/{stock-2YCDN3N6.js → stock-KXJ26BY4.js} +5 -5
  300. package/dist/{studio-RA7QQH4O.js → studio-SYKOSNDB.js} +1 -1
  301. package/dist/{sync-GWTLKZTU.js → sync-LJGSODK3.js} +3 -2
  302. package/dist/{sync-GWTLKZTU.js.map → sync-LJGSODK3.js.map} +1 -1
  303. package/dist/{sync-definition-IPUFS5XS.js → sync-definition-QR2N233R.js} +12 -11
  304. package/dist/{tags-KFYLZLB3.js → tags-4BAVFH4S.js} +3 -2
  305. package/dist/{tags-KFYLZLB3.js.map → tags-4BAVFH4S.js.map} +1 -1
  306. package/dist/{tags-ABHSX6M5.js → tags-5SBMRC2A.js} +4 -3
  307. package/dist/{tags-ABHSX6M5.js.map → tags-5SBMRC2A.js.map} +1 -1
  308. package/dist/{tags-3WPW6PTV.js → tags-PYWFSBTR.js} +4 -4
  309. package/dist/{tags-6342FQEB.js → tags-QQU3OKMZ.js} +4 -3
  310. package/dist/{tags-6342FQEB.js.map → tags-QQU3OKMZ.js.map} +1 -1
  311. package/dist/{tags-FJIBBBRG.js → tags-YYLNF3PK.js} +4 -3
  312. package/dist/{tags-FJIBBBRG.js.map → tags-YYLNF3PK.js.map} +1 -1
  313. package/dist/{targeting-criteria-NR47AF5C.js → targeting-criteria-RJFLFICN.js} +3 -3
  314. package/dist/{targets-L56KOVQE.js → targets-S2MT2PNB.js} +4 -3
  315. package/dist/{targets-L56KOVQE.js.map → targets-S2MT2PNB.js.map} +1 -1
  316. package/dist/{templates-B6XGDYUF.js → templates-ZE5TOGRT.js} +4 -3
  317. package/dist/{templates-B6XGDYUF.js.map → templates-ZE5TOGRT.js.map} +1 -1
  318. package/dist/{testimonials-CVC4YIXO.js → testimonials-DII5DYLR.js} +6 -6
  319. package/dist/{top-companies-45X3DT7Z.js → top-companies-PGIAEHDF.js} +4 -3
  320. package/dist/{top-companies-45X3DT7Z.js.map → top-companies-PGIAEHDF.js.map} +1 -1
  321. package/dist/{translate-Z66FDB4K.js → translate-GXTS633J.js} +12 -11
  322. package/dist/{translate-Z66FDB4K.js.map → translate-GXTS633J.js.map} +1 -1
  323. package/dist/{triggers-22EMIVFD.js → triggers-2PTONXRU.js} +4 -3
  324. package/dist/{triggers-22EMIVFD.js.map → triggers-2PTONXRU.js.map} +1 -1
  325. package/dist/{unlink-65KUN6ID.js → unlink-XRMYJ6DB.js} +4 -3
  326. package/dist/{unlink-65KUN6ID.js.map → unlink-XRMYJ6DB.js.map} +1 -1
  327. package/dist/{unstage-2E3I5SWF.js → unstage-FY7A3YFF.js} +4 -3
  328. package/dist/{unstage-2E3I5SWF.js.map → unstage-FY7A3YFF.js.map} +1 -1
  329. package/dist/{unstage-4ZEULXEQ.js → unstage-RM2RLXKD.js} +5 -4
  330. package/dist/{unstage-4ZEULXEQ.js.map → unstage-RM2RLXKD.js.map} +1 -1
  331. package/dist/{update-KREBPGBH.js → update-E5SRBXQR.js} +4 -3
  332. package/dist/{update-KREBPGBH.js.map → update-E5SRBXQR.js.map} +1 -1
  333. package/dist/{update-D6DJC6T7.js → update-PJ67D2OG.js} +3 -2
  334. package/dist/{update-D6DJC6T7.js.map → update-PJ67D2OG.js.map} +1 -1
  335. package/dist/{update-2S7CSEAW.js → update-S4562V3O.js} +4 -3
  336. package/dist/{update-2S7CSEAW.js.map → update-S4562V3O.js.map} +1 -1
  337. package/dist/{update-7NCOTAQZ.js → update-V6YVEUI2.js} +4 -3
  338. package/dist/{update-7NCOTAQZ.js.map → update-V6YVEUI2.js.map} +1 -1
  339. package/dist/{upload-O6NHRPS7.js → upload-R6CQVLKF.js} +4 -3
  340. package/dist/{upload-O6NHRPS7.js.map → upload-R6CQVLKF.js.map} +1 -1
  341. package/dist/{url-options-GGXAL3J4.js → url-options-JOKU46F2.js} +4 -3
  342. package/dist/{url-options-GGXAL3J4.js.map → url-options-JOKU46F2.js.map} +1 -1
  343. package/dist/{url-params-3EFGVTZZ.js → url-params-7U2XMOWF.js} +4 -3
  344. package/dist/{url-params-3EFGVTZZ.js.map → url-params-7U2XMOWF.js.map} +1 -1
  345. package/dist/{validate-UMHHNTVU.js → validate-7YPOUKPB.js} +10 -9
  346. package/dist/{validate-UMHHNTVU.js.map → validate-7YPOUKPB.js.map} +1 -1
  347. package/dist/{videos-YSXYGTBM.js → videos-LICG6ACJ.js} +5 -5
  348. package/dist/{web-IGIGVEKS.js → web-BA2PGTWU.js} +4 -3
  349. package/dist/{web-IGIGVEKS.js.map → web-BA2PGTWU.js.map} +1 -1
  350. package/dist/{winning-ads-2WS7FI4E.js → winning-ads-C6S2C5VP.js} +2 -2
  351. package/dist/{write-commands-5C7FUOVN.js → write-commands-7SJ3BOW5.js} +5 -4
  352. package/dist/{write-commands-5C7FUOVN.js.map → write-commands-7SJ3BOW5.js.map} +1 -1
  353. package/dist/{x-BFSKFCZD.js → x-CZHRC6U7.js} +6 -6
  354. package/package.json +1 -1
  355. package/dist/add-5GAN6CVO.js.map +0 -1
  356. package/dist/analytics-FKCXIMPO.js.map +0 -1
  357. package/dist/chunk-DWHIOO7E.js.map +0 -1
  358. package/dist/chunk-EDLZGTGN.js.map +0 -1
  359. package/dist/chunk-GKZ2WU75.js.map +0 -1
  360. package/dist/chunk-SSJK7FEV.js.map +0 -1
  361. package/dist/chunk-T2PC5AVH.js.map +0 -1
  362. package/dist/chunk-XF4JUKVF.js.map +0 -1
  363. package/dist/chunk-YRQYA2LR.js.map +0 -1
  364. package/dist/flows-KABCBS3S.js.map +0 -1
  365. package/dist/funnel-AAX27NH4.js.map +0 -1
  366. package/dist/get-QEYJRLV3.js.map +0 -1
  367. package/dist/scaffold-static-ad-HJY5HFDL.js.map +0 -1
  368. /package/dist/{actions-P35MEMGN.js.map → actions-6TQMSVWD.js.map} +0 -0
  369. /package/dist/{ads-73PGA4YC.js.map → ads-AGYCVD62.js.map} +0 -0
  370. /package/dist/{avatars-EKCKHCC3.js.map → avatars-467OSBD6.js.map} +0 -0
  371. /package/dist/{brand-C6PFGGQN.js.map → brand-YRTEPGBK.js.map} +0 -0
  372. /package/dist/{campaigns-KZYZTXDS.js.map → campaigns-OYMXDGWX.js.map} +0 -0
  373. /package/dist/{canvas-UJNSHD3B.js.map → canvas-YQFG52IG.js.map} +0 -0
  374. /package/dist/{catalog-ZQX6BGXS.js.map → catalog-XLXIM7IW.js.map} +0 -0
  375. /package/dist/{chunk-7YCRFMXF.js.map → chunk-24EB7EDR.js.map} +0 -0
  376. /package/dist/{chunk-5ZDLTE5T.js.map → chunk-2AOE2MZQ.js.map} +0 -0
  377. /package/dist/{chunk-4SG4RW2P.js.map → chunk-2VPBIT65.js.map} +0 -0
  378. /package/dist/{chunk-NPY4QUMQ.js.map → chunk-54C6YDGJ.js.map} +0 -0
  379. /package/dist/{chunk-LZ73CZGP.js.map → chunk-5WCSKQ7Z.js.map} +0 -0
  380. /package/dist/{chunk-3G3ZDLMI.js.map → chunk-5ZNTADVR.js.map} +0 -0
  381. /package/dist/{chunk-AEOSAVVL.js.map → chunk-6F7DVPOS.js.map} +0 -0
  382. /package/dist/{chunk-CJCVIEJ5.js.map → chunk-6NY2GPR4.js.map} +0 -0
  383. /package/dist/{chunk-CXWFX2AM.js.map → chunk-6Y7ZBENQ.js.map} +0 -0
  384. /package/dist/{chunk-M242LHLX.js.map → chunk-7CTMH5AK.js.map} +0 -0
  385. /package/dist/{chunk-QD7ESRLN.js.map → chunk-C46GUI2S.js.map} +0 -0
  386. /package/dist/{chunk-6N6WKAJM.js.map → chunk-CWYAELVG.js.map} +0 -0
  387. /package/dist/{chunk-MXYBTMKB.js.map → chunk-DCRPXOJJ.js.map} +0 -0
  388. /package/dist/{chunk-JQJDXPCO.js.map → chunk-FUHN4MFY.js.map} +0 -0
  389. /package/dist/{chunk-S77PZVYM.js.map → chunk-FYGR3I2A.js.map} +0 -0
  390. /package/dist/{chunk-OZRUJVIQ.js.map → chunk-H3427GPU.js.map} +0 -0
  391. /package/dist/{chunk-IR6D7K4H.js.map → chunk-I3ZR655O.js.map} +0 -0
  392. /package/dist/{chunk-YK32GUBN.js.map → chunk-KMKEYI37.js.map} +0 -0
  393. /package/dist/{chunk-W3ZHJJVT.js.map → chunk-KS2QY6MK.js.map} +0 -0
  394. /package/dist/{chunk-WNRV4QH7.js.map → chunk-LYQJ4PZW.js.map} +0 -0
  395. /package/dist/{chunk-CSYSX4D2.js.map → chunk-N4LAYIIN.js.map} +0 -0
  396. /package/dist/{chunk-4AUMTNVB.js.map → chunk-NA63BH7V.js.map} +0 -0
  397. /package/dist/{chunk-4BQXAE7Z.js.map → chunk-NDEE6G2J.js.map} +0 -0
  398. /package/dist/{chunk-MELOSESI.js.map → chunk-R25YLW6H.js.map} +0 -0
  399. /package/dist/{chunk-Y6O7EWYY.js.map → chunk-RL5CP7N6.js.map} +0 -0
  400. /package/dist/{chunk-DGUNI37S.js.map → chunk-RX2DKU3W.js.map} +0 -0
  401. /package/dist/{chunk-VTDMKARH.js.map → chunk-ULG4QRTV.js.map} +0 -0
  402. /package/dist/{chunk-QRP3PXWN.js.map → chunk-VL43TNIP.js.map} +0 -0
  403. /package/dist/{chunk-SHL7LOC3.js.map → chunk-VLMBTPXU.js.map} +0 -0
  404. /package/dist/{chunk-KHRXPQID.js.map → chunk-VYQ3QJ3C.js.map} +0 -0
  405. /package/dist/{chunk-A4LOJ2VD.js.map → chunk-WGUQHAJY.js.map} +0 -0
  406. /package/dist/{chunk-ZEYEWPK6.js.map → chunk-WKQG6TER.js.map} +0 -0
  407. /package/dist/{chunk-3IBYKLXR.js.map → chunk-ZDMTXQ2Q.js.map} +0 -0
  408. /package/dist/{connect-QCOGEPP4.js.map → connect-FCXNVTXG.js.map} +0 -0
  409. /package/dist/{creatives-NJF2U763.js.map → creatives-FXUQ5WSD.js.map} +0 -0
  410. /package/dist/{customers-A36LOZOB.js.map → customers-XH2DMTFH.js.map} +0 -0
  411. /package/dist/{feedback-PPQMOQ46.js.map → feedback-EIZKS4JU.js.map} +0 -0
  412. /package/dist/{find-OTDIX6V4.js.map → find-FRRHAPWX.js.map} +0 -0
  413. /package/dist/{fonts-EMMX3KII.js.map → fonts-MXR3ZKDX.js.map} +0 -0
  414. /package/dist/{ga4-UDQ2HA2J.js.map → ga4-DV2AXCSL.js.map} +0 -0
  415. /package/dist/{google-M7KEXVK5.js.map → google-6OGZX47I.js.map} +0 -0
  416. /package/dist/{google-KTO3PLEU.js.map → google-QYYYSSXI.js.map} +0 -0
  417. /package/dist/{gsc-P3QYGDV2.js.map → gsc-TAKOF7J5.js.map} +0 -0
  418. /package/dist/{icon-I43F77FV.js.map → icon-L4RSS6PZ.js.map} +0 -0
  419. /package/dist/{ideas-MIDU7YOA.js.map → ideas-NFOW3HKJ.js.map} +0 -0
  420. /package/dist/{images-S254MS6O.js.map → images-2EFFUNNV.js.map} +0 -0
  421. /package/dist/{ingest-YV2NLDBE.js.map → ingest-2EIKN4QC.js.map} +0 -0
  422. /package/dist/{inspiration-P265QJ2H.js.map → inspiration-S3DU4CMQ.js.map} +0 -0
  423. /package/dist/{landing-CJYGWCK4.js.map → landing-2ZB46LXH.js.map} +0 -0
  424. /package/dist/{line-items-7ZGIKEF2.js.map → line-items-5NECXUZT.js.map} +0 -0
  425. /package/dist/{logo-2IP663QO.js.map → logo-Q5D7PZY6.js.map} +0 -0
  426. /package/dist/{lookup-XK45W2SH.js.map → lookup-ETWY47F7.js.map} +0 -0
  427. /package/dist/{media-sources-O6ZRUA3N.js.map → media-sources-ZXHEEP6T.js.map} +0 -0
  428. /package/dist/{performance-6QW2KEEQ.js.map → performance-UF5VTY2U.js.map} +0 -0
  429. /package/dist/{promoted-tweets-SURKMHFI.js.map → promoted-tweets-LZKS5JIF.js.map} +0 -0
  430. /package/dist/{reddit-GIP3ADMS.js.map → reddit-NU2N3LZD.js.map} +0 -0
  431. /package/dist/{research-2BLEISBG.js.map → research-FMM6AWZC.js.map} +0 -0
  432. /package/dist/{run-MODGUNGT.js.map → run-EUO34T2J.js.map} +0 -0
  433. /package/dist/{scheduled-agents-6U44QE76.js.map → scheduled-agents-N4LJRM4C.js.map} +0 -0
  434. /package/dist/{sources-YBQ6KPFM.js.map → sources-FQ2UZTHL.js.map} +0 -0
  435. /package/dist/{stock-2YCDN3N6.js.map → stock-KXJ26BY4.js.map} +0 -0
  436. /package/dist/{studio-RA7QQH4O.js.map → studio-SYKOSNDB.js.map} +0 -0
  437. /package/dist/{sync-definition-IPUFS5XS.js.map → sync-definition-QR2N233R.js.map} +0 -0
  438. /package/dist/{tags-3WPW6PTV.js.map → tags-PYWFSBTR.js.map} +0 -0
  439. /package/dist/{targeting-criteria-NR47AF5C.js.map → targeting-criteria-RJFLFICN.js.map} +0 -0
  440. /package/dist/{testimonials-CVC4YIXO.js.map → testimonials-DII5DYLR.js.map} +0 -0
  441. /package/dist/{videos-YSXYGTBM.js.map → videos-LICG6ACJ.js.map} +0 -0
  442. /package/dist/{winning-ads-2WS7FI4E.js.map → winning-ads-C6S2C5VP.js.map} +0 -0
  443. /package/dist/{x-BFSKFCZD.js.map → x-CZHRC6U7.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../api/src/analytics/eventKey.ts","../../api/src/analytics/adParams.ts","../../api/src/analytics/peopleSearch.ts","../../api/src/identity/digest.ts","../../api/src/identity/email.ts","../../api/src/identity/phone.ts","../../api/src/identity/index.ts","../../api/src/analytics/wire.ts","../../api/src/analytics/conversions.ts","../../api/src/analytics/submissionAnswers.ts","../../api/src/analytics/trackingPlan.ts","../../api/src/funnel/wire.ts","../../api/src/funnel/stepTemplates.ts","../../api/src/funnel/vocabulary.ts"],"sourcesContent":["/**\n * The name of a thing that happens on a published page.\n *\n * Baker's event stream is typed rows, not named events: a Form node's trigger\n * lives in `flow_slug` / `step_id` / `trigger_id`, a page-defined event in\n * `event_name`, an outbound click's destination in `event_name` again. Nothing\n * in it is a single value you could point at and say \"count that one\".\n *\n * An event key is that value, derived from the row rather than stored on it:\n *\n * ```\n * form:<flow_slug>:<step_id>:<trigger_id> a Form node's trigger\n * submit:<flow_slug> a Form reached its last node\n * page:<event_name> a named event: a data-baker-* event, a\n * video milestone, or one a client's\n * own server posted\n * exit:<event_name> an outbound click, by destination host\n * view:<landing_id> a landing page was viewed\n * ```\n *\n * ## Derived, never stored\n *\n * There is no `event_key` column and no producer change. The key is a SQL\n * expression over columns that already exist, which is what lets a page that\n * was published months ago start producing keys the moment an endpoint deploys\n * — and what keeps a conversion definition retroactive, since a definition\n * added today is matched against every row already collected.\n *\n * ## The SQL builds them; this module mostly reads them\n *\n * `eventKeySql` in `tinybird/definitions.ts` is the only thing that turns a row\n * into a key, so there is one producer and no chance of two vocabularies. This\n * module parses keys for display, and builds the one family that has to be\n * constructed without asking the store: the Form-builder star knows its flow,\n * node and trigger and has to name the key before any event has ever fired.\n * Every other family is discovered — a `page:` key is offered once an event\n * carrying that name has arrived, which is why there is no builder for it.\n * `eventKey.parity.test.ts` reads the SQL and fails if the two shapes drift.\n *\n * ## Why `:` is safe\n *\n * Flow slugs are directory names, node ids are UUIDs, and neither can contain a\n * colon. Trigger ids can (`iframe.<whatever the embed posts>`), so the trigger\n * takes everything after the third separator rather than being split on it.\n * Page event names and outbound hosts take everything after the first, for the\n * same reason.\n */\n\n/**\n * The families a key can belong to, and therefore everything that can be\n * counted.\n *\n * `view` is the newest and the only one that is not an outcome. A landing\n * being viewed is the first step of most funnels a marketer would draw —\n * \"saw the offer, asked for a quote, booked the visit\" — and until it had a\n * key the funnel could not start where the journey starts. It is a funnel\n * step and never a conversion: the conversions surfaces refuse to mark it\n * (`conversionArgs`, `analytics/conversions.ts`) and the catalogue does not\n * offer it, because a page view counted as an outcome would put the\n * conversion rate one click away from the traffic count.\n *\n * There was briefly a fifth, `server`, for an event a client's own server\n * posted. It is gone: a named event is a named event whoever sent it, and\n * splitting the vocabulary made a server-sent conversion a different kind of\n * thing on every screen that lists one. Which collector wrote it is `source` on\n * the row — a property a report can filter by, rather than a family half the\n * reports would have to learn about.\n *\n * `page:` keeps its prefix even though it now covers both. Renaming it to\n * something origin-neutral would silently stop counting every definition\n * already stored under the old spelling; only the label changes.\n */\nexport const EVENT_KEY_FAMILIES = [\"form\", \"submit\", \"page\", \"exit\", \"view\"] as const;\nexport type EventKeyFamily = (typeof EVENT_KEY_FAMILIES)[number];\n\nconst SEP = \":\";\n\n/**\n * The key for one trigger on one Form node.\n *\n * The only builder, because this is the only family whose key has to exist\n * before the event does — the star in the Form builder marks an outcome on a\n * node that may never have fired.\n */\nexport function formEventKey(flowSlug: string, nodeId: string, triggerId: string): string {\n return [\"form\", flowSlug, nodeId, triggerId].join(SEP);\n}\n\n/**\n * The key for one landing being viewed.\n *\n * The second builder, for the same reason as the first: a funnel step on a\n * landing is drawn from the Landings list, before the page has necessarily had\n * a visitor. `landing_id` is the landing's internal id — what the page stamps on\n * every row it sends — never its slug, which a rename changes.\n */\nexport function landingViewEventKey(landingId: string): string {\n return [\"view\", landingId].join(SEP);\n}\n\n/**\n * The key for ANY landing being viewed — the way a funnel's first step counts\n * everybody who arrived without naming each landing, and without going stale\n * the day a landing is added. Parsed as a `view` key with `*` for the id, so\n * both conversion write paths keep refusing it; `funnel_reach` is the one\n * reader that resolves it, after every exact key.\n */\nexport const ANY_LANDING_VIEW_KEY = \"view:*\";\n\nexport function isAnyLandingViewKey(key: string): boolean {\n return key === ANY_LANDING_VIEW_KEY;\n}\n\n/** One event key, taken apart far enough to describe in words. */\nexport type ParsedEventKey =\n | { family: \"form\"; flowSlug: string; nodeId: string; triggerId: string }\n | { family: \"submit\"; flowSlug: string }\n | { family: \"page\"; eventName: string }\n | { family: \"exit\"; host: string }\n | { family: \"view\"; landingId: string };\n\n/** Whether a key names a page being viewed — a funnel step, and never an outcome. */\nexport function isLandingViewKey(key: string): boolean {\n return parseEventKey(key)?.family === \"view\";\n}\n\n/**\n * A key's parts, or `null` for anything this vocabulary does not cover.\n *\n * Tolerant on purpose: keys arrive from a Convex row somebody may have written\n * through the CLI, and one unreadable definition must not cost the other three\n * their row on the screen. A caller that gets `null` shows the raw key, which is\n * still the truth about what is being counted.\n */\nexport function parseEventKey(key: string): ParsedEventKey | null {\n // Split off the family, then hand the rest to whoever knows how many\n // separators of its own it has.\n const cut = key.indexOf(SEP);\n if (cut <= 0) return null;\n const family = key.slice(0, cut);\n const rest = key.slice(cut + 1);\n if (rest === \"\") return null;\n\n switch (family) {\n case \"form\": {\n // The trigger takes everything after the third separator: `iframe.<name>`\n // is named by whatever a client's embedded page posts and may contain one.\n const [flowSlug, nodeId, ...triggerParts] = rest.split(SEP);\n const triggerId = triggerParts.join(SEP);\n if (!flowSlug || !nodeId || triggerId === \"\") return null;\n return { family: \"form\", flowSlug, nodeId, triggerId };\n }\n case \"submit\":\n return { family: \"submit\", flowSlug: rest };\n case \"page\":\n return { family: \"page\", eventName: rest };\n case \"exit\":\n return { family: \"exit\", host: rest };\n case \"view\":\n return { family: \"view\", landingId: rest };\n default:\n return null;\n }\n}\n","/**\n * What each ad platform can tell us about a click — one vocabulary per platform.\n *\n * Every paid platform stamps its own structure onto the landing URL, and the\n * platforms do not describe the same world. Google Ads knows a keyword, a match\n * type and a search network; Meta has none of those and never will, because\n * nobody bids on a keyword there. Meta knows which of its four properties\n * served the ad; Google has no equivalent. TikTok's `__AID__` is the ad *group*\n * and `__CID__` is the ad, which reads as the exact opposite of what those\n * letters suggest. And the parameter *name* each value lands under is whatever\n * the advertiser typed into their own tracking setup.\n *\n * So this module holds one thing per platform: **the dimensions that platform\n * can actually send, and the spellings we already recognise for each.**\n *\n * ## Why there is no cross-platform mapping, and no \"all platforms\"\n *\n * An earlier version had one mapping per company plus a shared layer, and it\n * was wrong in a way no report announces. `cid` is TikTok's ad and half the\n * internet's campaign. `campaignid` hand-tagged in a LinkedIn account holds\n * `{{CAMPAIGN_ID}}`, which is the level Meta and Google call an ad *set*. A\n * single company-wide answer to \"what does `cid` mean\" has to be wrong for\n * somebody, and the company it is wrong for gets a confident, plausible,\n * incorrect report.\n *\n * The deeper problem was the shared vocabulary itself. Offering \"Keyword\" as a\n * meaning for a parameter on Meta traffic is not merely unhelpful, it invites\n * an answer that cannot be true. So a mapping entry always names a platform,\n * and the meanings on offer are that platform's own.\n *\n * ## What this module does not do\n *\n * It does not tell an advertiser how to tag their ads. There is no template to\n * paste and no naming convention to adopt: the account is theirs, it is usually\n * already tagged, and a tool that opens by proposing a rewrite of somebody's\n * live tracking is a tool they close. {@link AdPlatformDimension.macro} exists\n * to *show what a platform is able to send*, not to instruct.\n *\n * ## UTM parameters are not in here, deliberately\n *\n * `utm_source`, `utm_medium`, `utm_campaign`, `utm_content` and `utm_term` mean\n * the same thing on every platform, have their own columns, and are read as\n * themselves everywhere. Nothing about them needs mapping. They are listed in\n * {@link RESERVED_PARAM_NAMES} so a mapping cannot claim one and report the\n * same value twice under two vocabularies.\n *\n * ## Roles are resolved when a report is read\n *\n * Never stamped onto the row at ingest. So a company that fixes its mapping\n * fixes its history rather than only its future, and a dimension added next\n * year applies to traffic collected today. The cost is that a role cannot carry\n * an index; that is the right trade for a dimension you break down by rather\n * than look up, and the click ids that *are* looked up are already columns.\n *\n * Dependency-free, like the rest of `analytics/`: this ships to the edge.\n */\n\n// ---------------------------------------------------------------------------\n// The vocabulary\n// ---------------------------------------------------------------------------\n\n/**\n * Every dimension any ad platform can tell us about a click.\n *\n * The union across platforms, and no platform offers all of it — which is the\n * point. {@link AD_PLATFORM_DEFINITIONS} says which of these each one can\n * actually send, and that subset is what a person is offered when they are\n * naming a parameter on that platform's traffic.\n *\n * The bar for membership is that a marketer would break a report down by it or\n * filter on it. That bar keeps out the opaque numbers several platforms will\n * happily send — Google's geo criterion ids, its target and extension ids, the\n * hotel-campaign macros — every one of which is an identifier a person cannot\n * read and no screen would ever group by. Capture is derived from this list, so\n * leaving one out also stops us storing values nobody was going to look at.\n *\n * The two entries at the end are the flexible part, they are on every platform,\n * and they are opposites:\n *\n * - `other` — capture it and let me filter by its own name, but do not claim it\n * means anything. For a parameter that carries real information this\n * vocabulary has no word for.\n * - `ignore` — this is not campaign information. Stop storing it and stop\n * listing it. For the session tokens, cache busters and app state that share\n * a query string with the tracking.\n */\nexport const AD_PARAM_ROLES = [\n \"campaign_id\",\n \"campaign_name\",\n \"adgroup_id\",\n \"adgroup_name\",\n \"ad_id\",\n \"ad_name\",\n \"keyword\",\n \"match_type\",\n \"search_query\",\n \"audience\",\n \"placement\",\n \"network\",\n \"site_source\",\n \"device\",\n \"product_id\",\n \"account_name\",\n \"other\",\n \"ignore\",\n] as const;\n\nexport type AdParamRole = (typeof AD_PARAM_ROLES)[number];\n\n/** On every platform, because they say something about the URL rather than the ad. */\nexport const UNIVERSAL_AD_PARAM_ROLES: readonly AdParamRole[] = [\"other\", \"ignore\"];\n\n/**\n * Dimensions no platform's macro vocabulary fills in, but any account can put\n * on its own URLs.\n *\n * A third tier, and it exists because the first two could not hold `audience`.\n * `AD_PLATFORM_DEFINITIONS` lists what a platform can *tell us*, and none of\n * the platforms exposes a macro for the remarketing list or interest segment a\n * click came from — so `audience` belonged to no platform, and once\n * `adPlatformKnowsRole` started gating writes it became a role that could be\n * asked for and never mapped, on any platform, by anyone. A `--role audience`\n * report then resolves to no spellings at all, which the SQL reads as \"arrived\n * carrying none of these\" and answers with a confident zero.\n *\n * The `keyword`-on-Meta reasoning does not apply to it. Nobody bids on a\n * keyword in Meta, so offering the role there invites an answer that cannot be\n * true; every platform on this list, by contrast, has audiences — an advertiser\n * writing `?aud=warm-retargeting` into their own tracking template on any of\n * them means exactly what {@link AD_PARAM_ROLE_SPECS} says. Answering that with\n * `other` would keep the value and lose the normalization, which is the only\n * reason a role exists rather than a parameter name.\n *\n * Kept separate from {@link UNIVERSAL_AD_PARAM_ROLES} rather than merged into\n * it: those two are answers about the reader's own URL and deliberately end\n * every list, and `adParams.test.ts` pins that.\n */\nexport const HAND_TAGGED_AD_PARAM_ROLES: readonly AdParamRole[] = [\"audience\"];\n\nexport interface AdParamRoleSpec {\n role: AdParamRole;\n /** What a marketer calls it. Shown in the dashboard and the CLI. */\n label: string;\n /** One line, written for someone deciding whether their parameter is this. */\n description: string;\n}\n\n/**\n * The three-tier hierarchy is normalized to campaign → ad group → ad, because\n * every platform has those three levels under four different sets of names and\n * comparing them across platforms is the entire point. Each platform's own\n * words for them are in {@link AD_PLATFORM_DEFINITIONS}, where the rename is\n * visible rather than implied.\n */\nexport const AD_PARAM_ROLE_SPECS: Readonly<Record<AdParamRole, AdParamRoleSpec>> = {\n campaign_id: { role: \"campaign_id\", label: \"Campaign ID\", description: \"The top level of this account's structure.\" },\n campaign_name: { role: \"campaign_name\", label: \"Campaign name\", description: \"The campaign's name.\" },\n adgroup_id: { role: \"adgroup_id\", label: \"Ad group ID\", description: \"The targeting container inside a campaign.\" },\n adgroup_name: { role: \"adgroup_name\", label: \"Ad group name\", description: \"The ad group's name.\" },\n ad_id: { role: \"ad_id\", label: \"Ad ID\", description: \"The individual ad that was clicked.\" },\n ad_name: { role: \"ad_name\", label: \"Ad name\", description: \"The individual ad's name.\" },\n keyword: {\n role: \"keyword\",\n label: \"Keyword\",\n description: \"The keyword that matched, as it is written in the account — not what the visitor typed.\",\n },\n match_type: {\n role: \"match_type\",\n label: \"Match type\",\n description: \"How loosely the keyword matched: broad, phrase or exact.\",\n },\n search_query: { role: \"search_query\", label: \"Search query\", description: \"What the visitor actually typed.\" },\n audience: {\n role: \"audience\",\n label: \"Audience\",\n description: \"The remarketing list or interest segment the visitor was in.\",\n },\n placement: {\n role: \"placement\",\n label: \"Placement\",\n description: \"Where the ad appeared — a feed, a story, a site on the display network.\",\n },\n network: {\n role: \"network\",\n label: \"Network\",\n description: \"Which network served it: search, a search partner, display, or a video surface.\",\n },\n site_source: {\n role: \"site_source\",\n label: \"App\",\n description: \"Which app the click came from, on platforms that span several.\",\n },\n device: { role: \"device\", label: \"Device\", description: \"Mobile, tablet or desktop, as the platform saw it.\" },\n product_id: { role: \"product_id\", label: \"Product ID\", description: \"The shopping item that was clicked.\" },\n account_name: {\n role: \"account_name\",\n label: \"Account name\",\n description: \"Which ad account paid for the click, where an agency runs several.\",\n },\n other: {\n role: \"other\",\n label: \"Something else\",\n description: \"Keep the values and let me filter by this name, without saying what it means.\",\n },\n ignore: {\n role: \"ignore\",\n label: \"Ignore it\",\n description: \"Not campaign information. Baker stops storing it and stops asking about it.\",\n },\n};\n\nexport function isAdParamRole(value: string): value is AdParamRole {\n return (AD_PARAM_ROLES as readonly string[]).includes(value);\n}\n\n/**\n * Names a mapping may never claim.\n *\n * The five UTM parameters are the same thing on every platform, have their own\n * columns on the event, and are already reported as themselves. Letting one be\n * mapped to a role would store the same value twice under two vocabularies and\n * leave the Campaigns report and the ad breakdown quietly disagreeing about\n * which one the reader is looking at.\n */\nexport const RESERVED_PARAM_NAMES: readonly string[] = [\n \"utm_source\",\n \"utm_medium\",\n \"utm_campaign\",\n \"utm_content\",\n \"utm_term\",\n \"utm_id\",\n];\n\nexport function isReservedParamName(name: string): boolean {\n return RESERVED_PARAM_NAMES.includes(normalizeAdParamName(name));\n}\n\n// ---------------------------------------------------------------------------\n// Platforms\n// ---------------------------------------------------------------------------\n\n/**\n * The platforms a mapping can belong to, in the order they appear as tabs.\n *\n * X is deliberately absent even though `twclid` is a click id we store: X\n * offers no dynamic URL parameters at all, so there is nothing for it to send\n * and nothing for a mapping to say. Its traffic still appears in every report —\n * it simply has no vocabulary of its own.\n */\nexport const AD_PLATFORMS = [\n \"google\",\n \"meta\",\n \"microsoft\",\n \"linkedin\",\n \"tiktok\",\n \"reddit\",\n \"pinterest\",\n \"snapchat\",\n \"chatgpt\",\n] as const;\nexport type AdPlatform = (typeof AD_PLATFORMS)[number];\n\nexport function isAdPlatform(value: string): value is AdPlatform {\n return (AD_PLATFORMS as readonly string[]).includes(value);\n}\n\n/** One thing a platform is able to put on the URL. */\nexport interface AdPlatformDimension {\n role: AdParamRole;\n /**\n * The platform's own macro for it, shown as evidence of what it can send.\n *\n * Not an instruction. Nothing generates a template from these and nobody is\n * asked to paste one — an account is usually already tagged, often by\n * somebody who has left, and a mapping tool that opens by proposing a rewrite\n * of live tracking is one people close.\n */\n macro: string;\n /**\n * Spellings already recognised for this dimension on this platform, most\n * canonical first.\n *\n * Safe to be generous here in a way a single cross-platform list never was:\n * `cid` can be TikTok's ad because it is only ever claimed on TikTok traffic.\n */\n names: readonly string[];\n /** Present when the platform's own naming contradicts what the value is. */\n note?: string;\n}\n\nexport interface AdPlatformDefinition {\n platform: AdPlatform;\n label: string;\n /** Where the list came from, so the next person can check it. */\n docs: string;\n /** What this platform can tell us — and, by omission, what it cannot. */\n dimensions: readonly AdPlatformDimension[];\n}\n\n/**\n * Google Ads (ValueTrack).\n *\n * The richest vocabulary here, and the only one with both a keyword and a match\n * type. Names and meanings come from the Google Ads API's own\n * ValueTrack-to-report mapping, which is authoritative where the help-centre\n * article omits several and keeps a few that no longer resolve.\n *\n * Left out on purpose: the geo criterion ids (`{loc_physical_ms}` and friends\n * are bare numbers with no name attached), `{targetid}`, `{feeditemid}` and the\n * fourteen hotel-campaign macros. Each is an identifier a person cannot read.\n * If a client runs hotel campaigns, this is the list to extend.\n */\nconst GOOGLE: AdPlatformDefinition = {\n platform: \"google\",\n label: \"Google Ads\",\n docs: \"https://developers.google.com/google-ads/api/docs/reporting/valuetrack-mapping\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{campaignid}\", names: [\"campaign_id\", \"campaignid\", \"gad_campaignid\"] },\n { role: \"adgroup_id\", macro: \"{adgroupid}\", names: [\"adgroup_id\", \"adgroupid\"] },\n {\n role: \"ad_id\",\n macro: \"{creative}\",\n names: [\"ad_id\", \"creative\", \"adid\"],\n note: \"ValueTrack calls the ad id {creative}.\",\n },\n { role: \"keyword\", macro: \"{keyword}\", names: [\"keyword\", \"kw\"] },\n {\n role: \"match_type\",\n macro: \"{matchtype}\",\n names: [\"match_type\", \"matchtype\", \"mt\"],\n note: \"b broad, p phrase, e exact, a AI Max.\",\n },\n {\n role: \"network\",\n macro: \"{network}\",\n names: [\"network\", \"gad_source\"],\n note: \"g search, s partner, d display, ytv YouTube.\",\n },\n { role: \"device\", macro: \"{device}\", names: [\"device\"] },\n { role: \"placement\", macro: \"{placement}\", names: [\"placement\"] },\n { role: \"product_id\", macro: \"{product_id}\", names: [\"product_id\"], note: \"Shopping campaigns only.\" },\n ],\n};\n\n/**\n * Meta.\n *\n * Eight macros, and that is the whole language — no tracking template, no\n * string functions, no product-level macros. Meta cannot send a keyword, a\n * match type or a search query, and no amount of configuration will make it:\n * nobody bids on a keyword there. It is the clearest case for a per-platform\n * vocabulary, because offering \"Keyword\" here invites an answer that cannot be\n * true.\n *\n * The two it has that Google does not are the most useful and the least used:\n * `{{placement}}` separates feed from story from reels, and\n * `{{site_source_name}}` says which of Meta's four properties served the ad.\n */\nconst META: AdPlatformDefinition = {\n platform: \"meta\",\n label: \"Meta Ads\",\n docs: \"https://www.facebook.com/business/help/2360940870872492\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{{campaign.id}}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"{{campaign.name}}\", names: [\"campaign_name\", \"campaignname\"] },\n {\n role: \"adgroup_id\",\n macro: \"{{adset.id}}\",\n names: [\"adset_id\", \"adgroup_id\", \"adsetid\"],\n note: \"Meta calls an ad group an ad set.\",\n },\n { role: \"adgroup_name\", macro: \"{{adset.name}}\", names: [\"adset_name\", \"adgroup_name\"] },\n { role: \"ad_id\", macro: \"{{ad.id}}\", names: [\"ad_id\", \"adid\"] },\n { role: \"ad_name\", macro: \"{{ad.name}}\", names: [\"ad_name\", \"adname\"] },\n {\n role: \"placement\",\n macro: \"{{placement}}\",\n names: [\"placement\", \"placement_id\"],\n note: \"feed, story, reels and the rest.\",\n },\n {\n role: \"site_source\",\n macro: \"{{site_source_name}}\",\n names: [\"site_source\", \"site_source_name\"],\n note: \"fb, ig, an or msg.\",\n },\n ],\n};\n\n/**\n * Microsoft Advertising.\n *\n * Close to Google's by design — its tracking templates are built for accounts\n * imported from Google Ads — with one thing Google has no equivalent for:\n * `{QueryString}` returns what the visitor actually typed, which is the\n * difference between \"this keyword converts\" and \"the people reaching this\n * keyword are asking for something else\".\n */\nconst MICROSOFT: AdPlatformDefinition = {\n platform: \"microsoft\",\n label: \"Microsoft Advertising\",\n docs: \"https://learn.microsoft.com/en-us/advertising/guides/url-tracking-upgraded-urls\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{CampaignId}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"{Campaign}\", names: [\"campaign_name\", \"campaignname\"] },\n { role: \"adgroup_id\", macro: \"{AdGroupId}\", names: [\"adgroup_id\", \"adgroupid\"] },\n { role: \"adgroup_name\", macro: \"{AdGroup}\", names: [\"adgroup_name\", \"adgroupname\"] },\n { role: \"ad_id\", macro: \"{AdId}\", names: [\"ad_id\", \"adid\"] },\n { role: \"keyword\", macro: \"{Keyword}\", names: [\"keyword\", \"kw\"] },\n { role: \"match_type\", macro: \"{MatchType}\", names: [\"match_type\", \"matchtype\", \"mt\"] },\n {\n role: \"search_query\",\n macro: \"{QueryString}\",\n names: [\"search_query\", \"querystring\"],\n note: \"What the visitor typed. Google has no equivalent.\",\n },\n { role: \"network\", macro: \"{Network}\", names: [\"network\"] },\n { role: \"device\", macro: \"{Device}\", names: [\"device\"] },\n ],\n};\n\n/**\n * LinkedIn.\n *\n * Its hierarchy is account → campaign group → campaign → creative, one name out\n * of step with everyone else: a LinkedIn *campaign group* is what Meta and\n * Google call a campaign, and a LinkedIn *campaign* is their ad set or ad\n * group. The renames below are what let a report compare LinkedIn to Meta at\n * the same tier, and they are only safe because they are scoped here —\n * `campaign_id` on LinkedIn traffic is its ad-group level, and reading it as a\n * campaign would make every cross-platform comparison wrong by one tier.\n */\nconst LINKEDIN: AdPlatformDefinition = {\n platform: \"linkedin\",\n label: \"LinkedIn Ads\",\n docs: \"https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/dynamic-utm-tracking\",\n dimensions: [\n { role: \"account_name\", macro: \"{{ACCOUNT_NAME}}\", names: [\"account_name\"] },\n {\n role: \"campaign_id\",\n macro: \"{{CAMPAIGN_GROUP_ID}}\",\n names: [\"campaign_group_id\", \"campaign_id\"],\n note: \"LinkedIn's campaign group is the level other platforms call a campaign.\",\n },\n { role: \"campaign_name\", macro: \"{{CAMPAIGN_GROUP_NAME}}\", names: [\"campaign_group_name\", \"campaign_name\"] },\n {\n role: \"adgroup_id\",\n macro: \"{{CAMPAIGN_ID}}\",\n names: [\"adgroup_id\"],\n note: \"LinkedIn's campaign is the level other platforms call an ad group.\",\n },\n { role: \"adgroup_name\", macro: \"{{CAMPAIGN_NAME}}\", names: [\"adgroup_name\"] },\n { role: \"ad_id\", macro: \"{{CREATIVE_ID}}\", names: [\"creative_id\", \"ad_id\"] },\n { role: \"ad_name\", macro: \"{{CREATIVE_NAME}}\", names: [\"creative_name\", \"ad_name\"] },\n ],\n};\n\n/**\n * TikTok.\n *\n * The two macros that matter most are named the opposite of what they hold:\n * `__AID__` is the ad *group* id, not the ad id, and `__CID__` is the creative\n * — the ad — not the campaign. Accounts tagged by hand get this wrong more\n * often than they get it right, which is why `cid` and `aid` are recognised\n * here as the ad and the ad group. Claiming those two spellings anywhere else\n * would be a disaster: `cid` is a campaign id on most of the internet.\n */\nconst TIKTOK: AdPlatformDefinition = {\n platform: \"tiktok\",\n label: \"TikTok Ads\",\n docs: \"https://ads.tiktok.com/help/article/track-offsite-web-events-with-utm-parameters\",\n dimensions: [\n { role: \"campaign_id\", macro: \"__CAMPAIGN_ID__\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"__CAMPAIGN_NAME__\", names: [\"campaign_name\", \"campaignname\"] },\n {\n role: \"adgroup_id\",\n macro: \"__AID__\",\n names: [\"adgroup_id\", \"aid\"],\n note: \"__AID__ is the ad GROUP id, not the ad id.\",\n },\n { role: \"adgroup_name\", macro: \"__AID_NAME__\", names: [\"adgroup_name\"] },\n {\n role: \"ad_id\",\n macro: \"__CID__\",\n names: [\"ad_id\", \"cid\"],\n note: \"__CID__ is the creative id, not the campaign id.\",\n },\n { role: \"ad_name\", macro: \"__CID_NAME__\", names: [\"ad_name\"] },\n { role: \"placement\", macro: \"__PLACEMENT__\", names: [\"placement\"], note: \"TikTok or TikTok Pangle.\" },\n ],\n};\n\n/**\n * Reddit.\n *\n * Ordinary double-brace macros with no traps. Only the ones every published\n * reference agrees on are listed: an unrecognised macro is left in the URL\n * verbatim, so a guess would show up as a literal `{{PLACEMENT}}` on somebody's\n * landing page rather than as a missing column.\n */\nconst REDDIT: AdPlatformDefinition = {\n platform: \"reddit\",\n label: \"Reddit Ads\",\n docs: \"https://business.reddithelp.com/s/article/URL-Parameters\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{{CAMPAIGN_ID}}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"{{CAMPAIGN_NAME}}\", names: [\"campaign_name\"] },\n { role: \"adgroup_id\", macro: \"{{ADGROUP_ID}}\", names: [\"adgroup_id\", \"ad_group_id\"] },\n { role: \"adgroup_name\", macro: \"{{ADGROUP_NAME}}\", names: [\"adgroup_name\", \"ad_group_name\"] },\n { role: \"ad_id\", macro: \"{{AD_ID}}\", names: [\"ad_id\", \"adid\"] },\n { role: \"ad_name\", macro: \"{{AD_NAME}}\", names: [\"ad_name\"] },\n { role: \"device\", macro: \"{{DEVICE_GROUP}}\", names: [\"device\", \"device_group\"] },\n ],\n};\n\n/**\n * Pinterest.\n *\n * Pinterest runs keyword-targeted campaigns and then refuses to send the\n * keyword: its own documentation states `{keyword}` is not supported for\n * tracking links on any ad. So the keyword is not in this vocabulary, and \"why\n * is my Pinterest keyword column empty\" stops being a question somebody spends\n * an afternoon on.\n */\nconst PINTEREST: AdPlatformDefinition = {\n platform: \"pinterest\",\n label: \"Pinterest Ads\",\n docs: \"https://help.pinterest.com/en/business/article/third-party-and-dynamic-tracking\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{campaignid}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"{campaign_name}\", names: [\"campaign_name\", \"campaignname\"] },\n { role: \"adgroup_id\", macro: \"{adgroupid}\", names: [\"adgroup_id\", \"adgroupid\"] },\n { role: \"adgroup_name\", macro: \"{ad_group_name}\", names: [\"adgroup_name\", \"adgroupname\"] },\n {\n role: \"ad_id\",\n macro: \"{adid}\",\n names: [\"ad_id\", \"adid\", \"creative_id\"],\n note: \"The promoted Pin, not the Pin itself.\",\n },\n { role: \"device\", macro: \"{device}\", names: [\"device\"], note: \"c computer, m mobile, t tablet.\" },\n { role: \"product_id\", macro: \"{product_id}\", names: [\"product_id\"], note: \"Shopping campaigns only.\" },\n ],\n};\n\n/**\n * Snapchat.\n *\n * Its macros are case-sensitive in a way none of the others are: `{{adSet.id}}`\n * resolves and `{{adset.id}}` — the spelling Meta uses for the same idea — does\n * not, and a mistyped macro is left in the URL rather than reported.\n */\nconst SNAPCHAT: AdPlatformDefinition = {\n platform: \"snapchat\",\n label: \"Snapchat Ads\",\n docs: \"https://businesshelp.snapchat.com/s/article/url-parameters\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{{campaign.id}}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"campaign_name\", macro: \"{{campaign.name}}\", names: [\"campaign_name\"] },\n {\n role: \"adgroup_id\",\n macro: \"{{adSet.id}}\",\n names: [\"adset_id\", \"adgroup_id\"],\n note: \"Case-sensitive: {{adset.id}} does not resolve.\",\n },\n { role: \"adgroup_name\", macro: \"{{adSet.name}}\", names: [\"adset_name\", \"adgroup_name\"] },\n { role: \"ad_id\", macro: \"{{ad.id}}\", names: [\"ad_id\", \"adid\"] },\n { role: \"ad_name\", macro: \"{{creative.name}}\", names: [\"ad_name\", \"creative_name\"] },\n ],\n};\n\n/**\n * ChatGPT Ads.\n *\n * Ids and nothing else: its tracking templates fill in five macros\n * (`CHATGPT_TRACKING_MACROS`) and refuse any other at publish, so there is no\n * name to send and no placement, device or keyword. `{oppref}` is its click id,\n * which it appends as `oppref` by itself and Baker stores as a column, and\n * `{ad_account_id}` names nothing a report breaks down by. The ad group is the level\n * that holds the context hints, which makes it the one a budget decision is\n * made at — and the one a template carrying only `utm_campaign={campaign_id}`\n * and `utm_content={ad_id}` loses, because the UTMs are reported as themselves\n * and never read as a role.\n */\nconst CHATGPT: AdPlatformDefinition = {\n platform: \"chatgpt\",\n label: \"ChatGPT Ads\",\n docs: \"https://help.openai.com/en/articles/20001212-create-ads-for-chatgpt\",\n dimensions: [\n { role: \"campaign_id\", macro: \"{campaign_id}\", names: [\"campaign_id\", \"campaignid\"] },\n { role: \"adgroup_id\", macro: \"{ad_group_id}\", names: [\"ad_group_id\", \"adgroup_id\"] },\n { role: \"ad_id\", macro: \"{ad_id}\", names: [\"ad_id\", \"adid\"] },\n ],\n};\n\nexport const AD_PLATFORM_DEFINITIONS: Readonly<Record<AdPlatform, AdPlatformDefinition>> = {\n google: GOOGLE,\n meta: META,\n microsoft: MICROSOFT,\n linkedin: LINKEDIN,\n tiktok: TIKTOK,\n reddit: REDDIT,\n pinterest: PINTEREST,\n snapchat: SNAPCHAT,\n chatgpt: CHATGPT,\n};\n\n/**\n * What this platform can be asked about, in the order a person looks for it.\n *\n * The list a \"read as\" control offers, and — because `validateAdParamMapping`\n * checks against it — exactly what may be stored for this platform. The two\n * have to be one list: a role that stores and is not offered renders the\n * control blank over a mapping that is really set.\n *\n * Three tiers, narrowest first: what the platform sends, what any account can\n * hand-tag on any platform, then the two answers about the reader's own URL.\n * `other` and `ignore` end every platform's list, which `adParams.test.ts`\n * pins.\n */\nexport function adPlatformRoles(platform: AdPlatform): AdParamRole[] {\n return [\n ...AD_PLATFORM_DEFINITIONS[platform].dimensions.map((entry) => entry.role),\n ...HAND_TAGGED_AD_PARAM_ROLES,\n ...UNIVERSAL_AD_PARAM_ROLES,\n ];\n}\n\n/** Whether this platform can carry that dimension — sent by it, or hand-tagged on it. */\nexport function adPlatformKnowsRole(platform: AdPlatform, role: AdParamRole): boolean {\n return adPlatformRoles(platform).includes(role);\n}\n\n/**\n * The dimensions without which a campaign is not usefully measurable.\n *\n * ## Why this exists, and why it is a short list\n *\n * This file's stated position was that it proposes nothing: an ad account\n * belongs to the client, it is usually already tagged, and a tool that opens by\n * demanding a rewrite of live tracking is one people close. That holds for\n * everything except the ad hierarchy, and there the cost of staying silent is\n * the whole report. A landing page whose URLs carry only `utm_campaign` can say\n * eighty visits came from Meta and nothing about which of nine ad sets or\n * thirty creatives sent them — so the one decision the report exists to inform,\n * move budget from this to that, cannot be made from it. Nobody discovers that\n * until they go looking for the breakdown and find it empty, by which point the\n * traffic it would have described is a month old and unrecoverable: an unmapped\n * parameter's *values* are never stored, so this is the rare configuration\n * whose absence cannot be fixed retroactively.\n *\n * Hence a warning rather than a preference. It is the only thing on this screen\n * that is stated as advice.\n *\n * ## Campaign, ad group, ad — and, where somebody is bidding on words, the words\n *\n * Four at most, and usually three. A recommendation naming eight things is one\n * nobody acts on, so placement, device, network and the rest stay merely\n * useful. `search_query` is left off for a different reason: only Microsoft\n * sends it, so making it essential would report every other platform as\n * incompletely tagged for a thing it cannot do.\n *\n * Ids, never names, at every tier a platform offers both. Renaming a campaign\n * splits its history in two under a name; an id survives the rename, which is\n * exactly what makes a month-over-month comparison possible.\n */\nconst ESSENTIAL_ROLES: readonly AdParamRole[] = [\"campaign_id\", \"adgroup_id\", \"ad_id\", \"keyword\", \"match_type\"];\n\n/**\n * The essential dimensions this platform can actually send.\n *\n * Intersected with the platform's own vocabulary rather than asserted, so Meta\n * is never told it is missing a keyword. That is the same rule the role\n * dropdown follows and for the same reason: a recommendation that cannot be\n * satisfied teaches people to ignore recommendations.\n */\nexport function essentialAdDimensions(platform: AdPlatform): readonly AdPlatformDimension[] {\n return AD_PLATFORM_DEFINITIONS[platform].dimensions.filter((entry) => ESSENTIAL_ROLES.includes(entry.role));\n}\n\n/**\n * Whether any platform at all offers this role.\n *\n * Separates the two ways a mapping can name an unreachable dimension, which\n * read identically to whoever hit them and need opposite fixes: \"Meta has no\n * keyword, use a platform that does\" is a correction the caller can act on,\n * while \"nothing anywhere reports this\" is a hole in the vocabulary and a bug\n * here. `adParams.test.ts` asserts the second can no longer exist, so this\n * exists to keep the *message* honest rather than to expect a `false`.\n */\nexport function anyPlatformKnowsRole(role: AdParamRole): boolean {\n return AD_PLATFORMS.some((platform) => adPlatformKnowsRole(platform, role));\n}\n\n// ---------------------------------------------------------------------------\n// Mapping\n// ---------------------------------------------------------------------------\n\n/** Parameter name, lowercased, to what it means — within one platform. */\nexport type AdParamMapping = Readonly<Record<string, AdParamRole>>;\n\n/**\n * A company's own entries, keyed `<platform>/<name>`.\n *\n * One flat record rather than a record of records, so a write stays a bag of\n * set/remove operations on keys and cannot be half-applied across two levels of\n * nesting. Every key names a platform; there is no cross-platform entry to\n * write and nothing reads one.\n */\nexport type StoredAdParamMapping = Readonly<Record<string, string>>;\n\nexport function adMappingKey(platform: AdPlatform, name: string): string {\n return `${platform}/${normalizeAdParamName(name)}`;\n}\n\nexport interface AdMappingEntry {\n platform: AdPlatform;\n name: string;\n}\n\nexport function parseAdMappingKey(key: string): AdMappingEntry | null {\n const separator = key.indexOf(\"/\");\n if (separator === -1) return null;\n const platform = key.slice(0, separator).trim().toLowerCase();\n const name = normalizeAdParamName(key.slice(separator + 1));\n if (!isAdPlatform(platform) || name === \"\") return null;\n return { platform, name };\n}\n\n/** Parameter names are compared lowercased; URLs are not consistent about case. */\nexport function normalizeAdParamName(raw: string): string {\n return raw.trim().toLowerCase().slice(0, 64);\n}\n\nfunction builtinFor(platform: AdPlatform): AdParamMapping {\n const mapping: Record<string, AdParamRole> = {};\n for (const dimension of AD_PLATFORM_DEFINITIONS[platform].dimensions) {\n for (const name of dimension.names) mapping[normalizeAdParamName(name)] = dimension.role;\n }\n return mapping;\n}\n\nconst BUILTIN: Readonly<Record<AdPlatform, AdParamMapping>> = Object.fromEntries(\n AD_PLATFORMS.map((platform) => [platform, builtinFor(platform)]),\n) as Record<AdPlatform, AdParamMapping>;\n\n/** The spellings this platform is already understood to use, before any configuration. */\nexport function builtinAdParamMapping(platform: AdPlatform): AdParamMapping {\n return BUILTIN[platform];\n}\n\n/**\n * Every spelling any platform can produce, which is what the edge captures.\n *\n * Capture is name-based and platform-blind — the Worker sees a query string,\n * not an ad account — so it has to be the union. That is correct: storing a\n * value the reports then read under one platform's vocabulary costs a map\n * entry, and refusing to store it because another platform means something else\n * by the name would lose the data entirely.\n */\nexport const EVERY_BUILTIN_AD_PARAM_NAME: readonly string[] = [\n ...new Set(AD_PLATFORMS.flatMap((platform) => Object.keys(BUILTIN[platform]))),\n].sort();\n\n/**\n * Parameters worth storing that no role can be named for.\n *\n * A preset entry is a *name for a role*, so a parameter only gets into\n * {@link EVERY_BUILTIN_AD_PARAM_NAME} if one of {@link AD_PARAM_ROLES} describes\n * it. These are real macros a live account emits and this vocabulary has no\n * word for: ValueTrack's two location ids, the feed and extension ids, the\n * device model. There is nothing dishonest to map them to — inventing a role\n * per macro would mean a role nobody ever breaks a report down by — and\n * dropping them means the values are gone rather than merely unlabelled.\n *\n * So capture is deliberately wider than mapping. They arrive, they show up in\n * `baker analytics ads` with no role, and a company that cares says what one of\n * them means with `baker analytics map`. That is the same path a company's own\n * private spelling takes, and it only works if the value was stored.\n *\n * Two things this is not. It is not \"every parameter\": a landing URL carries\n * client state and, on a magic link, an address — which is why `ref`, `source`\n * and friends are deliberately absent however common they are. And it is not a\n * place to park a name that *does* have a role; that belongs in the platform's\n * preset, where it also teaches the reports.\n */\nexport const CAPTURED_WITHOUT_ROLE: readonly string[] = [\n \"account_id\",\n \"audience\",\n \"device_model\",\n \"devicemodel\",\n \"experiment\",\n \"extensionid\",\n \"feed_item_id\",\n \"feeditemid\",\n \"loc_interest_ms\",\n \"loc_physical_ms\",\n \"location_interest\",\n \"location_physical\",\n \"target_id\",\n \"targetid\",\n].sort();\n\n/**\n * The mapping in force for a company on one platform.\n *\n * Two layers: what the platform is already understood to send, then the\n * company's own entries for it, which win. A company that uses `placement` for\n * something of its own must be able to say so, and quietly keeping our reading\n * because we happen to know the name would put their data under a role it does\n * not belong to.\n *\n * An entry naming a role that does not exist is skipped rather than throwing.\n * This reads persisted data that may predate a role being renamed or removed,\n * and a report must never fail because of a mapping written last year. The\n * write path reports the same entry loudly, which is where that belongs.\n */\nexport function resolveAdParamMapping(custom: StoredAdParamMapping | undefined, platform: AdPlatform): AdParamMapping {\n const mapping: Record<string, AdParamRole> = { ...BUILTIN[platform] };\n for (const [key, role] of Object.entries(custom ?? {})) {\n const entry = parseAdMappingKey(key);\n if (entry?.platform === platform && isAdParamRole(role)) mapping[entry.name] = role;\n }\n return mapping;\n}\n\n/**\n * Every parameter name that carries one role, sorted.\n *\n * This is what a query filters on. A company that renamed `kw` to `keyword`\n * last spring has both spellings in its history, so asking for the keyword role\n * has to ask for both — which is the whole reason roles are resolved when a\n * report is read rather than stamped on the row at ingest.\n */\nexport function adParamNamesForRole(mapping: AdParamMapping, role: AdParamRole): string[] {\n return Object.entries(mapping)\n .filter(([, mapped]) => mapped === role)\n .map(([name]) => name)\n .sort();\n}\n\n/**\n * The same question with no platform in hand: every spelling that carries the\n * role on any platform that can send it.\n *\n * The honest answer for a report spanning platforms, and honestly imprecise:\n * TikTok reads `cid` as the ad where most accounts mean a campaign by it, so\n * the union puts one value under two roles in two different reports. Nothing\n * can resolve that without knowing where the click came from, which is why\n * every screen picks a platform and only the cross-platform CLI read does not.\n */\nexport function adParamNamesForRoleAcrossPlatforms(\n custom: StoredAdParamMapping | undefined,\n role: AdParamRole,\n): string[] {\n const names = new Set<string>();\n for (const platform of AD_PLATFORMS) {\n for (const name of adParamNamesForRole(resolveAdParamMapping(custom, platform), role)) names.add(name);\n }\n return [...names].sort();\n}\n\n/**\n * The mapping to label ONE visit's parameters with, when the platform may not\n * be known.\n *\n * A lead panel shows the parameters a single visit arrived with and wants to\n * print \"Keyword\" rather than `kw`. Usually the visit names its platform — a\n * click id says so — and then this is simply that platform's mapping.\n *\n * When it does not, the honest answer is a merge that **drops every name the\n * platforms disagree about**. Labelling `cid` as an ad because TikTok says so,\n * on a visit that may well have come from Google, would put a confident wrong\n * word in front of a person; showing the raw name says exactly as much as we\n * know. A name every platform reads the same way is safe and keeps its label.\n */\nexport function labelAdParamMapping(custom: StoredAdParamMapping | undefined, platform: string): AdParamMapping {\n if (isAdPlatform(platform)) return resolveAdParamMapping(custom, platform);\n const merged: Record<string, AdParamRole> = {};\n const disputed = new Set<string>();\n for (const entry of AD_PLATFORMS) {\n for (const [name, role] of Object.entries(resolveAdParamMapping(custom, entry))) {\n if (merged[name] !== undefined && merged[name] !== role) disputed.add(name);\n merged[name] = role;\n }\n }\n for (const name of disputed) delete merged[name];\n return merged;\n}\n\n/**\n * What one parameter name means on one platform, or null if nothing has said.\n *\n * Normalizes first, which is the whole reason this is a function rather than an\n * index: URLs arrive with `Keyword`, `keyword` and `KEYWORD` and they are one\n * parameter. A caller reaching into the map directly gets a miss on two of the\n * three and shows a raw name beside a value it could have labelled.\n */\nexport function adParamRoleOf(mapping: AdParamMapping, name: string): AdParamRole | null {\n return mapping[normalizeAdParamName(name)] ?? null;\n}\n\n/**\n * Read a URL's captured parameters as roles.\n *\n * Where two spellings of one role are both present — which happens mid-rename,\n * and whenever an advertiser leaves an old parameter in place while adding a\n * new one — the alphabetically first name wins, so the same URL always resolves\n * the same way. Arbitrary, but stable, and a report that flickered between two\n * answers for the same visit would be worse.\n */\nexport function resolveAdDimensions(\n params: Readonly<Record<string, string>>,\n mapping: AdParamMapping,\n): Partial<Record<AdParamRole, string>> {\n const out: Partial<Record<AdParamRole, string>> = {};\n for (const name of Object.keys(params).sort()) {\n const value = params[name];\n if (typeof value !== \"string\" || value === \"\") continue;\n const role = mapping[normalizeAdParamName(name)];\n // `other` is captured but unnamed and `ignore` is not campaign information\n // at all. Neither is a dimension, so neither belongs in a dimension map.\n if (!role || role === \"other\" || role === \"ignore\") continue;\n if (out[role] === undefined) out[role] = value;\n }\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Tracking coverage — what a platform is not sending, and what to add\n// ---------------------------------------------------------------------------\n\n/** One essential dimension, and whether this account is actually sending it. */\nexport interface AdDimensionCoverage {\n role: AdParamRole;\n /** The platform's own macro, which is what goes in the URL. */\n macro: string;\n /**\n * The parameter name this account uses for it, or the canonical one to adopt.\n *\n * The account's own spelling wins wherever there is one — a company that has\n * been sending `kw` for two years should be told to keep sending `kw`, not to\n * change it. `names[0]` is the fallback, and only for a dimension nothing is\n * carrying yet.\n */\n name: string;\n /** Whether some parameter on this platform already carries this role. */\n covered: boolean;\n note?: string;\n}\n\n/**\n * Which of the essential dimensions this account's traffic actually carries.\n *\n * Read off **the parameter names observed arriving on this platform's clicks**,\n * resolved through the mapping — not off the mapping alone. The distinction is\n * the whole correctness of the warning: {@link resolveAdParamMapping} starts\n * from the built-in spellings, which are the names Baker would *recognise* if\n * they turned up, so a mapping-only reading reports every dimension as covered\n * for an account sending none of them. The question is what the ads are\n * sending, and only the traffic knows.\n *\n * `observed` is the inventory the discovery report already produces. An empty\n * inventory means either an untagged account or a platform nobody runs, and the\n * caller distinguishes those by whether the platform has visits at all — a\n * campaign that has not run yet must not be reported as badly tagged.\n */\nexport function adDimensionCoverage(\n platform: AdPlatform,\n custom: StoredAdParamMapping | undefined,\n /** Parameter names seen on this platform's traffic, however they are spelled. */\n observed: readonly string[],\n): AdDimensionCoverage[] {\n const mapping = resolveAdParamMapping(custom, platform);\n const carried = new Map<AdParamRole, string>();\n for (const name of observed) {\n const normalized = normalizeAdParamName(name);\n const role = mapping[normalized];\n // First spelling wins, so a rename in progress reports the older name and\n // a suggestion never asks for a parameter the account is already sending.\n if (role !== undefined && !carried.has(role)) carried.set(role, normalized);\n }\n return essentialAdDimensions(platform).map((dimension) => {\n const name = carried.get(dimension.role);\n return {\n role: dimension.role,\n macro: dimension.macro,\n name: name ?? dimension.names[0] ?? dimension.role,\n covered: name !== undefined,\n ...(dimension.note === undefined ? {} : { note: dimension.note }),\n };\n });\n}\n\n/**\n * The URL suffix that would start sending the dimensions this account is missing.\n *\n * Exactly the missing ones, in the platform's own macro language, ready to\n * paste into the account's tracking template or URL-parameters field. Nothing\n * about the ad itself and nothing that touches what is already there — the\n * existing parameters keep working and keep being read, which is what makes it\n * safe to hand to somebody who did not write the current tagging.\n *\n * Empty when nothing is missing, so a caller can tell \"here is what to add\"\n * from \"there is nothing to add\" without inspecting the string.\n */\nexport function missingParamSuffix(\n platform: AdPlatform,\n custom: StoredAdParamMapping | undefined,\n observed: readonly string[],\n): string {\n return adDimensionCoverage(platform, custom, observed)\n .filter((entry) => !entry.covered)\n .map((entry) => `${entry.name}=${entry.macro}`)\n .join(\"&\");\n}\n","/**\n * Finding people by what somebody already holds about them.\n *\n * A marketer reconciling Baker against their CRM has a column of emails, phone\n * numbers, HubSpot contact or deal ids, or the click ids an ad platform showed\n * them — never the browser cookie or the digest the store keys a person by. So\n * a search takes those, one per line, and turns each into the keys the identity\n * graph is walked from:\n *\n * - **An email or a phone is hashed here**, under every normalization version\n * the store has written (`identity/`), because the store holds digests and\n * the plaintext never reaches the query. A national phone number is hashed as\n * typed — v1 guesses no country, and neither does this.\n * - **A bare number is two guesses**: a CRM contact id (HubSpot's are digits)\n * and a phone typed without its prefix. A wrong guess costs nothing — a\n * digest nobody holds matches no row.\n * - **A deal id is not a key at all.** Deals name contacts; the caller resolves\n * it through the CRM into contact ids before asking the store.\n * - **Anything else is a key taken verbatim**: a browser id, one of the ad\n * click ids, a Meta cookie. A prefix (`gclid:…`) says which; without one every\n * verbatim kind is tried.\n *\n * Pure but for the hashing, so the parsing is a table a test can read.\n */\n\nimport { z } from \"zod\";\nimport { externalIdDigest, isSha256Hex, normalizeIdentity, sha256Hex } from \"../identity\";\nimport type { IdentityKey, IdentityKeyKind } from \"./identityLinks\";\n\n/** How many people one search may name. A reconciliation is a day's leads, not a customer base. */\nexport const PEOPLE_SEARCH_MAX_TERMS = 50;\n\n/** The key kinds a value is taken verbatim as: nothing hashes them. */\nconst VERBATIM_KINDS = [\n \"browser\",\n \"gclid\",\n \"wbraid\",\n \"gbraid\",\n \"dclid\",\n \"fbclid\",\n \"ttclid\",\n \"twclid\",\n \"li_fat_id\",\n \"msclkid\",\n \"rdt_cid\",\n \"epik\",\n \"sccid\",\n \"oppref\",\n \"fbp\",\n \"fbc\",\n] as const satisfies readonly IdentityKeyKind[];\ntype VerbatimKind = (typeof VERBATIM_KINDS)[number];\n\n/**\n * What a term was read as.\n *\n * - `number`: bare digits — a CRM contact id, or a phone with no prefix.\n * - `digest`: a SHA-256 somebody already computed — an email's, a phone's or a CRM id's.\n * - `deal`: a CRM deal id, resolved to its contacts by the caller.\n * - `key`: a value with no recognisable shape, tried as every verbatim kind.\n */\nexport type PersonTermKind = \"email\" | \"phone\" | \"external\" | \"number\" | \"digest\" | \"deal\" | \"key\" | VerbatimKind;\n\nexport type PersonTerm = {\n /** Exactly what was typed, trimmed: what the answer is reported against. */\n input: string;\n kind: PersonTermKind;\n /** The value with any prefix removed. */\n value: string;\n};\n\n/** Prefixes a term may name its kind with, beyond the kinds' own names. */\nconst PREFIXES: Readonly<Record<string, PersonTermKind>> = {\n email: \"email\",\n mail: \"email\",\n phone: \"phone\",\n tel: \"phone\",\n external: \"external\",\n contact: \"external\",\n hubspot: \"external\",\n id: \"external\",\n deal: \"deal\",\n digest: \"digest\",\n hash: \"digest\",\n browser: \"browser\",\n anon: \"browser\",\n ...Object.fromEntries(VERBATIM_KINDS.map((kind) => [kind, kind])),\n};\n\nconst TERM_SEPARATORS = /[\\n\\r\\t,;]+/;\nconst EMAIL_SHAPE = /^[^\\s@]+@[^\\s@]+$/;\nconst DIGITS = /^\\d+$/;\n/** `+34 600 111 222`, `0034-600-111-222`: a prefix, then digits and what people type between them. */\nconst INTERNATIONAL_PHONE = /^(\\+|00)[\\d\\s().-]{7,}$/;\n/** A Meta cookie: `fb.1.<timestamp>.<rest>`. */\nconst META_COOKIE = /^fb\\.\\d\\./;\n\n/** The kind a value with no prefix looks like. */\nfunction kindOf(value: string): PersonTermKind {\n if (EMAIL_SHAPE.test(value)) return \"email\";\n if (isSha256Hex(value)) return \"digest\";\n if (INTERNATIONAL_PHONE.test(value)) return \"phone\";\n if (DIGITS.test(value)) return \"number\";\n if (META_COOKIE.test(value)) return \"fbc\";\n return \"key\";\n}\n\nfunction readTerm(input: string): PersonTerm {\n const colon = input.indexOf(\":\");\n if (colon > 0) {\n const kind = PREFIXES[input.slice(0, colon).trim().toLowerCase()];\n const value = input.slice(colon + 1).trim();\n if (kind !== undefined && value !== \"\") return { input, kind, value };\n }\n return { input, kind: kindOf(input), value: input };\n}\n\n/**\n * What makes two terms the same person: the kind and the value as the store\n * reads it — an email or phone normalized, a CRM id or digest lower-cased — so\n * `Ana@Empresa.com` and `ana@empresa.com` are one line, not two.\n */\nfunction sameness(term: PersonTerm): string {\n switch (term.kind) {\n case \"email\":\n case \"phone\":\n return `${term.kind}|${normalizeIdentity({ kind: term.kind, value: term.value }, 1)?.value ?? term.value}`;\n case \"external\":\n case \"digest\":\n return `${term.kind}|${term.value.toLowerCase()}`;\n default:\n return `${term.kind}|${term.value}`;\n }\n}\n\n/**\n * Every term in a pasted list, in order, once each.\n *\n * Split on lines, tabs, commas and semicolons — what a spreadsheet column, a\n * CSV row and a hand-typed list are separated by — and never on spaces, which\n * a phone number is written with. `dropped` counts the terms past\n * {@link PEOPLE_SEARCH_MAX_TERMS}, so the caller can say the list was cut.\n */\nexport function parsePeopleQuery(text: string | readonly string[]): { terms: PersonTerm[]; dropped: number } {\n const inputs = (typeof text === \"string\" ? [text] : text).flatMap((part) => part.split(TERM_SEPARATORS));\n const seen = new Set<string>();\n const terms: PersonTerm[] = [];\n for (const raw of inputs) {\n const input = raw.trim();\n if (input === \"\") continue;\n const term = readTerm(input);\n const identity = sameness(term);\n if (seen.has(identity)) continue;\n seen.add(identity);\n terms.push(term);\n }\n return {\n terms: terms.slice(0, PEOPLE_SEARCH_MAX_TERMS),\n dropped: Math.max(0, terms.length - PEOPLE_SEARCH_MAX_TERMS),\n };\n}\n\n/** A contact's digests under every version that accepts it, once each: the store holds v1 and may hold v2. */\nasync function contactKeys(kind: \"email\" | \"phone\", value: string): Promise<IdentityKey[]> {\n const canonicals = new Set<string>();\n for (const version of [1, 2] as const) {\n const canonical = normalizeIdentity({ kind, value }, version);\n if (canonical !== null) canonicals.add(canonical.value);\n }\n return await Promise.all([...canonicals].map(async (canonical) => ({ kind, value: await sha256Hex(canonical) })));\n}\n\nasync function externalKeys(value: string): Promise<IdentityKey[]> {\n const digest = await externalIdDigest(value);\n return digest === null ? [] : [{ kind: \"external\", value: digest }];\n}\n\n/**\n * The keys one term is looked up by, in the form the identity graph stores\n * them. Empty for a deal, which names no person until the CRM says whose it is.\n */\nexport async function personTermKeys(term: PersonTerm): Promise<IdentityKey[]> {\n const value = term.value.trim();\n switch (term.kind) {\n case \"email\":\n case \"phone\":\n return await contactKeys(term.kind, value);\n case \"external\":\n return await externalKeys(value);\n case \"number\":\n return [...(await externalKeys(value)), ...(await contactKeys(\"phone\", value))];\n case \"digest\": {\n const digest = value.toLowerCase();\n return ([\"email\", \"phone\", \"external\"] as const).map((kind) => ({ kind, value: digest }));\n }\n case \"deal\":\n return [];\n case \"key\":\n return VERBATIM_KINDS.map((kind) => ({ kind, value }));\n default:\n return [{ kind: term.kind, value }];\n }\n}\n\n/**\n * The seed list the store is asked with: `term|kind|value`, where `term` is the\n * position in `keysPerTerm` — the line of the search each key answers.\n *\n * A value holding a comma is dropped: the parameter travels comma-separated, so\n * it would arrive as two meaningless seeds. No digest or id the store keys on\n * contains one; a `|` inside a value is kept, since the store splits on the\n * first two only.\n */\nexport function peopleSeeds(keysPerTerm: readonly (readonly IdentityKey[])[]): string[] {\n return keysPerTerm.flatMap((keys, term) =>\n keys.filter((key) => !key.value.includes(\",\")).map((key) => `${term}|${key.kind}|${key.value}`),\n );\n}\n\n// ============================================================================\n// The wire\n// ============================================================================\n\n/** One line of a search, as long as anything a person is keyed by can be. */\nconst personTermInputSchema = z.string().trim().min(1).max(320);\n\n/** The search, as sent: the lines the reader typed or pasted, unparsed. */\nexport const peopleSearchInputSchema = z\n .array(personTermInputSchema)\n .min(1)\n .max(PEOPLE_SEARCH_MAX_TERMS * 4);\n\n/** `POST /api/analytics/people`: what Baker saw of each of these people. */\nexport const peopleLookupRequestSchema = z.object({ people: peopleSearchInputSchema });\nexport type PeopleLookupRequest = z.infer<typeof peopleLookupRequestSchema>;\n\n/**\n * How one line of a search was read, returned beside every answer so the\n * reader sees what Baker looked for — \"90001234567 → a HubSpot contact id, or\n * a phone\" — rather than a result they cannot connect to what they typed.\n */\nexport const peopleSearchTermSchema = z.object({\n /** Position in the search; what `personTerms` on a feed row points at. */\n term: z.number().int(),\n input: z.string(),\n kind: z.string(),\n /**\n * Why this line could not be looked up as asked, in the reader's words — a\n * deal HubSpot does not know, HubSpot not connected. Empty when it was.\n */\n problem: z.string().default(\"\"),\n /** A deal's contacts, as found in the CRM. Empty for every other kind. */\n contacts: z.array(z.string()).default([]),\n});\nexport type PeopleSearchTerm = z.infer<typeof peopleSearchTermSchema>;\n\n/** What Baker saw of one person, all time. Every count is zero for a line that matched nobody. */\nexport const peopleLookupRowSchema = peopleSearchTermSchema.extend({\n found: z.boolean(),\n events: z.number(),\n firstSeen: z.string(),\n lastSeen: z.string(),\n pageViews: z.number(),\n landings: z.number(),\n visits: z.number(),\n formSubmits: z.number(),\n /** What the company's own systems reported about them, by event name — CRM stages, orders. */\n systemEvents: z.array(z.string()),\n pageEvents: z.array(z.string()),\n uploads: z.number(),\n uploadedTo: z.array(z.string()),\n googleClick: z.boolean(),\n metaClick: z.boolean(),\n /** `utm_source`, else the referrer, of the first visit Baker saw. Empty when it saw none. */\n firstSource: z.string(),\n /** Every kind of key they are linked by: `email`, `phone`, `external`, `browser`, a click id. */\n knownBy: z.array(z.string()),\n});\nexport type PeopleLookupRow = z.infer<typeof peopleLookupRowSchema>;\n\nexport const peopleLookupDataSchema = z.object({\n people: z.array(peopleLookupRowSchema),\n /** Lines past the limit, not looked up. */\n dropped: z.number(),\n});\nexport type PeopleLookupData = z.infer<typeof peopleLookupDataSchema>;\n","/**\n * The one hash, and the one way to recognise one.\n *\n * Web Crypto, so the same code runs in the Convex runtime, a Worker, Node and a\n * browser — an identity digest that differs by runtime is a digest that matches\n * nothing, and nothing about that failure is visible from either end.\n */\n\n/** SHA-256 in lowercase hex. The form every ad platform documents. */\nexport async function sha256Hex(value: string): Promise<string> {\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\nconst SHA256_HEX = /^[0-9a-fA-F]{64}$/;\n\n/**\n * Whether a value is already a SHA-256 digest — the check that decides whether\n * a field holds plain text to normalize and hash, or a digest someone else\n * computed. Hashing a hash produces a key that matches nothing, forever, with\n * no way to tell afterwards.\n */\nexport function isSha256Hex(value: string): boolean {\n return SHA256_HEX.test(value);\n}\n\n/** The storable form of a supplied digest, or `null` if it is not one. */\nexport function normalizeSha256Hex(value: string): string | null {\n const trimmed = value.trim();\n return SHA256_HEX.test(trimmed) ? trimmed.toLowerCase() : null;\n}\n\n/**\n * The canonical form of a site's own id for a person, before it is hashed.\n *\n * Trim and lowercase, and deliberately nothing else. An `external_id` is an\n * opaque key in somebody else's system — a customer number, a CRM contact id, a\n * membership code — so there is no shape to check and no punctuation that means\n * anything. What matters is only that **both ends canonicalise it the same\n * way**: the browser hashing `Cust-4821` and the CRM hashing `cust-4821` would\n * produce two people out of one, with nothing anywhere to report it.\n *\n * Not part of the versioned normalizer beside it, on purpose. Those versions\n * exist because an address has a *correct* form that we learned late; this has\n * never had one and never will.\n */\nexport function normalizeExternalId(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/** The digest a site's own id joins on, or `null` when there is nothing to hash. */\nexport async function externalIdDigest(raw: string): Promise<string | null> {\n const canonical = normalizeExternalId(raw);\n return canonical === null ? null : await sha256Hex(canonical);\n}\n","/**\n * Email normalization, one rule per version.\n *\n * A version is not a preference: a digest computed under v1 and stored a year\n * ago can never be recomputed, because the address that produced it was dropped\n * on purpose. So v1 is frozen at whatever the browser did on the day it ran, and\n * a better rule arrives as v2 alongside it rather than in place of it.\n */\n\n/**\n * **v1 — frozen.** Trim and lowercase, exactly what\n * the beacon's own rule (now `src/lib/tracking/identity-normalize.ts`) has always done. No shape check:\n * whatever the visitor typed was hashed, and every historical digest was\n * produced this way.\n *\n * `null` only for an empty result, which is the one case the beacon also\n * declines to report.\n */\nexport function normalizeEmailV1(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/** No dots-as-separators, no length games: one `@`, a local part, a dotted domain. */\nconst EMAIL = /^[^\\s@]+@[^\\s@.]+(?:\\.[^\\s@.]+)+$/;\n\n/**\n * **v2.** v1 plus a shape check, so an unusable value is declined instead of\n * hashed into a key that can never match.\n */\nexport function normalizeEmailV2(raw: string): string | null {\n const trimmed = raw.trim().toLowerCase();\n return EMAIL.test(trimmed) ? trimmed : null;\n}\n\n/**\n * Google's own email canonicalization, applied on top of a normalized address:\n * for `gmail.com` and `googlemail.com`, drop the dots and any `+tag` from the\n * local part.\n *\n * `null` when there is no address left to send — a local part that was nothing\n * but a `+tag`. Google is the only platform that asks for this; Meta and\n * LinkedIn hash the address as written, which is why this is a provider step\n * and not part of the version.\n */\nexport function googleEmail(normalizedEmail: string): string | null {\n const [localPart, domain, ...extraParts] = normalizedEmail.split(\"@\");\n if (!localPart || !domain || extraParts.length > 0) return normalizedEmail;\n if (domain !== \"gmail.com\" && domain !== \"googlemail.com\") return normalizedEmail;\n const canonicalLocalPart = localPart.split(\"+\", 1)[0]?.replace(/\\./g, \"\") ?? \"\";\n return canonicalLocalPart ? `${canonicalLocalPart}@${domain}` : null;\n}\n","/**\n * Phone normalization, one rule per version, plus the shape each platform\n * hashes.\n *\n * Three copies of this used to exist — the beacon's, the funnel contract's and\n * `lib/capi.ts` — and they disagreed on the `+`. A digest of `34600111222` and a\n * digest of `+34600111222` are two unrelated keys for one person, and neither\n * end reports anything when they fail to meet.\n */\n\n/**\n * **v1 — frozen.** Digits only, with a `+` in front, exactly what\n * the beacon's own rule (now `src/lib/tracking/identity-normalize.ts`) has always done. It guesses no\n * country code and validates nothing: a national number becomes `+600111222`,\n * and that is the digest sitting in the store for every visitor who identified\n * before v2 existed.\n */\nexport function normalizePhoneV1(raw: string): string | null {\n const digits = raw\n .trim()\n .toLowerCase()\n .replace(/[^0-9]/g, \"\");\n return digits === \"\" ? null : `+${digits}`;\n}\n\n/** What a CRM writes around the digits and what E.164 does not keep. */\nconst PHONE_PUNCTUATION = /[\\s()./-]/g;\n/** E.164: `+`, a country code that cannot start at 0, up to 15 digits total. */\nconst E164 = /^\\+[1-9]\\d{7,14}$/;\n\n/**\n * **v2 — strict E.164.**\n *\n * A number with no international prefix is refused rather than guessed at. The\n * country code cannot be inferred from the value, and inventing one produces a\n * hash that silently matches nothing — worse than declining the key, because\n * the event still resolves by some other rung and nobody learns the phone was\n * lost. Both `+34…` and the access prefix `0034…` are accepted; a bare\n * `600111222` is not.\n */\nexport function normalizePhoneV2(raw: string): string | null {\n const compact = raw.replace(PHONE_PUNCTUATION, \"\");\n const e164 = compact.startsWith(\"00\") ? `+${compact.slice(2)}` : compact;\n return E164.test(e164) ? e164 : null;\n}\n\n/**\n * E.164 without the `+` — what Meta, LinkedIn and Twitter hash.\n *\n * Google hashes the same number *with* the `+`, and that single character is\n * the whole reason this function has a name.\n */\nexport function phoneWithoutPlus(normalizedPhone: string): string {\n return normalizedPhone.startsWith(\"+\") ? normalizedPhone.slice(1) : normalizedPhone;\n}\n","/**\n * Versioned identity normalization — one rule set, in one place, for the whole\n * platform.\n *\n * Several copies of \"normalize an email or a phone and hash it\" exist: the\n * browser beacon's, the one every Conversions API dispatcher shares\n * (`convex/lib/capi.ts`), and Google Ads' own on top of it\n * (`convex/sideEffects/googleAdsCapi/utils.ts`). They disagree about the `+` on\n * a phone, about whether a malformed address should be declined, and about\n * Gmail. Each disagreement is the same failure: two digests for one person, no\n * error anywhere, and an attribution that quietly matches nobody.\n *\n * **This module has taken over exactly one of them so far — the beacon's.** The\n * CAPI dispatchers still hold their own, because they sit on live conversion\n * uploads where a changed digest is money mis-attributed, so they move in their\n * own change with their own evidence. What is done instead, and now, is to make\n * the drift *detectable*: `capi.parity.test.ts` in `packages/backend` runs those\n * copies over the same table as these and fails when they stop agreeing. That is\n * the whole problem — the copies are identical today and nothing was watching.\n * One of them, Google Ads' phone rule, is genuinely a third rule and cannot be\n * pinned to either version; the test says so in place of pretending otherwise.\n *\n * Two ideas make that fixable rather than merely fixed:\n *\n * - **The version is data.** A digest cannot be recomputed — the plaintext was\n * dropped on purpose, which is the point of holding a digest at all. So the\n * rule that produced it is frozen as v1 and kept, and a better rule ships\n * beside it as v2. Anything holding plaintext produces both and looks up\n * both, which is why a normalization change cannot orphan the history.\n * - **The provider form is not the version.** Meta hashes E.164 without the\n * `+`, Google hashes it with the `+` and canonicalizes Gmail addresses. Those\n * are three digests of one canonical value, not three normalizations.\n */\n\nimport { sha256Hex } from \"./digest\";\nimport { normalizeEmailV1, normalizeEmailV2 } from \"./email\";\nimport { normalizePhoneV1, normalizePhoneV2 } from \"./phone\";\nimport { providerPlain } from \"./providers\";\nimport type { CanonicalIdentity, IdentityInput, NormalizationVersion } from \"./types\";\n\nexport { externalIdDigest, isSha256Hex, normalizeExternalId, normalizeSha256Hex, sha256Hex } from \"./digest\";\nexport { googleEmail, normalizeEmailV1, normalizeEmailV2 } from \"./email\";\nexport { normalizePhoneV1, normalizePhoneV2, phoneWithoutPlus } from \"./phone\";\nexport { type ProviderPlain, providerPlain } from \"./providers\";\nexport {\n type CanonicalIdentity,\n type IdentityInput,\n type IdentityKind,\n NORMALIZATION_VERSIONS,\n type NormalizationVersion,\n} from \"./types\";\nexport { extractDomain, isPublicEmailDomain, workEmailDomain } from \"./workDomain\";\n\n/**\n * Apply one version's rule to plain text, or decline it.\n *\n * `null` means this version has no usable form of this value — not that the\n * person has no phone. Under v2 that happens to any national number, on\n * purpose: see {@link normalizePhoneV2}.\n */\nexport function normalizeIdentity(raw: IdentityInput, version: NormalizationVersion): CanonicalIdentity | null {\n const value =\n raw.kind === \"email\"\n ? version === 1\n ? normalizeEmailV1(raw.value)\n : normalizeEmailV2(raw.value)\n : version === 1\n ? normalizePhoneV1(raw.value)\n : normalizePhoneV2(raw.value);\n return value === null ? null : { kind: raw.kind, value, normalizationVersion: version };\n}\n\n/**\n * The digests one canonical value produces, keyed by who asks for them.\n *\n * Snake case because this is a wire shape: it is what the browser sends, what\n * the ingest stores, and what an activation payload reads. `google_sha256` is\n * `null` when Google has no usable form of the value — a Gmail address whose\n * local part was only a `+tag`.\n */\nexport type IdentityDigests = {\n canonical_sha256: string;\n meta_sha256: string;\n google_sha256: string | null;\n normalization_version: NormalizationVersion;\n};\n\nexport async function providerDigests(canonical: CanonicalIdentity): Promise<IdentityDigests> {\n const plain = providerPlain(canonical);\n const [canonicalSha, metaSha, googleSha] = await Promise.all([\n sha256Hex(plain.canonical),\n sha256Hex(plain.meta),\n plain.google === null ? Promise.resolve(null) : sha256Hex(plain.google),\n ]);\n return {\n canonical_sha256: canonicalSha,\n meta_sha256: metaSha,\n google_sha256: googleSha,\n normalization_version: canonical.normalizationVersion,\n };\n}\n\n/**\n * The compact set a page sends and an ingest reads: one entry per version, plus\n * the two provider digests, for one plaintext value.\n *\n * `meta` and `google` are computed from the best version that produced a value\n * — v2 when it accepted the value, v1 otherwise — because a platform wants one\n * digest, not a history. `v1` and `v2` are both present when both rules\n * accepted the value, and they are equal when the two rules agreed.\n *\n * `null` when no version has a usable form: there is nothing to report, and\n * reporting an empty digest would be reporting the hash of the empty string.\n */\nexport type IdentityDigestSet = {\n v1?: string;\n v2?: string;\n meta: string;\n google?: string;\n};\n\nexport async function identityDigestSet(raw: IdentityInput): Promise<IdentityDigestSet | null> {\n const v1 = normalizeIdentity(raw, 1);\n const v2 = normalizeIdentity(raw, 2);\n const best = v2 ?? v1;\n if (best === null) return null;\n const digests = await providerDigests(best);\n return {\n ...(v1 === null ? {} : { v1: v1.value === best.value ? digests.canonical_sha256 : await sha256Hex(v1.value) }),\n ...(v2 === null ? {} : { v2: digests.canonical_sha256 }),\n meta: digests.meta_sha256,\n ...(digests.google_sha256 === null ? {} : { google: digests.google_sha256 }),\n };\n}\n","/**\n * Wire contract for `/api/analytics/*` — reading this company's own web\n * analytics.\n *\n * Unlike `/api/ga4/*`, there is no OAuth and no external property to resolve:\n * the data is Baker's, keyed by the company the API key already identifies. A\n * freshly published landing has numbers immediately, and a client who never\n * connected Google Analytics still has a funnel.\n *\n * Rows live in the `web_analytics_events` Tinybird datasource and are read\n * through its published endpoints, never through hand-built SQL — so there is\n * no query string to escape and no dialect to guess at. Every row is stored,\n * so every count here is exact rather than an estimate.\n */\nimport { z } from \"zod\";\nimport { AD_PARAM_ROLES, AD_PLATFORMS } from \"./adParams\";\n\n/**\n * What the raw feed can be narrowed to about what was sent on: every delivery,\n * the refused ones, or a send's events that were skipped because they carried\n * nothing the platform can match a person by.\n */\nexport const SEND_FILTERS = [\"any\", \"failed\", \"skipped\"] as const;\nexport type SendFilter = (typeof SEND_FILTERS)[number];\n\nimport { CONVERSION_COUNT_MODES, MAX_CONVERSION_NAME } from \"./conversions\";\nimport { peopleSearchInputSchema, peopleSearchTermSchema } from \"./peopleSearch\";\nimport { boundSubmissionAnswers, cutToLength } from \"./submissionAnswers\";\n\n/** The closed ad-dimension vocabulary, as a request may name it. */\nexport const adParamRoleSchema = z.enum(AD_PARAM_ROLES);\n\n/** Datasource TTL. Long enough to compare a month against the same month last year. */\nexport const ANALYTICS_RETENTION_DAYS = 400;\n\n/** Default lookback when a request names no window. */\nexport const ANALYTICS_DEFAULT_DAYS = 30;\n\n/**\n * Below this many sessions the derived rates are noise, and the agent is told\n * to say so rather than present a conversion rate off nine visits.\n */\nexport const ANALYTICS_LOW_SAMPLE_SESSIONS = 100;\n\n/**\n * The row a conversion the attribution model could not credit is filed under,\n * in the spelling the analytics store emits.\n *\n * A sentinel and not a blank, because blank already means something: a visit\n * that arrived with no referrer, which is *direct*. Left blank, every\n * conversion the model declined to credit was displayed on the `direct` row —\n * measured on seeded data, `direct` read 787 visits and 101 conversions under a\n * model whose whole premise is that direct is never credited.\n *\n * It appears in three places that must agree — the SQL that emits it, the\n * shaper that must not fold it into `direct`, and the tables that label it —\n * so it is one exported constant rather than three string literals. Kept in\n * step with `ATTRIBUTION_UNATTRIBUTED` in `tinybird/definitions.ts`, which\n * cannot import from here, by `attributionModel.parity.test.ts`.\n */\nexport const ATTRIBUTION_UNATTRIBUTED = \"(unattributed)\";\n\n/** Rows per breakdown, compact vs `--full`. */\nexport const ANALYTICS_COMPACT_BREAKDOWN_LIMIT = 5;\nexport const ANALYTICS_FULL_BREAKDOWN_LIMIT = 100;\n\n/**\n * The bounds on a page of a list report.\n *\n * The size is capped because the row is the unit of work on the other side: a\n * visitor row carries its acquisition, its geography and its device, and two\n * hundred of them is already a screenful many times over. The page number is\n * capped for a duller reason — `OFFSET` in ClickHouse is read-and-discard, so\n * page 9,000 costs the scan of the 8,999 before it, and nobody navigating a\n * list by hand ever asks for it.\n */\nexport const ANALYTICS_MAX_PAGE_SIZE = 200;\nexport const ANALYTICS_MAX_PAGE = 500;\n\n/** What a screen asks for when it is showing a list a person scrolls. */\nexport const ANALYTICS_DEFAULT_PAGE_SIZE = 50;\n\n/**\n * Whether the platform can resolve this zone name.\n *\n * Asked of `Intl` rather than checked against a list we would then have to\n * maintain: the zone database ships with the runtime and gains entries without\n * us. Anything it throws on is a name no store downstream will accept either.\n */\nfunction isResolvableTimeZone(value: string): boolean {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: value });\n return true;\n } catch {\n return false;\n }\n}\n\nexport const analyticsPresetSchema = z.enum([\n /** Everything that matters in one call — the default entry point. */\n \"overview\",\n /** Traffic shape: trend, sources, geo, device. */\n \"traffic\",\n /** Per-step drop-off for the company's Forms. */\n \"funnel\",\n /**\n * One Form in depth: its steps, where people went between them, and how many\n * converted at the node that actually produced the conversion.\n *\n * Distinct from `funnel`, which is a per-step table across every Form.\n * A Form with branches is not a table — a visitor who leaves step two for\n * the booking branch and a visitor who leaves it for nothing are the same\n * row there, and they are the whole question. `paths` returns the edges\n * between steps, which is what a Sankey draws.\n */\n \"flow\",\n /** One page in detail. */\n \"page\",\n /**\n * Every Form trigger that fired, and how much of it produced a side effect.\n *\n * Separate from `funnel` because it answers a different question: the funnel\n * measures the steps a visitor walked, this measures the things they *did* —\n * clicking the link that redirects them out, an embedded checkout posting\n * back — most of which have nothing configured against them and none of\n * which appear as a step.\n */\n \"triggers\",\n /** What each published build did, so a change can be attributed to a publish. */\n \"releases\",\n /**\n * One ad dimension broken down, plus what is actually on the URLs.\n *\n * Answers the question the ad platform cannot: not how many clicks a keyword\n * bought, but whether the people it brought read the page, filled the Form\n * or left immediately. Pair it with `adRole` to choose the dimension; the\n * parameter inventory comes back either way, because on a half-tagged\n * account \"there is no keyword on 80% of your paid traffic\" is the finding.\n */\n \"ads\",\n /**\n * Every landing side by side: traffic, entrances, conversion rate, and a\n * sparkline each, joined to the landing's real name and tags.\n *\n * The list view. `page` answers one page in depth and needs to be told which\n * one; this answers \"which of my pages is working\" without knowing the\n * answer first, and is what a landings screen renders.\n */\n \"landings\",\n /**\n * The same numbers grouped by the tag a landing is filed under.\n *\n * The unit a campaign is actually run at. Nobody asks how `/pricing-b` did;\n * they ask how the September push did, and September was six landings.\n */\n \"tags\",\n /**\n * Events a page defined for itself — a section seen, a video played, a\n * pricing toggle flipped.\n *\n * Separate from every other preset because the vocabulary is the page's\n * rather than the product's. Mixing them into `traffic` would produce a list\n * half of which the reader has to already know is bespoke.\n */\n \"events\",\n /**\n * Browser, OS, engine and viewport of real visitors.\n *\n * `traffic` reports the device family, which is enough to notice that mobile\n * converts worse and not enough to do anything about it. This is narrow\n * enough to reproduce a bug on.\n */\n \"devices\",\n /**\n * Paid acquisition, grouped the way money is spent.\n *\n * Distinct from `traffic` in two ways that matter. It groups by SESSION, so a\n * visitor counts once for the campaign they arrived on rather than once per\n * page they read. And it reports leads that were actually DELIVERED, not\n * `form_submit` events — a campaign whose forms all submit and whose CRM is\n * rejecting every one of them reads as converting perfectly on every other\n * preset here, and reads as zero delivered on this one.\n */\n \"paid\",\n /**\n * Where each submission actually went, and what each destination made of it.\n *\n * The preset for \"I filled in the form, where is my lead?\". One row per\n * submission listing every destination, its outcome, and the id the\n * destination gave the record it created — which is what turns \"it says\n * success\" into something a client can open and check.\n */\n \"delivery\",\n /**\n * Every attempt anybody made at a Form, delivered or not.\n *\n * The wider companion to `delivery`, and the one that answers \"I filled in\n * my own form, where is it?\" honestly. `delivery` starts from the dispatch,\n * so a Form wired to no destination produces no row in it at all — which is\n * correct for \"what did we hand to their CRM\" and reads as data loss to\n * everybody else. The grain here is the attempt: one visitor, one Form, one\n * visit, whether they finished, gave up halfway, or completed a Form that\n * sends nowhere.\n */\n \"submissions\",\n /**\n * Where the people who convert actually are, at whatever resolution is asked\n * for.\n *\n * `traffic` breaks acquisition down by country, which is the right grain for\n * \"which market is this campaign working in\" and the wrong one for every\n * decision a local advertiser makes. A dentist buying a five-mile radius or a\n * franchise choosing where to open is asking about postcodes, which is also\n * how the ad platforms sell that targeting.\n */\n \"geo\",\n /**\n * Which machines are fetching this site.\n *\n * Every other preset here excludes them, which is correct — a crawler is not\n * an audience — and a verify check now enforces that rather than trusting it. The rows are kept, though, and this is what\n * they are kept for: whether Google is still crawling a page that was\n * republished, whether Meta fetched the link preview before spend went\n * behind the URL, and how much of the traffic is now AI answer engines.\n */\n \"bots\",\n /**\n * One visit, replayed end to end — and every visit the same person made\n * before it.\n *\n * The only preset that answers about a *person* rather than a population.\n * Every other report here aggregates, which is the right shape for \"is the\n * campaign working\" and useless for the question a marketer asks the moment\n * a lead arrives: who was this, where did they come from, what did they read,\n * and did their details reach the CRM. Answering that from an aggregate is\n * impossible by construction.\n *\n * Needs `sessionId`. Give `identityHash` as well and it also returns the\n * person's earlier visits, including the anonymous ones from before they ever\n * identified themselves — which is the difference between \"converted on the\n * first visit\" and \"converted on the fourth\", two very different businesses.\n */\n \"session\",\n /**\n * Everybody who visited, one row per person — converted or not.\n *\n * The unit here is a *person*, which no other preset has. `traffic` counts\n * visitors and cannot name one; `delivery` names the ones who became a lead\n * and is silent about the ninety-odd percent who did not; `session` describes\n * one visit and has to be told which. This is the list those are read from.\n *\n * Grouped by browser cookie, so somebody who came back on Wednesday is one\n * row and not two. Pass `onlyConverted` for the converted-only cut, and\n * `landingId` to ask who visited one page.\n *\n * Not offered as a `baker analytics` preset, for the same reason `realtime`\n * is not: it answers about individuals, and an agent writing a client report\n * should be reading the population.\n */\n \"people\",\n /**\n * Who is on the site right now.\n *\n * The only preset measured from `now()` rather than over a date window, and\n * the only one meant to be polled. Kept out of `overview` for exactly that\n * reason: a live counter has to refresh every few seconds and the rest of the\n * page must not refetch with it.\n *\n * Deliberately not offered as a `baker analytics` preset. The sandbox agent\n * works asynchronously — by the time it reads an answer, \"the last five\n * minutes\" names a window that has passed — so the only thing listing it\n * would do is add a choice the agent can never usefully pick to the menu it\n * reads before picking one.\n */\n \"realtime\",\n /**\n * What this company counts as a conversion, and everything it could count.\n *\n * The two halves of one question, which is why they are one preset: the list\n * of definitions with what each produced, and the catalogue of every event\n * these pages actually emitted with whether it is already counted. Reading\n * the first without the second is how the previous design failed — a\n * marketer could see that nothing was counted and had no way to find out what\n * was available to count.\n */\n \"conversions\",\n /**\n * Every event as it was stored, newest first — the one preset that does not\n * reduce.\n *\n * Deliberately not offered as a `baker analytics` preset. It is the raw feed\n * a person watches while wiring something up, and an agent asked to describe\n * an account wants the counts rather than the tape.\n */\n \"stream\",\n]);\nexport type AnalyticsPreset = z.infer<typeof analyticsPresetSchema>;\n\nexport const ANALYTICS_PRESETS = analyticsPresetSchema.options;\n\n/**\n * The four ways an event can reach Baker, as a reader picks between them.\n *\n * Two columns answer two different questions, and one filter used to read only\n * the first: `source` says **who wrote the row** (`client` for Baker's script\n * in a browser, `edge` for our Worker as it serves the HTML, `ingest` for a\n * third party's server, `server` for Baker's own dispatch), and `deployment`\n * says **where the page lives** (`baker`, `external`, `export`). The filter\n * tested `source = 'ingest'` and called everything else \"the browser\", which\n * was true only while every browser was on a page Baker published. The website\n * tag ended that: a client's own site now reports through the same `client`\n * collector as a landing does, and the two were indistinguishable on every\n * screen.\n *\n * Three values rather than two filters, because the two questions are not\n * independent. An ingest row is stamped `deployment: \"external\"` on purpose —\n * no edge row can exist for it — so a separate \"which site\" control would put\n * a server event under the client's website, and \"server + Baker's pages\"\n * would be a combination that selects nothing. These three are mutually\n * exclusive and exhaustive, so every row has exactly one and no choice is\n * empty by construction.\n *\n * ## Why `website` is a positive test\n *\n * `deployment` was added after the corpus existed and carries no default, so\n * every row written before it reads `''`. `website` therefore asks whether the\n * deployment **is** off-Baker rather than whether it is not `baker` — the\n * second reading would sweep the entire pre-column corpus into the client's\n * website and make the one filter built to isolate a handful of rows return\n * millions. Legacy rows land in `pages`, which is the same direction\n * `readOrigin` takes for the same reason.\n *\n * `export` travels with `external`: a downloaded build runs on the client's own\n * site too, and the distinction between the two is how the key was minted, not\n * where the visitor was.\n */\n/*\n * ## Four, since the API and an integration stopped sharing a door\n *\n * `server` was every `ingest` row: an event the client's server posted AND\n * one Baker read from HubSpot. On screen that was \"your systems\", and a\n * marketer asked what on earth their system was — they think in four places\n * an event comes from: Baker pages, the pixel, the API, and an integration\n * like HubSpot. So `server` is now the API alone — ingest rows carrying no\n * source name, or the server door's own (`SERVER_SOURCE_NAME` in\n * `@baker/api/event-sources`) — and `integrations` is every ingest row a named\n * source sent. Still exclusive and exhaustive.\n */\nexport const ANALYTICS_EVENT_DOORS = [\"pages\", \"website\", \"server\", \"integrations\"] as const;\nexport type AnalyticsEventDoor = (typeof ANALYTICS_EVENT_DOORS)[number];\n\n// ---------------------------------------------------------------------------\n// Request\n// ---------------------------------------------------------------------------\n\nexport const analyticsQueryRequestSchema = z\n .object({\n preset: analyticsPresetSchema,\n /** Lookback in days. Ignored when `startDate` is given. */\n days: z.coerce.number().int().positive().max(400).optional(),\n startDate: z.iso.date().optional(),\n endDate: z.iso.date().optional(),\n /** Required by the `page` preset; ignored by the others. */\n path: z.string().max(1024).optional(),\n /** Narrows `funnel` to one Form. Omitted means every Form. */\n flowSlug: z.string().max(120).optional(),\n /**\n * How far down the `geo` preset looks. Ignored by every other preset.\n *\n * A closed set rather than a column name, because it names a column and a\n * column name taken from a request must never reach the SQL.\n */\n grain: z.enum([\"country\", \"region\", \"city\", \"postal_code\", \"metro_code\"]).optional(),\n /**\n * Narrows `geo` to one country before going finer.\n *\n * Not optional decoration below country level: postcodes collide across\n * markets, so a bare `28001` is a Madrid postcode and a US ZIP at once.\n */\n country: z.string().max(8).optional(),\n /**\n * Which ad dimension to break down by, or to narrow every other report to.\n *\n * A role from the closed vocabulary — `keyword`, `match_type`,\n * `campaign_id` — never a raw parameter name. The company's own spellings\n * are resolved from its mapping server-side, so a caller asking for\n * \"keyword\" gets `kw` rows from before a rename as well as `keyword` rows\n * after it, and no request can name a column.\n */\n adRole: adParamRoleSchema.optional(),\n /**\n * Narrows to one value of `adRole`. Requires `adRole`.\n *\n * An empty string with `adRole` set is a real query — \"arrived carrying\n * none of these\" — which is how you size the untagged half of an account.\n * Omit both to leave the report unnarrowed.\n */\n adValue: z.string().max(255).optional(),\n /**\n * Read this report in one ad platform's vocabulary, and from its traffic.\n *\n * Two effects, and they belong together. A role resolves against the\n * mapping in force for that platform — so `cid` is TikTok's ad here and\n * nobody's campaign — and the report narrows to the sessions that arrived\n * from it, matched on the click id the platform stamps and, failing that,\n * on `utm_source`. Asking a platform's question of another platform's\n * traffic is how a keyword report ends up counting Meta visits that could\n * not have carried a keyword.\n *\n * Omit it for the union across every platform, which is the honest\n * superset and the right default for \"how is paid doing\".\n */\n adPlatform: z.enum(AD_PLATFORMS).optional(),\n /**\n * Read only what came in by one door. See {@link ANALYTICS_EVENT_DOORS}.\n *\n * Omit it for all of it, which is the default and the honest superset.\n * Only the reads where the split is a question somebody asks honour it —\n * the totals, the trend, the two page-event reads, the conversion\n * breakdown and the events catalogue. A session-scoped report cannot: an\n * ingest row carries no `session_id`, deliberately, so there is no visit\n * for it to be counted in.\n */\n eventOrigin: z.enum(ANALYTICS_EVENT_DOORS).optional(),\n /**\n * `stream` only: keep just one kind of event, named by the key\n * `conversions` hands back in its catalogue.\n *\n * The key rather than `eventName`, because three of the four families have\n * no name of their own — a Form's trigger, a submit, an outbound click —\n * and a filter that could only name the fourth would be a filter that hides\n * most of the feed from itself.\n */\n eventKey: z.string().optional(),\n /**\n * `stream` only: keep just what one source sent, by the source's name —\n * the `baker_source` every event from an address or a HubSpot read\n * carries. Names come from `baker analytics sources`.\n */\n sourceName: z.string().optional(),\n /**\n * `stream` only: keep just the uploads a conversion's sends made —\n * `any` for every upload, `failed` for the ones the platform refused.\n */\n sends: z.enum(SEND_FILTERS).optional(),\n /** `stream` only: keep just the uploads one send made, by its id (`s1`). */\n sendId: z.string().optional(),\n /** `stream` only: keep what went to one destination (`meta`, `httpWebhook`) — a Form's deliveries and sends' uploads alike. */\n sentTo: z.string().max(64).optional(),\n /** `stream` only: one event by its uid, and every upload made for it — with the platform's verdict on each. */\n eventUid: z.string().optional(),\n /** Return the long breakdowns and the per-day trend. */\n full: z.boolean().optional(),\n /**\n * IANA zone the day boundaries are drawn in. Defaults to UTC.\n *\n * Not cosmetic. Bucketing a Madrid client's traffic by UTC days moves two\n * hours of every evening into the following day, so \"Tuesday\" is not\n * Tuesday and a day-of-week comparison is wrong by however much traffic\n * arrives after 22:00 — which on a consumer landing is a lot of it.\n *\n * Validated against the platform's own zone database rather than an enum,\n * because the list is the platform's and not ours — but validated it must\n * be. The zone is substituted into the query as a string literal and\n * ClickHouse rejects one it cannot resolve, so an unrecognised zone used to\n * fail the whole report as an INTERNAL_ERROR with nothing naming the cause.\n *\n * Rejected rather than quietly defaulted to UTC. A silent fallback returns\n * a report that looks like the one that was asked for and is bucketed on\n * different days, which is the exact error this parameter exists to\n * prevent — better to say the zone is unknown than to answer for the wrong\n * one.\n */\n timezone: z\n .string()\n .max(64)\n .refine(isResolvableTimeZone, { message: \"Unknown timezone — pass an IANA zone such as Europe/Madrid\" })\n .optional(),\n /**\n * How wide one point of a series is.\n *\n * Chosen by the caller rather than derived from the window, because the\n * caller knows what it is drawing: the same 30 days is 30 points on a\n * dashboard and 4 on a slide. A 24-hour window at `day` granularity is one\n * bar, which is the shape this exists to prevent.\n */\n granularity: z.enum([\"hour\", \"day\", \"week\", \"month\"]).optional(),\n /**\n * Narrow to one landing by its `internalId`.\n *\n * The reference where `path` is a description: it survives the page being\n * renamed or moved, which is exactly when a before-and-after comparison\n * matters most and is exactly when `path` stops matching.\n */\n landingId: z.string().max(120).optional(),\n /** Narrows `landings` to the landings carrying one tag. */\n tag: z.string().max(32).optional(),\n /**\n * Which visit the `session` preset replays.\n *\n * Ignored by every other preset. Not a filter on the aggregates: narrowing\n * a population report to one visitor produces numbers that are individually\n * true and collectively meaningless.\n */\n sessionId: z.string().max(120).optional(),\n /**\n * Whose earlier visits to resolve, as a lowercase hex digest.\n *\n * A digest and never an address: the identity a page sends is hashed in the\n * browser, and nothing downstream of that ever holds the original.\n */\n identityHash: z.string().max(128).optional(),\n /** Which page-defined event the `events` preset breaks down. */\n eventName: z.string().max(120).optional(),\n /** Which of that event's own properties to break it down by. */\n property: z.string().max(64).optional(),\n /**\n * Narrow the breakdown to the rows carrying one property value.\n *\n * Not the same as breaking down by a second key. Video is the case that\n * demanded it: every milestone carries `autoplay`, and the retention curve\n * of the videos a visitor chose to play is a different curve from the one a\n * muted hero produces by playing to nobody. Grouping gives the two totals;\n * only filtering gives either curve.\n */\n where: z.object({ property: z.string().max(64), value: z.string().max(120) }).optional(),\n /**\n * An ordered funnel over page-defined event names.\n *\n * Data rather than schema, deliberately: defining a new funnel is a\n * parameter on a request, not a migration and a deploy. The order is the\n * caller's and is enforced — a session counts at step N only if it produced\n * step N after step N-1, or \"saw pricing then clicked demo\" and the reverse\n * would be the same number.\n */\n steps: z.array(z.string().max(120)).max(10).optional(),\n /**\n * Also return the immediately preceding window of the same length.\n *\n * The first question anyone asks of a number is \"compared to what\". Served\n * as a second full totals read rather than a delta computed in SQL, so the\n * comparison window is described in the response and a caller can render\n * either side of it.\n */\n compare: z.boolean().optional(),\n /** `devices` only: which facet to group on. */\n deviceGrain: z.enum([\"browser\", \"os\", \"engine\", \"device\", \"viewport\"]).optional(),\n /**\n * One browser, by its cookie id.\n *\n * Narrows `people` to a single person, narrows `stream` to everything\n * that person did, and replays that person's whole history on `session` —\n * every visit they made, not just the one. Given with `sessionId`, the\n * session wins and this is ignored.\n *\n * On `stream` it is a seed rather than a cookie filter: the browser plus\n * every address, phone, click id and platform cookie ever seen beside it.\n * Filtering on the cookie alone would drop exactly the rows the reader\n * came for — a deal a CRM posted names the person and carries no cookie.\n */\n anonId: z.string().max(120).optional(),\n /**\n * `stream` and `session`: one person by any key the store recognises them\n * by — a contact digest, a CRM id, a click id, a platform cookie — for the\n * rows a system posted about somebody no browser has named yet. A browser\n * wins when both are given.\n */\n personKind: z.string().max(40).optional(),\n personValue: z.string().max(255).optional(),\n /**\n * `stream` only: several people, each by whatever the reader holds about\n * them — an email, a phone, a CRM contact or deal id, a click id, a browser\n * id, `kind:value` to say which. Emails and phones are hashed by the\n * server; the plaintext never reaches the store. Wins over the single\n * person above, and every row comes back naming which of these it is\n * (`personTerms`), with how each was read in `peopleSearch`.\n */\n people: peopleSearchInputSchema.optional(),\n /**\n * `people` only: keep only the visitors who converted.\n *\n * A parameter rather than a client-side filter because the list is capped:\n * filtering the most recent 200 visitors down to the ones who converted\n * usually leaves two, and reads as \"we had two leads\".\n */\n onlyConverted: z.boolean().optional(),\n /**\n * Which page of a list-shaped report to read, 1-based.\n *\n * Only three reports are lists of individual things rather than\n * breakdowns — `people`, `submissions` and `delivery` — and only those\n * three take this. A breakdown is a top-N by construction: page two of\n * \"your busiest countries\" is not a thing anybody wants.\n *\n * It exists because the alternative silently stopped being true. Every one\n * of those lists was capped, the cap was invisible, and the summary line\n * above the list counted the rows it had been handed — so an account with\n * four thousand visitors read \"200 people visited in this period\" with no\n * indication that the number was the cap talking. A cap that is reported is\n * a page; a cap that is not is a wrong answer.\n */\n page: z.coerce.number().int().min(1).max(ANALYTICS_MAX_PAGE).optional(),\n /**\n * How many rows one page holds. Bounded, because the reader is a browser.\n *\n * Omitted, a list keeps the size it had before pagination existed, which is\n * what keeps `baker analytics submissions --full` returning the same 800\n * rows it always did for an agent that reads the whole thing in one go.\n */\n pageSize: z.coerce.number().int().min(1).max(ANALYTICS_MAX_PAGE_SIZE).optional(),\n })\n .refine((value) => value.preset !== \"page\" || typeof value.path === \"string\", {\n message: \"The 'page' preset needs --path\",\n path: [\"path\"],\n })\n .refine(\n (value) =>\n value.preset !== \"session\" ||\n typeof value.sessionId === \"string\" ||\n typeof value.anonId === \"string\" ||\n typeof value.personValue === \"string\",\n {\n message: \"The 'session' preset needs --session, a browser id or a person key\",\n path: [\"sessionId\"],\n },\n )\n .refine((value) => value.property === undefined || typeof value.eventName === \"string\", {\n message: \"Breaking an event down by a property needs --event too\",\n path: [\"property\"],\n })\n .refine((value) => value.where === undefined || typeof value.property === \"string\", {\n message: \"Narrowing with --where needs --event and --property too\",\n path: [\"where\"],\n });\nexport type AnalyticsQueryRequest = z.infer<typeof analyticsQueryRequestSchema>;\n\n// ---------------------------------------------------------------------------\n// Shared response pieces\n// ---------------------------------------------------------------------------\n\nexport const analyticsWindowSchema = z.object({\n startDate: z.iso.date(),\n endDate: z.iso.date(),\n days: z.number().int().positive(),\n /** True when the window reaches past the datasource TTL, so part of it is simply gone. */\n beyondRetention: z.boolean(),\n});\nexport type AnalyticsWindow = z.infer<typeof analyticsWindowSchema>;\n\n/**\n * Counts are exact — every row is stored, nothing is sampled.\n *\n * `pagesPerSession` stands in for a classic bounce rate: it carries the same\n * signal (at or near 1 means visitors leave from the page they land on) and is\n * a plain ratio of two counts rather than a definition every analytics vendor\n * disagrees about.\n */\nexport const analyticsTotalsSchema = z.object({\n /** Counted from `visitor_new`. */\n visitors: z.number().int().nonnegative(),\n /** Counted from `session_start`. */\n sessions: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n /**\n * Every conversion, counting a visit twice when it converted twice.\n *\n * A Form's author can mark an outcome as counting every time it happens — a\n * download, a repeatable action — so this legitimately runs ahead of\n * {@link convertingSessions}, and of `sessions`.\n */\n conversions: z.number().int().nonnegative(),\n /**\n * Conversions in the window that no landing earned — by people none of the\n * company's pages saw. Not in `conversions`, which is a page metric; shown\n * beside it so a deal a CRM reported is never a silent zero. Zero under any\n * scope.\n */\n unplacedConversions: z.number().int().nonnegative().default(0),\n /** Visits that produced at least one conversion. Never above `sessions`. */\n convertingSessions: z.number().int().nonnegative(),\n /**\n * Converting visits per visit, 0–1. Null when there were no visits.\n *\n * Over converting visits rather than over conversions, because the second\n * ratio passes 1 the moment one visit converts twice — and a headline card\n * reading \"125%\" is read as a broken report, not as a visitor who did the\n * thing twice. The count above still says how often it happened.\n */\n conversionRate: z.number().min(0).max(1).nullable(),\n avgEngagementMs: z.number().nonnegative().nullable(),\n /** Page views per session. At or near 1 means visitors leave from the page they land on. */\n pagesPerSession: z.number().nonnegative().nullable(),\n});\nexport type AnalyticsTotals = z.infer<typeof analyticsTotalsSchema>;\n\nexport const analyticsTrendPointSchema = z.object({\n /**\n * The bucket's start, as an ISO instant.\n *\n * A full instant rather than a date, because a series is no longer always\n * daily: at `hour` granularity `2026-08-22` names twenty-four points, and at\n * `month` it names one that started three weeks earlier. It is also now\n * timezone-aware, so the same instant is a different calendar day depending\n * on the zone the caller asked for — which a bare `YYYY-MM-DD` cannot\n * express without silently choosing one.\n */\n bucket: z.string(),\n visitors: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n});\nexport type AnalyticsTrendPoint = z.infer<typeof analyticsTrendPointSchema>;\n\n/** One landing in the list view, with its own shape over the window. */\nexport const analyticsLandingRowSchema = z.object({\n /** The landing's `internalId` — the reference every event carries. */\n landingId: z.string(),\n /** The Convex `landings._id`, so a dashboard can link straight to the row. */\n landingRef: z.string(),\n /**\n * What a person calls it, or `\"\"` when the dimension has not been mirrored\n * yet.\n *\n * Empty is a real and temporary state — a landing published before the\n * mirror existed, or one whose sync has not run — and it is reported rather\n * than papered over with the id, so a caller can say \"not synced yet\"\n * instead of showing something that looks like a name and is not.\n */\n name: z.string(),\n slug: z.string(),\n tags: z.array(z.string()),\n views: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n /** Sessions that BEGAN here. The honest denominator for this page's rate. */\n entrances: z.number().int().nonnegative(),\n visitors: z.number().int().nonnegative(),\n /**\n * Conversions that fired ON this landing — rarely the number to show.\n *\n * A landing's outcome usually happens somewhere else: the client's checkout,\n * their shop, a CRM days later. None of those rows carries a landing id, so\n * this reads 0 for a page whose visits convert reliably.\n */\n conversions: z.number().int().nonnegative(),\n /** Visits that converted on this page at least once. */\n convertingSessions: z.number().int().nonnegative(),\n /**\n * Conversions this landing led to — what the page is bought for.\n *\n * The landing rule: a conversion on the page, or anywhere else when this was\n * the last landing its person viewed, up to 90 days before. So it includes\n * the sale a returning visitor made next week and the deal a CRM posted with\n * no cookie at all, and the landings add up to the headline.\n */\n creditedConversions: z.number().int().nonnegative(),\n /** People whose conversions are credited here. */\n creditedVisitors: z.number().int().nonnegative(),\n outboundClicks: z.number().int().nonnegative(),\n /**\n * Visits credited a conversion, per visit. Null when nobody visited.\n *\n * Converting visits, not conversions: see {@link analyticsTotalsSchema}.\n */\n conversionRate: z.number().min(0).max(1).nullable(),\n avgEngagementMs: z.number().nonnegative().nullable(),\n /**\n * Views per bucket, zero-filled against the same axis every other landing\n * in the response uses — so the arrays are the same length and can be drawn\n * side by side without asking what each element means.\n */\n sparkline: z.array(z.number().int().nonnegative()),\n /**\n * The ad platforms actually sending this page traffic — `google`, `meta`,\n * `linkedin`, `tiktok`, `x`, `microsoft`.\n *\n * Derived from the click ids a visit arrived with, never from `utm_source`:\n * a label is whatever somebody typed into a tracking template, a `gclid` is a\n * click. Ordered by traffic, busiest first.\n */\n channels: z.array(z.string()),\n /**\n * Visits per entry of {@link channels}, in the same order.\n *\n * The half that makes a mark readable. A mark on its own says \"advertised\n * here\", which is why it used to be withheld until three visits had arrived —\n * and withholding it is what made a page whose whole day was five Meta clicks\n * show nothing at all. The count says how much, so one test click and a live\n * campaign are distinguishable by reading rather than by absence.\n */\n channelSessions: z.array(z.number().int().nonnegative()),\n});\nexport type AnalyticsLandingRow = z.infer<typeof analyticsLandingRowSchema>;\n\nexport const analyticsTagRowSchema = z.object({\n tag: z.string(),\n landings: z.number().int().nonnegative(),\n views: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n entrances: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /** Visits that converted on one of this tag's pages. */\n convertingSessions: z.number().int().nonnegative(),\n /** Converting visits per entrance. */\n conversionRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsTagRow = z.infer<typeof analyticsTagRowSchema>;\n\n/**\n * Which collector produced an event, in the vocabulary a report filters by.\n *\n * Three words rather than the four values of `events.source`, because the split\n * this badge is about is \"did one team report this, or two\": `edge`, `client`\n * and `server` are all Baker measuring, and the difference between them is a\n * plumbing question nobody asks on a report.\n *\n * Coarser than {@link ANALYTICS_EVENT_DOORS} on purpose, and not the same\n * question. A door is a property of one row and says which of three ways it\n * arrived; this is a property of an event NAME across every row carrying it,\n * and splitting `site` into \"a landing\" and \"the client's own website\" would\n * make seven combinations of a badge whose whole job is to be read at a\n * glance. Filter by the door when the answer matters; this says only whether\n * more than one team is reporting the name.\n *\n * `both` is only ever a property of an aggregate — one event NAME arriving from\n * a page and from a CRM — never of a single row, and it is worth surfacing\n * rather than folding away: it means two teams are measuring one thing twice,\n * or one of them typed the other's name.\n */\nexport const ANALYTICS_EVENT_ORIGINS = [\"site\", \"systems\", \"both\"] as const;\nexport type AnalyticsEventOrigin = (typeof ANALYTICS_EVENT_ORIGINS)[number];\n\nexport const analyticsCustomEventRowSchema = z.object({\n eventName: z.string(),\n events: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n visitors: z.number().int().nonnegative(),\n /**\n * The property keys this event carries.\n *\n * The keys, not the values: a caller has to know what it can break the event\n * down BY before it can ask, and the values are unbounded where the keys are\n * capped. This is what lets a dashboard offer the breakdown without the\n * reader already knowing what the page chose to record.\n */\n propertyKeys: z.array(z.string()),\n /**\n * What these events were worth, per currency.\n *\n * A map and never one number, for the reason the person card's `money` is\n * one: a name carrying 99,882.50 EUR and 1,000 USD is not worth 100,882.50\n * of anything, and there is no rate in this product to make it so.\n *\n * The `''` key is a value a *page* reported — `value` with no currency,\n * which is a score on the page's own terms rather than money. Kept rather\n * than dropped, because for those events it is the only number there is.\n */\n money: z.record(z.string(), z.number()).default({}),\n landings: z.array(z.string()),\n /** Which collector produced this name — and `both` when more than one did. */\n origin: z.enum(ANALYTICS_EVENT_ORIGINS),\n});\nexport type AnalyticsCustomEventRow = z.infer<typeof analyticsCustomEventRowSchema>;\n\nexport const analyticsEventBreakdownRowSchema = z.object({\n value: z.string(),\n events: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n /** Per currency, exactly as {@link analyticsCustomEventRowSchema.money}. */\n money: z.record(z.string(), z.number()).default({}),\n});\nexport type AnalyticsEventBreakdownRow = z.infer<typeof analyticsEventBreakdownRowSchema>;\n\nexport const analyticsCustomFunnelStepSchema = z.object({\n stepIndex: z.number().int().positive(),\n stepName: z.string(),\n sessions: z.number().int().nonnegative(),\n /** Share of the sessions that reached the previous step. Null on the first. */\n stepRate: z.number().min(0).max(1).nullable(),\n /** Share of the sessions that reached step one. Null on the first. */\n overallRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsCustomFunnelStep = z.infer<typeof analyticsCustomFunnelStepSchema>;\n\nexport const analyticsDeviceRowSchema = z.object({\n /** The bucket label — `Chrome 120.0`, `iOS 17.4`, `380–767`. */\n bucket: z.string(),\n sessions: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n convertingSessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /**\n * Converting sessions over sessions.\n *\n * Over sessions rather than conversions over sessions, because one session\n * can submit twice and a rate above 1 in a browser-comparison table reads as\n * a bug in the report rather than as a visitor who filled two forms.\n */\n conversionRate: z.number().min(0).max(1).nullable(),\n avgEngagementMs: z.number().nonnegative().nullable(),\n});\nexport type AnalyticsDeviceRow = z.infer<typeof analyticsDeviceRowSchema>;\n\nexport const analyticsPageRowSchema = z.object({\n path: z.string(),\n /**\n * The landing's own `internalId`, straight out of its `_definition.md`.\n *\n * The path says where the page is; this says which page it is, so a number\n * here lines up with a file the agent can open — and with the same page after\n * it has been renamed, which the path does not. Empty for a path with no\n * landing behind it.\n */\n landingId: z.string(),\n pageViews: z.number().int().nonnegative(),\n /** Sessions that began on this page — its value as a landing page. */\n entrances: z.number().int().nonnegative(),\n /**\n * Conversions that fired ON this page — \"which page converts\".\n *\n * Almost never the number to put beside Entrances. A landing page's job is to\n * start a visit that converts, and the conversion is usually somewhere else:\n * the shop, the checkout, a CRM a week later. Read alone this makes every\n * landing page of a real funnel report zero.\n */\n conversions: z.number().int().nonnegative(),\n /** Visits that converted on this page at least once. */\n convertingSessions: z.number().int().nonnegative(),\n /**\n * Conversions credited to this landing page by the landing rule — on it, or\n * anywhere when it was the last landing page its person viewed, up to 90\n * days before. The number a landing-page table means by \"conversions\".\n */\n creditedConversions: z.number().int().nonnegative(),\n /** People whose conversions are credited here. */\n creditedVisitors: z.number().int().nonnegative(),\n /** Credited people per entrance, 0–1. Null when nobody landed here. */\n conversionRate: z.number().min(0).max(1).nullable(),\n avgEngagementMs: z.number().nonnegative().nullable(),\n});\nexport type AnalyticsPageRow = z.infer<typeof analyticsPageRowSchema>;\n\nexport const analyticsSourceRowSchema = z.object({\n source: z.string(),\n medium: z.string(),\n sessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n conversionRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsSourceRow = z.infer<typeof analyticsSourceRowSchema>;\n\nexport const analyticsCampaignRowSchema = z.object({\n utmSource: z.string(),\n utmMedium: z.string(),\n utmCampaign: z.string(),\n /**\n * The platform a click id proves, or `\"\"` when the visit carried none.\n *\n * What separates a campaign the ad breakdown already reports — with its\n * platform proven and its ad set and ad underneath — from one nothing else\n * can show: the newsletter, the partner link, the hand-tagged post. The two\n * are otherwise identical, because `utm_campaign={campaignid}` is the normal\n * tagging convention and produces the same ids in both places.\n *\n * Kept on the row rather than filtered out here: a CLI hint reads an empty\n * campaign list as \"no campaign tagging on any traffic\", and dropping the\n * paid ones would make that fire on a perfectly tagged account.\n */\n clickPlatform: z.string(),\n sessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n conversionRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsCampaignRow = z.infer<typeof analyticsCampaignRowSchema>;\n\nexport const analyticsRealtimeMinuteSchema = z.object({\n /** The minute, as an ISO instant. */\n minute: z.string(),\n visitors: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n});\nexport type AnalyticsRealtimeMinute = z.infer<typeof analyticsRealtimeMinuteSchema>;\n\nexport const analyticsRealtimePageSchema = z.object({\n path: z.string(),\n /** The landing this path belongs to; empty when no landing claims it. */\n landingId: z.string(),\n visitors: z.number().int().nonnegative(),\n});\nexport type AnalyticsRealtimePage = z.infer<typeof analyticsRealtimePageSchema>;\n\nexport const analyticsRealtimeSchema = z.object({\n /** Distinct visitors with any activity inside the active window. */\n activeNow: z.number().int().nonnegative(),\n /** How recently a visitor must have acted to be counted, in minutes. */\n activeWithinMinutes: z.number().int().positive(),\n minutes: z.array(analyticsRealtimeMinuteSchema),\n pages: z.array(analyticsRealtimePageSchema),\n});\nexport type AnalyticsRealtime = z.infer<typeof analyticsRealtimeSchema>;\n\nexport const analyticsDimensionRowSchema = z.object({\n key: z.string(),\n sessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n conversionRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsDimensionRow = z.infer<typeof analyticsDimensionRowSchema>;\n\nexport const analyticsFunnelStepSchema = z.object({\n stepId: z.string(),\n stepIndex: z.number().int().nonnegative(),\n /** Visits that moved forward into this step. Never events — see `visits`. */\n views: z.number().int().nonnegative(),\n /** Visits that finished this step and moved on. */\n completions: z.number().int().nonnegative(),\n /** Share of viewers who did not complete this step, 0–1. */\n dropRate: z.number().min(0).max(1).nullable(),\n /**\n * Visits that converted AT this step — the node kind's own outcome trigger\n * fired here, or the Form was submitted here.\n *\n * Usually zero on every step but one. That is the point: a Form has one\n * conversion, and knowing which step owns it is what stops a drop-off chart\n * treating the booking widget's \"profile viewed\" as a funnel stage.\n */\n convertedSessions: z.number().int().nonnegative(),\n /**\n * This step is where the Form ends — a confirmation screen, not a loss.\n *\n * Stated rather than left to be inferred. The dashboard used to read it off\n * `dropRate === null`, which is also how a step nobody viewed arrives, so a\n * converting link node in the middle of a Form was labelled its ending.\n */\n isEnding: z.boolean(),\n});\nexport type AnalyticsFunnelStep = z.infer<typeof analyticsFunnelStepSchema>;\n\nexport const analyticsFunnelSchema = z.object({\n flowSlug: z.string(),\n /**\n * Visits that saw the Form at all — the denominator for every share here.\n *\n * Read this, not `starts`, whenever the question is \"out of how many\". A\n * start is recorded at the visitor's FIRST INTERACTION, so the two differ by\n * exactly the people who looked at the Form and never touched it — usually\n * most of them, and always the group a drop-off chart exists to find.\n *\n * Every count in this object is distinct visits, including each step's\n * `views` and `completions`. That is load-bearing rather than incidental:\n * the screen divides these by each other, and while the steps counted events\n * a Form four people had opened reported one step reached fifteen times and\n * fourteen people lost.\n */\n visits: z.number().int().nonnegative(),\n /** Visits that interacted with the Form at all — typed, picked, or advanced. */\n starts: z.number().int().nonnegative(),\n submits: z.number().int().nonnegative(),\n /** Conversions per visit that opened the Form, 0–1. */\n completionRate: z.number().min(0).max(1).nullable(),\n /** The step losing the most people. The single most useful field here. */\n worstStep: analyticsFunnelStepSchema.nullable(),\n steps: z.array(analyticsFunnelStepSchema),\n /**\n * Visits that converted, counted once each at whichever node did it.\n *\n * Read this rather than `submits` whenever the two disagree. `submits` only\n * fires when a flow runs out of nodes, so a Form that books a call on a\n * mid-flow Calendly node reports zero submits and every one of its real\n * bookings here.\n */\n convertedSessions: z.number().int().nonnegative(),\n});\nexport type AnalyticsFunnel = z.infer<typeof analyticsFunnelSchema>;\n\n/**\n * One campaign's paid performance.\n *\n * `clickPlatform` is derived from whichever click id the session arrived with,\n * and is the column to trust when the campaign label is missing or wrong —\n * which, on hand-built tracking templates, is often. `delivered` counts leads\n * whose server-side dispatch succeeded, so it can legitimately be far below\n * `conversions`; that gap IS the finding.\n */\nexport const analyticsPaidRowSchema = z.object({\n source: z.string(),\n medium: z.string(),\n campaign: z.string(),\n content: z.string(),\n term: z.string(),\n /** `google` | `meta` | `tiktok` | `x` | `linkedin` | `microsoft` | `\"\"`. */\n clickPlatform: z.string(),\n sessions: z.number().int().nonnegative(),\n convertingSessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /** Leads whose server-side delivery reported success. */\n delivered: z.number().int().nonnegative(),\n /** Leads whose delivery reported failure. Non-zero here is a broken integration. */\n failedDeliveries: z.number().int().nonnegative(),\n /** Distinct people, across devices — only countable where visitors identified themselves. */\n identifiedPeople: z.number().int().nonnegative(),\n /** Converting sessions per session, 0–1. */\n conversionRate: z.number().min(0).max(1).nullable(),\n /** Delivered leads per conversion, 0–1. Below 1 means leads are being lost after submit. */\n deliveryRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsPaidRow = z.infer<typeof analyticsPaidRowSchema>;\n\n/** One submission, and every destination it reached. */\nexport const analyticsDeliveryRowSchema = z.object({\n eventId: z.string(),\n submittedAt: z.string(),\n /**\n * The visit the submission was made in, so a lead can be opened as a story.\n *\n * The whole reason a delivery row is worth clicking. Without it a submission\n * is a timestamp and a CRM outcome, and the questions anybody actually has —\n * which ad brought them, what they read first, how long they took — are all\n * on the other side of this one join.\n */\n sessionId: z.string(),\n /** Lowercase hex digest of who submitted, when the page could identify them. */\n identityHash: z.string(),\n flowSlug: z.string(),\n stepId: z.string(),\n landingId: z.string(),\n destinations: z.array(z.string()),\n dispatched: z.number().int().nonnegative(),\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n /** Dispatched and never settled. Distinguishing this from failed is \"wait\" vs \"act\". */\n pending: z.number().int().nonnegative(),\n /**\n * The ids the destinations gave back.\n *\n * A submission that succeeded everywhere and carries none of these is a real\n * and previously invisible failure: the integration accepted the call and\n * dropped the record.\n */\n providerRefs: z.array(z.string()),\n sampleError: z.string(),\n});\nexport type AnalyticsDeliveryRow = z.infer<typeof analyticsDeliveryRowSchema>;\n\nexport const analyticsTriggerRowSchema = z.object({\n flowSlug: z.string(),\n /** `link`, `customForm`, `iframe`, `hubspotMeeting`, … */\n nodeType: z.string(),\n /** The trigger, verbatim: `link.onClick`, `iframe.checkout_completed`. */\n triggerId: z.string(),\n fires: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n /** How many of those fires produced a side effect. Often zero, on purpose. */\n sideEffectsFired: z.number().int().nonnegative(),\n});\nexport type AnalyticsTriggerRow = z.infer<typeof analyticsTriggerRowSchema>;\n\nexport const analyticsReleaseRowSchema = z.object({\n /** The commit the build came from. */\n release: z.string(),\n firstSeen: z.string(),\n lastSeen: z.string(),\n sessions: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /** Visits that converted on this build at least once. */\n convertingSessions: z.number().int().nonnegative(),\n /** Converting visits per session, 0–1. Null below a usable sample. */\n conversionRate: z.number().min(0).max(1).nullable(),\n});\nexport type AnalyticsReleaseRow = z.infer<typeof analyticsReleaseRowSchema>;\n\nexport const analyticsGeoRowSchema = z.object({\n /** The place itself, at whatever grain was asked for. */\n place: z.string(),\n /** Always carried: a postcode without its country is ambiguous, a city twice over. */\n country: z.string(),\n region: z.string(),\n sessions: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /** Conversions per session, 0–1. Null below a usable sample. */\n conversionRate: z.number().min(0).max(1).nullable(),\n /** People rather than browsers, where the visit identified itself. */\n identifiedPeople: z.number().int().nonnegative(),\n});\nexport type AnalyticsGeoRow = z.infer<typeof analyticsGeoRowSchema>;\n\nexport const analyticsBotRowSchema = z.object({\n /** The crawler's name, or `unidentified` for a machine we could not name. */\n bot: z.string(),\n /** `search` | `ai` | `social` | `seo` | `monitoring` | `tool` | `automation`. */\n category: z.string(),\n hits: z.number().int().nonnegative(),\n pages: z.number().int().nonnegative(),\n lastSeen: z.string(),\n samplePaths: z.array(z.string()),\n});\nexport type AnalyticsBotRow = z.infer<typeof analyticsBotRowSchema>;\n\nexport const analyticsWarningSchema = z.object({\n /**\n * `AD_ROLE_UNMAPPED` is the one that reports a *question* rather than the\n * data. A role resolves to the parameter names that carry it, and when a\n * company has mapped none the list is empty — which the filter reads as\n * \"arrived carrying none of these\" and answers with a confident zero across\n * the whole report. Zero is a far more expensive conclusion than \"nobody has\n * said which parameter that is\", so the narrowing is dropped and this says so.\n */\n code: z.enum([\"LOW_SAMPLE\", \"NO_DATA\", \"BEYOND_RETENTION\", \"AD_ROLE_UNMAPPED\"]),\n message: z.string(),\n});\nexport type AnalyticsWarning = z.infer<typeof analyticsWarningSchema>;\n\n// ---------------------------------------------------------------------------\n// Response\n// ---------------------------------------------------------------------------\n\n/**\n * One shape for every preset, with the irrelevant blocks omitted. A single\n * shape means the CLI renders and the agent reads one thing rather than five,\n * which is the whole point of `overview` answering a question in one call.\n */\n/**\n * One Form, summarised — and specifically, summarised on the number that was\n * previously unobtainable.\n *\n * `convertedSessions` counts visits that reached the outcome, wherever the\n * outcome lives. `submits` counts the flow running out of nodes. On a\n * customForm they are the same number; on a booking Form they are 19 and 0,\n * and the 0 is what every report showed before the conversion trigger was\n * named.\n */\nexport const analyticsFlowSummarySchema = z.object({\n flowSlug: z.string(),\n sessions: z.number().int().nonnegative(),\n starts: z.number().int().nonnegative(),\n convertedSessions: z.number().int().nonnegative(),\n submits: z.number().int().nonnegative(),\n stepViews: z.number().int().nonnegative(),\n /** Distinct steps anyone reached, across all visits. */\n stepsSeen: z.number().int().nonnegative(),\n deepestStepIndex: z.number().int().nonnegative(),\n /** Steps reached per visit, averaged — \"how much of this Form do people read\". */\n avgStepsReached: z.number().nonnegative(),\n /** Conversions per visit that started, 0–1. */\n conversionRate: z.number().min(0).max(1).nullable(),\n /** Which node ids produced the conversions. Usually one; two means two offers. */\n conversionSteps: z.array(z.string()),\n /** And by what — `calendlyEvent.eventScheduled`, `customForm.onFormSubmitted`. */\n conversionTriggers: z.array(z.string()),\n conversionNodeTypes: z.array(z.string()),\n lastSeen: z.string(),\n});\nexport type AnalyticsFlowSummary = z.infer<typeof analyticsFlowSummarySchema>;\n\n/**\n * How many visits moved from one step to the next.\n *\n * `__flow_start__`, `__flow_converted__` and `__flow_exit__` are synthetic\n * endpoints so the graph is closed: every node's inbound total equals its\n * outbound total, and abandonment is an edge rather than a number missing from\n * the diagram. A real `stepId` is a node id from the Form's `_data.json` and\n * never takes that shape.\n */\nexport const analyticsFlowEdgeSchema = z.object({\n flowSlug: z.string(),\n fromStep: z.string(),\n toStep: z.string(),\n sessions: z.number().int().nonnegative(),\n});\nexport type AnalyticsFlowEdge = z.infer<typeof analyticsFlowEdgeSchema>;\n\n/** The three synthetic nodes that bracket every path. */\nexport const ANALYTICS_FLOW_START = \"__flow_start__\";\nexport const ANALYTICS_FLOW_CONVERTED = \"__flow_converted__\";\nexport const ANALYTICS_FLOW_EXIT = \"__flow_exit__\";\n\n/**\n * One value of an ad dimension, and what the people who arrived on it did.\n *\n * `bouncedSessions` is the column that justifies the whole feature: a keyword\n * with traffic, no engagement and no conversions is a keyword buying the wrong\n * intent, and nothing in the ad platform's own reporting can say so.\n */\n/**\n * One conversion this company counts, by the name somebody gave it.\n *\n * Present even when it has produced nothing — a definition at zero is the most\n * actionable row here, because it usually means the event is real but this\n * page never reaches it, which nothing else surfaces.\n *\n * Keyed by NAME, not by event: two definitions sharing a name are one row, so\n * \"Booked a call\" across three Forms is the single number anybody wants.\n * `eventKeys` is what it is made of — parse them with `parseEventKey` to say\n * where each one happens.\n */\nexport const analyticsConversionRowSchema = z.object({\n /** What a person calls this outcome. */\n name: z.string(),\n /** Every event counted under this name. One entry unless the name is shared. */\n eventKeys: z.array(z.string()),\n /**\n * `once_per_visit` | `every_time` — how repeats inside one visit are counted.\n *\n * `mixed` when a shared name spans both, which is a real state and an editing\n * accident; saying so is what makes it findable.\n */\n countMode: z.string(),\n /** Counted the way each definition asked to be counted, and credited to a landing. */\n conversions: z.number(),\n /**\n * Times it happened that no landing earned: by people none of the company's\n * pages saw, within 90 days. Zero under a landing or an ad scope, where the\n * gap would mean something else. Absent on a row built before it existed.\n */\n unplaced: z.number().default(0),\n /** Distinct visits that produced it, never mode-adjusted. The gap between the two is the repeat behaviour. */\n convertingVisits: z.number(),\n /** Null when it has never fired. */\n lastSeen: z.string().nullable(),\n /**\n * The doors its events came in by in the window, in\n * {@link ANALYTICS_EVENT_DOORS} order. Empty when it has not fired.\n */\n doors: z.array(z.enum(ANALYTICS_EVENT_DOORS)).default([]),\n /** Proposed in this chat: counted from when it is published, so every report reads it as nothing until then. */\n staged: z.boolean().optional(),\n});\nexport type AnalyticsConversionRow = z.infer<typeof analyticsConversionRowSchema>;\n\n/**\n * One distinct thing that happened on these pages, whether or not it counts.\n *\n * What the \"add a conversion\" picker is made of. Discovered from real traffic\n * rather than declared, because nobody can mark an outcome they cannot see —\n * before this, naming a conversion meant knowing a node's UUID and its trigger\n * id, and 7 companies out of 45 ever did.\n */\nexport const analyticsEventCatalogRowSchema = z.object({\n /** `form:…` | `submit:…` | `page:…` | `exit:…` — parse with `parseEventKey`. */\n eventKey: z.string(),\n /**\n * Which collector produced this key — and `both` when more than one did.\n *\n * On the row rather than in the key, which is the whole shape of the change\n * that removed the `server:` family: a picker can say where an event came\n * from without a filter round-trip, and a report can still separate the two\n * populations at any grain, but nothing downstream has to learn a second\n * vocabulary to count one.\n */\n origin: z.enum(ANALYTICS_EVENT_ORIGINS),\n events: z.number(),\n sessions: z.number(),\n /** The Form node's kind, for a `form:` key. Empty otherwise. */\n nodeType: z.string(),\n /** The Form this happened in, for a `form:` or `submit:` key. Empty otherwise. */\n flowSlug: z.string(),\n /** Null when it has never fired — only possible for a row we already count. */\n lastSeen: z.string().nullable(),\n /** Already counted as a conversion. Shown, never hidden: a row that vanished on being counted reads as a bug. */\n isCounted: z.boolean(),\n /** The name it is counted under, when it is. */\n countedAs: z.string(),\n /**\n * The doors on Sources this key's events came through, by name — the\n * `baker_source` each event carries. Empty for a key nothing on Sources\n * sent; more than one when two doors used one name.\n */\n sources: z.array(z.string()),\n /**\n * The doors this key's events came in by, in {@link ANALYTICS_EVENT_DOORS}\n * order, each with its own volume — only the doors it actually used.\n *\n * `origin` says site or systems; this says which of the four, which is the\n * question every picker is read to answer. Defaulted, so a store that\n * predates the column parses as \"no door known\" rather than failing.\n */\n doors: z\n .array(z.object({ door: z.enum(ANALYTICS_EVENT_DOORS), events: z.number(), sessions: z.number() }))\n .default([]),\n});\nexport type AnalyticsEventCatalogRow = z.infer<typeof analyticsEventCatalogRowSchema>;\n\nexport const analyticsAdDimensionRowSchema = z.object({\n /** The dimension's value. Empty means \"arrived carrying none of these\". */\n value: z.string(),\n /** Which platform stamped the click, from the click id rather than a label. */\n platform: z.string(),\n sessions: z.number(),\n convertingSessions: z.number(),\n conversions: z.number(),\n bouncedSessions: z.number(),\n identifiedPeople: z.number(),\n pageViews: z.number(),\n engagementMs: z.number(),\n /** Conversions per session, or null when nothing arrived. */\n conversionRate: z.number().nullable(),\n /** Bounces per session, or null when nothing arrived. */\n bounceRate: z.number().nullable(),\n});\nexport type AnalyticsAdDimensionRow = z.infer<typeof analyticsAdDimensionRowSchema>;\n\n/**\n * One campaign parameter seen on this company's URLs.\n *\n * The inventory the mapping tool is built on. `role` is what we currently read\n * it as — absent when nothing does, which is precisely the row a person needs\n * to act on.\n */\nexport const analyticsAdParamRowSchema = z.object({\n name: z.string(),\n /** Whether the value is stored, or only the fact that the name appeared. */\n captured: z.boolean(),\n /** The role in force for the platform asked about, built-in or configured. */\n role: adParamRoleSchema.optional(),\n /**\n * True when this company said what it means, rather than Baker knowing it.\n *\n * The difference between a row that can be reset to a sensible default and\n * one where clearing it means \"nobody has said\".\n */\n configured: z.boolean(),\n /**\n * Visits carrying this parameter **that arrived from the platform asked\n * about**, not visits carrying it anywhere.\n *\n * This used to be the second: one inventory of every parameter on every\n * visit, shown identically under each platform tab. That is wrong on the\n * facts, and confidently so. A visit arrives from one platform — it has one\n * click id — so `gclid` traffic cannot also be Meta traffic, and a Meta tab\n * listing `gad_campaignid` on 1,204 visits invited somebody to name a Google\n * parameter in Meta's vocabulary and then wonder why no report ever used it.\n * The count belongs to the platform or it is not a count of anything.\n */\n sessions: z.number(),\n events: z.number(),\n /** Up to five distinct values. Always empty for an uncaptured parameter. */\n sampleValues: z.array(z.string()),\n lastSeen: z.string().optional(),\n /**\n * True when this row is here because somebody configured it, not because it\n * arrived.\n *\n * The row a mapping made before its first click. A tracking setup is\n * routinely written the week before the campaign runs, and a tool that can\n * only describe traffic it has already seen cannot be used at the one moment\n * somebody sits down to do this properly. Such a row has no visits and no\n * values, and says so rather than reading as a parameter that stopped\n * arriving.\n */\n awaitingTraffic: z.boolean().optional(),\n});\nexport type AnalyticsAdParamRow = z.infer<typeof analyticsAdParamRowSchema>;\n\n/**\n * How much traffic each ad platform actually brought in this window.\n *\n * The number that makes the platform tabs honest. Nine tabs all offering to\n * configure something read as nine things left undone; nine tabs where six say\n * \"no visits\" read as an account running three platforms, which is the truth\n * and is what the reader already knows. Attribution is the generous one — the\n * click id, and failing that `utm_source` — because somebody who picks the\n * Google tab means the traffic they buy from Google, half of which arrives with\n * autotagging off or the click id stripped.\n */\n/**\n * What one Form has demonstrably reached, as opposed to what its picture says.\n *\n * Small on purpose: it exists to answer \"is this Form wired to anything\" from\n * evidence, and nothing more. The counts of what happened live on the\n * submission rows.\n */\nexport const analyticsFlowDestinationsSchema = z.object({\n flowSlug: z.string(),\n /** Destination types seen — `meta`, `httpWebhook`, `hubspotForm`. */\n destinations: z.array(z.string()),\n lastSeen: z.string().optional(),\n});\nexport type AnalyticsFlowDestinations = z.infer<typeof analyticsFlowDestinationsSchema>;\n\nexport const analyticsAdPlatformTrafficSchema = z.object({\n platform: z.string(),\n sessions: z.number(),\n conversions: z.number(),\n /** How many of those visits carried any campaign parameter at all. */\n taggedSessions: z.number(),\n});\nexport type AnalyticsAdPlatformTraffic = z.infer<typeof analyticsAdPlatformTrafficSchema>;\n\n/**\n * Which page of a list report this is, and whether there is another.\n *\n * `hasMore` is derived by asking the store for one row more than the page holds\n * and throwing it away, rather than by a second counting query. That answers\n * the only question a pager actually has — is the \"next\" button live — for the\n * price of one row, where a total count is a second full scan of the window for\n * a number that is stale before it is rendered.\n */\nexport const analyticsPageInfoSchema = z.object({\n /** Which field of the response was paged. */\n block: z.enum([\"visitors\", \"submissions\", \"deliveries\", \"stream\"]),\n page: z.number().int(),\n pageSize: z.number().int(),\n returned: z.number().int(),\n hasMore: z.boolean(),\n});\nexport type AnalyticsPageInfo = z.infer<typeof analyticsPageInfoSchema>;\n\n/**\n * One thing that happened in a visit, in the order it happened.\n *\n * Deliberately one flat row type for every kind of event rather than a union:\n * a replay is read top to bottom, and a reader who has to know which of nine\n * shapes each line is has been handed the raw store back. The fields that do\n * not apply come back empty, which is also how the store holds them.\n */\nexport const analyticsTimelineRowSchema = z.object({\n timestamp: z.string(),\n /**\n * The visit this event belongs to, and the browser that made it.\n *\n * Empty on anything that belongs to neither — a settlement, and an event a\n * client's own server posted about somebody who was never on a page. Carried\n * because the raw feed (`stream`) is a company-wide list rather than one\n * visit's, so a row has to say who it was about before a reader can get from\n * it to the person. On a replay both are constant and simply confirm it.\n */\n sessionId: z.string(),\n anonId: z.string(),\n /**\n * Where the producer put this event in its own order, from 1. `0` means it\n * did not number this one.\n *\n * The tie-break that makes the replay a replay. The timestamp is\n * milliseconds and the Form engine emits several events in one synchronous\n * block, so a step completing, the identities it revealed and the next step\n * coming into view routinely share one — and sorted on the timestamp alone\n * they came back in an order that matched nothing that happened.\n */\n eventSeq: z.number().int().nonnegative(),\n /** This event's identity, so two rows can be said to be the same event. */\n eventUid: z.string(),\n /** `page_view`, `form_step_view`, `side_effect_dispatched`, … */\n eventType: z.string(),\n /** `edge`, `beacon`, `server` — where the row was written from. */\n source: z.string(),\n /**\n * `baker`, `external`, `export` — where the page was, which `source` does\n * not say. The two together are what decide the row's door; see\n * `ANALYTICS_EVENT_DOORS`.\n *\n * Defaulted rather than required: the column arrived after the corpus did\n * and carries no default of its own, so a row older than it reads `\"\"`, and\n * that has to mean \"Baker's, as everything was then\" rather than fail the\n * whole row's parse.\n */\n deployment: z.string().default(\"\"),\n environment: z.string(),\n /** The build the page was published from. */\n release: z.string(),\n path: z.string(),\n host: z.string(),\n landingId: z.string(),\n flowSlug: z.string(),\n stepId: z.string(),\n stepIndex: z.number().int().nonnegative(),\n nodeType: z.string(),\n triggerId: z.string(),\n /** A page-defined event's own name, when this row is one. */\n eventName: z.string(),\n /** Whatever the page attached to a custom event. Strings only, by design. */\n properties: z.record(z.string(), z.string()),\n /** Where an outbound click or a link node was going, in full. */\n targetUrl: z.string(),\n /** A number the page reported alongside the event. */\n value: z.number(),\n /**\n * The currency that number is in, when it has one.\n *\n * Only a server-sent event carries it — a page reports a `value` on its own\n * terms, a CRM reports a deal in euros — and without it the replay prints a\n * bare `4200.5` beside a closed deal, which is a number nobody can act on.\n */\n valueCurrency: z.string().default(\"\"),\n /** The visitor's digest, when they had identified themselves by this point. */\n identityHash: z.string(),\n /**\n * The browser to attribute this row to, once the identity has been resolved.\n *\n * `anonId` when the row has one, and otherwise the browser {@link identityHash}\n * resolves to through `identities`. Empty when neither exists.\n *\n * It is a separate field rather than a coalesce into `anonId` because the two\n * claims are not the same: `anonId` is the cookie the row was written with,\n * and a server-sent event was written with none and must not start claiming\n * one. This is the *read's* answer to \"who was that\", and it is retroactive\n * and cross-device by construction — a \"Deal won\" posted in March attaches to\n * the person the moment they type that address into a Form in April, and to\n * every browser they have used here.\n *\n * Only `event_stream` fills it. Empty everywhere else, which is honest: a\n * session replay deliberately does not resolve, because an event that\n * happened during no visit must not be placed inside one.\n */\n personAnonId: z.string().default(\"\"),\n /**\n * What this row knows the person by, when it does not know their browser:\n * `email` | `phone` | `external` | `click` | `cookie`, or empty.\n *\n * The feed's Who column reads it. A row naming a person by a means that has\n * no face here yet — a digest nobody has typed into a Form, an ad click, one\n * of Meta's cookies — is not a row about nobody, and rendering it as one is\n * what made the server-sent half of the feed look unattached to the rest.\n */\n knownBy: z.string().default(\"\"),\n /**\n * What this row counts as under the company's own conversion definitions, or\n * empty when it counts as nothing.\n *\n * The store's own key, projected rather than rebuilt here, so the feed and\n * the reports cannot disagree about what one event was. Two rows carrying the\n * same non-empty key are **one** conversion — the second is stored, listed,\n * and marked as already counted rather than hidden, because a sender who\n * posted a deal twice needs to see that the second request arrived.\n *\n * Only `event_stream` fills it; empty everywhere else.\n */\n conversionKey: z.string().default(\"\"),\n /**\n * Which lines of a people search this row belongs to, by position in\n * `peopleSearch`. Empty when nobody was searched for.\n */\n personTerms: z.array(z.number()).optional(),\n /**\n * `email` | `phone` — which of the two they gave.\n *\n * Load-bearing rather than trivia: a visitor who fills in both fields\n * produces two `identify` rows in the same millisecond, and without the kind\n * a replay renders the same sentence twice and reads as a duplicated event.\n */\n identityKind: z.string(),\n /**\n * The `user_data` block this event carried, exactly as it arrived.\n *\n * The contact digests (`email_sha256`, `phone_sha256`, `external_id_sha256`),\n * the click ids, Meta's cookies, and the advanced-matching /\n * enhanced-conversions fields — first name, city, postcode, country. Empty on\n * everything a page produced, which is most rows.\n *\n * **Per event, and deliberately not merged** — unlike the person card, which\n * merges the same fields newest-wins across everything anyone ever sent. The\n * question one event answers is \"what did *this request* contain\", and the\n * answer has to be allowed to be *worse* than what is known about the person\n * overall. That is how a sender finds the field they forgot to map: the\n * person has a postcode, and this event does not.\n */\n userData: z.record(z.string(), z.string()).default({}),\n sideEffectType: z.string(),\n sideEffectName: z.string(),\n sideEffectId: z.string(),\n tagId: z.string(),\n messageId: z.string(),\n /**\n * The submission this row belongs to.\n *\n * What ties a browser pixel and a server dispatch of the SAME submit\n * together. Without it they read as two unrelated things that happened to\n * occur in the same second.\n */\n eventId: z.string(),\n runId: z.string(),\n engagementMs: z.number().int().nonnegative(),\n scrollDepth: z.number().int().nonnegative(),\n /**\n * The A/B test this row was stamped into, and which side the edge served —\n * `a` for the page as it is, `b` for the new variant.\n *\n * Set only on rows a page under test produced, which is how a person's story\n * can say which version they were shown. Empty on a server-sent row: a CRM\n * knows nothing about the split, and the conversion it posts is attributed\n * to a side by WHO did it (see `experiment_conversions`), never by a stamp.\n */\n experimentId: z.string().default(\"\"),\n variant: z.string().default(\"\"),\n /** `success` | `failed` | `\"\"` for a dispatch that has not settled yet. */\n outcome: z.string(),\n /** What the destination said when it refused. Empty on success. */\n error: z.string(),\n /** The destination's own id for the record it created, when it gave one. */\n providerRef: z.string(),\n /** When the destination answered, so \"it took eleven seconds\" is sayable. */\n settledAt: z.string(),\n});\nexport type AnalyticsTimelineRow = z.infer<typeof analyticsTimelineRowSchema>;\n\n/**\n * One attempt at a Form — one visitor, one Form, one visit.\n *\n * The unit a person means by \"a submission\": they filled it in once. It exists\n * whether they finished, gave up halfway, or completed a Form wired to nothing\n * — which is the case the delivery list structurally could not show, because\n * that list is built from dispatches and a Form with no destination makes none.\n */\nexport const analyticsSubmissionRowSchema = z.object({\n sessionId: z.string(),\n flowSlug: z.string(),\n startedAt: z.string(),\n lastAt: z.string(),\n anonId: z.string(),\n identityHash: z.string(),\n identityKind: z.string(),\n landingId: z.string(),\n path: z.string(),\n /** Steps they saw. The denominator for \"how far did they get\". */\n stepsReached: z.number().int().nonnegative(),\n /** Steps they actually handed something over on. Zero means no attempt. */\n stepsSubmitted: z.number().int().nonnegative(),\n submittedStepIds: z.array(z.string()),\n /** The furthest step they reached, for naming where they stopped. */\n lastStepId: z.string(),\n /** Whether the Form reached an ending, by any of its three routes. */\n finished: z.boolean(),\n conversions: z.number().int().nonnegative(),\n destinations: z.array(z.string()),\n /** Destinations that fired as a pixel in the page. */\n browserDestinations: z.array(z.string()),\n /** Destinations Baker dispatched from the server. */\n serverDestinations: z.array(z.string()),\n /**\n * Server-side dispatch runs — the counterpart of `serverDestinations`, NOT of\n * `destinations`.\n *\n * Zero is not \"this went nowhere\", and reading it that way is a mistake\n * already made once: it is zero for an attempt abandoned before the step that\n * fires a destination, and zero for a Form whose only destination is a\n * browser pixel. `destinations` is the union of both sides and is the column\n * that answers \"did this reach anything at all\".\n */\n dispatched: z.number().int().nonnegative(),\n succeeded: z.number().int().nonnegative(),\n failed: z.number().int().nonnegative(),\n /** Dispatched and never settled — \"wait\", as against \"act\". */\n pending: z.number().int().nonnegative(),\n sampleError: z.string(),\n providerRefs: z.array(z.string()),\n /** The submission ids, which is how the panel opens the sealed payload. */\n eventIds: z.array(z.string()),\n});\nexport type AnalyticsSubmissionRow = z.infer<typeof analyticsSubmissionRowSchema>;\n\n/** One earlier visit by the same person, resolved across their devices. */\nexport const analyticsVisitorSessionSchema = z.object({\n sessionId: z.string(),\n startedAt: z.string(),\n endedAt: z.string(),\n entryPath: z.string(),\n entryLandingId: z.string(),\n utmCampaign: z.string(),\n referrerSource: z.string(),\n deviceType: z.string(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /**\n * True for the visits made BEFORE we knew who this was.\n *\n * Shown rather than smoothed over: a history without it invites the reading\n * that we recognised them all along, when in fact these visits were only\n * attributed backwards through the browser after they identified themselves.\n */\n wasAnonymous: z.boolean(),\n engagementMs: z.number().int().nonnegative(),\n});\nexport type AnalyticsVisitorSession = z.infer<typeof analyticsVisitorSessionSchema>;\n\n/**\n * Who made one visit — the header of a lead, not a row in a table.\n *\n * Everything here is one session's own facts, and it is the answer to the\n * question a conversion count cannot touch: a lead arrives, and before anything\n * else the reader wants to know whether this is a phone in Valencia off a\n * Google Ads keyword or a laptop in Berlin off a newsletter. That judgement is\n * made in a second from a flag, a device and a campaign, and it is made before\n * anybody reads a single delivery outcome.\n *\n * ## What is deliberately not here\n *\n * A name, an email, a phone number. `identityHash` is a digest computed in the\n * browser and the plaintext behind it never reaches the store — that is the\n * whole design of the lead vault, and it is why a person is shown as a stable\n * short code rather than as a person. Opening what they actually typed is a\n * separate, audited act with its own permission, and it stays that way.\n *\n * `campaignParams` is the honest substitute for a vendor's \"custom\n * properties\": the values the click itself carried, which for a paid visit is\n * usually the keyword, the ad and the campaign. Those are not personal data and\n * they are frequently the most useful thing on the panel.\n */\nexport const analyticsVisitProfileSchema = z.object({\n sessionId: z.string(),\n startedAt: z.string(),\n endedAt: z.string(),\n entryPath: z.string(),\n entryLandingId: z.string(),\n country: z.string(),\n region: z.string(),\n city: z.string(),\n timezone: z.string(),\n /** The network the visit came from. What separates a datacentre from a person. */\n asOrganization: z.string(),\n deviceType: z.string(),\n browser: z.string(),\n os: z.string(),\n referrerSource: z.string(),\n referrerDomain: z.string(),\n utmSource: z.string(),\n utmMedium: z.string(),\n utmCampaign: z.string(),\n /**\n * Which platform the click id proves, in the `AD_PLATFORMS` vocabulary —\n * `google` | `meta` | `tiktok` | `x` | `linkedin` | `microsoft` | `\"\"`.\n *\n * The same spelling every mark, mapping and report uses. It briefly said\n * `google_ads` / `meta_ads` here alone, which meant every logo lookup on the\n * People screen missed and a paid visit drew a neutral globe.\n */\n clickPlatform: z.string(),\n /** Every ValueTrack-style parameter the URL carried, unresolved. */\n campaignParams: z.record(z.string(), z.string()),\n /** The browser's own cookie id. One person can have several. */\n anonId: z.string(),\n identityHash: z.string(),\n /** What the digest was made of — `email`, `phone`. Never the value. */\n identityKind: z.string(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n engagementMs: z.number().int().nonnegative(),\n});\nexport type AnalyticsVisitProfile = z.infer<typeof analyticsVisitProfileSchema>;\n\n/**\n * One person in the visitors list.\n *\n * The same facts as {@link AnalyticsVisitProfile}, rolled up across every visit\n * that browser made instead of describing one. Two of the rollups are not\n * symmetrical and the asymmetry is deliberate: acquisition is first-touch,\n * because it records how somebody was found and the direct visit they made\n * afterwards must not take the credit; geography and device are last-touch,\n * because they answer \"what are they on\" and the current answer is the useful\n * one.\n *\n * No name and no email, for the reason given on the profile: the identity a\n * page sends is hashed in the browser. `anonId` is what the list is keyed and\n * labelled by, and a stable nickname and avatar are derived from it so a person\n * is recognisable between the list and their panel without ever being named.\n */\n/**\n * One key a person is known by.\n *\n * This used to be a pairing of a contact detail and a browser, and those were\n * the only two things it could ever be. A person is nameable in seven ways —\n * an email, a phone number, the sender's own contact id, the browser cookie,\n * an ad click, and either of Meta's two cookies — and six of them had nowhere\n * to appear, so \"how we recognise them\" answered \"by an email, or not at all\"\n * for a customer whose CRM identifies them perfectly well by something else.\n *\n * A digest never resolves to a value: it is a one-way hash and the value lives\n * in the sealed vault, so a row here is what \"we recognise this person\"\n * consists of and all of it.\n */\nexport const analyticsPersonKeySchema = z.object({\n /** `email` | `phone` | `external` | `browser` | a click-id name | `fbp` | `fbc`. */\n kind: z.string(),\n /** A digest for a contact detail, the value itself for a cookie or a click id. */\n value: z.string(),\n firstSeen: z.string(),\n lastSeen: z.string(),\n /** How many times it was observed beside another key — every submission repeats it. */\n observations: z.number().int().nonnegative(),\n sessions: z.number().int().nonnegative(),\n /** `client` | `edge` | `server` | `ingest` — which collector first saw it. */\n source: z.string(),\n /** The Form it was first seen on, where it came from one. */\n flowSlug: z.string(),\n landingId: z.string(),\n});\nexport type AnalyticsPersonKey = z.infer<typeof analyticsPersonKeySchema>;\n\n/**\n * The card: one person, rolled up across every key and every device.\n *\n * Distinct from the visitor row beside it, and the distinction is the whole\n * point. A visitor row is one **browser** — that is what the list is, because\n * most people never identify themselves and a list keyed on a person would be\n * a list of leads. Once a panel is open the unit has to change: the human who\n * read on a phone and converted on a laptop is one person, and their totals\n * have to say so or the panel contradicts the replay under it.\n */\nexport const analyticsPersonProfileSchema = z.object({\n firstSeen: z.string(),\n lastSeen: z.string(),\n sessions: z.number().int().nonnegative(),\n /** How many browsers resolved to this person. More than one is cross-device. */\n devices: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n /**\n * What they are worth, per currency — `{ EUR: 4753 }`.\n *\n * A map rather than an amount and a code, because the two-column shape had\n * no honest answer for somebody with a deal in each of two currencies: it\n * summed them and labelled the total with whichever code came back first.\n * Only a server event ever carries money, and a retried post is counted\n * once, on `event_uid`.\n */\n money: z.record(z.string(), z.number()),\n engagementMs: z.number().int().nonnegative(),\n /** How many of their events a client's own server posted. */\n serverEvents: z.number().int().nonnegative(),\n country: z.string(),\n region: z.string(),\n city: z.string(),\n deviceType: z.string(),\n browser: z.string(),\n os: z.string(),\n utmSource: z.string(),\n utmMedium: z.string(),\n utmCampaign: z.string(),\n referrerSource: z.string(),\n entryLandingId: z.string(),\n entryPath: z.string(),\n /**\n * The customer-matching block, merged newest-wins across everything anyone\n * has ever told us about them — `city`, `postal_code`, `country`,\n * `first_name_sha256`, `fbp`. Keyed exactly as the store holds it, so a key\n * ending `_sha256` says its value is a digest and cannot be shown.\n */\n matchKeys: z.record(z.string(), z.string()),\n});\nexport type AnalyticsPersonProfile = z.infer<typeof analyticsPersonProfileSchema>;\n\nexport const analyticsVisitorRowSchema = z.object({\n anonId: z.string(),\n firstSeen: z.string(),\n lastSeen: z.string(),\n sessions: z.number().int().nonnegative(),\n pageViews: z.number().int().nonnegative(),\n conversions: z.number().int().nonnegative(),\n formTriggers: z.number().int().nonnegative(),\n outboundClicks: z.number().int().nonnegative(),\n engagementMs: z.number().int().nonnegative(),\n /** The visit to open by default — the most recent one. */\n lastSessionId: z.string(),\n entryPath: z.string(),\n entryLandingId: z.string(),\n lastPath: z.string(),\n referrerSource: z.string(),\n referrerDomain: z.string(),\n utmSource: z.string(),\n utmMedium: z.string(),\n utmCampaign: z.string(),\n clickPlatform: z.string(),\n campaignParams: z.record(z.string(), z.string()),\n /**\n * The click ids this person arrived on, by their own names — `gclid`,\n * `fbclid`, `msclkid`, `li_fat_id`, `ttclid`, `twclid`, `wbraid`, `gbraid`,\n * `dclid`, `rdt_cid`, `epik`, `sccid`, `oppref`.\n *\n * Only the ones that were present. The endpoint has always returned all eight\n * columns and nothing above it carried them, so the one screen whose subject\n * is a person could name the platform that paid for the click and not the\n * click — which is the value a platform's own reporting is matched on, and\n * therefore the value somebody is looking for when a conversion did not show\n * up on the other side.\n */\n clickIds: z.record(z.string(), z.string()),\n country: z.string(),\n region: z.string(),\n city: z.string(),\n timezone: z.string(),\n asOrganization: z.string(),\n deviceType: z.string(),\n browser: z.string(),\n os: z.string(),\n identityHash: z.string(),\n identityKind: z.string(),\n});\nexport type AnalyticsVisitorRow = z.infer<typeof analyticsVisitorRowSchema>;\n\n/**\n * What the website tag is measuring, inferred from the rows it sent.\n *\n * Inferred and not stored: `data-baker-measure` is baked into a snippet\n * somebody pastes into their own tag manager, so nothing here records what is\n * actually live — and a stored copy would say what we told them to install,\n * not what they did. See `pixel_measure_scope` in `tinybird/definitions.ts`.\n *\n * `unknown` is the honest answer when the tag has sent nothing in this window:\n * not installed, not firing, or simply no traffic. It is not `campaigns`.\n */\nexport const analyticsMeasureScopeSchema = z.object({\n scope: z.enum([\"campaigns\", \"outcomes\", \"all\", \"unknown\"]),\n /** Every event the tag on the client's own site sent in this window. */\n websiteEvents: z.number(),\n /** Browser ids it minted off-Baker. Any at all means the tag is on `all`. */\n websiteNewVisitors: z.number(),\n});\nexport type AnalyticsMeasureScope = z.infer<typeof analyticsMeasureScopeSchema>;\n\nexport const analyticsQueryDataSchema = z.object({\n preset: analyticsPresetSchema,\n window: analyticsWindowSchema,\n totals: analyticsTotalsSchema,\n trend: z.array(analyticsTrendPointSchema).optional(),\n topPages: z.array(analyticsPageRowSchema).optional(),\n topSources: z.array(analyticsSourceRowSchema).optional(),\n topCampaigns: z.array(analyticsCampaignRowSchema).optional(),\n countries: z.array(analyticsDimensionRowSchema).optional(),\n devices: z.array(analyticsDimensionRowSchema).optional(),\n funnels: z.array(analyticsFunnelSchema).optional(),\n flowSummary: z.array(analyticsFlowSummarySchema).optional(),\n flowPaths: z.array(analyticsFlowEdgeSchema).optional(),\n triggers: z.array(analyticsTriggerRowSchema).optional(),\n releases: z.array(analyticsReleaseRowSchema).optional(),\n paid: z.array(analyticsPaidRowSchema).optional(),\n measureScope: analyticsMeasureScopeSchema.optional(),\n deliveries: z.array(analyticsDeliveryRowSchema).optional(),\n submissions: z.array(analyticsSubmissionRowSchema).optional(),\n geo: z.array(analyticsGeoRowSchema).optional(),\n bots: z.array(analyticsBotRowSchema).optional(),\n landings: z.array(analyticsLandingRowSchema).optional(),\n tags: z.array(analyticsTagRowSchema).optional(),\n customEvents: z.array(analyticsCustomEventRowSchema).optional(),\n eventBreakdown: z.array(analyticsEventBreakdownRowSchema).optional(),\n customFunnel: z.array(analyticsCustomFunnelStepSchema).optional(),\n deviceBreakdown: z.array(analyticsDeviceRowSchema).optional(),\n realtime: analyticsRealtimeSchema.optional(),\n adDimensions: z.array(analyticsAdDimensionRowSchema).optional(),\n adParams: z.array(analyticsAdParamRowSchema).optional(),\n /**\n * Parameters arriving on visits no platform can be named for.\n *\n * Kept apart rather than folded into the platform's own list, and kept rather\n * than dropped. Folding them in is what made every tab identical; dropping\n * them would lose a parameter that arrives on hand-tagged links, on an email\n * campaign, or on paid traffic whose click id an ad blocker removed — and\n * losing it silently, which is the one outcome worse than showing it in the\n * wrong place. They are evidence, not a to-do list: there is no platform to\n * map them under, so a reader who recognises one adds it by name to the\n * platform they know it belongs to.\n */\n adParamsUnattributed: z.array(analyticsAdParamRowSchema).optional(),\n adPlatformTraffic: z.array(analyticsAdPlatformTrafficSchema).optional(),\n flowDestinations: z.array(analyticsFlowDestinationsSchema).optional(),\n /** Present only on a report that was asked for by the page. */\n pageInfo: analyticsPageInfoSchema.optional(),\n conversions: z.array(analyticsConversionRowSchema).optional(),\n /** Every event these pages produced, counted or not. The \"add a conversion\" picker. */\n eventCatalog: z.array(analyticsEventCatalogRowSchema).optional(),\n timeline: z.array(analyticsTimelineRowSchema).optional(),\n /**\n * The raw feed. Same row shape as a replay, because it is the same rows —\n * what changes is that this one is bounded by a window rather than by a visit.\n */\n stream: z.array(analyticsTimelineRowSchema).optional(),\n /** How each line of a people search on `stream` was read — what `personTerms` points at. */\n peopleSearch: z.array(peopleSearchTermSchema).optional(),\n visitorSessions: z.array(analyticsVisitorSessionSchema).optional(),\n /** Every key this person is known by — contact details, browsers, clicks, cookies. */\n personKeys: z.array(analyticsPersonKeySchema).optional(),\n /** The same person, rolled up: their totals across every device, and what is known about them. */\n personProfile: analyticsPersonProfileSchema.optional(),\n visitProfile: analyticsVisitProfileSchema.optional(),\n visitors: z.array(analyticsVisitorRowSchema).optional(),\n /**\n * The same totals for the window immediately before this one, when asked for.\n *\n * The comparison window is returned alongside rather than reduced to a set of\n * deltas, so a caller can show either side of it and does not have to trust\n * our arithmetic to render \"1,240 vs 980\".\n */\n previous: z\n .object({\n window: analyticsWindowSchema,\n totals: analyticsTotalsSchema,\n })\n .optional(),\n});\nexport type AnalyticsQueryData = z.infer<typeof analyticsQueryDataSchema>;\n\nexport const analyticsQueryResponseSchema = z.object({\n ok: z.literal(true),\n data: analyticsQueryDataSchema,\n warnings: z.array(analyticsWarningSchema).optional(),\n hints: z.array(z.string()).optional(),\n});\nexport type AnalyticsQueryResponse = z.infer<typeof analyticsQueryResponseSchema>;\n\n// ---------------------------------------------------------------------------\n// What counts as a conversion\n// ---------------------------------------------------------------------------\n\n/**\n * Changing what this company counts as a conversion.\n *\n * Operations rather than the whole list, for the parameter mapping's reason: an\n * agent that has just decided one outcome matters would otherwise have to read\n * the list first, and a dropped read would silently wipe every other outcome —\n * including the ones a person set in the dashboard an hour ago.\n *\n * With neither field set this is a read, which is what makes\n * `baker analytics conversions` with no flags show what is counted rather than\n * erroring.\n */\nexport const analyticsConversionsRequestSchema = z.object({\n set: z\n .array(\n z.object({\n /** `form:<flow>:<step>:<trigger>` | `submit:<flow>` | `page:<name>` | `exit:<host>`. */\n eventKey: z.string().max(320),\n name: z.string().max(MAX_CONVERSION_NAME),\n countMode: z.enum(CONVERSION_COUNT_MODES).optional(),\n }),\n )\n .max(60)\n .optional(),\n remove: z.array(z.string().max(320)).max(60).optional(),\n /** Every key counted under `from` moves to `to`, and the sends under the name go with it. */\n rename: z\n .object({ from: z.string().min(1).max(MAX_CONVERSION_NAME), to: z.string().min(1).max(MAX_CONVERSION_NAME) })\n .optional(),\n});\nexport type AnalyticsConversionsRequest = z.infer<typeof analyticsConversionsRequestSchema>;\n\nexport const analyticsConversionsResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n /**\n * What the company counts — inside a chat, with this chat's proposal on\n * top: `staged` marks a definition that applies when the chat is published.\n */\n definitions: z.array(\n z.object({\n eventKey: z.string(),\n name: z.string(),\n countMode: z.string(),\n updatedAt: z.number(),\n staged: z.boolean().optional(),\n }),\n ),\n /** This chat's proposal, when it has one: counted from Publish, and gone if the chat is discarded. */\n staged: z\n .object({\n set: z.array(z.object({ eventKey: z.string(), name: z.string() })),\n remove: z.array(z.string()),\n })\n .optional(),\n }),\n hints: z.array(z.string()).optional(),\n});\nexport type AnalyticsConversionsResponse = z.infer<typeof analyticsConversionsResponseSchema>;\n\n// ---------------------------------------------------------------------------\n// The parameter mapping\n// ---------------------------------------------------------------------------\n\n/**\n * Changing how this company's URLs are understood.\n *\n * Expressed as operations rather than as the whole mapping, because the caller\n * is usually an agent that has just been told about one parameter. Making it\n * send the complete map back would mean reading it first and would turn a\n * dropped read into a silent wipe of every other entry.\n *\n * With neither field set this is a read, which is what makes `baker analytics\n * map` with no flags show the mapping in force rather than erroring.\n */\nexport const analyticsMappingRequestSchema = z.object({\n /**\n * Which platform these operations are about. Required for a change.\n *\n * There is no cross-platform entry to write: the platforms do not describe\n * the same world, so `cid` is TikTok's ad and half the internet's campaign,\n * and a keyword on Meta traffic is not a thing that can exist. Omit it only\n * to read the mapping back.\n */\n platform: z.enum(AD_PLATFORMS).optional(),\n /** Parameter name → role, on `platform`. Merged over what is stored. */\n set: z.record(z.string().max(64), adParamRoleSchema).optional(),\n /** Parameter names to stop reading, on `platform`. Applied after `set`. */\n remove: z.array(z.string().max(64)).max(64).optional(),\n});\nexport type AnalyticsMappingRequest = z.infer<typeof analyticsMappingRequestSchema>;\n\nexport const analyticsMappingResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n /**\n * This company's own entries after the change, keyed `<platform>/<name>`.\n *\n * Every platform's, not only the one the request named: a caller that has\n * just mapped `cid` on TikTok is usually about to be asked the same\n * question about Google, and the answer there is different.\n */\n params: z.record(z.string(), adParamRoleSchema),\n /**\n * Names that are understood without being configured.\n *\n * Returned so a caller can tell \"already handled\" from \"not mapped\" without\n * shipping a copy of the built-in list, and so an agent does not spend a\n * turn configuring `keyword` to mean keyword.\n */\n builtIn: z.array(z.string()),\n /**\n * What the client's own ad account says about each parameter just staged.\n *\n * Present only when a Session staged a `set` on a platform whose tracking\n * configuration Baker can read. `contradicted` is the entry worth stopping\n * for: the account fills that name with a placeholder meaning something\n * else, so the answer just given would produce a report that is wrong and\n * looks entirely plausible.\n */\n evidence: z\n .record(\n z.string(),\n z.object({\n status: z.enum([\"confirmed\", \"contradicted\", \"unseen\", \"not_read\"]),\n macro: z.string().optional(),\n suggestedRole: adParamRoleSchema.optional(),\n source: z.string().optional(),\n reason: z.string().optional(),\n }),\n )\n .optional(),\n updatedAt: z.number().nullable(),\n }),\n hints: z.array(z.string()).optional(),\n});\nexport type AnalyticsMappingResponse = z.infer<typeof analyticsMappingResponseSchema>;\n\n// ---------------------------------------------------------------------------\n// Whether the ads are tagged well enough to report on\n// ---------------------------------------------------------------------------\n\n/**\n * A read, always — nothing here changes an ad account or a mapping.\n *\n * It answers the question an audit opens with and the mapping screen cannot:\n * given what this company's ad URLs carry and what Baker understands of it,\n * which of the dimensions any budget decision needs will actually reach a\n * report. Omitting `platform` checks the ones worth checking rather than all\n * eight — see `platformsToCheck`.\n */\nexport const analyticsTrackingRequestSchema = z.object({\n platform: z.enum(AD_PLATFORMS).optional(),\n days: z.number().int().min(1).max(365).optional(),\n});\nexport type AnalyticsTrackingRequest = z.infer<typeof analyticsTrackingRequestSchema>;\n\nconst trackingDimensionSchema = z.object({\n role: adParamRoleSchema,\n /** The platform's own macro for it — what goes in the URL. */\n macro: z.string(),\n /** The account's own spelling where it has one, else the canonical name. */\n name: z.string(),\n /**\n * What has to happen for this dimension to reach a report.\n *\n * Four states rather than a boolean, because two of them need opposite fixes\n * and one of them is not a finding at all. `unmapped` is one\n * `baker analytics map` call and repairs the history with it; `missing` is a\n * change to the ad account and everything before it stays unattributable;\n * `unknown` means no visit arrived and the account could not be read, which\n * must never be reported as untagged.\n */\n state: z.enum([\"covered\", \"unmapped\", \"missing\", \"unknown\"]),\n evidence: z.string().optional(),\n note: z.string().optional(),\n});\n\nexport const analyticsTrackingPlatformSchema = z.object({\n platform: z.enum(AD_PLATFORMS),\n label: z.string(),\n sessions: z.number(),\n /** Whether the ad account itself could be read, and why not when it could not. */\n account: z.object({ read: z.boolean(), templates: z.number(), reason: z.string().optional() }),\n dimensions: z.array(trackingDimensionSchema),\n /** Names the URLs already carry that Baker does not read yet. */\n unmapped: z.record(z.string(), adParamRoleSchema),\n mapCommand: z.string(),\n unexplained: z.array(z.object({ name: z.string(), value: z.string() })),\n /** The pairs to append to the account's tagging, or `\"\"`. */\n suffix: z.string(),\n whereItGoes: z.string(),\n /** Which level to put them at, who can write it, and how an existing value is treated. */\n fix: z.string(),\n});\nexport type AnalyticsTrackingPlatform = z.infer<typeof analyticsTrackingPlatformSchema>;\n\nexport const analyticsTrackingResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({ days: z.number(), platforms: z.array(analyticsTrackingPlatformSchema) }),\n hints: z.array(z.string()).optional(),\n});\nexport type AnalyticsTrackingResponse = z.infer<typeof analyticsTrackingResponseSchema>;\n\n// ---------------------------------------------------------------------------\n// Keeping a copy of a submission\n// ---------------------------------------------------------------------------\n\n/**\n * What a page posts when somebody finishes a step of a Form.\n *\n * Not an analytics event and deliberately not shaped like one. The event that\n * says the step was finished has already gone to the collector; this is the\n * copy of what was typed, on its way to be sealed with a key only Convex holds.\n * The two travel separately because only one of them can ever be read back\n * without a permission check and an audit entry.\n *\n * Every field here is a reference the copy has to carry to be findable later —\n * which submission, which Form, which step, which page, which build, and which\n * person by digest. `answers` is the only field that holds anything a visitor\n * wrote, and it is the only one that is encrypted.\n */\n/**\n * A reference field, cut to length rather than rejected over it.\n *\n * `answers` was not the only field that could refuse a whole copy: every\n * `.max()` on the object below failed the entire `safeParse` too, and one of\n * them is reachable. `pageUrl` is `window.location.href`, so an ad URL whose\n * query string runs past 2048 characters discarded the answers along with it —\n * the same silent loss, arriving by a different field.\n *\n * Cutting keeps the useful half of every one of these, because what overruns\n * is always the tail: a URL's identity is its host and path, and its\n * parameters are what grow without bound.\n */\nconst boundedReference = (max: number) => z.string().transform((value) => cutToLength(value, max));\n\nexport const submissionRecordRequestSchema = z.object({\n /**\n * Injected by the Worker from the host or the site key. Never from the page.\n *\n * One of the two fields that is still required, because a copy that cannot\n * be filed under a company cannot be found again by anybody. Bounding it\n * would produce a row belonging to a company that does not exist, which is\n * worse than refusing — this is the case where refusing is right.\n */\n companyId: z.string().min(1),\n /** Shared with every destination this submit was sent to, and with its event. */\n submissionId: z.string().min(1).pipe(boundedReference(128)),\n /**\n * The Form execution this step belongs to, or `\"\"` from a page published\n * before attempts existed.\n *\n * `submissionId` is minted per node, so two steps of one filling produce two\n * copies with nothing joining them. This is that join. It changes nothing\n * else here: a sealed copy is still per step, and still the only payload\n * anybody keeps.\n */\n attemptId: boundedReference(128).default(\"\"),\n flowSlug: boundedReference(120).default(\"\"),\n nodeId: boundedReference(120).default(\"\"),\n nodeType: boundedReference(40).default(\"\"),\n landingId: boundedReference(120).default(\"\"),\n release: boundedReference(64).default(\"\"),\n pageUrl: boundedReference(2048).default(\"\"),\n /**\n * A SHA-256 digest, or absent. Never an address.\n *\n * The join from a recovered copy to every session the same person had,\n * without anybody having to open the copy to get there.\n */\n identityHash: boundedReference(128).optional(),\n /**\n * Degraded rather than refused, like everything else here: an unrecognised\n * kind costs the copy one label, and refusing it would cost the copy.\n */\n identityKind: z.enum([\"email\", \"phone\"]).optional().catch(undefined),\n /** Injected by the Worker's edge. Kept exactly here and as a /24 everywhere else. */\n clientIp: boundedReference(64).nullish(),\n /**\n * Every answer on the step, free text included. Sealed on arrival.\n *\n * Bounded rather than length-checked, and that is the whole of it: a `max()`\n * here refused the **entire copy** over one long answer, so a visitor who\n * pasted a paragraph into a free-text field lost the email and the budget\n * beside it too. See {@link boundSubmissionAnswers}.\n */\n answers: z.record(z.string(), z.string()).transform(boundSubmissionAnswers),\n});\nexport type SubmissionRecordRequest = z.infer<typeof submissionRecordRequestSchema>;\n","/**\n * What counts as a conversion: what the Form's author marked, and nothing else.\n *\n * Baker used to answer this with one built-in rule for everybody — on each node\n * kind, one trigger is the outcome, so any `customForm` submit counted and any\n * booking counted. It was removed, and this is why: a guess about the number\n * every other number on the screen is a ratio of is wrong in two ways it cannot\n * fix from inside, and both of them are invisible.\n *\n * - **A Form has more than one ending.** A qualification branch that sends the\n * visitor to a \"not a fit\" screen ends in a `customForm.onFormSubmitted`\n * exactly like the branch that books a call. One rule per node kind counted\n * both, so the disqualified were a conversion.\n * - **Not every submit is the outcome.** A Form that qualifies on step one and\n * books on step four raises two submits; the first is a screening question\n * and only the second is worth money.\n *\n * Neither produces an empty report or an error. It produces a *plausible* wrong\n * number, which is the expensive kind — a rate somebody sets a budget by. So the\n * definition lives in the Form, next to the side effects, where the person who\n * built it already knows which node is the point of it, and a Form nobody has\n * marked counts **zero**. Zero is visible; it is warned about on the Form card,\n * in the Forms list, on the report and in the client's own verify run; and it is\n * the one state that cannot be mistaken for a measurement.\n *\n * ## Resolved when a report is read, never stamped at ingest\n *\n * The same decision the ad-parameter mapping made, for the same reason:\n * marking a node as a conversion has to fix the *past*, not only the future.\n * A company that publishes its Forms today and marks the conversion next week\n * would otherwise have a week of traffic that can never be scored, and the\n * warning that asks them to mark it would be asking them to accept a hole.\n *\n * Definitions therefore mirror to the `conversion_definitions` dimension and\n * the endpoints join them onto history. The page never asserts its own conversion\n * — same rule that refuses an unhashed `identity_hash`, and for the same\n * reason: the conversion count is the number somebody would want to inflate.\n */\n\n/**\n * How often one definition may count inside a single visit.\n *\n * The question is not academic: a \"book a call\" button that a visitor clicks,\n * comes back to, and clicks again is one booking; a \"download\" button on a\n * resources page genuinely converts each time it is pressed. Guessing either\n * way is wrong for the other, and the person who built the Form is the only\n * one who knows which it is.\n */\nexport const CONVERSION_COUNT_MODES = [\"once_per_visit\", \"every_time\"] as const;\nexport type ConversionCountMode = (typeof CONVERSION_COUNT_MODES)[number];\n\n/**\n * The safe default, and why it is the default.\n *\n * A repeated click is far more often the same intent expressed twice than two\n * outcomes. Over-counting is also the more expensive mistake here: conversions\n * feed the rate on every screen, and an inflated rate makes a campaign look\n * profitable enough to spend more on.\n */\nexport const DEFAULT_CONVERSION_COUNT_MODE: ConversionCountMode = \"once_per_visit\";\n\nexport function isConversionCountMode(value: unknown): value is ConversionCountMode {\n return typeof value === \"string\" && (CONVERSION_COUNT_MODES as readonly string[]).includes(value);\n}\n\n/** One outcome a Form can produce, as its author marked it. */\nexport interface ConversionDefinition {\n /** The node the trigger fires on — `events.step_id`. */\n nodeId: string;\n /** The trigger that is the outcome — `events.trigger_id`. */\n triggerId: string;\n countMode: ConversionCountMode;\n /**\n * What a person calls this outcome.\n *\n * Optional in the file and never empty here, because a Form with three\n * conversions reports three rows and `node-7 / calendlyEvent.eventScheduled`\n * is not a row anybody can read. Falls back to the node's name.\n */\n name: string;\n}\n\n/**\n * Which triggers each node kind can actually raise.\n *\n * Mirrors the `triggers()` map on each dashboard node definition\n * (`apps/dashboard/src/lib/flow/definitions/**`), which is where the flow\n * editor gets its picker from. Copied rather than imported because this module\n * is read by the Worker and by a standalone `.mjs` validator in every client\n * repo; `conversions.test.ts` reads those definitions and fails on drift.\n *\n * The point of having it at all is that a conversion on a trigger the node\n * cannot raise is invisible: it does not error, it does not warn, it simply\n * never counts, and the Form reports zero for as long as nobody checks. That\n * is the one failure in this feature worth blocking a publish for.\n *\n * `iframe` is deliberately absent rather than empty — its triggers are\n * `iframe.<name>` where the name is whatever the embedded page posts, invented\n * per client, so there is no list to check against and anything is allowed.\n */\nexport const FLOW_NODE_TRIGGERS: Readonly<Record<string, readonly string[]>> = {\n calendly: [\n \"calendlyEvent.eventScheduled\",\n \"calendlyEvent.dateAndTimeSelected\",\n \"calendlyEvent.eventTypeViewed\",\n \"calendlyEvent.profilePageViewed\",\n ],\n customForm: [\"customForm.onFormSubmitted\"],\n highlevel: [\"highlevelEvent.appointmentScheduled\", \"highlevelEvent.calendarLoaded\"],\n highlevelForm: [\"highlevelFormEvent.formSubmitted\", \"highlevelFormEvent.formLoaded\"],\n hubspot: [\n \"hubspotForm.onFormSubmitted\",\n \"hubspotForm.onBeforeFormSubmit\",\n \"hubspotForm.onFormReady\",\n \"hubspotForm.onBeforeFormInit\",\n ],\n hubspotMeeting: [\"hubspotMeeting.onMeetingScheduled\"],\n link: [\"link.onClick\"],\n savvycal: [\"savvycalEvent.scheduled\"],\n text: [\"text.onTextDisplayed\", \"text.onButtonClicked\"],\n};\n\n/**\n * The one trigger on each node kind that means \"the visitor did the thing\".\n *\n * What the star on a node card marks, and the reason a mark needs no further\n * input: a node kind has exactly one event that is its point, and the rest are\n * lifecycle noise — a form that finished loading, a calendar page that was\n * looked at. Asking which of four `hubspotForm` events to count is asking a\n * marketer to know an embed's API.\n *\n * Every kind that raises anything a person could mean is here, including the\n * two — a link click and a button press — that no rule could ever have counted\n * on its own: a link click is the whole point of one Form and a \"back to the\n * homepage\" in the middle of another. Nothing here counts until it is marked,\n * so the map can afford to offer them.\n *\n * `iframe` is absent for the same reason it is absent from\n * {@link FLOW_NODE_TRIGGERS}: its events are named by whatever the embedded\n * page posts. The editor falls back to the node's own first trigger there.\n */\nexport const PRIMARY_CONVERSION_TRIGGER: Readonly<Record<string, string>> = {\n calendly: \"calendlyEvent.eventScheduled\",\n customForm: \"customForm.onFormSubmitted\",\n highlevel: \"highlevelEvent.appointmentScheduled\",\n highlevelForm: \"highlevelFormEvent.formSubmitted\",\n hubspot: \"hubspotForm.onFormSubmitted\",\n hubspotMeeting: \"hubspotMeeting.onMeetingScheduled\",\n link: \"link.onClick\",\n savvycal: \"savvycalEvent.scheduled\",\n text: \"text.onButtonClicked\",\n};\n\n/** The outcome trigger for a node kind, or `null` when only the node itself can say. */\nexport function primaryConversionTrigger(nodeType: string): string | null {\n return PRIMARY_CONVERSION_TRIGGER[nodeType] ?? null;\n}\n\n/**\n * The node kinds whose outcome trigger IS that step being submitted.\n *\n * Not a conversion rule — nothing here counts anything. It answers a narrower\n * question two places need: \"did this trigger fire because the visitor pressed\n * the button that completed the step?\" The replay folds such a trigger into the\n * completion beside it (one press, one line), and the scaffold's flow engine\n * files a node's side effects under it.\n *\n * Derived from {@link PRIMARY_CONVERSION_TRIGGER} rather than written out, so\n * the two cannot drift. The exclusions are the kinds whose primary trigger is\n * something the visitor did *instead of* submitting: a link click leaves the\n * page, and a text screen's button press advances a screen that collected\n * nothing.\n */\nconst NON_SUBMIT_NODE_TYPES: readonly string[] = [\"link\", \"text\"];\n\nexport const STEP_SUBMIT_TRIGGERS: Readonly<Record<string, string>> = Object.fromEntries(\n Object.entries(PRIMARY_CONVERSION_TRIGGER).filter(([nodeType]) => !NON_SUBMIT_NODE_TYPES.includes(nodeType)),\n);\n\n/** Node kinds whose trigger names are defined by the client's own embed. */\nconst DYNAMIC_TRIGGER_NODE_TYPES: readonly string[] = [\"iframe\"];\n\n/**\n * Can this node kind raise this trigger?\n *\n * Unknown node kinds answer `true`. A node type this list has not heard of is\n * a scaffold that is newer than the checker, and refusing a publish over that\n * would freeze the client on their current build — the expensive direction of\n * a check that exists to catch typos.\n */\nexport function nodeCanRaiseTrigger(nodeType: string, triggerId: string): boolean {\n if (DYNAMIC_TRIGGER_NODE_TYPES.includes(nodeType)) return triggerId.startsWith(\"iframe.\");\n const allowed = FLOW_NODE_TRIGGERS[nodeType];\n if (!allowed) return true;\n return allowed.includes(triggerId);\n}\n\n/**\n * How long the \"why this Form has no conversion\" note may be.\n *\n * Longer than a conversion name because it is a sentence rather than a label —\n * it is printed in place of a warning and has to say where the outcome went —\n * and still bounded, because it reaches a dashboard badge and a Convex row.\n */\nexport const MAX_NO_CONVERSION_REASON = 200;\n\n/** A Form's declaration that it has no outcome to measure. See `FlowNoConversion` in the scaffold's types. */\nexport interface FlowNoConversion {\n reason: string;\n}\n\n/**\n * The Form's \"no conversion here, on purpose\" declaration, or `null`.\n *\n * Read from the ROOT node only. `_data.json` has no wrapper around its tree, so\n * a Form-level fact lives on the root exactly as `globalVariables` does — and\n * reading it anywhere else would let one branch speak for the whole Form.\n * `validate-flow-conversions` errors on a misplaced one rather than silently\n * honouring it, so this reader does not have to go looking.\n *\n * A declaration with no usable reason is not a declaration: it would silence\n * the warning while telling a reader nothing, which is worse than the warning.\n * Dropped here and reported by the validator, the same way a malformed mark is.\n */\nexport function readFlowNoConversion(tree: unknown): FlowNoConversion | null {\n if (typeof tree !== \"object\" || tree === null) return null;\n const declared = (tree as { noConversion?: unknown }).noConversion;\n if (typeof declared !== \"object\" || declared === null) return null;\n const reason = (declared as { reason?: unknown }).reason;\n if (typeof reason !== \"string\") return null;\n const trimmed = reason.trim();\n return trimmed === \"\" ? null : { reason: trimmed.slice(0, MAX_NO_CONVERSION_REASON) };\n}\n\n/** How long a conversion's display name may be. Bounded before it reaches the dimension. */\nexport const MAX_CONVERSION_NAME = 80;\n\ninterface RawNode {\n id?: unknown;\n name?: unknown;\n nodeData?: { type?: unknown } | null;\n conversions?: unknown;\n children?: unknown;\n}\n\nfunction readOne(node: RawNode, raw: unknown): ConversionDefinition | null {\n if (typeof raw !== \"object\" || raw === null) return null;\n const entry = raw as { triggerId?: unknown; countMode?: unknown; name?: unknown };\n const nodeId = typeof node.id === \"string\" ? node.id : \"\";\n const triggerId = typeof entry.triggerId === \"string\" ? entry.triggerId.trim() : \"\";\n if (nodeId === \"\" || triggerId === \"\") return null;\n const given = typeof entry.name === \"string\" ? entry.name.trim() : \"\";\n const nodeName = typeof node.name === \"string\" ? node.name.trim() : \"\";\n return {\n nodeId,\n triggerId,\n countMode: isConversionCountMode(entry.countMode) ? entry.countMode : DEFAULT_CONVERSION_COUNT_MODE,\n name: (given || nodeName || triggerId).slice(0, MAX_CONVERSION_NAME),\n };\n}\n\n/**\n * Every conversion a flow tree declares, in tree order.\n *\n * Tolerant by construction — it reads a `_data.json` that a person or an agent\n * hand-edited, and one malformed entry must not cost the other three. What it\n * cannot read it drops; `validate-flow-conversions` is what tells the author.\n */\nexport function readFlowConversions(tree: unknown): ConversionDefinition[] {\n const found: ConversionDefinition[] = [];\n const seen = new Set<string>();\n for (const node of flowNodes(tree)) {\n if (!Array.isArray(node.conversions)) continue;\n for (const raw of node.conversions) {\n const definition = readOne(node, raw);\n if (!definition) continue;\n // One node cannot count the same trigger twice. Two entries for one pair\n // are an editing accident, and keeping both would double every number\n // they produce.\n const key = `${definition.nodeId} ${definition.triggerId}`;\n if (seen.has(key)) continue;\n seen.add(key);\n found.push(definition);\n }\n }\n return found;\n}\n\n/**\n * Every node in a flow tree, depth first.\n *\n * Shared by both readers, so the traversal — and its tolerance of whatever\n * shape a hand-edited `_data.json` turns out to be — exists once.\n */\nfunction* flowNodes(value: unknown): Generator<RawNode> {\n if (typeof value !== \"object\" || value === null) return;\n const node = value as RawNode;\n yield node;\n if (!Array.isArray(node.children)) return;\n for (const child of node.children) yield* flowNodes(child);\n}\n\n/** The node kind each node id in a tree carries, for checking a trigger against it. */\nexport function readFlowNodeTypes(tree: unknown): Map<string, string> {\n const types = new Map<string, string>();\n for (const node of flowNodes(tree)) {\n const id = typeof node.id === \"string\" ? node.id : \"\";\n const type = typeof node.nodeData?.type === \"string\" ? node.nodeData.type : \"\";\n if (id !== \"\" && type !== \"\") types.set(id, type);\n }\n return types;\n}\n","/**\n * What survives of one step's answers on the way into the sealed copy.\n *\n * The copy of a submission is a safety net — the thing somebody restores from\n * when a CRM was down for a week, and the only record at all of a Form wired to\n * nothing. So the one behaviour it must never have is *all or nothing*, and\n * that is exactly the behaviour it had: the answers arrived under\n * `z.record(z.string().max(120), z.string().max(4096))`, a visitor pasted a\n * long paragraph into a free-text field, and the route logged\n *\n * [analytics:submission] refused a malformed copy\n * { issue: 'Too big: expected string to have <=4096 characters' }\n *\n * and kept **nothing** — not the paragraph, not the email beside it, not the\n * budget or the headcount on the same step. The page is told `ok` either way\n * and holds no second copy, so the whole submission was gone, and the log named\n * no company, no Form and no field to find it by.\n *\n * A textarea has no length limit unless the Form's author set `maxLength`, so\n * this is a visitor holding down a key, not a malformed body. The same\n * submission delivered to a CRM was kept: that path caps the payload with a\n * `slice` and stores the row (`MAX_PROPERTIES_CHARS`). Retention was the strict\n * one, which is backwards — a delivery can be retried and a copy cannot.\n *\n * So a copy is bounded, never refused. Nothing here can fail, which is the\n * property that matters: the caps are what the store can hold, not a judgement\n * about the body, and a body that genuinely makes no sense is still the\n * schema's to reject.\n *\n * ## Storage is not what bounds this, and neither was 4096\n *\n * Worth stating, because 4096 looked like a storage limit and was not one.\n * Nothing in the store is near it: `properties_sealed` is a ClickHouse\n * `String`, AES-GCM has no length to speak of, and Convex's request body and\n * Tinybird's ingest are both orders of magnitude above anything a Form\n * collects. The number was a guess, and it was low enough that an ordinary\n * visitor writing at length could reach it, which is how a guess ended up\n * deciding whether a lead was kept.\n *\n * Encoding the answers to make them smaller would be answering the wrong\n * question at this end. Base64 makes them larger; compression only pays\n * against a limit, and it would cost the property this store is built on,\n * that a sealed row opens to plain JSON with no scheme to know about.\n *\n * ## The ceiling that does bind is the browser, and it is one hop earlier\n *\n * `recordSubmission` posts with `keepalive: true`, and a keepalive request\n * body over **64 KiB fails as a network error** — a budget shared across every\n * keepalive request the page has in flight, which the scaffold already notes\n * where the CRM dispatches use it (`flow-engine/side-effects.ts`). So the\n * copy that most needs bounding — a visitor pasting a document — never\n * reaches this module to be bounded, and `recordSubmission` swallows the\n * failure by design. **Nothing in this file can fix that**; the bound has to\n * be applied in the page, before the body is serialised, and until it is, the\n * caps below cover everything except the largest case of all.\n *\n * The caps exist so one pathological answer cannot crowd out the fifteen\n * ordinary ones beside it. That is their whole job.\n */\n\n/**\n * How much of one answer is kept.\n *\n * Generous on purpose — the sealed copy is the *full* version of what the event\n * stream already carries at 300 characters, so cutting it short here would\n * leave the long answer nowhere at all. Around 2,500 words: past this it is a\n * document rather than an answer, and four of them still fit inside one step's\n * budget, which is the ratio that matters. The answer that started all of this\n * would have been kept whole.\n */\nexport const MAX_ANSWER_CHARS = 16_384;\n\n/**\n * How much of a field's name is kept.\n *\n * A name is written by the Form's author or handed over by a widget's own\n * vocabulary; neither produces a long one. Bounded rather than refused for the\n * same reason as the value: losing the answer because its label was odd is a\n * worse outcome than a label that reads short.\n */\nexport const MAX_ANSWER_NAME_CHARS = 120;\n\n/**\n * Cut to length, saying so where something was cut.\n *\n * The ellipsis is the marker the reported half already uses, so \"this was\n * truncated\" reads the same way on the replay and in the opened copy.\n */\nconst TRUNCATED = \"…\";\n\n/**\n * What stands where an answer did not fit the step's budget at all.\n *\n * Words rather than a glyph, and that is the whole of the choice. The masked\n * sentinel beside this one is `•••`, and its module states the rule it was\n * learned from: a sentinel only some surfaces recognise \"prints three dots and\n * looks like a bug\" (`apps/dashboard/src/features/leads/sealedAnswer.ts`). The\n * sealed copy is read by the submission panel, by a lead export, and by\n * whoever is recovering a lead with a query — so a marker here has to survive\n * a reader that has never heard of it, which a bracketed sentence does and a\n * fourth glyph does not.\n *\n * It cannot be confused with a truncated answer either: that one is the\n * visitor's own text with `…` on the end, and this replaces the text entirely.\n */\nexport const OMITTED_ANSWER = \"[too long to keep]\";\n\n/**\n * Cut to `max`, marking the cut, without splitting a character in half.\n *\n * `slice` counts UTF-16 code units, so a cut landing between the halves of an\n * emoji leaves a lone surrogate on the end. It survives storage intact —\n * `JSON.stringify` escapes it to `\\ud83d`, which is ASCII by the time the row\n * is sealed and round-trips exactly — so nothing is corrupted. It is the\n * *reader* who pays: the panel renders the answer ending in a broken glyph.\n * Iterating by code point costs an array on a path that runs once per\n * over-long answer, which is a fair price for not handing somebody half a\n * character back as their own words.\n */\nexport function cutToLength(value: string, max: number): string {\n if (value.length <= max) return value;\n return `${[...value].slice(0, max - 1).join(\"\")}${TRUNCATED}`;\n}\n\n/**\n * Every answer on the step, each bounded to what the copy can hold.\n *\n * Two names sharing a 120-character prefix would collide here and the second\n * would overwrite the first — the same silent loss this module exists to end,\n * narrowed to a trigger nothing plausible reaches. A field name is written by\n * a Form's author or fixed by a widget's own vocabulary; none of them is\n * 120 characters, let alone two of them agreeing for 120 and differing after.\n * Left as it is deliberately: de-duplicating would mean inventing a name no\n * reader would recognise, to save a case that cannot arise from the producers\n * this endpoint has.\n */\nexport function boundSubmissionAnswers(answers: Record<string, string>): Record<string, string> {\n const kept: Record<string, string> = {};\n for (const [name, value] of Object.entries(answers)) {\n kept[cutToLength(name, MAX_ANSWER_NAME_CHARS)] = cutToLength(value, MAX_ANSWER_CHARS);\n }\n return kept;\n}\n\n/**\n * The step's answers, fitted to what one row of the store is given.\n *\n * Separate from the per-answer cap above because it answers a different\n * question — that one is \"how long may an answer be\", this is \"how much may a\n * step hold\" — and because the budget belongs to the store rather than to the\n * answer, so its caller passes it in.\n *\n * The route used to do this by slicing the serialised JSON, which is what the\n * delivered-payload path does. That is defensible there (its own comment says\n * a capped row may not parse, and recovery tooling reads it as text) and it is\n * a poor trade here: a copy is opened by somebody trying to recover a lead, and\n * handing them a truncated blob loses the answers that *did* fit along with the\n * one that did not. Dropping whole entries instead keeps the row parseable, so\n * everything inside the budget survives intact.\n *\n * An answer past the budget keeps its name and loses its value, for the reason\n * a masked answer does: \"this step asked for a phone number\" is a fact worth\n * reading even when the answer itself is not there. It says so in words — see\n * {@link OMITTED_ANSWER}.\n */\nexport function fitAnswersToBudget(answers: Record<string, string>, budget: number): Record<string, string> {\n const kept: Record<string, string> = {};\n let spent = \"{}\".length;\n for (const [name, value] of Object.entries(answers)) {\n // What this entry adds to the serialised row, escaping included — measured\n // rather than estimated, because a paragraph of quotes and newlines costs\n // considerably more than its character count.\n const cost = JSON.stringify(name).length + JSON.stringify(value).length + \":,\".length;\n if (spent + cost > budget) {\n kept[name] = OMITTED_ANSWER;\n spent += JSON.stringify(name).length + JSON.stringify(OMITTED_ANSWER).length + \":,\".length;\n continue;\n }\n kept[name] = value;\n spent += cost;\n }\n return kept;\n}\n","import { z } from \"zod\";\nimport { parseEventKey } from \"./eventKey\";\nimport { funnelStepSchema } from \"../funnel/wire\";\nimport { ANALYTICS_EVENT_DOORS } from \"./wire\";\n\nconst text = z.string().trim().min(1).max(2000);\nconst key = z.string().trim().min(1).max(100);\nconst webUrl = z.url().refine((value) => [\"https:\", \"http:\"].includes(new URL(value).protocol), \"Use a website address\");\n\nexport const trackingEventSchema = z.object({\n eventKey: key.refine((value) => parseEventKey(value) !== null, \"Use an existing Baker event key\"),\n name: text,\n purpose: z.enum([\"conversion\", \"progress\", \"diagnostic\", \"uncounted\"]),\n door: z.enum(ANALYTICS_EVENT_DOORS),\n sourceEvent: key.optional(),\n emitterEvidence: text.optional(),\n status: z.enum([\"prepared\", \"waiting\", \"published\", \"verified\"]),\n requirement: text.optional(),\n owner: text.optional(),\n verificationEvidence: text.optional(),\n}).superRefine((event, ctx) => {\n if (event.status === \"waiting\") {\n if (!event.requirement || !event.owner) ctx.addIssue({ code: \"custom\", message: \"A waiting event needs its requirement and owner\" });\n } else if (!event.emitterEvidence) {\n ctx.addIssue({ code: \"custom\", message: \"A prepared event needs evidence that the source emits it\" });\n }\n if ([\"published\", \"verified\"].includes(event.status) && !event.verificationEvidence) {\n ctx.addIssue({ code: \"custom\", message: \"Published or verified tracking needs evidence; a staged tag is only prepared\" });\n }\n});\nexport type TrackingEvent = z.infer<typeof trackingEventSchema>;\n\nexport const trackingJourneySchema = z.object({\n key,\n name: text,\n entryUrls: z.array(webUrl).max(50),\n destinationUrl: webUrl,\n strategy: z.enum([\"native\", \"embed\", \"api\", \"link\"]),\n status: z.enum([\"supported\", \"waiting\"]),\n requiredFields: z.array(key).max(100),\n attribution: text,\n acceptanceEvidence: text.optional(),\n continuationEvidence: text.optional(),\n requirement: text.optional(),\n owner: text.optional(),\n}).superRefine((journey, ctx) => {\n if (journey.strategy === \"link\" && journey.requiredFields.length > 0) ctx.addIssue({ code: \"custom\", message: \"A link handoff must not capture details that the destination asks for again\" });\n if (journey.status === \"waiting\" && (!journey.requirement || !journey.owner)) ctx.addIssue({ code: \"custom\", message: \"A waiting journey needs its requirement and owner\" });\n if (journey.status === \"supported\" && journey.strategy === \"api\" && (!journey.acceptanceEvidence || !journey.continuationEvidence)) ctx.addIssue({ code: \"custom\", message: \"An API replacement needs accepted-submission and continuation evidence\" });\n});\n\nexport const trackingPlanSchema = z.object({\n journeys: z.array(trackingJourneySchema).max(30),\n events: z.array(trackingEventSchema).max(100),\n}).superRefine((plan, ctx) => {\n for (const entries of [plan.journeys.map((journey) => journey.key), plan.events.map((event) => event.eventKey)]) {\n if (new Set(entries).size !== entries.length) ctx.addIssue({ code: \"custom\", message: \"Each journey and event must appear once\" });\n }\n});\nexport type TrackingPlan = z.infer<typeof trackingPlanSchema>;\n\nexport const TRACKING_STATUS_LABEL = { prepared: \"Prepared\", waiting: \"Waiting for a change\", published: \"Published\", verified: \"Verified\" } as const;\n\n/** Complete review text: no stageable mapping, dependency or evidence is hidden. */\nexport function describeTrackingPlan(plan: TrackingPlan | null | undefined): string {\n if (!plan) return \"No tracking plan\";\n return [\n ...plan.journeys.map((journey) => [journey.name, journey.key, journey.strategy, journey.status, journey.entryUrls.join(\", \"), `to ${journey.destinationUrl}`, `Fields: ${journey.requiredFields.join(\", \") || \"none\"}`, journey.attribution, journey.acceptanceEvidence, journey.continuationEvidence, journey.requirement, journey.owner].filter(Boolean).join(\" · \")),\n ...plan.events.map((event) => [event.name, event.eventKey, event.purpose, event.door, event.sourceEvent, TRACKING_STATUS_LABEL[event.status], event.emitterEvidence, event.requirement, event.owner, event.verificationEvidence].filter(Boolean).join(\" · \")),\n ].join(\"\\n\") || \"No journeys or events\";\n}\n\nconst variableName = z.string().trim().min(1).max(200).refine((value) => !/[{}<>\"'\\\\\\r\\n]/.test(value), \"Use a plain container variable name\");\nexport const trackingInstallationSchema = z.object({\n containerId: key,\n baseTagName: key,\n folderId: key.optional(),\n consent: z.enum([\"auto\", \"strict\"]).default(\"auto\"),\n measure: z.enum([\"campaigns\", \"outcomes\", \"all\"]).default(\"campaigns\"),\n events: z.array(z.object({\n eventKey: key.refine((value) => parseEventKey(value) !== null, \"Use an existing Baker event key\"), tagName: key, triggerId: key,\n properties: z.record(key, variableName).default({}),\n eventIdVariable: variableName.optional(),\n })).max(50),\n});\nexport type TrackingInstallation = z.infer<typeof trackingInstallationSchema>;\nexport const trackingPlanRequestSchema = z.object({ chatId: z.string().optional(), plan: trackingPlanSchema.optional(), wireConversions: z.boolean().default(false), steps: z.array(funnelStepSchema).max(30).optional(), installation: trackingInstallationSchema.optional() }).superRefine((request, ctx) => {\n if (!request.plan && (request.installation || request.wireConversions || request.steps)) ctx.addIssue({ code: \"custom\", message: \"Preparation needs the agreed tracking plan\" });\n});\nexport const trackingPlanResponseSchema = z.object({ ok: z.literal(true), data: z.object({ plan: trackingPlanSchema.nullable(), staged: z.boolean() }), hints: z.array(z.string()).optional() });\nexport type TrackingPlanResponse = z.infer<typeof trackingPlanResponseSchema>;\n","/**\n * The request and response `baker funnel` and its Convex route both speak.\n *\n * One schema, used by both sides, because the funnel is the one payload in this\n * feature that is a graph rather than a list of fields: a shape the CLI and the\n * backend agreed on separately would disagree about a predecessor naming a step\n * that does not exist, and that disagreement is invisible until a client's\n * funnel comes back drawn wrong.\n */\n\nimport { z } from \"zod\";\nimport { FUNNEL_VERTICALS } from \"./stepTemplates\";\nimport { FUNNEL_STEP_CLASSES } from \"./vocabulary\";\n\n/** How many steps one funnel may have. */\nconst MAX_STEPS = 40;\n/** How many triggers one step may have. */\nconst MAX_PER_STEP = 20;\n\n/**\n * One trigger: an event, by its key, a landing page being viewed, or any\n * landing being viewed.\n */\nexport const funnelTriggerSchema = z.discriminatedUnion(\"kind\", [\n z.object({\n id: z.string().min(1).max(64),\n kind: z.literal(\"event\"),\n /** The event's key, from `--moments`: `form:…`, `submit:…`, `page:…`, `exit:…`. */\n eventKey: z.string().min(1).max(320),\n }),\n z.object({\n id: z.string().min(1).max(64),\n kind: z.literal(\"landing\"),\n /** The landing's internal id — what the page stamps on its rows, never its slug. */\n landingId: z.string().min(1).max(120),\n }),\n /** Any landing being viewed — what a funnel's first step usually listens for. */\n z.object({\n id: z.string().min(1).max(64),\n kind: z.literal(\"any_landing\"),\n }),\n]);\n\nexport const funnelStepSchema = z.object({\n /** Lowercase letters, digits and underscores. Stable — renaming never changes it. */\n key: z.string().min(1).max(64),\n /** The client's own words for this step. Shown everywhere; unconstrained. */\n displayName: z.string().min(1).max(120),\n stepClass: z.enum(FUNNEL_STEP_CLASSES),\n /** Predecessor keys. Empty means people come in here. */\n after: z.array(z.string().max(64)).max(MAX_STEPS).default([]),\n /** What moves somebody onto this step. Any one of them is enough. */\n triggers: z.array(funnelTriggerSchema).max(MAX_PER_STEP).default([]),\n});\nexport type FunnelStepWire = z.infer<typeof funnelStepSchema>;\n\n/**\n * With none of `steps`, `preset`, `step`, `removeStep`, `addTrigger` and\n * `removeTrigger` this is a read, which is what makes `baker funnel` with no\n * flags show the funnel rather than erroring.\n *\n * `steps` restates the WHOLE funnel, and the review screen shows the funnel\n * the client will get rather than a set of edits whose result has to be\n * computed. `step` and `removeStep` change one step and leave the rest as it\n * stands — the door for an agent that wants to add a stage without restating\n * six others, because a restatement that forgot one removed it. Whichever\n * door is used, the response names every step the proposal dropped.\n */\nexport const funnelRequestSchema = z.object({\n steps: z.array(funnelStepSchema).max(MAX_STEPS).optional(),\n /** One step, added or replaced by its key. Everything else is untouched. */\n step: funnelStepSchema.optional(),\n /** One step taken out by key; whatever came after it moves up to whatever came before it. */\n removeStep: z.string().min(1).max(64).optional(),\n /**\n * ONE way in added to a step, leaving the rest of that step alone.\n *\n * `step` takes a whole step, so adding a way in through it means restating\n * the step's name, stage, `after[]` and every trigger it already had — and a\n * trigger left out of that restatement is silently removed. This is the door\n * for the thing that is actually being asked (\"this Form's booking should\n * count here\"), and it cannot drop anything.\n */\n addTrigger: z.object({ stepKey: z.string().min(1).max(64), eventKey: z.string().min(1).max(320) }).optional(),\n /** ONE way in taken off a step, by the event key it listens for. */\n removeTrigger: z.object({ stepKey: z.string().min(1).max(64), eventKey: z.string().min(1).max(320) }).optional(),\n /** One of the ready-made graphs, instead of stating steps. */\n preset: z.enum(FUNNEL_VERTICALS).optional(),\n /** Also return the suggestion library and the presets. */\n templates: z.boolean().optional(),\n /**\n * Also return everything a trigger can name: every event this company's\n * Forms, pages and systems have actually produced, its sources, and its\n * landings. The list to pick a trigger FROM, so nobody has to guess.\n */\n moments: z.boolean().optional(),\n /** How many days the counts beside each step cover. Default 30. */\n days: z.number().int().min(1).max(400).optional(),\n /**\n * The Forms, by slug, the caller names itself when no step counts them —\n * `baker funnel` reads its own workspace and names each with the key that\n * places it. The backend leaves them out of its own hint, so no Form is\n * named twice.\n */\n namedByCaller: z.array(z.string().min(1).max(200)).max(1000).optional(),\n});\nexport type FunnelRequest = z.infer<typeof funnelRequestSchema>;\n\n/**\n * What comes back is loosely typed on purpose.\n *\n * The response is read by an agent and by a person, never re-submitted, so a\n * strict mirror of the request would only make the route fail on a field the\n * store has and this file has not caught up with. The request is where the\n * shape is enforced.\n */\nexport const funnelResponseSchema = z.object({\n ok: z.literal(true),\n data: z.object({\n /** The published version, or 0 when this company has never drawn a funnel. */\n version: z.number(),\n /** Whether `steps` is a proposal waiting on this chat's publish rather than what is live. */\n staged: z.boolean(),\n steps: z.array(\n z.object({\n key: z.string(),\n displayName: z.string(),\n stepClass: z.string(),\n after: z.array(z.string()),\n triggers: z.array(z.record(z.string(), z.unknown())),\n /**\n * Where the people who reach this step are sent: the sends of every\n * system event among its triggers. Read-only here — a send belongs to\n * the event and is set with `baker analytics sends`.\n */\n sends: z.array(\n z.object({\n id: z.string(),\n eventKey: z.string(),\n platform: z.string(),\n event: z.string(),\n /** What happened to it in the window, in one line. */\n outcome: z.string().optional(),\n }),\n ),\n /** How many people reached this step in the window. Counted in people, across visits and devices. */\n people: z.number().optional(),\n /** How many reached this step or any step after it. */\n atLeast: z.number().optional(),\n /** How many got as far as the step before it. Absent for a way in. */\n before: z.number().optional(),\n /** `atLeast / before`, 0–1. Absent where there is no before. */\n share: z.number().optional(),\n events: z.number().optional(),\n money: z.record(z.string(), z.number()).optional(),\n }),\n ),\n /** The window `people` and friends were counted over. */\n window: z.object({ startDate: z.string(), endDate: z.string(), days: z.number() }).optional(),\n /** The step that loses the most people, by key. Absent while nothing is lost. */\n worstStep: z.string().optional(),\n /**\n * The steps this write took off the funnel, by key. Present on every write,\n * empty when nothing was dropped — the answer to \"did my restatement forget\n * one\", given in the same turn.\n */\n removed: z.array(z.string()).optional(),\n /**\n * What this company counts as page conversions, this chat's staged counts\n * included, by event key and name. Here so a Form's ending can say it is\n * already counted — the agent choosing a step's way in should use that\n * same key — and outside `moments` because the plain read's hints say it too.\n */\n counted: z.array(z.object({ eventKey: z.string(), name: z.string() })).optional(),\n /** Everything a trigger can name, when asked for with `moments`. */\n moments: z\n .object({\n events: z.array(\n z.object({\n eventKey: z.string(),\n /** `site` for a page or Form, `systems` for the client's own server, `both` when both sent it. */\n origin: z.string().optional(),\n /** The Form it belongs to, when it belongs to one. */\n flowSlug: z.string().optional(),\n nodeType: z.string().optional(),\n events: z.number(),\n sessions: z.number(),\n /** The name it is counted under as a page conversion, when the company counts it. Informational. */\n countedAs: z.string().optional(),\n /**\n * The step of the Form this happens on, in the Form's own words —\n * never a node id. Present on a Form's ending read from the Form\n * itself, which is the only place the name is known.\n */\n step: z.string().optional(),\n /**\n * `false` on an ending a Form raises natively but nobody has fired\n * yet — derived from the Form, offered at zero, exactly as a\n * Source is offered before its first send. Absent means it came\n * from the event store and therefore happened.\n */\n seen: z.boolean().optional(),\n }),\n ),\n /** The company's sources: a system of theirs that posts events to Baker, by the event name it raises. */\n sources: z.array(z.object({ eventKey: z.string(), name: z.string(), status: z.string() })),\n landings: z.array(z.object({ landingId: z.string(), title: z.string(), slug: z.string() })),\n })\n .optional(),\n templates: z\n .array(\n z.object({\n key: z.string(),\n displayName: z.string(),\n meaning: z.string(),\n stepClass: z.string(),\n }),\n )\n .optional(),\n presets: z\n .array(z.object({ vertical: z.string(), label: z.string(), description: z.string(), steps: z.array(z.string()) }))\n .optional(),\n /**\n * What each stage means, the test to apply, and the same stage in three\n * shapes of business.\n *\n * The stage is the one thing in a funnel a company does not invent, so it\n * is the one thing the agent has to get right on the company's behalf —\n * and \"engaged: did something real\" cannot settle whether a trial is\n * engaged or customer. Same source as the dashboard's stage picker, so the\n * two cannot teach it differently.\n */\n stages: z\n .array(\n z.object({\n stepClass: z.string(),\n title: z.string(),\n meaning: z.string(),\n test: z.string(),\n examples: z.object({ shop: z.string(), selfServe: z.string(), salesLed: z.string() }),\n }),\n )\n .optional(),\n }),\n hints: z.array(z.string()).optional(),\n});\nexport type FunnelResponse = z.infer<typeof funnelResponseSchema>;\n","/**\n * Step templates — a curated library of steps most funnels have, kept as\n * suggestions and never as law.\n *\n * The vocabulary is the company's: it invents its own steps, in its own words.\n * That does not mean everybody should have to invent \"Meeting booked\" from\n * nothing at kickoff, and it does not mean the research behind what each of\n * these moments means, whether it carries money, and what it becomes on Meta,\n * Google Ads and LinkedIn has to be re-derived per client.\n *\n * So the tables live here, as suggestion rather than schema:\n *\n * - **Nothing validates against this file.** A company step needs a class and a\n * graph, and neither has to come from a template. `graph.ts` never reads this\n * module.\n * - The funnel canvas offers templates when a step is created, and\n * `VERTICAL_PRESETS` offers four small ready-made graphs for the cold start.\n * - `platformDefaults` is the **prefill** for an offline conversion added to a\n * templated step — \"send this one to Meta\" on a won-like step should propose\n * `Purchase`, not an empty box (`defaultOfflineEvent`). Every value is\n * overridable; it is a default, not a mapping, and it is deliberately per\n * template rather than per class, so that where a conversion is sent never\n * becomes something the class decides.\n *\n * Pure data plus two derivations, tier-1 tested.\n */\n\nimport type { FunnelStepDefinition } from \"./graph\";\nimport type { FunnelStepClass } from \"./vocabulary\";\n\n/**\n * What a step usually becomes on Meta. The event name travels in the payload,\n * so anything goes — but a standard event optimizes better than a custom one,\n * which is why `standard` is recorded rather than left to be guessed from the\n * name.\n */\nexport interface MetaEventDefault {\n eventName: string;\n standard: boolean;\n}\n\n/**\n * The category Google Ads makes you pick when the conversion action is created.\n * `alternative` exists for the one genuine fork: a closed deal is \"Converted\n * lead\" in the lead funnel and \"Purchase\" once a revenue amount is reported,\n * and only the company knows which it is reporting.\n */\nexport interface GoogleAdsConversionDefault {\n category: string;\n alternative?: string;\n}\n\n/**\n * The `type` LinkedIn makes you pick when the conversion rule is created.\n *\n * `verified: false` carries a type taken from the documentation and never\n * checked against the live enum, so a creation attempt has to fall back to\n * `fallback` instead of failing.\n */\nexport interface LinkedinConversionDefault {\n type: string;\n verified: boolean;\n fallback?: string;\n}\n\nexport interface FunnelPlatformDefaults {\n meta?: MetaEventDefault;\n googleAds?: GoogleAdsConversionDefault;\n linkedin?: LinkedinConversionDefault;\n}\n\nexport interface FunnelStepTemplate {\n /** Suggested key. A company may rename it; nothing here is a stable identifier. */\n key: string;\n /** Suggested name, in a marketer's words. The company's own name wins. */\n displayName: string;\n /** One line, shown next to the suggestion so nobody has to guess what it covers. */\n meaning: string;\n stepClass: FunnelStepClass;\n /**\n * Other names for the same moment, lowercase and in English.\n *\n * Read only by `suggestStepForName`, which guesses a step for a name that has\n * arrived from somewhere else — a CRM stage, a spreadsheet column, whatever a\n * later source turns out to speak. Nothing validates against them and a match\n * is never applied on its own; a person still confirms it.\n */\n aliases: readonly string[];\n /**\n * Prefill for a destination created on a step made from this template.\n * Absent per platform where the old table said \"never sent\".\n */\n platformDefaults: FunnelPlatformDefaults;\n /** Why this class, where the answer is not obvious. Shown to nobody; read by whoever edits this file. */\n classNote?: string;\n}\n\n/**\n * Sixteen steps, each with the stage it belongs to.\n *\n * On the stage mapping, where it took a decision rather than a lookup:\n *\n * - **`lead` is \"we know who they are\", not \"they did something small\".**\n * `lead` and `signed_up` are the same fact reached two ways, so both are\n * `lead` even though one is a form and the other an account.\n * - **`engaged` is the wide one, and that is deliberate.** Qualified, cart,\n * checkout, trial, outreach, meeting booked, meeting held and an open\n * opportunity are all \"something real happened\" before any money. Splitting\n * them further is what the old eight-word list did, and it read as a sales\n * team's pipeline to everybody who was not one.\n * - **`customer` is the first money, `repeat` is the money after it.**\n * `subscribed` is therefore `customer`, not `repeat`: it is the moment a\n * subscription starts paying. `renewed` is what `repeat` is for.\n */\nexport const FUNNEL_STEP_TEMPLATES: readonly FunnelStepTemplate[] = [\n {\n key: \"saw_offer\",\n displayName: \"Saw the offer\",\n meaning: \"Someone opened one of your landing pages — where most journeys start\",\n stepClass: \"visited\",\n classNote: \"The only `visited` template: a landing being viewed is a step, never an outcome.\",\n aliases: [\"saw the offer\", \"visited\", \"landing viewed\", \"page viewed\", \"visit\", \"visitor\"],\n // Never sent anywhere: every platform already counts its own page views,\n // and uploading a view as a conversion would teach it to optimise for\n // nothing.\n platformDefaults: {},\n },\n {\n key: \"lead\",\n displayName: \"Lead\",\n meaning: \"Someone left their details — the starting point of most journeys\",\n stepClass: \"lead\",\n aliases: [\"lead\", \"new lead\", \"inbound lead\", \"enquiry\", \"inquiry\", \"form submission\"],\n platformDefaults: {\n meta: { eventName: \"Lead\", standard: true },\n googleAds: { category: \"Submit lead form\" },\n linkedin: { type: \"LEAD\", verified: true },\n },\n },\n {\n key: \"signed_up\",\n displayName: \"Signed up\",\n meaning: \"Someone created an account\",\n stepClass: \"lead\",\n classNote: \"Same fact as a lead reached a different way — we now know who they are.\",\n aliases: [\"signed up\", \"sign up\", \"registered\", \"registration\", \"account created\", \"new user\"],\n platformDefaults: {\n meta: { eventName: \"CompleteRegistration\", standard: true },\n googleAds: { category: \"Sign-up\" },\n linkedin: { type: \"SIGN_UP\", verified: true },\n },\n },\n {\n key: \"add_to_cart\",\n displayName: \"Added to cart\",\n meaning: \"Something went into the cart\",\n stepClass: \"engaged\",\n aliases: [\"added to cart\", \"add to cart\", \"cart\"],\n platformDefaults: {\n meta: { eventName: \"AddToCart\", standard: true },\n googleAds: { category: \"Add to cart\" },\n linkedin: { type: \"ADD_TO_CART\", verified: true },\n },\n },\n {\n key: \"checkout_started\",\n displayName: \"Started checkout\",\n meaning: \"The checkout began\",\n stepClass: \"engaged\",\n aliases: [\"started checkout\", \"checkout started\", \"checkout\", \"begin checkout\"],\n platformDefaults: {\n meta: { eventName: \"InitiateCheckout\", standard: true },\n googleAds: { category: \"Begin checkout\" },\n // Written from the documentation and never checked against the live\n // enum, which is what `verified: false` is for — carried as a caveat\n // rather than quietly resolved.\n linkedin: { type: \"START_CHECKOUT\", verified: false, fallback: \"OTHER\" },\n },\n },\n {\n key: \"trial_started\",\n displayName: \"Trial started\",\n meaning: \"A free trial began\",\n stepClass: \"engaged\",\n classNote: \"A trial is use, not payment — engaged, never customer.\",\n aliases: [\"trial\", \"trial started\", \"free trial\", \"in trial\"],\n platformDefaults: {\n meta: { eventName: \"StartTrial\", standard: true },\n googleAds: { category: \"Sign-up\" },\n linkedin: { type: \"OTHER\", verified: true },\n },\n },\n {\n key: \"qualified_lead\",\n displayName: \"Qualified lead\",\n meaning: \"The lead matches who you sell to\",\n stepClass: \"engaged\",\n aliases: [\"qualified lead\", \"qualified\", \"mql\", \"sql\", \"sales qualified lead\", \"marketing qualified lead\"],\n platformDefaults: {\n meta: { eventName: \"QualifiedLead\", standard: false },\n googleAds: { category: \"Qualified lead\" },\n linkedin: { type: \"QUALIFIED_LEAD\", verified: true },\n },\n },\n {\n key: \"contacted\",\n displayName: \"Contacted\",\n meaning: \"Your team reached out\",\n stepClass: \"engaged\",\n classNote: \"Engaged even though the move came from the seller: it is a real forward interaction.\",\n aliases: [\"contacted\", \"contact\", \"outreach\", \"follow up\", \"first contact\", \"attempting contact\"],\n platformDefaults: {\n meta: { eventName: \"Contact\", standard: true },\n googleAds: { category: \"Contact\" },\n linkedin: { type: \"CONTACT\", verified: true },\n },\n },\n {\n key: \"meeting_scheduled\",\n displayName: \"Meeting booked\",\n meaning: \"A meeting is on the calendar\",\n stepClass: \"engaged\",\n aliases: [\n \"meeting booked\",\n \"meeting scheduled\",\n \"demo scheduled\",\n \"demo booked\",\n \"appointment booked\",\n \"call booked\",\n ],\n platformDefaults: {\n meta: { eventName: \"Schedule\", standard: true },\n googleAds: { category: \"Book appointment\" },\n // LinkedIn has SCHEDULE and BOOK_APPOINTMENT separately; the second is the\n // one that means a reservation.\n linkedin: { type: \"BOOK_APPOINTMENT\", verified: true },\n },\n },\n {\n key: \"meeting_held\",\n displayName: \"Meeting held\",\n meaning: \"The meeting actually happened — kept apart from booking because no-show is a real number\",\n stepClass: \"engaged\",\n aliases: [\"meeting held\", \"meeting done\", \"demo held\", \"demo done\", \"demo completed\", \"call held\"],\n platformDefaults: {\n meta: { eventName: \"MeetingHeld\", standard: false },\n googleAds: { category: \"Other\" },\n linkedin: { type: \"OTHER\", verified: true },\n },\n },\n {\n key: \"opportunity\",\n displayName: \"Opportunity open\",\n meaning: \"A deal is open — send the estimated value if you have one\",\n stepClass: \"engaged\",\n classNote: \"A number behind an intention is still no money, so engaged rather than customer.\",\n aliases: [\"opportunity\", \"proposal sent\", \"proposal\", \"negotiation\", \"in negotiation\", \"quote sent\", \"deal open\"],\n platformDefaults: {\n meta: { eventName: \"Opportunity\", standard: false },\n googleAds: { category: \"Request quote\" },\n linkedin: { type: \"REQUEST_QUOTE\", verified: true },\n },\n },\n {\n key: \"won\",\n displayName: \"Deal won\",\n meaning: \"The deal closed — the amount is required here\",\n stepClass: \"customer\",\n aliases: [\"won\", \"closed won\", \"deal won\", \"purchase\", \"sale\"],\n platformDefaults: {\n meta: { eventName: \"Purchase\", standard: true },\n // Which of the two depends on whether the company reports a revenue\n // amount. It is a per-company answer, so it stays a fork, not a constant.\n googleAds: { category: \"Purchase\", alternative: \"Converted lead\" },\n linkedin: { type: \"PURCHASE\", verified: true },\n },\n },\n {\n key: \"subscribed\",\n displayName: \"Subscription started\",\n meaning: \"A paying subscription began — the amount is the recurring one\",\n stepClass: \"customer\",\n classNote: \"Customer, not repeat: it is the first money. Repeat is what happens after — see the renewed template.\",\n aliases: [\"subscribed\", \"subscription started\", \"new subscription\", \"paying\"],\n platformDefaults: {\n meta: { eventName: \"Subscribe\", standard: true },\n googleAds: { category: \"Purchase\" },\n linkedin: { type: \"PURCHASE\", verified: true },\n },\n },\n {\n key: \"renewed\",\n displayName: \"Subscription renewed\",\n meaning: \"An existing customer paid again or expanded — the amount is what they paid this time\",\n stepClass: \"repeat\",\n classNote:\n \"The smallest honest member of `repeat`. Without it every SaaS funnel drawn from this library ends at `subscribed` and the stage has nothing to hold. The recurring lifecycle beyond renewal — upgrades, churn, refunds — is a bigger conversation than a template.\",\n aliases: [\"renewed\", \"renewal\", \"subscription renewed\", \"expansion\", \"upsell\"],\n platformDefaults: {\n meta: { eventName: \"Renewed\", standard: false },\n googleAds: { category: \"Purchase\" },\n linkedin: { type: \"PURCHASE\", verified: true },\n },\n },\n {\n key: \"application_submitted\",\n displayName: \"Application submitted\",\n meaning: \"Someone submitted an application — a course, a policy, a credit line\",\n stepClass: \"engaged\",\n classNote: \"For education, events, fintech and insurance. Strong intent, no money yet.\",\n aliases: [\"application submitted\", \"application\", \"applied\", \"application received\"],\n platformDefaults: {\n meta: { eventName: \"SubmitApplication\", standard: true },\n googleAds: { category: \"Submit lead form\" },\n linkedin: { type: \"SUBMIT_APPLICATION\", verified: true },\n },\n },\n {\n key: \"lost\",\n displayName: \"Lost\",\n meaning: \"It did not go ahead — the deal fell through, or the lead was never a fit\",\n stepClass: \"lost\",\n classNote:\n \"Terminal and never sent anywhere. It can happen at any depth, which is why the order check leaves it alone.\",\n aliases: [\n \"lost\",\n \"closed lost\",\n \"deal lost\",\n \"no budget\",\n \"not interested\",\n \"disqualified\",\n \"unqualified\",\n \"not a fit\",\n \"spam\",\n \"duplicate\",\n \"junk\",\n ],\n platformDefaults: {},\n },\n];\n\nconst TEMPLATES_BY_KEY: ReadonlyMap<string, FunnelStepTemplate> = new Map(\n FUNNEL_STEP_TEMPLATES.map((template) => [template.key, template] as const),\n);\n\n/**\n * A name reduced to comparable words: lowercase, no separators, single spaces.\n * \"Won - Closed\", \"won_closed\" and \"WON / CLOSED\" all become the same two\n * words, which is the whole trick — every system writes the same moment its own\n * way.\n */\nfunction nameWords(value: string): string[] {\n return value\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .split(\" \")\n .filter((word) => word !== \"\");\n}\n\n/** Whether `needle`'s words appear, in order and adjacent, inside `haystack`. */\nfunction containsWords(haystack: readonly string[], needle: readonly string[]): boolean {\n if (needle.length === 0 || needle.length > haystack.length) {\n return false;\n }\n for (let start = 0; start <= haystack.length - needle.length; start++) {\n if (needle.every((word, offset) => haystack[start + offset] === word)) {\n return true;\n }\n }\n return false;\n}\n\ninterface NameCandidate {\n stepKey: string;\n phrases: readonly string[];\n}\n\n/** The longest phrase that matches wins — \"closed won\" beats a bare \"won\". */\nfunction bestCandidate(subject: readonly string[], candidates: readonly NameCandidate[]): string | null {\n let best: string | null = null;\n let bestLength = 0;\n for (const candidate of candidates) {\n for (const phrase of candidate.phrases) {\n const words = nameWords(phrase);\n const matches = containsWords(subject, words) || containsWords(words, subject);\n if (matches && words.length > bestLength) {\n best = candidate.stepKey;\n bestLength = words.length;\n }\n }\n }\n return best;\n}\n\n/**\n * A guess at which of *this company's* steps some other system's name means.\n *\n * The company's own names are tried first, because a company that calls a step\n * \"Lead that fits\" has already said what its words are and no library should\n * talk over it. Only then do the template aliases get a turn, and only for\n * templates whose key the funnel actually contains — a suggestion has to be a\n * step the person can pick, so an alias of a step they never drew is no match\n * at all.\n *\n * `null` means \"no idea\", which is a fine answer: the picker just opens empty.\n */\nexport function suggestStepForName(\n incomingName: string,\n steps: readonly { key: string; displayName: string }[],\n templates: readonly FunnelStepTemplate[] = FUNNEL_STEP_TEMPLATES,\n): string | null {\n const subject = nameWords(incomingName);\n if (subject.length === 0) {\n return null;\n }\n const own = bestCandidate(\n subject,\n steps.map((step) => ({ stepKey: step.key, phrases: [step.displayName] })),\n );\n if (own !== null) {\n return own;\n }\n const drawn = new Set(steps.map((step) => step.key));\n return bestCandidate(\n subject,\n templates.filter((t) => drawn.has(t.key)).map((t) => ({ stepKey: t.key, phrases: t.aliases })),\n );\n}\n\n/** `undefined` rather than a throw: a caller offering suggestions can simply offer fewer. */\nexport function stepTemplate(key: string): FunnelStepTemplate | undefined {\n return TEMPLATES_BY_KEY.get(key);\n}\n\n/**\n * The preset a company picks once, at the cold start, to get a graph instead of\n * a blank canvas.\n *\n * **Two families, because that is who Baker sells to today.** There is no\n * e-commerce preset: no client runs that funnel and none is on the way, and a\n * preset nobody picks is a graph nobody checks. The e-commerce *templates* stay\n * in the library above — `add_to_cart`, `checkout_started`, `signed_up` are\n * offered one by one on the canvas like any other suggestion, and the day an\n * e-commerce client arrives the preset is four lines here, not new research.\n *\n * Within each family there are variants rather than one average funnel, because\n * the difference between the two B2B shapes — whether a human runs meetings —\n * changes almost every node, and a preset that splits the difference fits\n * neither.\n */\nexport const FUNNEL_PRESET_FAMILIES = [\"b2b\", \"saas\", \"ecommerce\"] as const;\nexport type FunnelPresetFamily = (typeof FUNNEL_PRESET_FAMILIES)[number];\n\nexport const FUNNEL_VERTICALS = [\n \"b2b_sales\",\n \"b2b_inbound\",\n \"saas_self_serve\",\n \"saas_sales_assisted\",\n \"ecommerce_purchase\",\n] as const;\nexport type FunnelVertical = (typeof FUNNEL_VERTICALS)[number];\n\nexport interface FunnelPresetStep {\n templateKey: string;\n /** Predecessors, by template key. Empty means the funnel starts here. */\n after: readonly string[];\n /** Overrides the template's name where the vertical says it differently — \"Purchase\", not \"Deal won\". */\n displayName?: string;\n}\n\nexport interface FunnelVerticalPreset {\n vertical: FunnelVertical;\n family: FunnelPresetFamily;\n label: string;\n /** One line for the picker, in the company's language rather than ours. */\n description: string;\n steps: readonly FunnelPresetStep[];\n}\n\n/**\n * Four small graphs — two shapes of B2B, two of SaaS — each the shortest funnel\n * of its kind that is still honest, not the fullest.\n *\n * Small on purpose. A preset is the first thing a company sees on the canvas,\n * and a fourteen-node suggestion invites deleting rather than editing; a step\n * that exists because a preset put it there and that nothing ever reaches shows\n * up as a gap in the funnel forever after.\n */\nexport const VERTICAL_PRESETS: readonly FunnelVerticalPreset[] = [\n {\n vertical: \"b2b_sales\",\n family: \"b2b\",\n label: \"B2B sales team\",\n description: \"Leads a salesperson qualifies, meets, quotes and closes.\",\n steps: [\n { templateKey: \"lead\", after: [] },\n { templateKey: \"qualified_lead\", after: [\"lead\"] },\n { templateKey: \"meeting_scheduled\", after: [\"qualified_lead\"] },\n // Booked and held stay apart because the gap between them is the no-show\n // rate, which is a number this kind of team actually manages.\n { templateKey: \"meeting_held\", after: [\"meeting_scheduled\"] },\n { templateKey: \"opportunity\", after: [\"meeting_held\"] },\n { templateKey: \"won\", after: [\"opportunity\"] },\n // The end hangs off the earliest step at which it becomes possible; the\n // order check ignores it anyway (`isOutOfOrder`), so the edge is there to\n // be drawn, not to be enforced.\n { templateKey: \"lost\", after: [\"opportunity\"] },\n ],\n },\n {\n vertical: \"b2b_inbound\",\n family: \"b2b\",\n label: \"B2B inbound, no meetings\",\n description: \"Enquiries answered and closed without a meeting stage.\",\n steps: [\n { templateKey: \"lead\", after: [] },\n { templateKey: \"qualified_lead\", after: [\"lead\"] },\n { templateKey: \"contacted\", after: [\"qualified_lead\"] },\n { templateKey: \"won\", after: [\"contacted\"] },\n { templateKey: \"lost\", after: [\"contacted\"] },\n ],\n },\n {\n vertical: \"saas_self_serve\",\n family: \"saas\",\n label: \"SaaS, self-serve\",\n description: \"People who sign up, trial the product and start paying on their own.\",\n steps: [\n { templateKey: \"signed_up\", after: [] },\n { templateKey: \"trial_started\", after: [\"signed_up\"] },\n { templateKey: \"subscribed\", after: [\"trial_started\"] },\n { templateKey: \"renewed\", after: [\"subscribed\"] },\n { templateKey: \"lost\", after: [\"trial_started\"], displayName: \"Trial expired\" },\n ],\n },\n {\n vertical: \"saas_sales_assisted\",\n family: \"saas\",\n label: \"SaaS, sales-assisted\",\n description: \"Sign-ups and demo requests, with a salesperson in the middle of the bigger ones.\",\n steps: [\n // Two entry points, which is the whole reason `after` is a list: people\n // arrive by signing up or by asking for a demo, never both, and a single\n // position integer calls that ordinary path an anomaly.\n { templateKey: \"signed_up\", after: [] },\n { templateKey: \"lead\", after: [], displayName: \"Demo requested\" },\n { templateKey: \"meeting_held\", after: [\"lead\"], displayName: \"Demo held\" },\n { templateKey: \"trial_started\", after: [\"signed_up\", \"meeting_held\"] },\n { templateKey: \"subscribed\", after: [\"trial_started\", \"meeting_held\"] },\n { templateKey: \"renewed\", after: [\"subscribed\"] },\n ],\n },\n {\n vertical: \"ecommerce_purchase\",\n family: \"ecommerce\",\n label: \"Online shop\",\n description: \"People who browse, fill a basket, check out and come back for a second order.\",\n steps: [\n { templateKey: \"saw_offer\", after: [], displayName: \"Viewed a product\" },\n { templateKey: \"add_to_cart\", after: [\"saw_offer\"] },\n { templateKey: \"checkout_started\", after: [\"add_to_cart\"] },\n // A shop's \"customer\" is the order, and its \"repeat\" is the next one —\n // the same two stages every other preset ends on, in a shop's words.\n { templateKey: \"won\", after: [\"checkout_started\"], displayName: \"Order placed\" },\n { templateKey: \"renewed\", after: [\"won\"], displayName: \"Ordered again\" },\n ],\n },\n];\n\n/**\n * The funnel every company starts with.\n *\n * Every company has a funnel from the day it exists — \"no funnel\" was a real\n * state, and it meant every \"how far did they get\" question had no answer\n * until somebody drew one. The default is the smallest honest journey: seeing\n * the offer, becoming a lead, becoming a customer. The first step listens for\n * any landing being viewed, so it counts from the first visit; the other two\n * start unwired and the canvas says so, because what a lead IS is the\n * company's to say.\n */\nexport function defaultFunnelSteps(): FunnelStepDefinition[] {\n return [\n {\n key: \"visited\",\n displayName: \"Visited\",\n stepClass: \"visited\",\n after: [],\n triggers: [{ id: \"t1\", kind: \"any_landing\" }],\n },\n { key: \"lead\", displayName: \"Became a lead\", stepClass: \"lead\", after: [\"visited\"], triggers: [] },\n { key: \"customer\", displayName: \"Became a customer\", stepClass: \"customer\", after: [\"lead\"], triggers: [] },\n ];\n}\n\nexport function verticalPreset(vertical: FunnelVertical): FunnelVerticalPreset | undefined {\n return VERTICAL_PRESETS.find((preset) => preset.vertical === vertical);\n}\n\n/**\n * A template turned into a real step of a company's funnel.\n *\n * The template stops existing at this point: what comes out is an ordinary\n * `FunnelStepDefinition` the company owns and can rename, reclassify or rewire,\n * with no link back. That is what makes this a suggestion library and not a\n * second schema.\n */\nexport function stepFromTemplate(\n template: FunnelStepTemplate,\n after: readonly string[],\n displayName?: string,\n): FunnelStepDefinition {\n return {\n key: template.key,\n displayName: displayName ?? template.displayName,\n stepClass: template.stepClass,\n after: [...after],\n // A template says what a moment IS, never which of this company's events\n // announces it — that is a per-company answer, and prefilling a guess would\n // make a step look wired when it advances nobody.\n triggers: [],\n };\n}\n\n/**\n * The steps a preset produces, ready to hand to `validateDefinition` or draw.\n *\n * A preset step whose template does not exist is dropped rather than faked: the\n * pair is checked by a test, so a miss here is a bug in this file and a\n * half-invented step would hide it.\n */\nexport function presetDefinition(preset: FunnelVerticalPreset): FunnelStepDefinition[] {\n return preset.steps.flatMap((step) => {\n const template = stepTemplate(step.templateKey);\n return template ? [stepFromTemplate(template, step.after, step.displayName)] : [];\n });\n}\n","/**\n * The one closed vocabulary in a funnel that is otherwise the company's own.\n *\n * A company invents its own steps, in its own words, wired its own way\n * (`graph.ts`). What it cannot invent is the *stage* a step stands for: the\n * six words below are what keeps one company's funnel comparable with\n * another's, and they can stay closed because they describe the shape every\n * business has — somebody saw the offer, told you who they are, did something\n * real with you, paid, paid again, or went away — rather than any one sector's\n * name for a rung on it.\n *\n * Six, down from eight. The old list split \"qualified\", \"engaged\" and\n * \"committed\" apart, and \"lost\" from \"disqualified\", which read as a sales\n * team's pipeline and meant nothing to a shop, a clinic or a course. Every\n * step that was one of those three is a real forward interaction and is\n * `engaged`; every step that ends the journey without money is `lost`.\n *\n * These lists are mirrored from `packages/backend/convex/lib/validators.ts`,\n * which is the source of truth for what can be stored. They are re-declared\n * here rather than imported because `@baker/api` must not depend on `convex`;\n * `vocabulary.parity.test.ts` reads that file and fails if the two ever drift.\n */\n\n/**\n * The stage a funnel step stands for, never the step itself.\n *\n * Ordered as a journey runs, and **the order is meaningful**: it is the\n * fallback for comparing one company's funnel against another's when their\n * graphs cannot be laid over each other, and the tie-break for \"how far did\n * this person get\" between two steps at the same depth.\n *\n * Where a step is sent is never derived from this list — that lives per step\n * — which is exactly why it does not have to be exhaustive.\n */\nexport const FUNNEL_STEP_CLASSES = [\n /** Saw the offer: a landing opened, an ad clicked through. */\n \"visited\",\n /** We know who they are: a form sent, an account created. */\n \"lead\",\n /** Something real happened: a call booked, a trial started, a quote asked for, a cart filled. */\n \"engaged\",\n /** Paid, or signed. */\n \"customer\",\n /** Paid again, renewed, or grew. */\n \"repeat\",\n /** Terminal. Did not go ahead, or was never a fit. */\n \"lost\",\n] as const;\nexport type FunnelStepClass = (typeof FUNNEL_STEP_CLASSES)[number];\n\n/**\n * Each stage in plain words, with an example from three shapes of business.\n *\n * The stage is the only thing in a funnel a company does not get to invent, so\n * it is the only thing anybody has to be *taught* — and it was taught in five\n * words on a `<select>`: \"Engaged — did something real with you\". A marketer\n * setting up a demo-led funnel, a self-serve trial and a shop cannot tell from\n * that whether a trial is engaged or customer, and getting it wrong is\n * invisible: nothing on their own reports changes, and the cross-company\n * comparison this list exists for quietly stops working.\n *\n * So each one says what it means in a sentence a child could follow, and then\n * shows the same stage in three businesses that look nothing like each other.\n * Three, because that is the range that makes the rule legible — a shop has no\n * demo and a self-serve product has no salesperson, and a stage that survives\n * all three is a stage somebody can place their own step into.\n *\n * Here rather than in the dashboard because the agent needs the same words:\n * `baker funnel --templates` returns it, the stage picker renders it, and\n * `docs/product-model.md` quotes it.\n */\nexport interface FunnelStageGuide {\n /** One word for the chip on a card. */\n title: string;\n /** What it means, said once, plainly. */\n meaning: string;\n /** The test somebody applies to their own step to decide if it belongs here. */\n test: string;\n /** The same stage in three businesses: an online shop, a self-serve product, a sales-led business. */\n examples: { shop: string; selfServe: string; salesLed: string };\n}\n\nexport const FUNNEL_STAGE_GUIDE: Readonly<Record<FunnelStepClass, FunnelStageGuide>> = {\n visited: {\n title: \"Visited\",\n meaning: \"They looked, and that is all. You still have no idea who they are.\",\n test: \"Could this have happened without them telling you anything about themselves?\",\n examples: {\n shop: \"Opened a product page\",\n selfServe: \"Read the pricing page\",\n salesLed: \"Read a case study\",\n },\n },\n lead: {\n title: \"Lead\",\n meaning: \"Now you know who they are. They handed over a way to reach them.\",\n test: \"Do you have their email, their phone, or an account in their name?\",\n examples: {\n shop: \"Joined the newsletter\",\n selfServe: \"Created a free account\",\n salesLed: \"Asked for a demo\",\n },\n },\n engaged: {\n title: \"Engaged\",\n meaning: \"They did something real — more than reading, not yet paying.\",\n test: \"Did they spend effort or time on you, without any money changing hands?\",\n examples: {\n shop: \"Put something in the basket\",\n selfServe: \"Started a trial, or invited a colleague\",\n salesLed: \"Turned up to the demo, or asked for a quote\",\n },\n },\n customer: {\n title: \"Customer\",\n meaning: \"Money. They paid, or they signed something that means they will.\",\n test: \"Is there a first payment or a signed contract behind this?\",\n examples: {\n shop: \"Placed their first order\",\n selfServe: \"Started paying for a plan\",\n salesLed: \"Signed the contract\",\n },\n },\n repeat: {\n title: \"Repeat\",\n meaning: \"Money again. They came back, renewed, or bought more.\",\n test: \"Had they already paid you once before this happened?\",\n examples: {\n shop: \"Ordered a second time\",\n selfServe: \"Renewed, or moved to a bigger plan\",\n salesLed: \"Renewed the contract, or added seats\",\n },\n },\n lost: {\n title: \"Lost\",\n meaning: \"It ended, and no money came. Nothing comes after this step.\",\n test: \"Is this journey over without a sale — for now or for good?\",\n examples: {\n shop: \"Left the basket and never came back\",\n selfServe: \"The trial ran out unused\",\n salesLed: \"They went with somebody else\",\n },\n },\n};\n\n/**\n * The stages that end a journey without money. One word now: the old split\n * between \"it was real and did not close\" and \"it never was real\" is a\n * judgement a sales team makes and nobody else does, and the two read as one\n * loss rate on every report anyway.\n */\nexport const TERMINAL_NEGATIVE_CLASSES = [\"lost\"] as const;\n\nexport function isTerminalNegative(stepClass: FunnelStepClass): boolean {\n return (TERMINAL_NEGATIVE_CLASSES as readonly string[]).includes(stepClass);\n}\n\n/** The stages that mean money arrived: where a funnel is expected to end. */\nexport const MONEY_CLASSES = [\"customer\", \"repeat\"] as const;\n\nexport function isMoneyClass(stepClass: FunnelStepClass): boolean {\n return (MONEY_CLASSES as readonly string[]).includes(stepClass);\n}\n\n/** Where a stage sits in the journey's order — the cross-company fallback. */\nexport function stepClassRank(stepClass: FunnelStepClass): number {\n return FUNNEL_STEP_CLASSES.indexOf(stepClass);\n}\n\n/**\n * A company step key: lowercase letters, digits and underscores, 1–64\n * characters, no leading or trailing underscore.\n *\n * Constrained on purpose even though the vocabulary is open. The key is the\n * stable identifier for the step — it ends up in reporting arguments, CLI\n * arguments and URLs — so it must not be able to be `\"Deal — won (EU)\"`. The\n * client's own words live in `displayName`, which has no constraint at all,\n * and renaming a step never touches its key.\n */\nconst STEP_KEY = /^[a-z0-9](?:[a-z0-9_]{0,62}[a-z0-9])?$/;\n\nexport function isFunnelStepKey(value: string): boolean {\n return STEP_KEY.test(value);\n}\n\nexport function isFunnelStepClass(value: string): value is FunnelStepClass {\n return (FUNNEL_STEP_CLASSES as readonly string[]).includes(value);\n}\n"],"mappings":";AA2EA,IAAM,MAAM;AASL,SAAS,aAAa,UAAkB,QAAgB,WAA2B;AACxF,SAAO,CAAC,QAAQ,UAAU,QAAQ,SAAS,EAAE,KAAK,GAAG;AACvD;AAoCO,SAAS,iBAAiBA,MAAsB;AACrD,SAAO,cAAcA,IAAG,GAAG,WAAW;AACxC;AAUO,SAAS,cAAcA,MAAoC;AAGhE,QAAM,MAAMA,KAAI,QAAQ,GAAG;AAC3B,MAAI,OAAO,EAAG,QAAO;AACrB,QAAM,SAASA,KAAI,MAAM,GAAG,GAAG;AAC/B,QAAM,OAAOA,KAAI,MAAM,MAAM,CAAC;AAC9B,MAAI,SAAS,GAAI,QAAO;AAExB,UAAQ,QAAQ;AAAA,IACd,KAAK,QAAQ;AAGX,YAAM,CAAC,UAAU,QAAQ,GAAG,YAAY,IAAI,KAAK,MAAM,GAAG;AAC1D,YAAM,YAAY,aAAa,KAAK,GAAG;AACvC,UAAI,CAAC,YAAY,CAAC,UAAU,cAAc,GAAI,QAAO;AACrD,aAAO,EAAE,QAAQ,QAAQ,UAAU,QAAQ,UAAU;AAAA,IACvD;AAAA,IACA,KAAK;AACH,aAAO,EAAE,QAAQ,UAAU,UAAU,KAAK;AAAA,IAC5C,KAAK;AACH,aAAO,EAAE,QAAQ,QAAQ,WAAW,KAAK;AAAA,IAC3C,KAAK;AACH,aAAO,EAAE,QAAQ,QAAQ,MAAM,KAAK;AAAA,IACtC,KAAK;AACH,aAAO,EAAE,QAAQ,QAAQ,WAAW,KAAK;AAAA,IAC3C;AACE,aAAO;AAAA,EACX;AACF;;;AC7EO,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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