@iann29/rastro 0.1.0-alpha.0

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 (126) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +352 -0
  3. package/assets/rastro-live-atlas.png +0 -0
  4. package/dist/client/_generated/_ignore.d.ts +1 -0
  5. package/dist/client/_generated/_ignore.d.ts.map +1 -0
  6. package/dist/client/_generated/_ignore.js +3 -0
  7. package/dist/client/_generated/_ignore.js.map +1 -0
  8. package/dist/client/index.d.ts +960 -0
  9. package/dist/client/index.d.ts.map +1 -0
  10. package/dist/client/index.js +591 -0
  11. package/dist/client/index.js.map +1 -0
  12. package/dist/component/_generated/api.d.ts +60 -0
  13. package/dist/component/_generated/api.d.ts.map +1 -0
  14. package/dist/component/_generated/api.js +31 -0
  15. package/dist/component/_generated/api.js.map +1 -0
  16. package/dist/component/_generated/component.d.ts +569 -0
  17. package/dist/component/_generated/component.d.ts.map +1 -0
  18. package/dist/component/_generated/component.js +11 -0
  19. package/dist/component/_generated/component.js.map +1 -0
  20. package/dist/component/_generated/dataModel.d.ts +46 -0
  21. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  22. package/dist/component/_generated/dataModel.js +11 -0
  23. package/dist/component/_generated/dataModel.js.map +1 -0
  24. package/dist/component/_generated/server.d.ts +133 -0
  25. package/dist/component/_generated/server.d.ts.map +1 -0
  26. package/dist/component/_generated/server.js +80 -0
  27. package/dist/component/_generated/server.js.map +1 -0
  28. package/dist/component/affiliates.d.ts +28 -0
  29. package/dist/component/affiliates.d.ts.map +1 -0
  30. package/dist/component/affiliates.js +110 -0
  31. package/dist/component/affiliates.js.map +1 -0
  32. package/dist/component/constants.d.ts +28 -0
  33. package/dist/component/constants.d.ts.map +1 -0
  34. package/dist/component/constants.js +28 -0
  35. package/dist/component/constants.js.map +1 -0
  36. package/dist/component/convex.config.d.ts +3 -0
  37. package/dist/component/convex.config.d.ts.map +1 -0
  38. package/dist/component/convex.config.js +3 -0
  39. package/dist/component/convex.config.js.map +1 -0
  40. package/dist/component/errors.d.ts +3 -0
  41. package/dist/component/errors.d.ts.map +1 -0
  42. package/dist/component/errors.js +5 -0
  43. package/dist/component/errors.js.map +1 -0
  44. package/dist/component/funnels.d.ts +36 -0
  45. package/dist/component/funnels.d.ts.map +1 -0
  46. package/dist/component/funnels.js +117 -0
  47. package/dist/component/funnels.js.map +1 -0
  48. package/dist/component/goals.d.ts +30 -0
  49. package/dist/component/goals.d.ts.map +1 -0
  50. package/dist/component/goals.js +110 -0
  51. package/dist/component/goals.js.map +1 -0
  52. package/dist/component/guards.d.ts +2 -0
  53. package/dist/component/guards.d.ts.map +1 -0
  54. package/dist/component/guards.js +4 -0
  55. package/dist/component/guards.js.map +1 -0
  56. package/dist/component/http.d.ts +3 -0
  57. package/dist/component/http.d.ts.map +1 -0
  58. package/dist/component/http.js +270 -0
  59. package/dist/component/http.js.map +1 -0
  60. package/dist/component/ingest.d.ts +51 -0
  61. package/dist/component/ingest.d.ts.map +1 -0
  62. package/dist/component/ingest.js +991 -0
  63. package/dist/component/ingest.js.map +1 -0
  64. package/dist/component/live.d.ts +9 -0
  65. package/dist/component/live.d.ts.map +1 -0
  66. package/dist/component/live.js +36 -0
  67. package/dist/component/live.js.map +1 -0
  68. package/dist/component/reports.d.ts +330 -0
  69. package/dist/component/reports.d.ts.map +1 -0
  70. package/dist/component/reports.js +595 -0
  71. package/dist/component/reports.js.map +1 -0
  72. package/dist/component/retention.d.ts +10 -0
  73. package/dist/component/retention.d.ts.map +1 -0
  74. package/dist/component/retention.js +107 -0
  75. package/dist/component/retention.js.map +1 -0
  76. package/dist/component/sanitize.d.ts +20 -0
  77. package/dist/component/sanitize.d.ts.map +1 -0
  78. package/dist/component/sanitize.js +269 -0
  79. package/dist/component/sanitize.js.map +1 -0
  80. package/dist/component/schema.d.ts +517 -0
  81. package/dist/component/schema.d.ts.map +1 -0
  82. package/dist/component/schema.js +209 -0
  83. package/dist/component/schema.js.map +1 -0
  84. package/dist/component/sites.d.ts +54 -0
  85. package/dist/component/sites.d.ts.map +1 -0
  86. package/dist/component/sites.js +164 -0
  87. package/dist/component/sites.js.map +1 -0
  88. package/dist/component/validators.d.ts +377 -0
  89. package/dist/component/validators.d.ts.map +1 -0
  90. package/dist/component/validators.js +176 -0
  91. package/dist/component/validators.js.map +1 -0
  92. package/dist/react/index.d.ts +40 -0
  93. package/dist/react/index.d.ts.map +1 -0
  94. package/dist/react/index.js +31 -0
  95. package/dist/react/index.js.map +1 -0
  96. package/dist/tracker/generated.d.ts +5 -0
  97. package/dist/tracker/generated.d.ts.map +1 -0
  98. package/dist/tracker/generated.js +6 -0
  99. package/dist/tracker/generated.js.map +1 -0
  100. package/dist/tracker/tracker.d.ts +27 -0
  101. package/dist/tracker/tracker.d.ts.map +1 -0
  102. package/dist/tracker/tracker.js +108 -0
  103. package/dist/tracker/tracker.js.map +1 -0
  104. package/dist/tracker.min.js +1 -0
  105. package/package.json +121 -0
  106. package/src/component/_generated/api.ts +76 -0
  107. package/src/component/_generated/component.ts +706 -0
  108. package/src/component/_generated/dataModel.ts +60 -0
  109. package/src/component/_generated/server.ts +169 -0
  110. package/src/component/affiliates.ts +119 -0
  111. package/src/component/constants.ts +28 -0
  112. package/src/component/convex.config.ts +3 -0
  113. package/src/component/errors.ts +20 -0
  114. package/src/component/funnels.ts +134 -0
  115. package/src/component/goals.ts +122 -0
  116. package/src/component/guards.ts +3 -0
  117. package/src/component/http.ts +301 -0
  118. package/src/component/ingest.ts +1364 -0
  119. package/src/component/live.ts +36 -0
  120. package/src/component/reports.ts +720 -0
  121. package/src/component/retention.ts +180 -0
  122. package/src/component/sanitize.ts +278 -0
  123. package/src/component/schema.ts +232 -0
  124. package/src/component/sites.ts +188 -0
  125. package/src/component/validators.ts +226 -0
  126. package/src/test.ts +19 -0
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { createElement, useCallback, useMemo } from "react";
3
+ /** Renders the sub-1KB cookieless tracker with CSP nonce support. */
4
+ export function RastroScript({ siteId, src, endpoint, visitorId, nonce, onLoad, onError, }) {
5
+ return createElement("script", {
6
+ defer: true,
7
+ src,
8
+ nonce,
9
+ onLoad,
10
+ onError,
11
+ "data-site": siteId,
12
+ "data-endpoint": endpoint,
13
+ "data-visitor": visitorId,
14
+ });
15
+ }
16
+ /** Stable browser helpers. `false` means the deferred tracker is not ready yet. */
17
+ export function useRastro() {
18
+ const track = useCallback((name, properties) => {
19
+ if (typeof window === "undefined" || !window.rastro)
20
+ return false;
21
+ window.rastro("event", name, properties);
22
+ return true;
23
+ }, []);
24
+ const context = useCallback(() => {
25
+ if (typeof window === "undefined" || !window.rastro)
26
+ return null;
27
+ return window.rastro("context");
28
+ }, []);
29
+ return useMemo(() => ({ context, track }), [context, track]);
30
+ }
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAqC5D,qEAAqE;AACrE,MAAM,UAAU,YAAY,CAAC,EAC3B,MAAM,EACN,GAAG,EACH,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,GACW;IAClB,OAAO,aAAa,CAAC,QAAQ,EAAE;QAC7B,KAAK,EAAE,IAAI;QACX,GAAG;QACH,KAAK;QACL,MAAM;QACN,OAAO;QACP,WAAW,EAAE,MAAM;QACnB,eAAe,EAAE,QAAQ;QACzB,cAAc,EAAE,SAAS;KAC1B,CAAC,CAAC;AACL,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,SAAS;IACvB,MAAM,KAAK,GAAG,WAAW,CAAC,CAAC,IAAY,EAAE,UAA6B,EAAE,EAAE;QACxE,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAClE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACjE,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,CAAkB,CAAC;IACnD,CAAC,EAAE,EAAE,CAAC,CAAC;IAGP,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const TRACKER_SOURCE = "\"use strict\";(()=>{const e=document.currentScript,t=e?.dataset.site,r=e?.dataset.endpoint||e?.src.replace(/tracker\\.js.*$/,\"events\");if(!t||!r)return;const s=()=>crypto.randomUUID?.()||`${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;let n,o;try{n=sessionStorage._r||s(),sessionStorage._r=n,o=new URLSearchParams(location.search).get(\"ref\")?.slice(0,64)||sessionStorage._a,o&&(sessionStorage._a=o)}catch{n=s(),o=new URLSearchParams(location.search).get(\"ref\")?.slice(0,64)}const a=e.dataset.visitor||n;let i,c=0;const d=[],l=document.referrer?new URL(document.referrer).origin:void 0,p=e=>{const s=d.splice(0,20);if(!s.length)return;const n=new Blob([JSON.stringify({siteId:t,events:s})],{type:\"application/json\"});e&&navigator.sendBeacon(r,n)||fetch(r,{method:\"POST\",body:n,keepalive:1}).catch(()=>{}),d.length&&p(e)},u=(e,t,r)=>{const s=Date.now();d.push({eventId:`${n}.${s.toString(36)}.${c.toString(36)}`,sessionId:n,visitorId:a,type:e,name:t,path:location.pathname.slice(0,256)||\"/\",referrer:l,timestamp:s,sequence:c++,affiliateSlug:o,...r}),window.clearTimeout(i),i=window.setTimeout(p,1200)},h=()=>u(\"pageview\");window.rastro=(e,t,r)=>{if(\"context\"===e)return{sessionId:n,visitorId:a};\"event\"===e&&u(\"custom\",`${t||\"event\"}`.slice(0,80),{properties:r})},document.addEventListener(\"click\",e=>{const t=e.target?.closest(\"a,button,[data-rastro-event]\");if(!t)return;const r=t.dataset.rastroEvent,s=t.href,n=s?new URL(s,location.href):void 0;u(r?\"custom\":n&&n.origin!==location.origin?\"outbound\":\"click\",r,{target:(t.dataset.rastroLabel||t.tagName).slice(0,80),href:n?.pathname.slice(0,256)})},{capture:1,passive:1});const g=e=>{const t=history[e];history[e]=function(e,r,s){t.call(history,e,r,s),queueMicrotask(h)}};g(\"pushState\"),g(\"replaceState\"),addEventListener(\"popstate\",h),addEventListener(\"pagehide\",()=>p(1)),setInterval(()=>{u(\"heartbeat\"),p()},2e4),h()})();";
2
+ export declare const TRACKER_GZIP_BASE64 = "H4sIAAAAAAACA6VVXW/jNhD8KwlhGGRvj3HSa1BIYA0crg8pch+oL09pUNPUWuJFJnXkyqkh6b8XkmXn6/rUN2mWFGdnZilWRzyJFKwhlnIu1G+N8S7SCarMm3qDjqSpQ0BHCxNsRUAK5zLTpCOSjJYQwlMEXVZ566htcS5jMDJgVWqD/IyCNvcY/pLfovxpcgYMt+goMpHaNT+ltj0NIiDVwaV7ClH1fEzYVeRl0C7zm5ubqw9zyUXbLifNB00onX/gQpJfULAu5z9fim7SfNRUjDteFGUsrUF+IbplWiKdOPAphV3jVMQYrXcL8kHnKP8ObRu5gFewcuCVw4eTmz+vF6iDKb7ooDeRl95ost7JOKBC5kicBVwzMR+PncHlO9G2L7+pwU+n/BWqvOiMJlP07Lj4n8d2e1G1wqNXWxst+dC2btDCglGzUftM3d5B+ZiBgGsMAcN8pMBfVYT0webWJVtvs5MZVAqPYYoqk7EauVzM9o5HWaLLqXhuuhuafF/6Fb/9Y/H5k4yDd3a9402ftqssIdgnJ4mduIOGdhUmTFf99wclzr5F71gnUpxOnd7aXJMPMqLL3qM23vEATrTtGskUPECzQSp8lrAvnxdfGax8tksc3CNWurRbTM47IQcb9uPRCchG5tNpxVF0UCuOQBDEk4Yfw5lmsqpjwZuB9VWWLCeN6+Skic9jKyeNeY4sD+m7yhIHo1tXWaJh6BnB6Q0mBJWmIjnmoH/rC0fzL365FG3LzhgcvEpKILvBSHpTJREifq/RGUzMmzeg12tbWk24KOs88SClDJ2AB+sy/yBNiTp8tRv0NXErwKqxEJEOcAXnF7OZ6KAYBrjmrNI5bi0+MJGOy4OOFPwT3eyaM+Md4T/ElFI4pqL5DwW6dH99DGun05ozU0fyGwbLSUNtO1a75VGFX2cCmir4CgNZjEnoRAfHFOss+73fcW0jocPAmSmtuWfwGGJSKEmHHGkuTekjRuJMw6om8g5u+6F6u2/r7XD43eFmex7woOg4gPvlw8EQFcki4Bqciscpi3C0ta+JcbjSmof5oePETaduHL5TpY4b9sic+ZpWvnYZSw49BWj2jST8JZdrvcKybUmSzj/pDYpn+vUcEjf/ccR6PRujK6oDJudQ6RjH8Rk7z9VTMQsbyYfdLd6lj49qXTvTs+cIAaJoSBpdlnxcAXsUvtdY40drgicd73khui7NOevHbEGakAnI+ztw+PMckNcWV76KQxGKH5Z1joXNkEEf44qfi/53QFeOMGx1ub8Oas4K1IFWqIkJqLjo4ALfCSi46AQX6b+QRTLgYgcAAA==";
3
+ export declare const TRACKER_RAW_BYTES = 1890;
4
+ export declare const TRACKER_GZIP_BYTES = 991;
5
+ //# sourceMappingURL=generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../src/tracker/generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,o5DAAo5D,CAAC;AACh7D,eAAO,MAAM,mBAAmB,izCAAizC,CAAC;AACl1C,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,kBAAkB,MAAM,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Generated by scripts/build-tracker.mjs. Do not edit.
2
+ export const TRACKER_SOURCE = "\"use strict\";(()=>{const e=document.currentScript,t=e?.dataset.site,r=e?.dataset.endpoint||e?.src.replace(/tracker\\.js.*$/,\"events\");if(!t||!r)return;const s=()=>crypto.randomUUID?.()||`${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;let n,o;try{n=sessionStorage._r||s(),sessionStorage._r=n,o=new URLSearchParams(location.search).get(\"ref\")?.slice(0,64)||sessionStorage._a,o&&(sessionStorage._a=o)}catch{n=s(),o=new URLSearchParams(location.search).get(\"ref\")?.slice(0,64)}const a=e.dataset.visitor||n;let i,c=0;const d=[],l=document.referrer?new URL(document.referrer).origin:void 0,p=e=>{const s=d.splice(0,20);if(!s.length)return;const n=new Blob([JSON.stringify({siteId:t,events:s})],{type:\"application/json\"});e&&navigator.sendBeacon(r,n)||fetch(r,{method:\"POST\",body:n,keepalive:1}).catch(()=>{}),d.length&&p(e)},u=(e,t,r)=>{const s=Date.now();d.push({eventId:`${n}.${s.toString(36)}.${c.toString(36)}`,sessionId:n,visitorId:a,type:e,name:t,path:location.pathname.slice(0,256)||\"/\",referrer:l,timestamp:s,sequence:c++,affiliateSlug:o,...r}),window.clearTimeout(i),i=window.setTimeout(p,1200)},h=()=>u(\"pageview\");window.rastro=(e,t,r)=>{if(\"context\"===e)return{sessionId:n,visitorId:a};\"event\"===e&&u(\"custom\",`${t||\"event\"}`.slice(0,80),{properties:r})},document.addEventListener(\"click\",e=>{const t=e.target?.closest(\"a,button,[data-rastro-event]\");if(!t)return;const r=t.dataset.rastroEvent,s=t.href,n=s?new URL(s,location.href):void 0;u(r?\"custom\":n&&n.origin!==location.origin?\"outbound\":\"click\",r,{target:(t.dataset.rastroLabel||t.tagName).slice(0,80),href:n?.pathname.slice(0,256)})},{capture:1,passive:1});const g=e=>{const t=history[e];history[e]=function(e,r,s){t.call(history,e,r,s),queueMicrotask(h)}};g(\"pushState\"),g(\"replaceState\"),addEventListener(\"popstate\",h),addEventListener(\"pagehide\",()=>p(1)),setInterval(()=>{u(\"heartbeat\"),p()},2e4),h()})();";
3
+ export const TRACKER_GZIP_BASE64 = "H4sIAAAAAAACA6VVXW/jNhD8KwlhGGRvj3HSa1BIYA0crg8pch+oL09pUNPUWuJFJnXkyqkh6b8XkmXn6/rUN2mWFGdnZilWRzyJFKwhlnIu1G+N8S7SCarMm3qDjqSpQ0BHCxNsRUAK5zLTpCOSjJYQwlMEXVZ566htcS5jMDJgVWqD/IyCNvcY/pLfovxpcgYMt+goMpHaNT+ltj0NIiDVwaV7ClH1fEzYVeRl0C7zm5ubqw9zyUXbLifNB00onX/gQpJfULAu5z9fim7SfNRUjDteFGUsrUF+IbplWiKdOPAphV3jVMQYrXcL8kHnKP8ObRu5gFewcuCVw4eTmz+vF6iDKb7ooDeRl95ost7JOKBC5kicBVwzMR+PncHlO9G2L7+pwU+n/BWqvOiMJlP07Lj4n8d2e1G1wqNXWxst+dC2btDCglGzUftM3d5B+ZiBgGsMAcN8pMBfVYT0webWJVtvs5MZVAqPYYoqk7EauVzM9o5HWaLLqXhuuhuafF/6Fb/9Y/H5k4yDd3a9402ftqssIdgnJ4mduIOGdhUmTFf99wclzr5F71gnUpxOnd7aXJMPMqLL3qM23vEATrTtGskUPECzQSp8lrAvnxdfGax8tksc3CNWurRbTM47IQcb9uPRCchG5tNpxVF0UCuOQBDEk4Yfw5lmsqpjwZuB9VWWLCeN6+Skic9jKyeNeY4sD+m7yhIHo1tXWaJh6BnB6Q0mBJWmIjnmoH/rC0fzL365FG3LzhgcvEpKILvBSHpTJREifq/RGUzMmzeg12tbWk24KOs88SClDJ2AB+sy/yBNiTp8tRv0NXErwKqxEJEOcAXnF7OZ6KAYBrjmrNI5bi0+MJGOy4OOFPwT3eyaM+Md4T/ElFI4pqL5DwW6dH99DGun05ozU0fyGwbLSUNtO1a75VGFX2cCmir4CgNZjEnoRAfHFOss+73fcW0jocPAmSmtuWfwGGJSKEmHHGkuTekjRuJMw6om8g5u+6F6u2/r7XD43eFmex7woOg4gPvlw8EQFcki4Bqciscpi3C0ta+JcbjSmof5oePETaduHL5TpY4b9sic+ZpWvnYZSw49BWj2jST8JZdrvcKybUmSzj/pDYpn+vUcEjf/ccR6PRujK6oDJudQ6RjH8Rk7z9VTMQsbyYfdLd6lj49qXTvTs+cIAaJoSBpdlnxcAXsUvtdY40drgicd73khui7NOevHbEGakAnI+ztw+PMckNcWV76KQxGKH5Z1joXNkEEf44qfi/53QFeOMGx1ub8Oas4K1IFWqIkJqLjo4ALfCSi46AQX6b+QRTLgYgcAAA==";
4
+ export const TRACKER_RAW_BYTES = 1890;
5
+ export const TRACKER_GZIP_BYTES = 991;
6
+ //# sourceMappingURL=generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated.js","sourceRoot":"","sources":["../../src/tracker/generated.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,i5DAAi5D,CAAC;AACh7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,8yCAA8yC,CAAC;AACl1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC"}
@@ -0,0 +1,27 @@
1
+ type RastroProperty = string | number | boolean | null;
2
+ type RastroProperties = Record<string, RastroProperty>;
3
+ type RastroEventType = "pageview" | "click" | "custom" | "conversion" | "heartbeat" | "outbound";
4
+ interface RastroEvent {
5
+ eventId: string;
6
+ sessionId: string;
7
+ visitorId: string;
8
+ type: RastroEventType;
9
+ name?: string;
10
+ path: string;
11
+ referrer?: string;
12
+ timestamp: number;
13
+ sequence: number;
14
+ affiliateSlug?: string;
15
+ target?: string;
16
+ href?: string;
17
+ properties?: RastroProperties;
18
+ }
19
+ interface RastroContext {
20
+ sessionId: string;
21
+ visitorId: string;
22
+ }
23
+ type RastroCommand = (command: "event" | "context", value?: string, properties?: RastroProperties) => RastroContext | void;
24
+ interface RastroWindow extends Window {
25
+ rastro?: RastroCommand;
26
+ }
27
+ //# sourceMappingURL=tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.d.ts","sourceRoot":"","sources":["../../src/tracker/tracker.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AACvD,KAAK,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AACvD,KAAK,eAAe,GAChB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,YAAY,GACZ,WAAW,GACX,UAAU,CAAC;AAEf,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,UAAU,aAAa;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,aAAa,GAAG,CACnB,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,KAAK,CAAC,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,gBAAgB,KAC1B,aAAa,GAAG,IAAI,CAAC;AAE1B,UAAU,YAAa,SAAQ,MAAM;IACnC,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB"}
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ (() => {
3
+ const script = document.currentScript;
4
+ const siteId = script?.dataset.site;
5
+ const endpoint = script?.dataset.endpoint || script?.src.replace(/tracker\.js.*$/, "events");
6
+ if (!siteId || !endpoint)
7
+ return;
8
+ const createId = () => crypto.randomUUID?.() ||
9
+ `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;
10
+ let sessionId;
11
+ let affiliate;
12
+ try {
13
+ sessionId = sessionStorage._r || createId();
14
+ sessionStorage._r = sessionId;
15
+ affiliate =
16
+ new URLSearchParams(location.search).get("ref")?.slice(0, 64) ||
17
+ sessionStorage._a;
18
+ if (affiliate)
19
+ sessionStorage._a = affiliate;
20
+ }
21
+ catch {
22
+ sessionId = createId();
23
+ affiliate = new URLSearchParams(location.search)
24
+ .get("ref")
25
+ ?.slice(0, 64);
26
+ }
27
+ const visitorId = script.dataset.visitor || sessionId;
28
+ let sequence = 0;
29
+ let flushTimer;
30
+ const queue = [];
31
+ const referrer = document.referrer
32
+ ? new URL(document.referrer).origin
33
+ : undefined;
34
+ const flush = (beacon) => {
35
+ const events = queue.splice(0, 20);
36
+ if (!events.length)
37
+ return;
38
+ const body = new Blob([JSON.stringify({ siteId, events })], {
39
+ type: "application/json",
40
+ });
41
+ if (!beacon || !navigator.sendBeacon(endpoint, body)) {
42
+ void fetch(endpoint, { method: "POST", body, keepalive: true }).catch(() => {
43
+ // Best effort by design: analytics must never break the host page.
44
+ });
45
+ }
46
+ if (queue.length)
47
+ flush(beacon);
48
+ };
49
+ const emit = (type, name, extra) => {
50
+ const timestamp = Date.now();
51
+ queue.push({
52
+ eventId: `${sessionId}.${timestamp.toString(36)}.${sequence.toString(36)}`,
53
+ sessionId,
54
+ visitorId,
55
+ type,
56
+ name,
57
+ path: location.pathname.slice(0, 256) || "/",
58
+ referrer,
59
+ timestamp,
60
+ sequence: sequence++,
61
+ affiliateSlug: affiliate,
62
+ ...extra,
63
+ });
64
+ window.clearTimeout(flushTimer);
65
+ flushTimer = window.setTimeout(flush, 1_200);
66
+ };
67
+ const pageview = () => emit("pageview");
68
+ window.rastro = (command, value, properties) => {
69
+ if (command === "context")
70
+ return { sessionId, visitorId };
71
+ if (command === "event") {
72
+ emit("custom", `${value || "event"}`.slice(0, 80), { properties });
73
+ }
74
+ };
75
+ document.addEventListener("click", (event) => {
76
+ const element = event.target?.closest("a,button,[data-rastro-event]");
77
+ if (!element)
78
+ return;
79
+ const name = element.dataset.rastroEvent;
80
+ const href = element.href;
81
+ const url = href ? new URL(href, location.href) : undefined;
82
+ emit(name
83
+ ? "custom"
84
+ : url && url.origin !== location.origin
85
+ ? "outbound"
86
+ : "click", name, {
87
+ target: (element.dataset.rastroLabel || element.tagName).slice(0, 80),
88
+ href: url?.pathname.slice(0, 256),
89
+ });
90
+ }, { capture: true, passive: true });
91
+ const wrapHistory = (method) => {
92
+ const native = history[method];
93
+ history[method] = function (data, unused, url) {
94
+ native.call(history, data, unused, url);
95
+ queueMicrotask(pageview);
96
+ };
97
+ };
98
+ wrapHistory("pushState");
99
+ wrapHistory("replaceState");
100
+ addEventListener("popstate", pageview);
101
+ addEventListener("pagehide", () => flush(true));
102
+ setInterval(() => {
103
+ emit("heartbeat");
104
+ flush();
105
+ }, 20_000);
106
+ pageview();
107
+ })();
108
+ //# sourceMappingURL=tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracker.js","sourceRoot":"","sources":["../../src/tracker/tracker.ts"],"names":[],"mappings":";AAyCA,CAAC,GAAG,EAAE;IACJ,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAyC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,EAAE,OAAO,CAAC,QAAQ,IAAI,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IAC7F,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEjC,MAAM,QAAQ,GAAG,GAAG,EAAE,CACpB,MAAM,CAAC,UA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AAC;YACrE,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;SAClC,CACF,CAAC;IACJ,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CACjC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,MAAoC,EAAE,EAAE;QAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,GAAG,UAAU,IAAa,EAAE,MAAc,EAAE,GAAyB;YAClF,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YACxC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,WAAW,CAAC,WAAW,CAAC,CAAC;IACzB,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5B,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACvC,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,WAAW,CAAC,GAAG,EAAE;QACf,IAAI,CAAC,WAAW,CAAC,CAAC;QAClB,KAAK,EAAE,CAAC;IACV,CAAC,EAAE,MAAM,CAAC,CAAC;IACX,QAAQ,EAAE,CAAC;AACb,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";(()=>{const e=document.currentScript,t=e?.dataset.site,r=e?.dataset.endpoint||e?.src.replace(/tracker\.js.*$/,"events");if(!t||!r)return;const s=()=>crypto.randomUUID?.()||`${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;let n,o;try{n=sessionStorage._r||s(),sessionStorage._r=n,o=new URLSearchParams(location.search).get("ref")?.slice(0,64)||sessionStorage._a,o&&(sessionStorage._a=o)}catch{n=s(),o=new URLSearchParams(location.search).get("ref")?.slice(0,64)}const a=e.dataset.visitor||n;let i,c=0;const d=[],l=document.referrer?new URL(document.referrer).origin:void 0,p=e=>{const s=d.splice(0,20);if(!s.length)return;const n=new Blob([JSON.stringify({siteId:t,events:s})],{type:"application/json"});e&&navigator.sendBeacon(r,n)||fetch(r,{method:"POST",body:n,keepalive:1}).catch(()=>{}),d.length&&p(e)},u=(e,t,r)=>{const s=Date.now();d.push({eventId:`${n}.${s.toString(36)}.${c.toString(36)}`,sessionId:n,visitorId:a,type:e,name:t,path:location.pathname.slice(0,256)||"/",referrer:l,timestamp:s,sequence:c++,affiliateSlug:o,...r}),window.clearTimeout(i),i=window.setTimeout(p,1200)},h=()=>u("pageview");window.rastro=(e,t,r)=>{if("context"===e)return{sessionId:n,visitorId:a};"event"===e&&u("custom",`${t||"event"}`.slice(0,80),{properties:r})},document.addEventListener("click",e=>{const t=e.target?.closest("a,button,[data-rastro-event]");if(!t)return;const r=t.dataset.rastroEvent,s=t.href,n=s?new URL(s,location.href):void 0;u(r?"custom":n&&n.origin!==location.origin?"outbound":"click",r,{target:(t.dataset.rastroLabel||t.tagName).slice(0,80),href:n?.pathname.slice(0,256)})},{capture:1,passive:1});const g=e=>{const t=history[e];history[e]=function(e,r,s){t.call(history,e,r,s),queueMicrotask(h)}};g("pushState"),g("replaceState"),addEventListener("popstate",h),addEventListener("pagehide",()=>p(1)),setInterval(()=>{u("heartbeat"),p()},2e4),h()})();
package/package.json ADDED
@@ -0,0 +1,121 @@
1
+ {
2
+ "name": "@iann29/rastro",
3
+ "description": "Privacy-first, real-time web analytics for Convex: live visitor atlas, journeys, revenue, goals, funnels, affiliates, and a sub-1KB tracker.",
4
+ "repository": "github:amageweb/amage-rastro",
5
+ "homepage": "https://github.com/amageweb/amage-rastro#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/amageweb/amage-rastro/issues"
8
+ },
9
+ "version": "0.1.0-alpha.0",
10
+ "license": "Apache-2.0",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "keywords": [
15
+ "convex",
16
+ "convex-component",
17
+ "analytics",
18
+ "realtime",
19
+ "privacy",
20
+ "cookieless",
21
+ "session-journey",
22
+ "conversion-tracking",
23
+ "affiliate"
24
+ ],
25
+ "type": "module",
26
+ "unpkg": "./dist/tracker.min.js",
27
+ "jsdelivr": "./dist/tracker.min.js",
28
+ "scripts": {
29
+ "dev": "synapse dev --start 'npm run dev:build'",
30
+ "dev:frontend": "cd example && vite",
31
+ "dev:build": "chokidar 'tsconfig*.json' 'src/**/*.{ts,js}' 'scripts/build-tracker.mjs' -i '**/*.test.ts' -c 'npm run build:codegen' --initial",
32
+ "predev": "npm run build:codegen",
33
+ "build": "npm run build:tracker && tsc --project ./tsconfig.build.json",
34
+ "build:tracker": "node ./scripts/build-tracker.mjs",
35
+ "build:codegen": "synapse convex codegen --component-dir ./src/component && npm run build",
36
+ "build:clean": "rm -rf dist *.tsbuildinfo && npm run build:codegen",
37
+ "typecheck": "tsc --noEmit && tsc -p example && tsc -p example/convex",
38
+ "lint": "eslint .",
39
+ "test": "vitest run --typecheck",
40
+ "test:watch": "vitest --typecheck --clearScreen false",
41
+ "test:debug": "vitest --inspect-brk --no-file-parallelism",
42
+ "test:coverage": "vitest run --coverage --coverage.reporter=text",
43
+ "prepare": "npm run build",
44
+ "preversion": "npm ci && npm run build:clean && npm run test && npm run lint && npm run typecheck",
45
+ "alpha": "npm version prerelease --preid alpha && npm publish --tag alpha && git push --follow-tags",
46
+ "release": "npm version patch && npm publish && git push --follow-tags",
47
+ "version": "(npm whoami || npm login) && vim -c 'normal o' -c 'normal o## '$npm_package_version CHANGELOG.md && prettier -w CHANGELOG.md && git add CHANGELOG.md"
48
+ },
49
+ "files": [
50
+ "dist",
51
+ "src/test.ts",
52
+ "src/component/**/*.ts",
53
+ "!src/component/**/*.test.ts",
54
+ "assets/rastro-live-atlas.png"
55
+ ],
56
+ "exports": {
57
+ "./package.json": "./package.json",
58
+ ".": {
59
+ "types": "./dist/client/index.d.ts",
60
+ "default": "./dist/client/index.js"
61
+ },
62
+ "./react": {
63
+ "types": "./dist/react/index.d.ts",
64
+ "default": "./dist/react/index.js"
65
+ },
66
+ "./tracker.js": "./dist/tracker.min.js",
67
+ "./test": "./src/test.ts",
68
+ "./_generated/component.js": {
69
+ "types": "./dist/component/_generated/component.d.ts"
70
+ },
71
+ "./_generated/component": {
72
+ "types": "./dist/component/_generated/component.d.ts"
73
+ },
74
+ "./convex.config.js": {
75
+ "types": "./dist/component/convex.config.d.ts",
76
+ "default": "./dist/component/convex.config.js"
77
+ },
78
+ "./convex.config": {
79
+ "types": "./dist/component/convex.config.d.ts",
80
+ "default": "./dist/component/convex.config.js"
81
+ }
82
+ },
83
+ "peerDependencies": {
84
+ "convex": "^1.43.0",
85
+ "react": "^18.3.1 || ^19.0.0"
86
+ },
87
+ "devDependencies": {
88
+ "@convex-dev/eslint-plugin": "^4.0.0",
89
+ "@edge-runtime/vm": "^5.0.0",
90
+ "@eslint/eslintrc": "^3.3.6",
91
+ "@eslint/js": "9.39.5",
92
+ "@fontsource-variable/instrument-sans": "^5.3.0",
93
+ "@fontsource/ibm-plex-mono": "^5.3.0",
94
+ "@types/node": "^24.13.3",
95
+ "@types/react": "^19.2.18",
96
+ "@types/react-dom": "^19.2.4",
97
+ "@typescript/native": "npm:typescript@^7.0.2",
98
+ "@vitejs/plugin-react": "^6.0.5",
99
+ "chokidar-cli": "3.0.0",
100
+ "convex": "^1.44.0",
101
+ "convex-test": "0.0.55",
102
+ "eslint": "9.39.5",
103
+ "eslint-plugin-react": "^7.37.5",
104
+ "eslint-plugin-react-hooks": "^7.1.1",
105
+ "eslint-plugin-react-refresh": "^0.5.3",
106
+ "globals": "^17.9.0",
107
+ "lucide-react": "^1.32.0",
108
+ "maplibre-gl": "^6.4.1",
109
+ "pkg-pr-new": "^0.0.86",
110
+ "prettier": "3.9.6",
111
+ "react": "^19.2.8",
112
+ "react-dom": "^19.2.8",
113
+ "terser": "^5.50.0",
114
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
115
+ "typescript-eslint": "8.66.0",
116
+ "vite": "8.2.0",
117
+ "vitest": "4.1.10"
118
+ },
119
+ "types": "./dist/client/index.d.ts",
120
+ "module": "./dist/client/index.js"
121
+ }
@@ -0,0 +1,76 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+
11
+ import type * as affiliates from "../affiliates.js";
12
+ import type * as constants from "../constants.js";
13
+ import type * as errors from "../errors.js";
14
+ import type * as funnels from "../funnels.js";
15
+ import type * as goals from "../goals.js";
16
+ import type * as guards from "../guards.js";
17
+ import type * as http from "../http.js";
18
+ import type * as ingest from "../ingest.js";
19
+ import type * as live from "../live.js";
20
+ import type * as reports from "../reports.js";
21
+ import type * as retention from "../retention.js";
22
+ import type * as sanitize from "../sanitize.js";
23
+ import type * as sites from "../sites.js";
24
+ import type * as validators from "../validators.js";
25
+
26
+ import type {
27
+ ApiFromModules,
28
+ FilterApi,
29
+ FunctionReference,
30
+ } from "convex/server";
31
+ import { anyApi, componentsGeneric } from "convex/server";
32
+
33
+ const fullApi: ApiFromModules<{
34
+ affiliates: typeof affiliates;
35
+ constants: typeof constants;
36
+ errors: typeof errors;
37
+ funnels: typeof funnels;
38
+ goals: typeof goals;
39
+ guards: typeof guards;
40
+ http: typeof http;
41
+ ingest: typeof ingest;
42
+ live: typeof live;
43
+ reports: typeof reports;
44
+ retention: typeof retention;
45
+ sanitize: typeof sanitize;
46
+ sites: typeof sites;
47
+ validators: typeof validators;
48
+ }> = anyApi as any;
49
+
50
+ /**
51
+ * A utility for referencing Convex functions in your app's public API.
52
+ *
53
+ * Usage:
54
+ * ```js
55
+ * const myFunctionReference = api.myModule.myFunction;
56
+ * ```
57
+ */
58
+ export const api: FilterApi<
59
+ typeof fullApi,
60
+ FunctionReference<any, "public">
61
+ > = anyApi as any;
62
+
63
+ /**
64
+ * A utility for referencing Convex functions in your app's internal API.
65
+ *
66
+ * Usage:
67
+ * ```js
68
+ * const myFunctionReference = internal.myModule.myFunction;
69
+ * ```
70
+ */
71
+ export const internal: FilterApi<
72
+ typeof fullApi,
73
+ FunctionReference<any, "internal">
74
+ > = anyApi as any;
75
+
76
+ export const components = componentsGeneric() as unknown as {};