@urun-sh/react 0.2.3 → 0.2.5
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/CHANGELOG.md +18 -0
- package/dist/auth.d.mts +6 -0
- package/dist/auth.d.ts +6 -0
- package/dist/auth.js +1 -0
- package/dist/auth.mjs +1 -0
- package/dist/chunk-SSZO4I6Y.mjs +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +362 -13
- package/dist/index.d.ts +362 -13
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/styles.css +148 -0
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as ze,b as He,c as G}from"./chunk-QAEWAWV4.mjs";import{useEffect as We,useMemo as Ke,useState as Ze}from"react";import{Component as Fe}from"react";import{jsx as le,jsxs as Xe}from"react/jsx-runtime";var L=class extends Fe{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("[urun] Error caught by UrunErrorBoundary:",e,t)}render(){if(this.state.error){let{fallback:e}=this.props;return typeof e=="function"?e(this.state.error):e||Xe("div",{role:"status","aria-live":"polite",style:{padding:"16px",border:"1px solid rgba(17, 24, 39, 0.12)",borderRadius:"8px",background:"#ffffff",color:"#111827",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',maxWidth:"360px"},children:[le("p",{style:{margin:0,fontWeight:600},children:"Connection interrupted"}),le("p",{style:{margin:"6px 0 0",color:"#4b5563"},children:"Reconnecting automatically."})]})}return this.props.children}};import{createContext as $e}from"react";var D=$e(null);function N(r){return r&&r.trim()?r.trim():void 0}function U(r){switch(r){case"NEXT_PUBLIC_AUTH_MODE":return N(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_MODE:void 0);case"NEXT_PUBLIC_AUTH_ENABLED":return N(typeof process<"u"?process.env?.NEXT_PUBLIC_AUTH_ENABLED:void 0);case"NEXT_PUBLIC_SESSION_AUTH_PROVIDER":return N(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_AUTH_PROVIDER:void 0);case"NEXT_PUBLIC_SESSION_TOKEN":return N(typeof process<"u"?process.env?.NEXT_PUBLIC_SESSION_TOKEN:void 0);case"NEXT_PUBLIC_URUN_JWT":return N(typeof process<"u"?process.env?.NEXT_PUBLIC_URUN_JWT:void 0);case"VERCEL_ENV":return N(typeof process<"u"?process.env?.VERCEL_ENV:void 0);default:return N(typeof process<"u"?process.env?.[r]:void 0)}}function z(){let r=U("NEXT_PUBLIC_AUTH_MODE")?.toLowerCase();return r==="jwt"||r==="customer-jwt"||r==="test-jwt"?"jwt":r==="workos"||U("VERCEL_ENV")==="production"?"workos":U("NEXT_PUBLIC_AUTH_ENABLED")==="false"?"jwt":"workos"}function Je(){return z()==="workos"}import{jsx as Y}from"react/jsx-runtime";function Ge({baseUrl:r,orgId:e,appId:t,jwt:n,authProvider:o,fallback:i,children:a}){let[x,u]=Ze(),m=G(),b=U("NEXT_PUBLIC_SESSION_TOKEN")??U("NEXT_PUBLIC_URUN_JWT"),c=z(),p=c==="workos"&&!n,R=n??(c==="jwt"?b:void 0)??x,T=o??U("NEXT_PUBLIC_SESSION_AUTH_PROVIDER"),S=p&&!R,v=Ke(()=>({appId:t,baseUrl:r,orgId:e,jwt:R,getAccessToken:p?m?.getAccessToken:void 0,authProvider:T}),[t,m,r,T,R,e,p]);return We(()=>{if(!p||!m)return;let f=!1,h=m;async function g(){try{let C=await h.getAccessToken();f||u(C??void 0)}catch{f||u(void 0)}}g();let P=window.setInterval(()=>{g()},6e4);return()=>{f=!0,window.clearInterval(P)}},[m,p]),Y(L,{fallback:i,children:S?Y("div",{role:"status","aria-live":"polite",children:"Signing in..."}):Y(D.Provider,{value:v,children:a})})}import{useContext as Ye,useMemo as me,useReducer as Qe,useRef as er}from"react";import{App as rr}from"@urun-sh/core";function tr(r,e){return`${r}:${JSON.stringify(e??{})}`}var Q=class{constructor(e,t){this._doc=e;this._notify=t;this._unsubscribeChange=this._doc.on("change",()=>this._notify())}_doc;_notify;_unsubscribeChange;get(e,t){return this._doc.get(e,t)}set(e){this._doc.set(e),this._notify()}on(e,t){return this._doc.on(e,n=>t(n))}get synced(){return this._doc.synced}onSynced(e){return this._doc.onSynced(()=>{e(),this._notify()})}text(e){let t=this._doc.text(e),n=this._notify;return{append(o){t.append(o),n()},toString:()=>t.toString(),get length(){return t.length},on:(o,i)=>t.on(o,a=>{i(a),n()})}}dispose(){this._unsubscribeChange()}},ee=class{constructor(e,t){this._stream=e;this._notify=t;this._unsubscribeTrack=this._stream.on("track",()=>this._notify())}_stream;_notify;_unsubscribeTrack;get track(){return this._stream.track}attach(e){return this._stream.attach(e)}attachVideo(e){return this._stream.attachVideo(e)}detach(){return this._stream.detach()}detachVideo(){return this._stream.detachVideo()}seek(e){return this._stream.seek(e)}chunks(e){return this._stream.chunks(e)}onSeeked(e){return this._stream.onSeeked(e)}on(e,t){return this._stream.on(e,t)}messages(){return this._stream.messages()}emit(e,t){return this._stream.emit(e,t)}dispose(){this._unsubscribeTrack()}},re=class{constructor(e,t){this._session=e;this._notify=t;this._unsubscribePhase=this._session.onPhase(()=>this._notify())}_session;_notify;_docs=new Map;_streams=new Map;_unsubscribePhase;get id(){return this._session.id}get phase(){return this._session.phase}onPhase(e){return this._session.onPhase(e)}request(e,t){return this._session.request(e,t)}requestStream(e,t){return this._session.requestStream(e,t)}complete(e,t){return this._session.complete(e,t)}get recordings(){return this._session.recordings}get artifacts(){return this._session.artifacts}get presence(){return this._session.presence}doc(e){let t=this._docs.get(e);return t||(t=new Q(this._session.doc(e),this._notify),this._docs.set(e,t)),t}stream(e){let t=this._streams.get(e);return t||(t=new ee(this._session.stream(e),this._notify),this._streams.set(e,t)),t}disconnect(){for(let e of this._docs.values())e.dispose();for(let e of this._streams.values())e.dispose();this._docs.clear(),this._streams.clear(),this._unsubscribePhase(),this._session.disconnect(),this._notify()}};function nr(){let r=Ye(D);if(!r)throw new Error("useApp must be used within <UrunProvider>");if(!r.appId)throw new Error('useApp requires <UrunProvider appId="...">');let[,e]=Qe(o=>o+1,0),t=er(new Map),n=me(()=>rr(r.appId,{baseUrl:r.baseUrl,orgId:r.orgId,jwt:r.jwt,getAccessToken:r.getAccessToken,authProvider:r.authProvider}),[r.appId,r.baseUrl,r.orgId,r.jwt,r.getAccessToken,r.authProvider]);return me(()=>new Proxy({},{get(o,i){if(typeof i=="string")return a=>{let x=tr(i,a),u=t.current.get(x);if(u)return u;let m=new re(n[i](a),e);return t.current.set(x,m),m}}}),[n])}import{useCallback as te,useEffect as sr,useMemo as or,useRef as H,useState as ne}from"react";function M(r){let e=r;if(!e||typeof e.request!="function"||typeof e.requestStream!="function")throw new Error("This session does not support request/requestStream. Upgrade @urun-sh/core to a version that ships the request/response primitive.");return e}function ir(r){return r instanceof Error?r:new Error(String(r))}function ar(r,e){let t=or(()=>M(r),[r]),[n,o]=ne(void 0),[i,a]=ne(null),[x,u]=ne(!1),m=H(e);m.current=e;let b=H(0),c=H(null),p=H(!0);sr(()=>(p.current=!0,()=>{p.current=!1,c.current?.abort()}),[]);let R=te(async v=>{c.current?.abort();let f=new AbortController;c.current=f;let h=++b.current,g=()=>p.current&&b.current===h;g()&&(u(!0),a(null));try{let P=await t.request(v,{...m.current,signal:f.signal});return g()&&(o(P),u(!1),m.current?.onSuccess?.(P)),P}catch(P){let C=ir(P);throw g()&&(a(C),u(!1),m.current?.onError?.(C)),C}},[t]),T=te(v=>{R(v).catch(()=>{})},[R]),S=te(()=>{b.current++,c.current?.abort(),c.current=null,o(void 0),a(null),u(!1)},[]);return{mutate:T,mutateAsync:R,data:n,error:i,isPending:x,reset:S}}import{useCallback as fe,useEffect as ur,useMemo as cr,useRef as F,useState as se}from"react";function ge(r){return r instanceof Error?r:new Error(String(r))}var dr=r=>typeof r=="string"?r:String(r);function pr(r,e){let t=cr(()=>M(r),[r]),[n,o]=se(""),[i,a]=se(!1),[x,u]=se(null),m=F(e);m.current=e;let b=F(0),c=F(null),p=F(!0);ur(()=>(p.current=!0,()=>{p.current=!1,c.current?.cancel(),c.current=null}),[]);let R=fe(()=>{b.current++,c.current?.cancel(),c.current=null,p.current&&a(!1)},[]),T=fe(async S=>{c.current?.cancel();let v=++b.current,f=()=>p.current&&b.current===v,h=m.current,g=h?.parseChunk??dr,P=h?.buildPayload??(l=>({prompt:l}));f()&&(o(""),u(null),a(!0));let{parseChunk:C,buildPayload:W,onFinish:w,onError:s,...d}=h??{},y="",k;try{k=t.requestStream(P(S),d),c.current=k}catch(l){let _=ge(l);f()&&(u(_),a(!1),h?.onError?.(_));return}try{for await(let l of k){if(b.current!==v)break;y+=g(l),f()&&o(y)}f()&&(a(!1),h?.onFinish?.(y))}catch(l){let _=ge(l);f()&&(u(_),a(!1),h?.onError?.(_))}finally{c.current===k&&(c.current=null)}},[t]);return{completion:n,complete:T,stop:R,isStreaming:i,error:x}}import{useCallback as he,useEffect as lr,useMemo as mr,useRef as O,useState as X}from"react";function ve(r){return r instanceof Error?r:new Error(String(r))}var fr=r=>typeof r=="string"?r:String(r),ye=0;function oe(r){return ye+=1,`${r}-${ye}`}function gr(r,e){let t=mr(()=>M(r),[r]),[n,o]=X(()=>(e?.initialMessages??[]).map(g=>({id:g.id??oe("msg"),role:g.role,content:g.content}))),[i,a]=X(""),[x,u]=X(!1),[m,b]=X(null),c=O(e);c.current=e;let p=O(n);p.current=n;let R=O(i);R.current=i;let T=O(0),S=O(null),v=O(!0);lr(()=>(v.current=!0,()=>{v.current=!1,S.current?.cancel(),S.current=null}),[]);let f=he(()=>{T.current++,S.current?.cancel(),S.current=null,v.current&&u(!1)},[]),h=he(async g=>{let P=g===void 0,C=(P?R.current:g)??"";if(!C.trim())return;S.current?.cancel();let w=++T.current,s=()=>v.current&&T.current===w,d=c.current,y=d?.parseChunk??fr,k={id:oe("msg"),role:"user",content:C},l={id:oe("msg"),role:"assistant",content:""},_=[...p.current,k].map(E=>({role:E.role,content:E.content})),j=[...p.current,k,l];p.current=j,o(j),P&&a(""),b(null),u(!0);let Ve=d?.buildPayload??(E=>({messages:E})),{initialMessages:Wr,parseChunk:Kr,buildPayload:Zr,onFinish:Gr,onError:Yr,...Be}=d??{},De=E=>{o(I=>I.map(Z=>Z.id===l.id?{...Z,content:E}:Z))},K="",B;try{B=t.requestStream(Ve(_),Be),S.current=B}catch(E){let I=ve(E);s()&&(b(I),u(!1),d?.onError?.(I));return}try{for await(let E of B){if(T.current!==w)break;K+=y(E),s()&&De(K)}s()&&(u(!1),d?.onFinish?.({...l,content:K}))}catch(E){let I=ve(E);s()&&(b(I),u(!1),d?.onError?.(I))}finally{S.current===B&&(S.current=null)}},[t]);return{messages:n,input:i,setInput:a,sendMessage:h,stop:f,isStreaming:x,error:m}}var be=new Map;function hr(r,e,t){if(!t||typeof t.safeParse!="function")throw new Error(`registerComponent("${r}"): schema must be a valid Zod schema`);be.set(r,{component:e,schema:t})}function Se(r,e){let t=be.get(r);if(!t)return{error:`Unknown component: "${r}"`};let n=t.schema.safeParse(e);return n.success?{Component:t.component,validatedProps:n.data}:{error:`Validation failed for "${r}": ${n.error.message}`}}import{Fragment as yr,jsx as $}from"react/jsx-runtime";function vr({name:r,props:e,fallback:t}){let n=Se(r,e);if(n.error)return console.warn(`[urun] ComponentRenderer: ${n.error}`),t?$(yr,{children:t}):$("div",{className:"urun-component-error",role:"alert",children:$("span",{className:"urun-component-error-text",children:n.error})});let o=n.Component;return $(o,{...n.validatedProps})}import{z as V}from"zod";import{jsx as ie,jsxs as ke}from"react/jsx-runtime";var br=V.object({step:V.number().min(0),total:V.number().min(1),label:V.string().optional(),variant:V.enum(["default","success","error"]).default("default")});function Re(r){let{step:e,total:t,label:n,variant:o="default"}=r,i=Math.min(e/t*100,100),a=e>=t;return{step:e,total:t,label:n,variant:o,percentage:i,isComplete:a}}function Sr(r){let{step:e,total:t,label:n,variant:o,percentage:i}=Re(r);return ke("div",{className:"urun-progress-card","data-variant":o,children:[n&&ie("div",{className:"urun-progress-label",children:n}),ie("div",{className:"urun-progress-bar",children:ie("div",{className:"urun-progress-fill",style:{width:`${i}%`}})}),ke("div",{className:"urun-progress-text",children:[e,"/",t]})]})}import{z as ae}from"zod";import{jsx as Ce,jsxs as xr}from"react/jsx-runtime";var kr=ae.object({state:ae.enum(["thinking","generating","idle","error"]),message:ae.string().optional()}),Rr={thinking:"Thinking...",generating:"Generating...",idle:"Idle",error:"Error"};function xe(r){let{state:e,message:t}=r,n=e==="thinking"||e==="generating",o=t??Rr[e]??e;return{state:e,message:o,isActive:n}}function Cr(r){let{state:e,message:t,isActive:n}=xe(r);return xr("span",{className:"urun-status-badge","data-state":e,children:[Ce("span",{className:`urun-status-indicator${n?" urun-status-pulse":""}`}),Ce("span",{className:"urun-status-message",children:t})]})}import{useRef as Te,useEffect as Tr}from"react";import{z as ue}from"zod";import{jsx as Pe,jsxs as wr}from"react/jsx-runtime";var Pr=ue.object({text:ue.string(),streaming:ue.boolean().default(!1)});function Ee(r){let{text:e,streaming:t=!1}=r,n=e.length===0;return{text:e,streaming:t,isEmpty:n}}function Er(r){let{text:e,streaming:t}=Ee(r),n=Te(null),o=Te(0);return Tr(()=>{let i=n.current;i&&e.length!==o.current&&(i.textContent=e,o.current=e.length)},[e]),wr("div",{className:"urun-text-stream",children:[Pe("span",{ref:n,className:"urun-text-content"}),t&&Pe("span",{className:"urun-text-cursor"})]})}import{z as J}from"zod";import{jsx as we,jsxs as Ar}from"react/jsx-runtime";var _r=J.object({src:J.string().url(),alt:J.string().optional(),caption:J.string().optional()});function _e(r){let{src:e,alt:t,caption:n}=r;return{src:e,alt:t??"",caption:n}}function Ur(r){let{src:e,alt:t,caption:n}=_e(r);return Ar("figure",{className:"urun-image-frame",children:[we("img",{className:"urun-image",src:e,alt:t}),n&&we("figcaption",{className:"urun-image-caption",children:n})]})}import{z as A}from"zod";import{jsx as ce,jsxs as qr}from"react/jsx-runtime";var Ir=A.object({metrics:A.array(A.object({label:A.string(),value:A.union([A.string(),A.number()]),unit:A.string().optional()}))});function Ue(r){return{metrics:r.metrics.map(t=>({...t,displayValue:t.unit?`${t.value} ${t.unit}`:String(t.value)}))}}function Nr(r){let{metrics:e}=Ue(r);return ce("div",{className:"urun-metrics-panel",children:e.map((t,n)=>qr("div",{className:"urun-metric-card",children:[ce("div",{className:"urun-metric-label",children:t.label}),ce("div",{className:"urun-metric-value",children:t.displayValue})]},n))})}import{forwardRef as pe,useCallback as Ne,useEffect as de,useImperativeHandle as Vr,useRef as qe,useState as Br}from"react";import Dr from"video.js";import"video.js/dist/video-js.css";import{useContext as Or,useState as jr,useEffect as Lr}from"react";import{createContext as Mr,useState as Kt,useEffect as Zt,useRef as Gt}from"react";import{TransportSession as Qt}from"@urun-sh/core/internal";import{jsx as rn}from"react/jsx-runtime";var Ae=Mr(null);function Ie(r){let e=Or(Ae);if(!e)throw new Error("useTrack must be used within <SessionProvider> or <UrunProvider>");let[t,n]=jr(null);return Lr(()=>{let o=e.getState()._transport;if(!o)return;let i=o.getTrackByName?.bind(o),a=i?.(r);a&&a.readyState!=="ended"&&n(a);let x=o.on("track",u=>{let m=i?.(r);m&&m.id!==u.id||(n(u),u.addEventListener("ended",()=>{n(null)}))});return()=>{x()}},[r,e]),t}import{jsx as q,jsxs as je}from"react/jsx-runtime";function Me(r){r.posterImage?.hide?.()}var zr=`
|
|
1
|
+
import{a as Q,b as xe,c as Nr}from"./chunk-SSZO4I6Y.mjs";import{a as _r,b as Or,c as Ce}from"./chunk-QAEWAWV4.mjs";import{useEffect as Vr,useMemo as jr,useState as Dr}from"react";import{Component as Lr}from"react";import{jsx as We,jsxs as Ir}from"react/jsx-runtime";var ee=class extends Lr{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error("[urun] Error caught by UrunErrorBoundary:",e,t)}render(){if(this.state.error){let{fallback:e}=this.props;return typeof e=="function"?e(this.state.error):e||Ir("div",{role:"status","aria-live":"polite",style:{padding:"16px",border:"1px solid rgba(17, 24, 39, 0.12)",borderRadius:"8px",background:"#ffffff",color:"#111827",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',maxWidth:"360px"},children:[We("p",{style:{margin:0,fontWeight:600},children:"Connection interrupted"}),We("p",{style:{margin:"6px 0 0",color:"#4b5563"},children:"Reconnecting automatically."})]})}return this.props.children}};import{createContext as qr}from"react";var se=qr(null);import{jsx as Te}from"react/jsx-runtime";function Fr({baseUrl:r,orgId:e,appId:t,jwt:n,authProvider:s,fallback:a,children:i}){let[d,u]=Dr(),c=Ce(),h=Q("NEXT_PUBLIC_SESSION_TOKEN")??Q("NEXT_PUBLIC_URUN_JWT"),l=xe(),f=l==="workos"&&!n,P=n??(l==="jwt"?h:void 0)??d,x=s??Q("NEXT_PUBLIC_SESSION_AUTH_PROVIDER"),T=f&&!P,y=jr(()=>({appId:t,baseUrl:r,orgId:e,jwt:P,getAccessToken:f?c?.getAccessToken:void 0,authProvider:x}),[t,c,r,x,P,e,f]);return Vr(()=>{if(!f||!c)return;let g=!1,v=c;async function S(){try{let k=await v.getAccessToken();g||u(k??void 0)}catch{g||u(void 0)}}S();let w=window.setInterval(()=>{S()},6e4);return()=>{g=!0,window.clearInterval(w)}},[c,f]),Te(ee,{fallback:a,children:T?Te("div",{role:"status","aria-live":"polite",children:"Signing in..."}):Te(se.Provider,{value:y,children:i})})}import{useContext as zr,useMemo as Je,useReducer as Br,useRef as Hr}from"react";import{App as $r}from"@urun-sh/core";function Wr(r,e){return`${r}:${JSON.stringify(e??{})}`}var Re=class{constructor(e,t){this._doc=e;this._notify=t;this._unsubscribeChange=this._doc.on("change",()=>this._notify())}_doc;_notify;_unsubscribeChange;get(e,t){return this._doc.get(e,t)}set(e){this._doc.set(e),this._notify()}on(e,t){return this._doc.on(e,n=>t(n))}get synced(){return this._doc.synced}onSynced(e){return this._doc.onSynced(()=>{e(),this._notify()})}text(e){let t=this._doc.text(e),n=this._notify;return{append(s){t.append(s),n()},toString:()=>t.toString(),get length(){return t.length},on:(s,a)=>t.on(s,i=>{a(i),n()})}}dispose(){this._unsubscribeChange()}},Pe=class{constructor(e,t){this._stream=e;this._notify=t;this._unsubscribeTrack=this._stream.on("track",()=>this._notify())}_stream;_notify;_unsubscribeTrack;get track(){return this._stream.track}attach(e){return this._stream.attach(e)}attachVideo(e){return this._stream.attachVideo(e)}detach(){return this._stream.detach()}detachVideo(){return this._stream.detachVideo()}seek(e){return this._stream.seek(e)}chunks(e){return this._stream.chunks(e)}onSeeked(e){return this._stream.onSeeked(e)}on(e,t){return this._stream.on(e,t)}messages(){return this._stream.messages()}emit(e,t){return this._stream.emit(e,t)}dispose(){this._unsubscribeTrack()}},we=class{constructor(e,t){this._session=e;this._notify=t;this._unsubscribePhase=this._session.onPhase(()=>this._notify())}_session;_notify;_docs=new Map;_streams=new Map;_unsubscribePhase;_disposed=!1;get disposed(){return this._disposed}get id(){return this._session.id}get phase(){return this._session.phase}get status(){return this._session.status}onPhase(e){return this._session.onPhase(e)}whenLive(e){return this._session.whenLive(e)}request(e,t){return this._session.request(e,t)}requestStream(e,t){return this._session.requestStream(e,t)}complete(e,t){return this._session.complete(e,t)}get recordings(){return this._session.recordings}get artifacts(){return this._session.artifacts}get presence(){return this._session.presence}doc(e){let t=this._docs.get(e);return t||(t=new Re(this._session.doc(e),this._notify),this._docs.set(e,t)),t}stream(e){let t=this._streams.get(e);return t||(t=new Pe(this._session.stream(e),this._notify),this._streams.set(e,t)),t}disconnect(){this._disposed=!0;for(let e of this._docs.values())e.dispose();for(let e of this._streams.values())e.dispose();this._docs.clear(),this._streams.clear(),this._unsubscribePhase(),this._session.disconnect(),this._notify()}};function Jr(){let r=zr(se);if(!r)throw new Error("useApp must be used within <UrunProvider>");if(!r.appId)throw new Error('useApp requires <UrunProvider appId="...">');let[,e]=Br(s=>s+1,0),t=Hr(new Map),n=Je(()=>$r(r.appId,{baseUrl:r.baseUrl,orgId:r.orgId,jwt:r.jwt,getAccessToken:r.getAccessToken,authProvider:r.authProvider}),[r.appId,r.baseUrl,r.orgId,r.jwt,r.getAccessToken,r.authProvider]);return Je(()=>new Proxy({},{get(s,a){if(typeof a=="string")return i=>{let d=Wr(a,i),u=t.current.get(d);if(u&&!u.disposed)return u;let c=new we(n[a](i),e);return t.current.set(d,c),c}}}),[n])}import{useCallback as Ue,useEffect as Gr,useMemo as Xr,useRef as ae,useState as Ee}from"react";function J(r){let e=r;if(!e||typeof e.request!="function"||typeof e.requestStream!="function")throw new Error("This session does not support request/requestStream. Upgrade @urun-sh/core to a version that ships the request/response primitive.");return e}function Zr(r){return r instanceof Error?r:new Error(String(r))}function Kr(r,e){let t=Xr(()=>J(r),[r]),[n,s]=Ee(void 0),[a,i]=Ee(null),[d,u]=Ee(!1),c=ae(e);c.current=e;let h=ae(0),l=ae(null),f=ae(!0);Gr(()=>(f.current=!0,()=>{f.current=!1,l.current?.abort()}),[]);let P=Ue(async y=>{l.current?.abort();let g=new AbortController;l.current=g;let v=++h.current,S=()=>f.current&&h.current===v;S()&&(u(!0),i(null));try{let w=await t.request(y,{...c.current,signal:g.signal});return S()&&(s(w),u(!1),c.current?.onSuccess?.(w)),w}catch(w){let k=Zr(w);throw S()&&(i(k),u(!1),c.current?.onError?.(k)),k}},[t]),x=Ue(y=>{P(y).catch(()=>{})},[P]),T=Ue(()=>{h.current++,l.current?.abort(),l.current=null,s(void 0),i(null),u(!1)},[]);return{mutate:x,mutateAsync:P,data:n,error:a,isPending:d,reset:T}}import{useCallback as Ge,useEffect as Yr,useMemo as Qr,useRef as ie,useState as Ae}from"react";function Xe(r){return r instanceof Error?r:new Error(String(r))}var et=r=>typeof r=="string"?r:String(r);function rt(r,e){let t=Qr(()=>J(r),[r]),[n,s]=Ae(""),[a,i]=Ae(!1),[d,u]=Ae(null),c=ie(e);c.current=e;let h=ie(0),l=ie(null),f=ie(!0);Yr(()=>(f.current=!0,()=>{f.current=!1,l.current?.cancel(),l.current=null}),[]);let P=Ge(()=>{h.current++,l.current?.cancel(),l.current=null,f.current&&i(!1)},[]),x=Ge(async T=>{l.current?.cancel();let y=++h.current,g=()=>f.current&&h.current===y,v=c.current,S=v?.parseChunk??et,w=v?.buildPayload??(m=>({prompt:m}));g()&&(s(""),u(null),i(!0));let{parseChunk:k,buildPayload:L,onFinish:A,onError:o,...p}=v??{},b="",C;try{C=t.requestStream(w(T),p),l.current=C}catch(m){let U=Xe(m);g()&&(u(U),i(!1),v?.onError?.(U));return}try{for await(let m of C){if(h.current!==y)break;b+=S(m),g()&&s(b)}g()&&(i(!1),v?.onFinish?.(b))}catch(m){let U=Xe(m);g()&&(u(U),i(!1),v?.onError?.(U))}finally{l.current===C&&(l.current=null)}},[t]);return{completion:n,complete:x,stop:P,isStreaming:a,error:d}}import{useCallback as Ze,useEffect as tt,useMemo as nt,useRef as G,useState as ue}from"react";function Ke(r){return r instanceof Error?r:new Error(String(r))}var ot=r=>typeof r=="string"?r:String(r),Ye=0;function Me(r){return Ye+=1,`${r}-${Ye}`}function st(r,e){let t=nt(()=>J(r),[r]),[n,s]=ue(()=>(e?.initialMessages??[]).map(S=>({id:S.id??Me("msg"),role:S.role,content:S.content}))),[a,i]=ue(""),[d,u]=ue(!1),[c,h]=ue(null),l=G(e);l.current=e;let f=G(n);f.current=n;let P=G(a);P.current=a;let x=G(0),T=G(null),y=G(!0);tt(()=>(y.current=!0,()=>{y.current=!1,T.current?.cancel(),T.current=null}),[]);let g=Ze(()=>{x.current++,T.current?.cancel(),T.current=null,y.current&&u(!1)},[]),v=Ze(async S=>{let w=S===void 0,k=(w?P.current:S)??"";if(!k.trim())return;T.current?.cancel();let A=++x.current,o=()=>y.current&&x.current===A,p=l.current,b=p?.parseChunk??ot,C={id:Me("msg"),role:"user",content:k},m={id:Me("msg"),role:"assistant",content:""},U=[...f.current,C].map(M=>({role:M.role,content:M.content})),R=[...f.current,C,m];f.current=R,s(R),w&&i(""),h(null),u(!0);let q=p?.buildPayload??(M=>({messages:M})),{initialMessages:Se,parseChunk:be,buildPayload:ye,onFinish:ke,onError:Ar,...E}=p??{},N=M=>{s(I=>I.map(O=>O.id===m.id?{...O,content:M}:O))},j="",_;try{_=t.requestStream(q(U),E),T.current=_}catch(M){let I=Ke(M);o()&&(h(I),u(!1),p?.onError?.(I));return}try{for await(let M of _){if(x.current!==A)break;j+=b(M),o()&&N(j)}o()&&(u(!1),p?.onFinish?.({...m,content:j}))}catch(M){let I=Ke(M);o()&&(h(I),u(!1),p?.onError?.(I))}finally{T.current===_&&(T.current=null)}},[t]);return{messages:n,input:a,setInput:i,sendMessage:v,stop:g,isStreaming:d,error:c}}var Qe=new Map;function at(r,e,t){if(!t||typeof t.safeParse!="function")throw new Error(`registerComponent("${r}"): schema must be a valid Zod schema`);Qe.set(r,{component:e,schema:t})}function er(r,e){let t=Qe.get(r);if(!t)return{error:`Unknown component: "${r}"`};let n=t.schema.safeParse(e);return n.success?{Component:t.component,validatedProps:n.data}:{error:`Validation failed for "${r}": ${n.error.message}`}}import{Fragment as ut,jsx as ce}from"react/jsx-runtime";function it({name:r,props:e,fallback:t}){let n=er(r,e);if(n.error)return console.warn(`[urun] ComponentRenderer: ${n.error}`),t?ce(ut,{children:t}):ce("div",{className:"urun-component-error",role:"alert",children:ce("span",{className:"urun-component-error-text",children:n.error})});let s=n.Component;return ce(s,{...n.validatedProps})}import{z as re}from"zod";import{jsx as Ne,jsxs as rr}from"react/jsx-runtime";var ct=re.object({step:re.number().min(0),total:re.number().min(1),label:re.string().optional(),variant:re.enum(["default","success","error"]).default("default")});function tr(r){let{step:e,total:t,label:n,variant:s="default"}=r,a=Math.min(e/t*100,100),i=e>=t;return{step:e,total:t,label:n,variant:s,percentage:a,isComplete:i}}function lt(r){let{step:e,total:t,label:n,variant:s,percentage:a}=tr(r);return rr("div",{className:"urun-progress-card","data-variant":s,children:[n&&Ne("div",{className:"urun-progress-label",children:n}),Ne("div",{className:"urun-progress-bar",children:Ne("div",{className:"urun-progress-fill",style:{width:`${a}%`}})}),rr("div",{className:"urun-progress-text",children:[e,"/",t]})]})}import{z as _e}from"zod";import{jsx as nr,jsxs as ft}from"react/jsx-runtime";var dt=_e.object({state:_e.enum(["thinking","generating","idle","error"]),message:_e.string().optional()}),pt={thinking:"Thinking...",generating:"Generating...",idle:"Idle",error:"Error"};function or(r){let{state:e,message:t}=r,n=e==="thinking"||e==="generating",s=t??pt[e]??e;return{state:e,message:s,isActive:n}}function mt(r){let{state:e,message:t,isActive:n}=or(r);return ft("span",{className:"urun-status-badge","data-state":e,children:[nr("span",{className:`urun-status-indicator${n?" urun-status-pulse":""}`}),nr("span",{className:"urun-status-message",children:t})]})}import{useRef as sr,useEffect as gt}from"react";import{z as Oe}from"zod";import{jsx as ar,jsxs as St}from"react/jsx-runtime";var ht=Oe.object({text:Oe.string(),streaming:Oe.boolean().default(!1)});function ir(r){let{text:e,streaming:t=!1}=r,n=e.length===0;return{text:e,streaming:t,isEmpty:n}}function vt(r){let{text:e,streaming:t}=ir(r),n=sr(null),s=sr(0);return gt(()=>{let a=n.current;a&&e.length!==s.current&&(a.textContent=e,s.current=e.length)},[e]),St("div",{className:"urun-text-stream",children:[ar("span",{ref:n,className:"urun-text-content"}),t&&ar("span",{className:"urun-text-cursor"})]})}import{z as le}from"zod";import{jsx as ur,jsxs as kt}from"react/jsx-runtime";var bt=le.object({src:le.string().url(),alt:le.string().optional(),caption:le.string().optional()});function cr(r){let{src:e,alt:t,caption:n}=r;return{src:e,alt:t??"",caption:n}}function yt(r){let{src:e,alt:t,caption:n}=cr(r);return kt("figure",{className:"urun-image-frame",children:[ur("img",{className:"urun-image",src:e,alt:t}),n&&ur("figcaption",{className:"urun-image-caption",children:n})]})}import{z as D}from"zod";import{jsx as Le,jsxs as Tt}from"react/jsx-runtime";var xt=D.object({metrics:D.array(D.object({label:D.string(),value:D.union([D.string(),D.number()]),unit:D.string().optional()}))});function lr(r){return{metrics:r.metrics.map(t=>({...t,displayValue:t.unit?`${t.value} ${t.unit}`:String(t.value)}))}}function Ct(r){let{metrics:e}=lr(r);return Le("div",{className:"urun-metrics-panel",children:e.map((t,n)=>Tt("div",{className:"urun-metric-card",children:[Le("div",{className:"urun-metric-label",children:t.label}),Le("div",{className:"urun-metric-value",children:t.displayValue})]},n))})}import{forwardRef as qe,useCallback as mr,useEffect as Ie,useImperativeHandle as Et,useRef as fr,useState as At}from"react";import Mt from"video.js";import"video.js/dist/video-js.css";import{useContext as Pt,useState as wt,useEffect as Ut}from"react";import{createContext as Rt,useState as Ro,useEffect as Po,useRef as wo}from"react";import{TransportSession as Eo}from"@urun-sh/core/internal";import{jsx as Mo}from"react/jsx-runtime";var dr=Rt(null);function pr(r){let e=Pt(dr);if(!e)throw new Error("useTrack must be used within <SessionProvider> or <UrunProvider>");let[t,n]=wt(null);return Ut(()=>{let s=e.getState()._transport;if(!s)return;let a=s.getTrackByName?.bind(s),i=a?.(r);i&&i.readyState!=="ended"&&n(i);let d=s.on("track",u=>{let c=a?.(r);c&&c.id!==u.id||(n(u),u.addEventListener("ended",()=>{n(null)}))});return()=>{d()}},[r,e]),t}import{jsx as H,jsxs as vr}from"react/jsx-runtime";function gr(r){r.posterImage?.hide?.()}var Nt=`
|
|
2
2
|
[data-urun-video]{width:100%;height:100%}
|
|
3
3
|
[data-urun-video] .video-js,[data-urun-video] .vjs-tech{width:100%;height:100%}
|
|
4
4
|
[data-urun-video] .vjs-tech{object-fit:contain}
|
|
@@ -6,4 +6,4 @@ import{a as ze,b as He,c as G}from"./chunk-QAEWAWV4.mjs";import{useEffect as We,
|
|
|
6
6
|
.urun-video-live.vjs-has-started .vjs-loading-spinner,
|
|
7
7
|
.urun-video-live.vjs-has-started .vjs-big-play-button{display:none !important}
|
|
8
8
|
.urun-video-live .vjs-poster{background-color:transparent}
|
|
9
|
-
`,Oe="urun-video-critical-css";function Hr(){if(typeof document>"u"||document.getElementById(Oe))return;let r=document.createElement("style");r.id=Oe,r.textContent=zr,document.head.appendChild(r)}var Fr=["playToggle","volumePanel","fullscreenToggle"],Xr=["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],Le=pe(function(e,t){let{track:n,stream:o,src:i,type:a="video/mp4",className:x,videoClassName:u,poster:m,controls:b=!0,autoPlay:c=!0,muted:p=!0,onVideoElement:R,onPlayerReady:T,children:S}=e,v=typeof i=="string"&&i.length>0,f=!v,h=qe(null),g=qe(null),[P,C]=Br(!1),W=Ne(s=>{h.current=s,typeof t=="function"?t(s):t&&(t.current=s),R?.(s)},[t,R]);Vr(t,()=>h.current,[]);let w=Ne(()=>{let s=h.current;if(!s||!s.srcObject&&!s.src)return;p&&(s.muted=!0,s.defaultMuted=!0),s.setAttribute("playsinline",""),s.setAttribute("webkit-playsinline","");let d=s.play();d&&typeof d.then=="function"&&d.then(()=>C(!1)).catch(y=>{(y instanceof Error?y.name:String(y))!=="AbortError"&&C(!0)})},[p]);return de(()=>{if(typeof document>"u")return;let s=h.current;if(!s)return;Hr(),p&&(s.muted=!0,s.defaultMuted=!0,s.setAttribute("muted","")),s.autoplay=c,s.setAttribute("playsinline",""),s.setAttribute("webkit-playsinline","");let d=Dr(s,{controls:b,autoplay:c,muted:p,playsinline:!0,preload:"auto",fluid:!1,bigPlayButton:!0,poster:m,userActions:{click:!0,doubleClick:!1,hotkeys:!1},controlBar:{children:f?Fr:Xr}});f&&d.addClass("urun-video-live");let y=()=>C(!1),k=()=>{d.hasStarted(!0),Me(d),y()},l=()=>{f&&w()};return s.addEventListener("playing",k),s.addEventListener("loadedmetadata",l),f&&s.addEventListener("pause",l),g.current=d,T?.(d),()=>{s.removeEventListener("playing",k),s.removeEventListener("loadedmetadata",l),s.removeEventListener("pause",l),T?.(null),g.current&&(g.current.dispose(),g.current=null)}},[f]),de(()=>{if(!v)return;let s=g.current;if(!s)return;let d=s.tech?.(!0)?.el?.();d&&(d.srcObject=null),s.src({src:i,type:a}),c&&w()},[v,i,a,c,w]),de(()=>{if(!f)return;let s=g.current;if(!s)return;let d=n??null,y=o??null;!y&&d&&(y=new MediaStream([d]));let k=s.tech?.(!0)?.el?.()??h.current;if(!k)return;if(!y){k.srcObject=null,C(!1);return}k.srcObject=y,w();let l=y.getVideoTracks()[0]??d??null,_=()=>{s.hasStarted(!0),Me(s),w()},j=()=>{k.srcObject=null,C(!1)};return l&&(l.addEventListener("unmute",_),l.addEventListener("ended",j),l.muted||_()),()=>{l&&(l.removeEventListener("unmute",_),l.removeEventListener("ended",j))}},[f,n,o,w]),je("div",{className:x,style:{position:"relative",width:"100%",height:"100%"},"data-urun-video":"","data-urun-video-mode":f?"live":"vod",children:[q("video",{ref:W,className:["video-js","vjs-default-skin",u].filter(Boolean).join(" "),playsInline:!0}),P&&q("button",{type:"button",onClick:w,"aria-label":"Tap to play",style:{position:"absolute",inset:0,zIndex:30,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.6)",border:0,cursor:"pointer",color:"#fff"},children:je("span",{style:{display:"inline-flex",alignItems:"center",gap:8,borderRadius:999,border:"1px solid rgba(255,255,255,0.2)",background:"rgba(255,255,255,0.1)",padding:"10px 20px",fontSize:14,fontWeight:500},children:[q("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:16,height:16,"aria-hidden":!0,children:q("path",{d:"M8 5v14l11-7z"})}),"Tap to play"]})}),S]})}),$r=pe(function({name:e,...t},n){let o=Ie(e);return q(Le,{ref:n,...t,track:o})}),Jr=pe(function(e,t){return!!e.name&&!e.track&&!e.stream&&!(typeof e.src=="string"&&e.src)?q($r,{ref:t,...e,name:e.name}):q(Le,{ref:t,...e})});export{vr as ComponentRenderer,Ur as ImageFrame,_r as ImageFrameSchema,Nr as MetricsPanel,Ir as MetricsPanelSchema,Sr as ProgressCard,br as ProgressCardSchema,Cr as StatusBadge,kr as StatusBadgeSchema,Er as TextStream,Pr as TextStreamSchema,ze as UrunAuthProvider,L as UrunErrorBoundary,He as UrunJwtProvider,Ge as UrunProvider,Jr as UrunVideo,z as authMode,hr as registerComponent,U as urunPublicEnv,nr as useApp,gr as useChat,pr as useCompletion,_e as useImageFrame,Ue as useMetricsPanel,Re as useProgressCard,ar as useRequest,xe as useStatusBadge,Ee as useTextStream,G as useUrunAuth,Je as usesWorkOSAuth};
|
|
9
|
+
`,hr="urun-video-critical-css";function _t(){if(typeof document>"u"||document.getElementById(hr))return;let r=document.createElement("style");r.id=hr,r.textContent=Nt,document.head.appendChild(r)}var Ot=["playToggle","volumePanel","fullscreenToggle"],Lt=["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","remainingTimeDisplay","fullscreenToggle"],Sr=qe(function(e,t){let{track:n,stream:s,src:a,type:i="video/mp4",className:d,videoClassName:u,poster:c,controls:h=!0,autoPlay:l=!0,muted:f=!0,onVideoElement:P,onPlayerReady:x,children:T}=e,y=typeof a=="string"&&a.length>0,g=!y,v=fr(null),S=fr(null),[w,k]=At(!1),L=mr(o=>{v.current=o,typeof t=="function"?t(o):t&&(t.current=o),P?.(o)},[t,P]);Et(t,()=>v.current,[]);let A=mr(()=>{let o=v.current;if(!o||!o.srcObject&&!o.src)return;f&&(o.muted=!0,o.defaultMuted=!0),o.setAttribute("playsinline",""),o.setAttribute("webkit-playsinline","");let p=o.play();p&&typeof p.then=="function"&&p.then(()=>k(!1)).catch(b=>{(b instanceof Error?b.name:String(b))!=="AbortError"&&k(!0)})},[f]);return Ie(()=>{if(typeof document>"u")return;let o=v.current;if(!o)return;_t(),f&&(o.muted=!0,o.defaultMuted=!0,o.setAttribute("muted","")),o.autoplay=l,o.setAttribute("playsinline",""),o.setAttribute("webkit-playsinline","");let p=Mt(o,{controls:h,autoplay:l,muted:f,playsinline:!0,preload:"auto",fluid:!1,bigPlayButton:!0,poster:c,userActions:{click:!0,doubleClick:!1,hotkeys:!1},controlBar:{children:g?Ot:Lt}});g&&p.addClass("urun-video-live");let b=()=>k(!1),C=()=>{p.hasStarted(!0),gr(p),b()},m=()=>{g&&A()};return o.addEventListener("playing",C),o.addEventListener("loadedmetadata",m),g&&o.addEventListener("pause",m),S.current=p,x?.(p),()=>{o.removeEventListener("playing",C),o.removeEventListener("loadedmetadata",m),o.removeEventListener("pause",m),x?.(null),S.current&&(S.current.dispose(),S.current=null)}},[g]),Ie(()=>{if(!y)return;let o=S.current;if(!o)return;let p=o.tech?.(!0)?.el?.();p&&(p.srcObject=null),o.src({src:a,type:i}),l&&A()},[y,a,i,l,A]),Ie(()=>{if(!g)return;let o=S.current;if(!o)return;let p=n??null,b=s??null;!b&&p&&(b=new MediaStream([p]));let C=o.tech?.(!0)?.el?.()??v.current;if(!C)return;if(!b){C.srcObject=null,k(!1);return}C.srcObject=b,A();let m=b.getVideoTracks()[0]??p??null,U=()=>{o.hasStarted(!0),gr(o),A()},R=()=>{C.srcObject=null,k(!1)};return m&&(m.addEventListener("unmute",U),m.addEventListener("ended",R),m.muted||U()),()=>{m&&(m.removeEventListener("unmute",U),m.removeEventListener("ended",R))}},[g,n,s,A]),vr("div",{className:d,style:{position:"relative",width:"100%",height:"100%"},"data-urun-video":"","data-urun-video-mode":g?"live":"vod",children:[H("video",{ref:L,className:["video-js","vjs-default-skin",u].filter(Boolean).join(" "),playsInline:!0}),w&&H("button",{type:"button",onClick:A,"aria-label":"Tap to play",style:{position:"absolute",inset:0,zIndex:30,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.6)",border:0,cursor:"pointer",color:"#fff"},children:vr("span",{style:{display:"inline-flex",alignItems:"center",gap:8,borderRadius:999,border:"1px solid rgba(255,255,255,0.2)",background:"rgba(255,255,255,0.1)",padding:"10px 20px",fontSize:14,fontWeight:500},children:[H("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:16,height:16,"aria-hidden":!0,children:H("path",{d:"M8 5v14l11-7z"})}),"Tap to play"]})}),T]})}),It=qe(function({name:e,...t},n){let s=pr(e);return H(Sr,{ref:n,...t,track:s})}),qt=qe(function(e,t){return!!e.name&&!e.track&&!e.stream&&!(typeof e.src=="string"&&e.src)?H(It,{ref:t,...e,name:e.name}):H(Sr,{ref:t,...e})});import{forwardRef as jt,useCallback as X,useEffect as br,useImperativeHandle as Dt,useRef as Z}from"react";var de=null;function Vt(){if(typeof window>"u")return null;let r=window;return r.AudioContext??r.webkitAudioContext??null}function pe(){if(de)return de;let r=Vt();return r?(de=new r,de):null}function Ve(){let r=pe();r&&r.state==="suspended"&&r.resume().catch(()=>{})}import{jsx as zt}from"react/jsx-runtime";var Ft=1e3,yr=200;function je(...r){console.debug("[urun-audio]",...r)}var De=jt(function(e,t){let{session:n,stream:s="audio",track:a,controls:i=!1,className:d,onTrack:u,onUnlockChange:c,onAudioElement:h}=e,l=Z(null),f=Z(null),P=Z(null),x=Z(null),T=Z(u);T.current=u;let y=Z(c);y.current=c;let g=X(o=>{P.current!==o&&(P.current=o,y.current?.(o))},[]),v=X(()=>{if(typeof MediaStream>"u")return null;f.current||(f.current=new MediaStream);let o=l.current;return o&&o.srcObject!==f.current&&(o.srcObject=f.current),f.current},[]),S=X(o=>{let p=l.current;if(!p)return;let b=p.play();!b||typeof b.then!="function"||b.then(()=>{p.muted||g(!0)}).catch(C=>{let m=C instanceof Error?C.name:String(C);if(m==="AbortError"){je(`play() aborted (${o}); retrying in ${yr}ms`),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{x.current=null,S(`${o}:retry`)},yr);return}if(m==="NotAllowedError"){je(`play() blocked pending a user gesture (${o})`),g(!1);return}je(`play() failed (${o})`,C)})},[g]),w=X(o=>{let p=v();if(p){for(let b of p.getAudioTracks())b!==o&&p.removeTrack(b);o&&!p.getAudioTracks().includes(o)&&p.addTrack(o),o&&S("track-attach"),T.current?.(o)}},[v,S]),k=X(()=>{let o=l.current;o&&(v(),o.muted=!1,S("gesture"),Ve(),g(!0))},[v,S,g]);Dt(t,()=>({unlock:k,get unlocked(){return P.current===!0},get element(){return l.current}}),[k]);let L=X(o=>{l.current=o,o&&(o.setAttribute("playsinline",""),o.setAttribute("webkit-playsinline",""),v()),h?.(o)},[v,h]),A=a!==void 0;return br(()=>{if(A){w(a??null);return}if(!n)return;let o=n.stream(s),p=()=>{let R=f.current;return R?R.getAudioTracks()[0]??null:null},b=R=>{if(R!==p()&&(w(R),R)){let q=()=>{p()===R&&w(null)};R.addEventListener("ended",q)}},C=o.track;C&&C.readyState==="live"&&b(C);let m=o.on("track",R=>{R&&R.readyState!=="live"||b(R)}),U=setInterval(()=>{let R=o.track;R&&R.readyState==="live"&&b(R)},Ft);return()=>{m(),clearInterval(U)}},[n,s,A,a,w]),br(()=>()=>{x.current&&clearTimeout(x.current)},[]),zt("audio",{ref:L,className:d,autoPlay:!0,playsInline:!0,controls:i,"data-urun-audio":""})});import{forwardRef as Bt,useCallback as me,useEffect as Ht,useImperativeHandle as $t,useRef as K}from"react";import{sessionFailureFromMediaError as kr}from"@urun-sh/core";import{jsx as Gt}from"react/jsx-runtime";var xr={channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0};function Wt(...r){console.debug("[urun-voice]",...r)}var Jt=Bt(function(e,t){let{session:n,stream:s="audio",constraints:a=xr,connectTimeoutMs:i,attempts:d=3,retryDelayMs:u=1500,onActiveChange:c,onError:h,onMicStream:l,onTrack:f,onUnlockChange:P}=e,x=K(null),T=K(null),y=K(!1),g=K(c);g.current=c;let v=K(h);v.current=h;let S=K(l);S.current=l;let w=me(o=>{y.current!==o&&(y.current=o,g.current?.(o))},[]),k=me(()=>{let o=T.current;if(o){for(let p of o.getTracks())p.stop();T.current=null,S.current?.(null)}},[]),L=me(async()=>{k(),w(!1),await n.stream(s).detach().catch(()=>{})},[n,s,k,w]),A=me(async()=>{x.current?.unlock();let o;try{o=await navigator.mediaDevices.getUserMedia({audio:a,video:!1})}catch(m){let U=kr(m,n.status);throw v.current?.(U),U}k(),T.current=o,S.current?.(o);let p=o.getAudioTracks()[0];if(!p){k();let m=kr(Object.assign(new Error("no microphone audio track"),{name:"NotFoundError"}),n.status);throw v.current?.(m),m}n.connect?.();let b;for(let m=1;m<=d;m++)try{await n.whenLive(i!==void 0?{timeout:i}:void 0),await n.stream(s).attach(p),w(!0);return}catch(U){b=U,Wt(`start attempt ${m}/${d} failed`,U),m<d&&await new Promise(R=>setTimeout(R,u))}k(),w(!1);let C=b instanceof Error?b:new Error(String(b??"voice start failed"));throw v.current?.(C),C},[n,s,a,i,d,u,k,w]);return $t(t,()=>({start:A,stop:L,unlock:()=>x.current?.unlock(),get active(){return y.current},get micStream(){return T.current},get audio(){return x.current}}),[A,L]),Ht(()=>k,[k]),Gt(De,{ref:x,session:n,stream:s,onTrack:f,onUnlockChange:P})});import{sessionFailureFromMediaError as Cr}from"@urun-sh/core";import{forwardRef as Xt,useCallback as F,useEffect as Zt,useImperativeHandle as Kt,useRef as V,useState as Yt}from"react";import{jsx as en,jsxs as rn}from"react/jsx-runtime";var Rr={width:{ideal:960},height:{ideal:720},frameRate:{ideal:8}};function Tr(...r){console.debug("[urun-camera]",...r)}var Qt=Xt(function(e,t){let{session:n,stream:s="video",constraints:a,facingMode:i="environment",mirror:d="auto",connectTimeoutMs:u,preview:c=!0,className:h,videoClassName:l,onActiveChange:f,onError:P,onStream:x,onTrack:T,children:y}=e,g=V(null),v=V(null),S=V(null),w=V(!1),k=V(i),[L,A]=Yt(i),o=V(f);o.current=f;let p=V(P);p.current=P;let b=V(x);b.current=x;let C=V(T);C.current=T;let m=F(E=>{w.current!==E&&(w.current=E,o.current?.(E))},[]),U=F(E=>{let N=g.current;N&&(N.muted=!0,N.srcObject=E,E&&N.play()?.catch?.(j=>Tr("preview play() failed",j)))},[]),R=F(()=>{S.current?.(),S.current=null;let E=v.current;if(E){for(let N of E.getTracks())N.stop();v.current=null,b.current?.(null),C.current?.(null)}U(null)},[U]),q=F(async E=>{let N=v.current,j=S.current,_;try{_=await navigator.mediaDevices.getUserMedia({video:{...Rr,...a,facingMode:E},audio:!1})}catch(O){let B=Cr(O,n.status);throw p.current?.(B),B}let M=_.getVideoTracks()[0];if(!M){for(let B of _.getTracks())B.stop();let O=Cr(Object.assign(new Error("no camera video track"),{name:"NotFoundError"}),n.status);throw p.current?.(O),O}v.current=_,k.current=E,A(E),U(_),b.current?.(_);let I=()=>{v.current===_&&(Tr("camera track ended (device removed or permission revoked)"),R(),m(!1))};M.addEventListener("ended",I),S.current=()=>M.removeEventListener("ended",I);try{n.connect?.(),await n.whenLive(u!==void 0?{timeout:u}:void 0),await n.stream(s).attachVideo(M)}catch(O){M.removeEventListener("ended",I);for(let Mr of _.getTracks())Mr.stop();v.current===_&&(v.current=N,S.current=j,U(N),b.current?.(N));let B=O instanceof Error?O:new Error(String(O));throw p.current?.(B),B}if(N&&N!==_){j?.();for(let O of N.getTracks())O.stop()}C.current?.(M),m(!0)},[n,s,a,u,U,R,m]),Se=F(E=>q(E?.facingMode??k.current),[q]),be=F(async E=>{w.current&&k.current===E||await q(E)},[q]),ye=F(()=>q(k.current==="environment"?"user":"environment"),[q]),ke=F(async()=>{R(),m(!1),await n.stream(s).detachVideo().catch(()=>{})},[n,s,R,m]);return Kt(t,()=>({start:Se,stop:ke,flip:ye,setFacingMode:be,get active(){return w.current},get facingMode(){return k.current},get stream(){return v.current},get element(){return g.current}}),[Se,ke,ye,be]),Zt(()=>R,[R]),c?rn("div",{className:h,style:{position:"relative",width:"100%",height:"100%"},"data-urun-camera":"","data-urun-camera-facing":L,children:[en("video",{ref:g,className:l,autoPlay:!0,muted:!0,playsInline:!0,style:{width:"100%",height:"100%",objectFit:"contain",...(d==="auto"?L==="user":d)?{transform:"scaleX(-1)"}:{}}}),y]}):null});import{useEffect as tn,useState as nn}from"react";var Fe={level:0,speaking:!1};function on(r,e={}){let{fftSize:t=512,intervalMs:n=100,speakingThreshold:s=.02}=e,[a,i]=nn(Fe);return tn(()=>{if(!r){i(Fe);return}let d=pe();if(!d||typeof MediaStream>"u")return;let u;r instanceof MediaStream?u=r:(u=new MediaStream,u.addTrack(r));let c,h;try{c=d.createMediaStreamSource(u),h=d.createAnalyser(),h.fftSize=t,c.connect(h)}catch{return}let l=new Uint8Array(h.fftSize),P=setInterval(()=>{h.getByteTimeDomainData(l);let x=0;for(let y=0;y<l.length;y++){let g=(l[y]-128)/128;x+=g*g}let T=Math.sqrt(x/l.length);i(y=>{let g=T>s;return Math.abs(y.level-T)<.005&&y.speaking===g?y:{level:T,speaking:g}})},n);return()=>{clearInterval(P),c.disconnect(),i(Fe)}},[r,t,n,s]),a}import{useEffect as sn,useState as an}from"react";function un(r,e){let[t,n]=an(null);return sn(()=>{if(!r||!e){n(null);return}let s=r.stream(e);return n(s.track),s.on("track",n)},[r,e]),t}import{useCallback as cn,useEffect as ln,useState as Pr}from"react";function ze(r,e){let[t,n]=Pr(null),[s,a]=Pr(!1);ln(()=>{if(!r||!e){n(null),a(!1);return}let d=r.doc(e);n(d.get()??{}),a(d.synced);let u=d.on("change",h=>n(h)),c=d.onSynced(()=>a(!0));return()=>{u(),c()}},[r,e]);let i=cn(d=>{r&&e&&r.doc(e).set(d)},[r,e]);return{snapshot:t,synced:s,set:i}}import{useEffect as dn,useState as pn}from"react";var $=200;function z(r,e,t=200){let n=[...r,e];return n.length>t?n.slice(n.length-t):n}function te(r){if(typeof r=="string")return r;try{return JSON.stringify(r)}catch{return String(r)}}function Be(r){let e=r.trim();if(!e)return{ok:!1,error:"Enter a JSON object."};let t;try{t=JSON.parse(e)}catch(n){return{ok:!1,error:n instanceof Error?n.message:"Invalid JSON."}}return t===null||typeof t!="object"||Array.isArray(t)?{ok:!1,error:"The payload must be a JSON object."}:{ok:!0,value:t}}function He(r,e,t={}){let n=t.cap??200,[s,a]=pn([]);return dn(()=>{if(a([]),!r||!e)return;let i=!0,d=r.stream(e).messages()[Symbol.asyncIterator]();return(async()=>{for(;;){let u=await d.next();if(!i||u.done)break;a(c=>z(c,{at:Date.now(),payload:u.value},n))}})(),()=>{i=!1,d.return?.()}},[r,e,n]),s}import{jsx as fe,jsxs as ne}from"react/jsx-runtime";function mn({session:r,name:e,cap:t,className:n}){let s=He(r,e,{cap:t});return ne("div",{className:["urun-stream-tail",n].filter(Boolean).join(" "),children:[ne("div",{className:"urun-stream-tail-meta",children:[fe("code",{children:e}),ne("span",{className:"urun-stream-tail-count",children:[s.length," messages"]})]}),fe("div",{className:"urun-stream-tail-log",children:s.length===0?ne("span",{className:"urun-stream-tail-empty",children:["Waiting for ",fe("code",{children:e})," messages\u2026"]}):s.map((a,i)=>ne("div",{className:"urun-stream-tail-line",children:[fe("span",{className:"urun-stream-tail-time",children:new Date(a.at).toLocaleTimeString()})," ",te(a.payload)]},`${a.at}-${i}`))})]})}import{useCallback as fn,useState as wr}from"react";import{jsx as W,jsxs as ge}from"react/jsx-runtime";function he({placeholder:r,buttonLabel:e,disabled:t,onApply:n}){let[s,a]=wr(""),[i,d]=wr(null),u=fn(()=>{let c=Be(s);if(!c.ok){d(c.error);return}d(null),n(c.value,s.trim()),a("")},[s,n]);return ge("div",{className:"urun-doc-patch",children:[W("textarea",{className:"urun-doc-patch-input",value:s,onChange:c=>a(c.target.value),placeholder:r,rows:3}),ge("div",{className:"urun-doc-patch-actions",children:[W("button",{type:"button",className:"urun-doc-patch-button",disabled:t||!s.trim(),onClick:u,children:e}),i?W("span",{className:"urun-doc-patch-error",role:"alert",children:i}):null]})]})}function gn({session:r,docKey:e,editable:t=!0,patchPlaceholder:n='{"desired": {"prompt": {"text": "a sunset"}}}',className:s}){let{snapshot:a,synced:i,set:d}=ze(r,e);return ge("div",{className:["urun-doc-panel",s].filter(Boolean).join(" "),children:[ge("div",{className:"urun-doc-panel-meta",children:[W("code",{children:e}),W("span",{className:"urun-doc-panel-synced","data-synced":i?"true":"false",children:i?"synced":"syncing\u2026"})]}),W("pre",{className:"urun-doc-panel-snapshot",children:JSON.stringify(a??{},null,2)}),t?W(he,{placeholder:n,buttonLabel:"Apply patch",disabled:!r,onApply:u=>d(u)}):null]})}import{useEffect as hn,useState as vn}from"react";import{jsx as oe,jsxs as Er}from"react/jsx-runtime";function Ur(r,e=600){return r.length>e?`${r.slice(0,e)}\u2026`:r}function Sn({session:r,docKey:e="control",cap:t=200,className:n}){let[s,a]=vn([]);return hn(()=>(a([]),r?r.doc(e).on("change",d=>{a(u=>z(u,{at:Date.now(),direction:"in",text:Ur(te(d))},t))}):void 0),[r,e,t]),Er("div",{className:["urun-control-sender",n].filter(Boolean).join(" "),children:[oe(he,{placeholder:'{"desired": {"settings": {"values": {}}}}',buttonLabel:`Send to ${e}`,disabled:!r,onApply:(i,d)=>{r?.doc(e).set(i),a(u=>z(u,{at:Date.now(),direction:"out",text:Ur(d)},t))}}),oe("div",{className:"urun-control-sender-log",children:s.length===0?oe("span",{className:"urun-control-sender-empty",children:"Nothing yet."}):[...s].reverse().map((i,d)=>Er("div",{className:"urun-control-sender-line","data-direction":i.direction,children:[oe("span",{className:"urun-control-sender-dir",children:i.direction==="out"?"sent":"change"})," ",oe("span",{className:"urun-control-sender-time",children:new Date(i.at).toLocaleTimeString()})," ",i.text]},`${i.at}-${d}`))})]})}import{useEffect as bn,useState as yn}from"react";import{jsx as ve,jsxs as xn}from"react/jsx-runtime";function kn({session:r,trackNames:e=["video","audio"],docKeys:t=["control"],cap:n=200,className:s}){let[a,i]=yn([]),d=e.join(","),u=t.join(",");return bn(()=>{if(i([]),!r)return;let c=(l,f)=>i(P=>z(P,{at:Date.now(),kind:l,text:f},n)),h=[];h.push(r.onPhase(l=>c("phase",`phase \u2192 ${l.name}`)));for(let l of e){let f=r.stream(l);h.push(f.on("track",P=>c("track",`${l}: ${P?"track arrived":"track ended"}`)))}for(let l of t){let f=r.doc(l);h.push(f.on("change",()=>c("doc",`${l} changed`)))}return()=>h.forEach(l=>l())},[r,d,u,n]),ve("div",{className:["urun-event-spine",s].filter(Boolean).join(" "),children:a.length===0?ve("span",{className:"urun-event-spine-empty",children:"No activity yet \u2014 the spine fills as the session moves through its lifecycle."}):[...a].reverse().map((c,h)=>xn("div",{className:"urun-event-spine-line","data-kind":c.kind,children:[ve("span",{className:"urun-event-spine-kind",children:c.kind})," ",ve("span",{className:"urun-event-spine-time",children:new Date(c.at).toLocaleTimeString()})," ",c.text]},`${c.at}-${h}`))})}import{useEffect as Cn,useState as Tn}from"react";import{jsx as Y,jsxs as Un}from"react/jsx-runtime";var Rn={idle:"idle",queued:"queued",provisioning:"provisioning",connecting:"connecting",live:"live",error:"error",ended:"ended"};function $e(r){let[e,t]=Tn(r?.phase??null);return Cn(()=>{if(!r){t(null);return}return r.onPhase(t)},[r]),e}function Pn({session:r,className:e}){let t=$e(r),n=t?.name??"idle",s=t?.name==="queued"&&t.queue?`pos ${t.queue.position} / depth ${t.queue.depth}`:t?.name==="error"&&t.error?t.error.reason:null;return Un("span",{className:["urun-session-status",e].filter(Boolean).join(" "),"data-phase":n,children:[Y("span",{className:"urun-session-status-dot","data-phase":n}),Y("span",{className:"urun-session-status-label",children:Rn[n]}),s?Y("span",{className:"urun-session-status-detail",children:s}):null]})}function wn({session:r,children:e,fallback:t,className:n}){let s=$e(r);if(s?.name==="live")return Y("div",{className:["urun-session-gate",n].filter(Boolean).join(" "),children:e});let a=t?t(s):Y("span",{className:"urun-session-gate-fallback",children:s?.name==="error"?`Session ${s.error?.reason??"failed"}.`:s?.name==="ended"?"Session ended.":"Waiting for a live session\u2026"});return Y("div",{className:["urun-session-gate",n].filter(Boolean).join(" "),children:a})}export{it as ComponentRenderer,Rr as DEFAULT_CAMERA_CONSTRAINTS,$ as DEFAULT_LOG_CAP,xr as DEFAULT_VOICE_CONSTRAINTS,he as DocPatchForm,yt as ImageFrame,bt as ImageFrameSchema,Ct as MetricsPanel,xt as MetricsPanelSchema,lt as ProgressCard,ct as ProgressCardSchema,mt as StatusBadge,dt as StatusBadgeSchema,vt as TextStream,ht as TextStreamSchema,De as UrunAudio,_r as UrunAuthProvider,Qt as UrunCamera,Sn as UrunControlSender,gn as UrunDocPanel,ee as UrunErrorBoundary,kn as UrunEventSpine,Or as UrunJwtProvider,Fr as UrunProvider,wn as UrunSessionGate,Pn as UrunSessionStatus,mn as UrunStreamTail,qt as UrunVideo,Jt as UrunVoice,xe as authMode,te as formatPayload,pe as getUrunAudioContext,Be as parseJsonObject,z as pushCapped,at as registerComponent,Ve as resumeUrunAudioContext,Q as urunPublicEnv,Jr as useApp,st as useChat,rt as useCompletion,cr as useImageFrame,lr as useMetricsPanel,tr as useProgressCard,Kr as useRequest,ze as useSessionDoc,$e as useSessionPhase,un as useSessionTrack,or as useStatusBadge,He as useStreamMessages,ir as useTextStream,on as useUrunAudioLevel,Ce as useUrunAuth,Nr as usesWorkOSAuth};
|
package/dist/styles.css
CHANGED
|
@@ -251,3 +251,151 @@
|
|
|
251
251
|
.urun-video-live .vjs-poster {
|
|
252
252
|
background-color: transparent;
|
|
253
253
|
}
|
|
254
|
+
|
|
255
|
+
/* ── Session workbench building blocks ─────────────────────────────────────
|
|
256
|
+
* Unstyled-by-default debug/steer blocks: minimal chrome via CSS custom
|
|
257
|
+
* properties so a consumer can theme with --urun-wb-* or override .urun-*. */
|
|
258
|
+
.urun-stream-tail,
|
|
259
|
+
.urun-doc-panel,
|
|
260
|
+
.urun-control-sender,
|
|
261
|
+
.urun-event-spine {
|
|
262
|
+
display: flex;
|
|
263
|
+
flex-direction: column;
|
|
264
|
+
gap: 6px;
|
|
265
|
+
font-size: 12px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.urun-stream-tail-meta,
|
|
269
|
+
.urun-doc-panel-meta {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
gap: 8px;
|
|
273
|
+
color: var(--urun-wb-muted, #8a8a8a);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.urun-stream-tail-log,
|
|
277
|
+
.urun-control-sender-log {
|
|
278
|
+
display: flex;
|
|
279
|
+
flex-direction: column;
|
|
280
|
+
gap: 2px;
|
|
281
|
+
max-height: 220px;
|
|
282
|
+
overflow: auto;
|
|
283
|
+
padding: 6px;
|
|
284
|
+
border-radius: 6px;
|
|
285
|
+
background: var(--urun-wb-log-bg, rgba(0, 0, 0, 0.25));
|
|
286
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
287
|
+
font-size: 11px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.urun-stream-tail-time,
|
|
291
|
+
.urun-control-sender-time,
|
|
292
|
+
.urun-event-spine-time {
|
|
293
|
+
color: var(--urun-wb-muted, #8a8a8a);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.urun-doc-panel-snapshot {
|
|
297
|
+
margin: 0;
|
|
298
|
+
padding: 8px;
|
|
299
|
+
max-height: 220px;
|
|
300
|
+
overflow: auto;
|
|
301
|
+
border-radius: 6px;
|
|
302
|
+
background: var(--urun-wb-log-bg, rgba(0, 0, 0, 0.25));
|
|
303
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
304
|
+
font-size: 11px;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.urun-doc-patch,
|
|
308
|
+
.urun-control-sender {
|
|
309
|
+
display: flex;
|
|
310
|
+
flex-direction: column;
|
|
311
|
+
gap: 6px;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.urun-doc-patch-input {
|
|
315
|
+
width: 100%;
|
|
316
|
+
resize: vertical;
|
|
317
|
+
border-radius: 6px;
|
|
318
|
+
border: 1px solid var(--urun-wb-border, rgba(128, 128, 128, 0.4));
|
|
319
|
+
background: var(--urun-wb-input-bg, transparent);
|
|
320
|
+
color: inherit;
|
|
321
|
+
padding: 6px 8px;
|
|
322
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
323
|
+
font-size: 12px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.urun-doc-patch-actions {
|
|
327
|
+
display: flex;
|
|
328
|
+
align-items: center;
|
|
329
|
+
gap: 8px;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.urun-doc-patch-button,
|
|
333
|
+
.urun-mic-button {
|
|
334
|
+
cursor: pointer;
|
|
335
|
+
border-radius: 6px;
|
|
336
|
+
border: 1px solid var(--urun-wb-border, rgba(128, 128, 128, 0.4));
|
|
337
|
+
background: var(--urun-wb-accent, #24db49);
|
|
338
|
+
color: var(--urun-wb-accent-fg, #04120a);
|
|
339
|
+
padding: 4px 12px;
|
|
340
|
+
font-size: 12px;
|
|
341
|
+
font-weight: 600;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.urun-doc-patch-button:disabled {
|
|
345
|
+
cursor: default;
|
|
346
|
+
opacity: 0.5;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.urun-doc-patch-error,
|
|
350
|
+
.urun-mic-error {
|
|
351
|
+
color: var(--urun-wb-danger, #e5484d);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.urun-event-spine {
|
|
355
|
+
max-height: 260px;
|
|
356
|
+
overflow: auto;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.urun-event-spine-line,
|
|
360
|
+
.urun-control-sender-line {
|
|
361
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
362
|
+
font-size: 11px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.urun-event-spine-kind,
|
|
366
|
+
.urun-control-sender-dir {
|
|
367
|
+
display: inline-block;
|
|
368
|
+
min-width: 3.5em;
|
|
369
|
+
color: var(--urun-wb-muted, #8a8a8a);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Session status pill + gate */
|
|
373
|
+
.urun-session-status {
|
|
374
|
+
display: inline-flex;
|
|
375
|
+
align-items: center;
|
|
376
|
+
gap: 6px;
|
|
377
|
+
font-size: 12px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.urun-session-status-dot {
|
|
381
|
+
width: 8px;
|
|
382
|
+
height: 8px;
|
|
383
|
+
border-radius: 50%;
|
|
384
|
+
background: var(--urun-wb-muted, #8a8a8a);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.urun-session-status-dot[data-phase='live'] {
|
|
388
|
+
background: var(--urun-wb-accent, #24db49);
|
|
389
|
+
}
|
|
390
|
+
.urun-session-status-dot[data-phase='connecting'],
|
|
391
|
+
.urun-session-status-dot[data-phase='provisioning'],
|
|
392
|
+
.urun-session-status-dot[data-phase='queued'] {
|
|
393
|
+
background: var(--urun-wb-warn, #ffb224);
|
|
394
|
+
}
|
|
395
|
+
.urun-session-status-dot[data-phase='error'] {
|
|
396
|
+
background: var(--urun-wb-danger, #e5484d);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.urun-session-status-detail {
|
|
400
|
+
color: var(--urun-wb-muted, #8a8a8a);
|
|
401
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urun-sh/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "React bindings for the urun TypeScript SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"require": "./dist/index.js"
|
|
22
22
|
},
|
|
23
23
|
"./auth": {
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"import": "./dist/
|
|
26
|
-
"require": "./dist/
|
|
24
|
+
"types": "./dist/auth.d.ts",
|
|
25
|
+
"import": "./dist/auth.mjs",
|
|
26
|
+
"require": "./dist/auth.js"
|
|
27
27
|
},
|
|
28
28
|
"./workos": {
|
|
29
29
|
"types": "./dist/workos.d.ts",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dev": "tsup --watch"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@urun-sh/core": "^0.2.
|
|
51
|
+
"@urun-sh/core": "^0.2.5",
|
|
52
52
|
"@workos-inc/authkit-nextjs": "^3.0.0",
|
|
53
53
|
"@workos-inc/authkit-react": "^0.15.0 || ^0.16.0",
|
|
54
54
|
"next": "^15.0.0 || ^16.0.0",
|