@agentuity/frontend 0.1.7 → 0.1.8
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.
- package/dist/beacon-script.js +1 -1
- package/dist/beacon.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -1
- package/src/types.ts +27 -0
package/dist/beacon-script.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Auto-generated - do not edit
|
|
2
2
|
// Minified analytics beacon script (overwrites TypeScript output)
|
|
3
|
-
export const BEACON_SCRIPT = "/* @agentuity/frontend v0.1.
|
|
3
|
+
export const BEACON_SCRIPT = "/* @agentuity/frontend v0.1.8 */\n(()=>{function A(X){if(X===void 0||X===null)return\"\";try{let V=new WeakSet;return JSON.stringify(X,(Y,Z)=>{if(typeof Z===\"object\"&&Z!==null){if(V.has(Z))return\"[Circular]\";V.add(Z)}return Z})}catch(V){let Y=V instanceof Error?V.message:String(V);return console.warn(\"[Agentuity Analytics] Failed to stringify properties:\",Y),`[unserializable: ${Y}]`}}(function(){let X=window,V=document,Y=X.__AGENTUITY_ANALYTICS__;if(!Y||!Y.enabled)return;let Z=X;if(Y.isDevmode)console.debug(\"[Agentuity Analytics] Script loaded, init flag:\",Z.__AGENTUITY_BEACON_INIT__,\"path:\",location.pathname);if(Z.__AGENTUITY_BEACON_INIT__){if(Y.isDevmode)console.debug(\"[Agentuity Analytics] Already initialized, skipping\");return}Z.__AGENTUITY_BEACON_INIT__=!0;let J=Y,K=null,z=!1,C=Date.now(),Q=\"\",M={},q={id:\"\",timestamp:0,timezone_offset:0,url:\"\",path:\"\",referrer:\"\",title:\"\",screen_width:0,screen_height:0,viewport_width:0,viewport_height:0,device_pixel_ratio:1,user_agent:\"\",language:\"\",scroll_depth:0,time_on_page:0,scroll_events:[],custom_events:[]};function O(){return crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function T(){let x=new URLSearchParams(location.search),B={};return[\"utm_source\",\"utm_medium\",\"utm_campaign\",\"utm_term\",\"utm_content\"].forEach((G)=>{let W=x.get(G);if(W)B[G]=W}),B}function F(x){if(!x)return\"\";try{let B=new URL(x);return B.origin+B.pathname}catch{return x.split(\"?\")[0]}}function U(){q.id=O(),q.timestamp=Date.now(),q.timezone_offset=new Date().getTimezoneOffset(),q.url=F(location.href),q.path=location.pathname,q.referrer=F(V.referrer),q.title=V.title||\"\",q.screen_width=screen.width||0,q.screen_height=screen.height||0,q.viewport_width=innerWidth||0,q.viewport_height=innerHeight||0,q.device_pixel_ratio=devicePixelRatio||1,q.user_agent=navigator.userAgent||\"\",q.language=navigator.language||\"\";let x=T();for(let B in x)q[B]=x[B];if(q.scroll_events=[],q.custom_events=[],q.scroll_depth=0,z=!1,C=Date.now(),typeof performance<\"u\"&&performance.getEntriesByType){let B=performance.getEntriesByType(\"navigation\")[0];if(B)if(q.dom_ready=Math.round(B.domContentLoadedEventEnd-B.startTime),q.ttfb=Math.round(B.responseStart-B.requestStart),B.loadEventEnd>0)q.load_time=Math.round(B.loadEventEnd-B.startTime);else setTimeout(()=>{let G=performance.getEntriesByType(\"navigation\")[0];if(G&&G.loadEventEnd>0)q.load_time=Math.round(G.loadEventEnd-G.startTime)},0)}if(J.isDevmode)console.debug(\"[Agentuity Analytics] Session started (full init):\",q.id)}function j(){if(q.id=O(),q.timestamp=Date.now(),q.scroll_events=[],q.custom_events=[],q.scroll_depth=0,q.time_on_page=0,z=!1,C=Date.now(),J.isDevmode)console.debug(\"[Agentuity Analytics] Session started (soft reset):\",q.id)}fetch(\"https://agentuity.sh/location\").then((x)=>x.json()).then((x)=>{K=x;try{sessionStorage.setItem(\"agentuity_geo\",JSON.stringify(x))}catch{}}).catch(()=>{try{let x=sessionStorage.getItem(\"agentuity_geo\");if(x)K=JSON.parse(x)}catch{}});try{let x=sessionStorage.getItem(\"agentuity_geo\");if(x)K=JSON.parse(x)}catch{}function N(){return X.__AGENTUITY_SESSION__}function L(x=!1){if(z&&!x){if(J.isDevmode)console.debug(\"[Agentuity Analytics] send() skipped - already sent\");return}if(J.sampleRate!==void 0&&J.sampleRate<1&&Math.random()>J.sampleRate)return;if(z=!0,q.time_on_page=Date.now()-C,K){if(q.country=K.country||\"\",K.country_latitude)q.country_latitude=parseFloat(String(K.country_latitude));if(K.country_longitude)q.country_longitude=parseFloat(String(K.country_longitude));if(q.region=K.region||\"\",K.region_latitude)q.region_latitude=parseFloat(String(K.region_latitude));if(K.region_longitude)q.region_longitude=parseFloat(String(K.region_longitude));if(q.city=K.city||\"\",K.city_latitude)q.city_latitude=parseFloat(String(K.city_latitude));if(K.city_longitude)q.city_longitude=parseFloat(String(K.city_longitude));if(q.timezone=K.timezone||\"\",K.latitude)q.latitude=parseFloat(String(K.latitude));if(K.longitude)q.longitude=parseFloat(String(K.longitude))}if(q.cls)q.cls=Math.round(q.cls*1000)/1000;let B=N(),G=localStorage.getItem(\"agentuity_visitor_id\")||\"vid_\"+O();try{localStorage.setItem(\"agentuity_visitor_id\",G)}catch{}let W={org_id:J.orgId,project_id:J.projectId,thread_id:B?.threadId||\"\",visitor_id:G,user_id:Q,user_traits:M,is_devmode:J.isDevmode,pageview:q};try{sessionStorage.removeItem(\"agentuity_pending_pageview\")}catch{}if(J.isDevmode){console.debug(\"[Agentuity Analytics]\",JSON.stringify(W,null,2));return}let _=JSON.stringify(W);if(navigator.sendBeacon)navigator.sendBeacon(\"/_agentuity/webanalytics/collect\",_);else fetch(\"/_agentuity/webanalytics/collect\",{method:\"POST\",body:_,keepalive:!0}).catch(()=>{})}if(V.addEventListener(\"visibilitychange\",()=>{if(J.isDevmode)console.debug(\"[Agentuity Analytics] visibilitychange:\",V.visibilityState,\"sent:\",z);if(V.visibilityState===\"hidden\")L();else if(V.visibilityState===\"visible\")j()}),X.addEventListener(\"pagehide\",()=>{if(J.isDevmode){console.debug(\"[Agentuity Analytics] pagehide event\");try{sessionStorage.setItem(\"agentuity_last_event\",`pagehide:${Date.now()}:${q.path}`)}catch{}}L()}),X.addEventListener(\"beforeunload\",()=>{if(J.isDevmode){console.debug(\"[Agentuity Analytics] beforeunload event\");try{sessionStorage.setItem(\"agentuity_last_event\",`beforeunload:${Date.now()}:${q.path}`)}catch{}}L()}),J.isDevmode)try{let x=sessionStorage.getItem(\"agentuity_last_event\");if(x)console.debug(\"[Agentuity Analytics] Previous page event:\",x),sessionStorage.removeItem(\"agentuity_last_event\")}catch{}try{let x=sessionStorage.getItem(\"agentuity_pending_pageview\");if(x){sessionStorage.removeItem(\"agentuity_pending_pageview\");let B=JSON.parse(x);if(B.pageview?.path!==location.pathname)if(J.isDevmode)console.debug(\"[Agentuity Analytics] Sending unsent data from previous page:\",B.pageview?.path),console.debug(\"[Agentuity Analytics]\",JSON.stringify(B,null,2));else{let G=JSON.stringify(B);if(navigator.sendBeacon)navigator.sendBeacon(\"/_agentuity/webanalytics/collect\",G)}}}catch{}function H(){try{q.time_on_page=Date.now()-C;let x=N(),B=localStorage.getItem(\"agentuity_visitor_id\")||\"vid_\"+O(),G={org_id:J.orgId,project_id:J.projectId,thread_id:x?.threadId||\"\",visitor_id:B,user_id:Q,user_traits:M,is_devmode:J.isDevmode,pageview:{...q}};sessionStorage.setItem(\"agentuity_pending_pageview\",JSON.stringify(G))}catch{}}if(setInterval(H,2000),V.addEventListener(\"click\",H,{passive:!0}),V.addEventListener(\"scroll\",H,{passive:!0,once:!0}),J.isDevmode)console.debug(\"[Agentuity Analytics] Beacon initialized, visibility:\",V.visibilityState);if(J.trackScroll!==!1){let B=function(){let G=X.scrollY||V.documentElement.scrollTop,W=V.documentElement.scrollHeight-V.documentElement.clientHeight;return W<=0?100:Math.min(100,Math.round(G/W*100))};var D=B;let x=new Set;X.addEventListener(\"scroll\",()=>{let G=B();if(G>q.scroll_depth)q.scroll_depth=G;[25,50,75,100].forEach((W)=>{if(G>=W&&!x.has(W))x.add(W),q.scroll_events.push({depth:W,timestamp:Date.now()-C})})},{passive:!0})}if(J.trackWebVitals!==!1&&typeof PerformanceObserver<\"u\"){try{let x=new PerformanceObserver((B)=>{B.getEntries().forEach((G)=>{if(G.name===\"first-contentful-paint\")q.fcp=Math.round(G.startTime),x.disconnect()})});x.observe({type:\"paint\",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{let B=x.getEntries();if(B.length)q.lcp=Math.round(B[B.length-1].startTime)}).observe({type:\"largest-contentful-paint\",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{x.getEntries().forEach((B)=>{let G=B;if(!G.hadRecentInput&&G.value)q.cls=(q.cls||0)+G.value})}).observe({type:\"layout-shift\",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{x.getEntries().forEach((B)=>{let G=B;if(G.duration&&G.duration>(q.inp||0))q.inp=Math.round(G.duration)})}).observe({type:\"event\",buffered:!0})}catch{}}if(J.trackSPANavigation!==!1){let _=function(){let $=location.pathname+location.search;if($!==G){if(J.isDevmode)console.debug(\"[Agentuity Analytics] SPA navigation:\",G,\"->\",$);L(!0),G=$,W=location.href,U()}};var R=_;let{pushState:x,replaceState:B}=history,G=location.pathname+location.search,W=location.href;if(J.isDevmode)console.debug(\"[Agentuity Analytics] SPA tracking enabled, initial path:\",G);history.pushState=function(...$){x.apply(this,$),setTimeout(_,0)},history.replaceState=function(...$){B.apply(this,$),setTimeout(_,0)},X.addEventListener(\"popstate\",_),setInterval(()=>{if(location.href!==W)W=location.href,_()},200)}if(J.trackClicks!==!1)V.addEventListener(\"click\",(x)=>{let B=x.target;if(!B)return;let G=B.closest(\"[data-analytics]\");if(!G)return;if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:\"click:\"+G.getAttribute(\"data-analytics\"),data:\"\"})},!0);if(J.trackErrors!==!1)X.addEventListener(\"error\",(x)=>{if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:\"error:js_error\",data:JSON.stringify({message:x.message||\"Unknown\",filename:x.filename||\"\",lineno:x.lineno||0})})}),X.addEventListener(\"unhandledrejection\",(x)=>{if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:\"error:unhandled_rejection\",data:JSON.stringify({message:x.reason instanceof Error?x.reason.message:String(x.reason)})})});if(V.readyState===\"complete\")U();else X.addEventListener(\"load\",U);X.agentuityAnalytics={track(x,B){if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:x,data:A(B)})},identify(x,B){if(Q=x,B){M={};for(let[G,W]of Object.entries(B))M[G]=String(W)}},flush:()=>L(!0)}})();})();\n";
|
|
4
4
|
|
|
5
5
|
export function validateBeaconScript() {
|
|
6
6
|
if (!BEACON_SCRIPT || BEACON_SCRIPT.length === 0) {
|
package/dist/beacon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* @agentuity/frontend v0.1.
|
|
1
|
+
/* @agentuity/frontend v0.1.8 */
|
|
2
2
|
(()=>{function A(X){if(X===void 0||X===null)return"";try{let V=new WeakSet;return JSON.stringify(X,(Y,Z)=>{if(typeof Z==="object"&&Z!==null){if(V.has(Z))return"[Circular]";V.add(Z)}return Z})}catch(V){let Y=V instanceof Error?V.message:String(V);return console.warn("[Agentuity Analytics] Failed to stringify properties:",Y),`[unserializable: ${Y}]`}}(function(){let X=window,V=document,Y=X.__AGENTUITY_ANALYTICS__;if(!Y||!Y.enabled)return;let Z=X;if(Y.isDevmode)console.debug("[Agentuity Analytics] Script loaded, init flag:",Z.__AGENTUITY_BEACON_INIT__,"path:",location.pathname);if(Z.__AGENTUITY_BEACON_INIT__){if(Y.isDevmode)console.debug("[Agentuity Analytics] Already initialized, skipping");return}Z.__AGENTUITY_BEACON_INIT__=!0;let J=Y,K=null,z=!1,C=Date.now(),Q="",M={},q={id:"",timestamp:0,timezone_offset:0,url:"",path:"",referrer:"",title:"",screen_width:0,screen_height:0,viewport_width:0,viewport_height:0,device_pixel_ratio:1,user_agent:"",language:"",scroll_depth:0,time_on_page:0,scroll_events:[],custom_events:[]};function O(){return crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function T(){let x=new URLSearchParams(location.search),B={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach((G)=>{let W=x.get(G);if(W)B[G]=W}),B}function F(x){if(!x)return"";try{let B=new URL(x);return B.origin+B.pathname}catch{return x.split("?")[0]}}function U(){q.id=O(),q.timestamp=Date.now(),q.timezone_offset=new Date().getTimezoneOffset(),q.url=F(location.href),q.path=location.pathname,q.referrer=F(V.referrer),q.title=V.title||"",q.screen_width=screen.width||0,q.screen_height=screen.height||0,q.viewport_width=innerWidth||0,q.viewport_height=innerHeight||0,q.device_pixel_ratio=devicePixelRatio||1,q.user_agent=navigator.userAgent||"",q.language=navigator.language||"";let x=T();for(let B in x)q[B]=x[B];if(q.scroll_events=[],q.custom_events=[],q.scroll_depth=0,z=!1,C=Date.now(),typeof performance<"u"&&performance.getEntriesByType){let B=performance.getEntriesByType("navigation")[0];if(B)if(q.dom_ready=Math.round(B.domContentLoadedEventEnd-B.startTime),q.ttfb=Math.round(B.responseStart-B.requestStart),B.loadEventEnd>0)q.load_time=Math.round(B.loadEventEnd-B.startTime);else setTimeout(()=>{let G=performance.getEntriesByType("navigation")[0];if(G&&G.loadEventEnd>0)q.load_time=Math.round(G.loadEventEnd-G.startTime)},0)}if(J.isDevmode)console.debug("[Agentuity Analytics] Session started (full init):",q.id)}function j(){if(q.id=O(),q.timestamp=Date.now(),q.scroll_events=[],q.custom_events=[],q.scroll_depth=0,q.time_on_page=0,z=!1,C=Date.now(),J.isDevmode)console.debug("[Agentuity Analytics] Session started (soft reset):",q.id)}fetch("https://agentuity.sh/location").then((x)=>x.json()).then((x)=>{K=x;try{sessionStorage.setItem("agentuity_geo",JSON.stringify(x))}catch{}}).catch(()=>{try{let x=sessionStorage.getItem("agentuity_geo");if(x)K=JSON.parse(x)}catch{}});try{let x=sessionStorage.getItem("agentuity_geo");if(x)K=JSON.parse(x)}catch{}function N(){return X.__AGENTUITY_SESSION__}function L(x=!1){if(z&&!x){if(J.isDevmode)console.debug("[Agentuity Analytics] send() skipped - already sent");return}if(J.sampleRate!==void 0&&J.sampleRate<1&&Math.random()>J.sampleRate)return;if(z=!0,q.time_on_page=Date.now()-C,K){if(q.country=K.country||"",K.country_latitude)q.country_latitude=parseFloat(String(K.country_latitude));if(K.country_longitude)q.country_longitude=parseFloat(String(K.country_longitude));if(q.region=K.region||"",K.region_latitude)q.region_latitude=parseFloat(String(K.region_latitude));if(K.region_longitude)q.region_longitude=parseFloat(String(K.region_longitude));if(q.city=K.city||"",K.city_latitude)q.city_latitude=parseFloat(String(K.city_latitude));if(K.city_longitude)q.city_longitude=parseFloat(String(K.city_longitude));if(q.timezone=K.timezone||"",K.latitude)q.latitude=parseFloat(String(K.latitude));if(K.longitude)q.longitude=parseFloat(String(K.longitude))}if(q.cls)q.cls=Math.round(q.cls*1000)/1000;let B=N(),G=localStorage.getItem("agentuity_visitor_id")||"vid_"+O();try{localStorage.setItem("agentuity_visitor_id",G)}catch{}let W={org_id:J.orgId,project_id:J.projectId,thread_id:B?.threadId||"",visitor_id:G,user_id:Q,user_traits:M,is_devmode:J.isDevmode,pageview:q};try{sessionStorage.removeItem("agentuity_pending_pageview")}catch{}if(J.isDevmode){console.debug("[Agentuity Analytics]",JSON.stringify(W,null,2));return}let _=JSON.stringify(W);if(navigator.sendBeacon)navigator.sendBeacon("/_agentuity/webanalytics/collect",_);else fetch("/_agentuity/webanalytics/collect",{method:"POST",body:_,keepalive:!0}).catch(()=>{})}if(V.addEventListener("visibilitychange",()=>{if(J.isDevmode)console.debug("[Agentuity Analytics] visibilitychange:",V.visibilityState,"sent:",z);if(V.visibilityState==="hidden")L();else if(V.visibilityState==="visible")j()}),X.addEventListener("pagehide",()=>{if(J.isDevmode){console.debug("[Agentuity Analytics] pagehide event");try{sessionStorage.setItem("agentuity_last_event",`pagehide:${Date.now()}:${q.path}`)}catch{}}L()}),X.addEventListener("beforeunload",()=>{if(J.isDevmode){console.debug("[Agentuity Analytics] beforeunload event");try{sessionStorage.setItem("agentuity_last_event",`beforeunload:${Date.now()}:${q.path}`)}catch{}}L()}),J.isDevmode)try{let x=sessionStorage.getItem("agentuity_last_event");if(x)console.debug("[Agentuity Analytics] Previous page event:",x),sessionStorage.removeItem("agentuity_last_event")}catch{}try{let x=sessionStorage.getItem("agentuity_pending_pageview");if(x){sessionStorage.removeItem("agentuity_pending_pageview");let B=JSON.parse(x);if(B.pageview?.path!==location.pathname)if(J.isDevmode)console.debug("[Agentuity Analytics] Sending unsent data from previous page:",B.pageview?.path),console.debug("[Agentuity Analytics]",JSON.stringify(B,null,2));else{let G=JSON.stringify(B);if(navigator.sendBeacon)navigator.sendBeacon("/_agentuity/webanalytics/collect",G)}}}catch{}function H(){try{q.time_on_page=Date.now()-C;let x=N(),B=localStorage.getItem("agentuity_visitor_id")||"vid_"+O(),G={org_id:J.orgId,project_id:J.projectId,thread_id:x?.threadId||"",visitor_id:B,user_id:Q,user_traits:M,is_devmode:J.isDevmode,pageview:{...q}};sessionStorage.setItem("agentuity_pending_pageview",JSON.stringify(G))}catch{}}if(setInterval(H,2000),V.addEventListener("click",H,{passive:!0}),V.addEventListener("scroll",H,{passive:!0,once:!0}),J.isDevmode)console.debug("[Agentuity Analytics] Beacon initialized, visibility:",V.visibilityState);if(J.trackScroll!==!1){let B=function(){let G=X.scrollY||V.documentElement.scrollTop,W=V.documentElement.scrollHeight-V.documentElement.clientHeight;return W<=0?100:Math.min(100,Math.round(G/W*100))};var D=B;let x=new Set;X.addEventListener("scroll",()=>{let G=B();if(G>q.scroll_depth)q.scroll_depth=G;[25,50,75,100].forEach((W)=>{if(G>=W&&!x.has(W))x.add(W),q.scroll_events.push({depth:W,timestamp:Date.now()-C})})},{passive:!0})}if(J.trackWebVitals!==!1&&typeof PerformanceObserver<"u"){try{let x=new PerformanceObserver((B)=>{B.getEntries().forEach((G)=>{if(G.name==="first-contentful-paint")q.fcp=Math.round(G.startTime),x.disconnect()})});x.observe({type:"paint",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{let B=x.getEntries();if(B.length)q.lcp=Math.round(B[B.length-1].startTime)}).observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{x.getEntries().forEach((B)=>{let G=B;if(!G.hadRecentInput&&G.value)q.cls=(q.cls||0)+G.value})}).observe({type:"layout-shift",buffered:!0})}catch{}try{new PerformanceObserver((x)=>{x.getEntries().forEach((B)=>{let G=B;if(G.duration&&G.duration>(q.inp||0))q.inp=Math.round(G.duration)})}).observe({type:"event",buffered:!0})}catch{}}if(J.trackSPANavigation!==!1){let _=function(){let $=location.pathname+location.search;if($!==G){if(J.isDevmode)console.debug("[Agentuity Analytics] SPA navigation:",G,"->",$);L(!0),G=$,W=location.href,U()}};var R=_;let{pushState:x,replaceState:B}=history,G=location.pathname+location.search,W=location.href;if(J.isDevmode)console.debug("[Agentuity Analytics] SPA tracking enabled, initial path:",G);history.pushState=function(...$){x.apply(this,$),setTimeout(_,0)},history.replaceState=function(...$){B.apply(this,$),setTimeout(_,0)},X.addEventListener("popstate",_),setInterval(()=>{if(location.href!==W)W=location.href,_()},200)}if(J.trackClicks!==!1)V.addEventListener("click",(x)=>{let B=x.target;if(!B)return;let G=B.closest("[data-analytics]");if(!G)return;if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:"click:"+G.getAttribute("data-analytics"),data:""})},!0);if(J.trackErrors!==!1)X.addEventListener("error",(x)=>{if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:"error:js_error",data:JSON.stringify({message:x.message||"Unknown",filename:x.filename||"",lineno:x.lineno||0})})}),X.addEventListener("unhandledrejection",(x)=>{if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:"error:unhandled_rejection",data:JSON.stringify({message:x.reason instanceof Error?x.reason.message:String(x.reason)})})});if(V.readyState==="complete")U();else X.addEventListener("load",U);X.agentuityAnalytics={track(x,B){if(q.custom_events.length<1000)q.custom_events.push({timestamp:Date.now(),name:x,data:A(B)})},identify(x,B){if(Q=x,B){M={};for(let[G,W]of Object.entries(B))M[G]=String(W)}},flush:()=>L(!0)}})();})();
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { getProcessEnv } from './env';
|
|
|
2
2
|
export { buildUrl, defaultBaseUrl } from './url';
|
|
3
3
|
export { deserializeData } from './serialization';
|
|
4
4
|
export { createReconnectManager, type ReconnectOptions, type ReconnectManager } from './reconnect';
|
|
5
|
-
export { type RouteRegistry, type WebSocketRouteRegistry, type SSERouteRegistry } from './types';
|
|
5
|
+
export { type RouteRegistry, type WebSocketRouteRegistry, type SSERouteRegistry, type RPCRouteRegistry, } from './types';
|
|
6
6
|
export { jsonEqual } from './memo';
|
|
7
7
|
export { WebSocketManager, type MessageHandler as WebSocketMessageHandler, type WebSocketCallbacks, type WebSocketManagerOptions, type WebSocketManagerState, } from './websocket-manager';
|
|
8
8
|
export { EventStreamManager, type MessageHandler as EventStreamMessageHandler, type EventStreamCallbacks, type EventStreamManagerOptions, type EventStreamManagerState, } from './eventstream-manager';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACN,gBAAgB,EAChB,KAAK,cAAc,IAAI,uBAAuB,EAC9C,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,kBAAkB,EAClB,KAAK,cAAc,IAAI,yBAAyB,EAChD,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,GAC5B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACX,MAAM,EACN,aAAa,EACb,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,GACZ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACN,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,WAAW,GAChB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAgD,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAgD,MAAM,aAAa,CAAC;AAOnG,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACN,gBAAgB,GAKhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,kBAAkB,GAKlB,MAAM,uBAAuB,CAAC;AAE/B,uDAAuD;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAW9C,2EAA2E;AAC3E,OAAO,EACN,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,UAAU,EACV,SAAS,EACT,YAAY,GAQZ,MAAM,aAAa,CAAC;AAErB,8CAA8C;AAC9C,wEAAwE;AACxE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Route registry containing all typed API routes in the application.
|
|
3
3
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
7
|
+
* The augmentation provides type-safe routing for useAPI and other hooks.
|
|
4
8
|
*/
|
|
5
9
|
export interface RouteRegistry {
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
12
|
* WebSocket route registry containing all typed WebSocket routes in the application.
|
|
9
13
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
17
|
+
* The augmentation provides type-safe routing for useWebsocket and other hooks.
|
|
10
18
|
*/
|
|
11
19
|
export interface WebSocketRouteRegistry {
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
22
|
* SSE route registry containing all typed SSE routes in the application.
|
|
15
23
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
27
|
+
* The augmentation provides type-safe routing for useEventStream and other hooks.
|
|
16
28
|
*/
|
|
17
29
|
export interface SSERouteRegistry {
|
|
18
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* RPC route registry containing all typed RPC routes in the application.
|
|
33
|
+
* Used by createClient() and createAPIClient() for type-safe RPC-style API calls.
|
|
34
|
+
* Auto-generated by the build tool from route discovery.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
38
|
+
* The augmentation provides type-safe routing for createClient and createAPIClient.
|
|
39
|
+
*/
|
|
40
|
+
export interface RPCRouteRegistry {
|
|
41
|
+
}
|
|
19
42
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;CAG7B;AAED;;;;;;;GAOG;AAEH,MAAM,WAAW,sBAAsB;CAGtC;AAED;;;;;;;GAOG;AAEH,MAAM,WAAW,gBAAgB;CAGhC;AAED;;;;;;;;GAQG;AAEH,MAAM,WAAW,gBAAgB;CAGhC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/frontend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"prepublishOnly": "bun run clean && bun run build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@agentuity/core": "0.1.
|
|
29
|
+
"@agentuity/core": "0.1.8"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@agentuity/test-utils": "0.1.
|
|
32
|
+
"@agentuity/test-utils": "0.1.8",
|
|
33
33
|
"@types/bun": "latest",
|
|
34
34
|
"bun-types": "latest",
|
|
35
35
|
"typescript": "^5.9.0"
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,12 @@ export { getProcessEnv } from './env';
|
|
|
2
2
|
export { buildUrl, defaultBaseUrl } from './url';
|
|
3
3
|
export { deserializeData } from './serialization';
|
|
4
4
|
export { createReconnectManager, type ReconnectOptions, type ReconnectManager } from './reconnect';
|
|
5
|
-
export {
|
|
5
|
+
export {
|
|
6
|
+
type RouteRegistry,
|
|
7
|
+
type WebSocketRouteRegistry,
|
|
8
|
+
type SSERouteRegistry,
|
|
9
|
+
type RPCRouteRegistry,
|
|
10
|
+
} from './types';
|
|
6
11
|
export { jsonEqual } from './memo';
|
|
7
12
|
export {
|
|
8
13
|
WebSocketManager,
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Route registry containing all typed API routes in the application.
|
|
3
3
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
7
|
+
* The augmentation provides type-safe routing for useAPI and other hooks.
|
|
4
8
|
*/
|
|
5
9
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
6
10
|
export interface RouteRegistry {
|
|
@@ -11,6 +15,10 @@ export interface RouteRegistry {
|
|
|
11
15
|
/**
|
|
12
16
|
* WebSocket route registry containing all typed WebSocket routes in the application.
|
|
13
17
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
21
|
+
* The augmentation provides type-safe routing for useWebsocket and other hooks.
|
|
14
22
|
*/
|
|
15
23
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
16
24
|
export interface WebSocketRouteRegistry {
|
|
@@ -21,9 +29,28 @@ export interface WebSocketRouteRegistry {
|
|
|
21
29
|
/**
|
|
22
30
|
* SSE route registry containing all typed SSE routes in the application.
|
|
23
31
|
* Auto-generated by the build tool from routes that use validator() middleware.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
35
|
+
* The augmentation provides type-safe routing for useEventStream and other hooks.
|
|
24
36
|
*/
|
|
25
37
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
26
38
|
export interface SSERouteRegistry {
|
|
27
39
|
// Will be augmented by generated code
|
|
28
40
|
// Format: '/path': { inputSchema: ..., outputSchema: ... }
|
|
29
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* RPC route registry containing all typed RPC routes in the application.
|
|
45
|
+
* Used by createClient() and createAPIClient() for type-safe RPC-style API calls.
|
|
46
|
+
* Auto-generated by the build tool from route discovery.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* This interface is augmented by generated code via `declare module '@agentuity/frontend'`.
|
|
50
|
+
* The augmentation provides type-safe routing for createClient and createAPIClient.
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
53
|
+
export interface RPCRouteRegistry {
|
|
54
|
+
// Will be augmented by generated code
|
|
55
|
+
// Format: { path: { method: { input: ..., output: ..., type: ... } } }
|
|
56
|
+
}
|