@odigos/ui-kit 0.0.265 → 0.0.267

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 (31) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/docs/api-context.md +2 -2
  3. package/lib/chunks/{index-BMLDblot.js → index-DUhfkGj1.js} +1 -1
  4. package/lib/chunks/{odigos-context-Dq_yIuDF.js → odigos-context-DzuZq_D5.js} +1 -1
  5. package/lib/chunks/{source-instrument-form-context-D1tB6ZAx.js → source-instrument-form-context-oSSPNkMA.js} +1 -1
  6. package/lib/chunks/ui-components-Dq_j4_BI.js +1591 -0
  7. package/lib/components/condition/index.d.ts +10 -1
  8. package/lib/components/skeleton-loader/index.d.ts +2 -1
  9. package/lib/components.js +1 -1
  10. package/lib/constants/strings/index.d.ts +4 -1
  11. package/lib/constants.js +1 -1
  12. package/lib/containers/_drawers/edit-source-drawer/libraries/index.d.ts +6 -0
  13. package/lib/containers/_drawers/edit-source-drawer/overview/runtime-card.d.ts +2 -0
  14. package/lib/containers/_drawers/edit-source-drawer/overview/vm-processes.d.ts +10 -0
  15. package/lib/containers/_drawers/edit-source-drawer/pods/containers-card/process-card.d.ts +7 -1
  16. package/lib/containers/_drawers/edit-source-drawer/tabs.d.ts +1 -0
  17. package/lib/containers.js +241 -230
  18. package/lib/contexts/odigos-api/types.d.ts +13 -0
  19. package/lib/contexts/odigos-api/use-odigos-api.d.ts +11 -2
  20. package/lib/contexts.js +1 -1
  21. package/lib/functions.js +1 -1
  22. package/lib/hooks.js +1 -1
  23. package/lib/snippets.js +1 -1
  24. package/lib/store.js +1 -1
  25. package/lib/theme/palettes/index.d.ts +1 -0
  26. package/lib/theme.js +1 -1
  27. package/lib/types/workload/index.d.ts +30 -0
  28. package/lib/types.js +1 -1
  29. package/lib/visuals.js +1 -1
  30. package/package.json +1 -1
  31. package/lib/chunks/ui-components-CoDVeDqt.js +0 -1581
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.267](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.266...ui-kit-v0.0.267) (2026-07-16)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api-context:** enhance proxy switching with clientKey for cache management ([#1086](https://github.com/odigos-io/ui-kit/issues/1086)) ([a30ea01](https://github.com/odigos-io/ui-kit/commit/a30ea01f21df18785ba5e386b310251c1b48b3b0))
9
+
10
+ ## [0.0.266](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.265...ui-kit-v0.0.266) (2026-07-15)
11
+
12
+
13
+ ### Features
14
+
15
+ * **edit-source-drawer:** VM per-PID process list under Instrumentation (PLAT-1276) ([#1088](https://github.com/odigos-io/ui-kit/issues/1088)) ([5a11e48](https://github.com/odigos-io/ui-kit/commit/5a11e48570a6cfb88c5e189f25e4f165cf1f304e))
16
+ * revive instrumented libraries tab in the source drawer ([#1081](https://github.com/odigos-io/ui-kit/issues/1081)) ([582a38c](https://github.com/odigos-io/ui-kit/commit/582a38c772829227b6e73445d938d1e3e71297ee))
17
+ * **source-drawer:** merge rollout status with actionItems (PLAT-1288) ([#1091](https://github.com/odigos-io/ui-kit/issues/1091)) ([ac7d333](https://github.com/odigos-io/ui-kit/commit/ac7d3332aadd01dc572b889a7721e0d500f001f9))
18
+ * **table:** integrate SkeletonLoader in Table component for loading state ([#1089](https://github.com/odigos-io/ui-kit/issues/1089)) ([4bfc635](https://github.com/odigos-io/ui-kit/commit/4bfc6356670ffb0981db27d15ec64430e719bfb8))
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **button:** loading state (PLAT-1284) ([#1087](https://github.com/odigos-io/ui-kit/issues/1087)) ([f295982](https://github.com/odigos-io/ui-kit/commit/f295982f3d56562c1d7eadac37f7409f320b6ab7))
24
+ * **libraries:** add count, remove message, change origin of data ([#1090](https://github.com/odigos-io/ui-kit/issues/1090)) ([b9d4d53](https://github.com/odigos-io/ui-kit/commit/b9d4d534ebe4521f61532d3dd90edb49b58e6157))
25
+ * **z-index:** keep sidebar above upgrade-required modal [PLAT-1251] ([#1085](https://github.com/odigos-io/ui-kit/issues/1085)) ([5c34fd2](https://github.com/odigos-io/ui-kit/commit/5c34fd2655b23c5b800b48078ecd4f70c63a63b3))
26
+
3
27
  ## [0.0.265](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.264...ui-kit-v0.0.265) (2026-07-14)
4
28
 
5
29
 
@@ -461,7 +461,7 @@ graph LR
461
461
  FETCH -->|"runQuery<br/>(network-only)"| CACHE
462
462
  MUT -->|"runMutation<br/>then await fetchAll()"| CACHE
463
463
  SSE[Host SSE handler] -->|"sourcesApi.fetchAll()"| CACHE
464
- PROXY[Proxy switch<br/>central-ui] -->|"resetCache()"| CACHE
464
+ PROXY[Proxy switch<br/>central-ui] -->|"bump clientKey<br/>(new ApolloClient)"| CACHE
465
465
 
466
466
  CACHE -.broadcast.-> SUB
467
467
  CACHE -.broadcast.-> SUB2
@@ -473,7 +473,7 @@ graph LR
473
473
 
474
474
  **SSE.** Both host SSE handlers (`useSSE.ts`) drop their old `useEntityStore` imports and refresh through the same `sourcesApi.fetchAll()` / `destinationsApi.fetchAll()` entry points. The deleted-target eviction primitive is gone — for an envelope-aware kit (central-ui's `REMOTE_FETCH` makes generic `cache.modify` impractical), refetching the canonical list is simpler and the result is identical.
475
475
 
476
- **Reset.** Central-ui's `useProxy.resetStores()` calls `useOdigosApi().resetCache()` when switching between proxies (and on every out-of-proxy navigation). `resetCache()` delegates to `client.cache.reset()` **not** `client.clearStore()`. This matters: `clearStore()` aborts every in-flight query, rejecting it with Apollo error #42 ("Store reset while query was in flight"). Because central-ui resets on out-of-proxy navigation, that abort raced with the legitimate out-of-proxy queries still loading on the same render (`GetSystemConfig`, `GetHealth`, `GetComputePlatforms`) and surfaced them as confusing network/CORS-looking errors plus an error toast. `cache.reset()` wipes the cache and broadcasts to active watchers (they re-render empty and re-fetch on next access) but leaves in-flight requests alone — they write into the freshly-reset cache when they resolve.
476
+ **Reset.** Central-ui bumps `ApolloConfig.clientKey` (via an `apolloCacheEpoch` on the proxy store) when switching proxies and on every out-of-proxy navigation. That recreates the ApolloClient with an empty cache and orphans any in-flight writes onto the discarded client the reliable hard boundary for multi-proxy caching. Soft alternative: `useOdigosApi().resetCache()` `client.cache.reset()`, which does **not** abort in-flight queries (avoids Apollo error #42) but also cannot stop those responses from writing the previous proxy's data back into the cleared cache. Prefer `clientKey` for proxy switches; use `resetCache` when you only need to drop entities without tearing down the client.
477
477
 
478
478
  **Precondition guards (`Operation.canRun`).** An `Operation` may declare `canRun?(ctx): boolean`. When it returns `false`, `useApiQuery` / `useApiLazyQuery` / `useApiMutation` skip the dispatch (no network request, no Apollo observer) and the imperative `runQuery` / `runMutation` short-circuit to `{ data: undefined }` with no error (so domain hooks don't toast). central-ui sets `canRun: (ctx) => !!ctx.proxyID && !!getVersionedQuery(...)` on every `REMOTE_FETCH`-backed op: out-of-proxy pages have no selected proxy, so without the guard the kit would fire an empty `RemoteFetch($proxyID, $query, $variables)` with both required vars missing. The multi-cluster fan-out path (`runMulti` / `transformVariablesMulti`) is scoped by explicit `proxyIDs` and intentionally bypasses `canRun`, so connections-scope bulk drawers keep working even though `ctx.proxyID` is empty there.
479
479
 
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{W as l,B as r,c as n,D as i,V as s,F as o,d,e as c,f as u,g as p,C as h,h as g,i as m,I as v,s as f,j as b,k as y,l as x,m as C,n as S,o as T,L as $,p as k,q as w,J as A,G as O,H as P,r as M,u as L,v as D,b as I,w as N,x as R,y as z,S as E,z as X,E as H,K as B,M as V,N as j,O as q,Q as G,U as _,X as U,Y as J,Z as K,_ as W,$ as Y,a0 as F,a1 as Z,a2 as Q,a3 as ee,a4 as ae,a5 as te,a6 as le,a7 as re,a8 as ne,a9 as ie,aa as se,ab as oe,ac as de,ad as ce,ae as ue,af as pe,ag as he,ah as ge,ai as me,aj as ve,ak as fe,al as be,am as ye,an as xe,ao as Ce,ap as Se,aq as Te,ar as $e,as as ke,at as we,au as Ae,av as Oe,aw as Pe,ax as Me,ay as Le,az as De,aA as Ie,aB as Ne,aC as Re,aD as ze,aE as Ee,aF as Xe,aG as He,aH as Be,aI as Ve,aJ as je,aK as qe,aL as Ge,aM as _e,aN as Ue,aO as Je,aP as Ke,aQ as We,aR as Ye,aS as Fe,aT as Ze,aU as Qe,aV as ea,aW as aa,aX as ta,aY as la,R as ra,aZ as na,a_ as ia,A as sa,a$ as oa,b0 as da}from"./ui-components-CoDVeDqt.js";import{VIcon as ca,EditIcon as ua,OdigosLogoTextCentral as pa,OdigosLogoTextEnterprise as ha,OdigosLogoTextCommunity as ga,OdigosLogoTextColoredCentral as ma,OdigosLogoTextColoredEnterprise as va,OdigosLogoTextColoredCommunity as fa,ArrowLeftIcon as ba,ArrowRightIcon as ya,VSquareIcon as xa,CopyIcon as Ca,YamlIcon as Sa}from"../icons.js";import Ta,{useMemo as $a,useCallback as ka,useState as wa,useEffect as Aa,useRef as Oa,forwardRef as Pa,useImperativeHandle as Ma}from"react";import{a as La,C as Da,b as Ia,u as Na,i as Ra,d as za,e as Ea,f as Xa,g as Ha,h as Ba,j as Va,k as ja,m as qa}from"./odigos-context-Dq_yIuDF.js";import Ga,{useTheme as _a}from"styled-components";const Ua=({isOpen:a,onClose:t,onDeny:n,onApprove:i})=>e(l,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:a,onClose:t,denyButton:{label:"Keep editing",variant:r.Secondary,onClick:()=>{n?.(),t()}},approveButton:{label:"Discard changes",variant:r.Primary,onClick:()=>{i?.(),t()}}}),Ja=({isOpen:a,onClose:t,onViewConnector:o})=>e(l,{isOpen:a,onClose:t,visual:()=>e(s,{scale:1.2,icon:ca}),title:i.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:i.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:n.STAY_ON_CONNECTIONS,variant:r.Secondary,onClick:t},approveButton:{label:n.GO_TO_CONNECTOR_OVERVIEW,variant:r.Primary,onClick:o??t}}),Ka=({isOpen:a,onClose:t,onDeny:n,onApprove:i,action:s="delete",target:o,description:d,overrideApproveButtonLabel:c,overrideDenyButtonLabel:u})=>{const p=s.charAt(0).toUpperCase()+s.substring(1),h=o?.endsWith("s")?"these":"this";return e(l,{title:`${p}${o?` ${o}`:""}?`,description:d??`Are you sure you want to ${s}${o?` ${h} ${o}`:""}?`,isOpen:a,onClose:t,denyButton:{label:u??"Go back",variant:r.Secondary,onClick:()=>{n?.(),t()}},approveButton:{label:c??p,variant:r.Primary,onClick:()=>{i?.(),t()}}})},Wa=({componentType:a,inputType:t,name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T,setValue:$,errorMessage:k,warnMessage:w,helpMessage:A,dropdownOptions:O,dropdownNoSearch:P,dropdownNoCheckbox:M,timeUnits:L,timeDefaultUnit:D,toggleSize:I=u.L})=>{switch(a){case o.Input:return e(y,{name:l,type:t,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T??"",onChange:e=>{const a=e.target.value;$(t===x.Number?""===a?null:Number(a):a)},errorMessage:k,warnMessage:w,helpMessage:A},l);case o.MultiInput:return e(b,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,values:Array.isArray(T)?T:f(T,[]),setValues:e=>$(e),errorMessage:k,warnMessage:w,helpMessage:A,plain:!0},l);case o.KeyValuePair:return e(v,{name:l,label:r,tooltip:n,badge:i,required:C,disabled:S,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(T)?T:f(T,[]),setValues:e=>$(e),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.TextArea:return e(m,{name:l,label:r,tooltip:n,badge:i,required:C,disabled:S,placeholder:s,value:T??"",onChange:e=>$(e.target.value),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Dropdown:return e(g,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,withSearch:!P,options:O?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!M}))||[],values:T?[String(T)]:[],setValues:e=>$(e[0]),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Checkbox:return e(h,{name:l,label:r,tooltip:n,badge:i,value:!0===T||"true"===T,onChange:e=>$(e),disabled:S,errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Time:return e(p,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T??"",setValue:e=>$(e),units:L,defaultUnit:D,errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Toggle:return e(d,{name:l,size:I,labelAlign:c.Right,label:r,tooltip:n,badge:i,value:!0===T||"true"===T,onChange:e=>$(e),disabled:S,errorMessage:k,warnMessage:w,helpMessage:A},l);default:return null}},Ya=Ga.div`
1
+ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{W as l,B as r,c as n,D as i,V as s,F as o,d,e as c,f as u,g as p,C as h,h as g,i as m,I as v,s as f,j as b,k as y,l as x,m as C,n as S,o as T,L as $,p as k,q as w,J as A,G as O,H as P,r as M,u as L,v as D,b as I,w as N,x as R,y as z,S as E,z as X,E as H,K as B,M as V,N as j,O as q,Q as G,U as _,X as U,Y as J,Z as K,_ as W,$ as Y,a0 as F,a1 as Z,a2 as Q,a3 as ee,a4 as ae,a5 as te,a6 as le,a7 as re,a8 as ne,a9 as ie,aa as se,ab as oe,ac as de,ad as ce,ae as ue,af as pe,ag as he,ah as ge,ai as me,aj as ve,ak as fe,al as be,am as ye,an as xe,ao as Ce,ap as Se,aq as Te,ar as $e,as as ke,at as we,au as Ae,av as Oe,aw as Pe,ax as Me,ay as Le,az as De,aA as Ie,aB as Ne,aC as Re,aD as ze,aE as Ee,aF as Xe,aG as He,aH as Be,aI as Ve,aJ as je,aK as qe,aL as Ge,aM as _e,aN as Ue,aO as Je,aP as Ke,aQ as We,aR as Ye,aS as Fe,aT as Ze,aU as Qe,aV as ea,aW as aa,aX as ta,aY as la,R as ra,aZ as na,a_ as ia,A as sa,a$ as oa,b0 as da}from"./ui-components-Dq_j4_BI.js";import{VIcon as ca,EditIcon as ua,OdigosLogoTextCentral as pa,OdigosLogoTextEnterprise as ha,OdigosLogoTextCommunity as ga,OdigosLogoTextColoredCentral as ma,OdigosLogoTextColoredEnterprise as va,OdigosLogoTextColoredCommunity as fa,ArrowLeftIcon as ba,ArrowRightIcon as ya,VSquareIcon as xa,CopyIcon as Ca,YamlIcon as Sa}from"../icons.js";import Ta,{useMemo as $a,useCallback as ka,useState as wa,useEffect as Aa,useRef as Oa,forwardRef as Pa,useImperativeHandle as Ma}from"react";import{a as La,C as Da,b as Ia,u as Na,i as Ra,d as za,e as Ea,f as Xa,g as Ha,h as Ba,j as Va,k as ja,m as qa}from"./odigos-context-DzuZq_D5.js";import Ga,{useTheme as _a}from"styled-components";const Ua=({isOpen:a,onClose:t,onDeny:n,onApprove:i})=>e(l,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:a,onClose:t,denyButton:{label:"Keep editing",variant:r.Secondary,onClick:()=>{n?.(),t()}},approveButton:{label:"Discard changes",variant:r.Primary,onClick:()=>{i?.(),t()}}}),Ja=({isOpen:a,onClose:t,onViewConnector:o})=>e(l,{isOpen:a,onClose:t,visual:()=>e(s,{scale:1.2,icon:ca}),title:i.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:i.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:n.STAY_ON_CONNECTIONS,variant:r.Secondary,onClick:t},approveButton:{label:n.GO_TO_CONNECTOR_OVERVIEW,variant:r.Primary,onClick:o??t}}),Ka=({isOpen:a,onClose:t,onDeny:n,onApprove:i,action:s="delete",target:o,description:d,overrideApproveButtonLabel:c,overrideDenyButtonLabel:u})=>{const p=s.charAt(0).toUpperCase()+s.substring(1),h=o?.endsWith("s")?"these":"this";return e(l,{title:`${p}${o?` ${o}`:""}?`,description:d??`Are you sure you want to ${s}${o?` ${h} ${o}`:""}?`,isOpen:a,onClose:t,denyButton:{label:u??"Go back",variant:r.Secondary,onClick:()=>{n?.(),t()}},approveButton:{label:c??p,variant:r.Primary,onClick:()=>{i?.(),t()}}})},Wa=({componentType:a,inputType:t,name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T,setValue:$,errorMessage:k,warnMessage:w,helpMessage:A,dropdownOptions:O,dropdownNoSearch:P,dropdownNoCheckbox:M,timeUnits:L,timeDefaultUnit:D,toggleSize:I=u.L})=>{switch(a){case o.Input:return e(y,{name:l,type:t,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T??"",onChange:e=>{const a=e.target.value;$(t===x.Number?""===a?null:Number(a):a)},errorMessage:k,warnMessage:w,helpMessage:A},l);case o.MultiInput:return e(b,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,values:Array.isArray(T)?T:f(T,[]),setValues:e=>$(e),errorMessage:k,warnMessage:w,helpMessage:A,plain:!0},l);case o.KeyValuePair:return e(v,{name:l,label:r,tooltip:n,badge:i,required:C,disabled:S,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(T)?T:f(T,[]),setValues:e=>$(e),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.TextArea:return e(m,{name:l,label:r,tooltip:n,badge:i,required:C,disabled:S,placeholder:s,value:T??"",onChange:e=>$(e.target.value),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Dropdown:return e(g,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,withSearch:!P,options:O?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!M}))||[],values:T?[String(T)]:[],setValues:e=>$(e[0]),errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Checkbox:return e(h,{name:l,label:r,tooltip:n,badge:i,value:!0===T||"true"===T,onChange:e=>$(e),disabled:S,errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Time:return e(p,{name:l,label:r,tooltip:n,badge:i,placeholder:s,required:C,disabled:S,value:T??"",setValue:e=>$(e),units:L,defaultUnit:D,errorMessage:k,warnMessage:w,helpMessage:A},l);case o.Toggle:return e(d,{name:l,size:I,labelAlign:c.Right,label:r,tooltip:n,badge:i,value:!0===T||"true"===T,onChange:e=>$(e),disabled:S,errorMessage:k,warnMessage:w,helpMessage:A},l);default:return null}},Ya=Ga.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: 24px;
@@ -1,4 +1,4 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import i from"styled-components";import{T as u,t as l,b as c,P as p}from"./ui-components-CoDVeDqt.js";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=i.span`
1
+ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import i from"styled-components";import{T as u,t as l,b as c,P as p}from"./ui-components-Dq_j4_BI.js";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=i.span`
2
2
  font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
3
3
  font-size: ${({theme:e})=>e.v2.text.size.xxs}px;
4
4
  line-height: 20px;
@@ -1,4 +1,4 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b1 as c,b2 as l,D as d,aB as u,b3 as m,b4 as p,b5 as f,P as E,b as y,b6 as h,b7 as S,b8 as T,b9 as g,ba as _,bb as A,bc as R,bd as I,be as v,bf as C,bg as N,aR as O,bh as D,bi as b,bj as w,bk as P,bl as L,bm as k,bn as F,bo as G,s as U,bp as M,F as x,bq as H,H as K,q as V,G as W,J as Y,p as $,br as j}from"./ui-components-CoDVeDqt.js";import{n as q,m as B,k as Q,l as z,o as J,p as X,v as Z,q as ee,u as te}from"./odigos-context-Dq_yIuDF.js";import{ApolloProvider as re,useLazyQuery as ae,useApolloClient as ne,useQuery as oe}from"@apollo/client/react";import{ErrorLink as se}from"@apollo/client/link/error";import{SetContextLink as ie}from"@apollo/client/link/context";import{getMainDefinition as ce}from"@apollo/client/utilities";import{CombinedGraphQLErrors as le,ServerError as de}from"@apollo/client/errors";import{HttpLink as ue,ApolloLink as me,ApolloClient as pe,InMemoryCache as fe,gql as Ee}from"@apollo/client";const ye=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},he=a(null),Se=()=>{const e=r(he);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},Te=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new ue({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new se(({error:t})=>{le.is(t)?t.errors.some(e=>ye(e.message))&&e.onAuthError?.():(de.is(t)&&401===t.statusCode||ye(t.message))&&e.onAuthError?.()}),a=new ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=me.from(n);e.wsLink&&(o=me.split(({query:e})=>{const t=ce(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new pe({link:o,cache:new fe({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(re,{client:s,children:e(he.Provider,{value:i,children:o})})},ge=he,_e=({connectionIds:r,children:a})=>{const n=Se(),o=t(()=>({operations:n.operations,context:{...n.context,connectionIds:r},apolloConfig:n.apolloConfig}),[n.operations,n.context,n.apolloConfig,r.join(",")]);return e(ge.Provider,{value:o,children:a})},Ae=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},Re=e=>{const{addNotification:t}=c(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Ae(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(u.Error,e,t,a),notifySuccess:(e,t,a)=>r(u.Success,e,t,a),notifyPending:(e,t)=>r(u.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})}}},Ie=e=>{e({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})},ve=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ce=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Ne=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},Oe=(e,t)=>e.client??t,De=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const o=Ce(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=Oe(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?Ne(e.error):void 0}}catch(e){return{error:Ne(e)}}},be=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const n=Ce(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=Oe(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:Ne(e)}}},we=async(e,t,r,a,n)=>{if(!t)return ve("Multi fetch operation not configured");if(!r.length)return ve("No proxy ids supplied for multi fetch");const o=Oe(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=Ne(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await De(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Pe=Ee`
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b1 as c,b2 as l,D as d,aB as u,b3 as m,b4 as p,b5 as f,P as E,b as y,b6 as h,b7 as S,b8 as T,b9 as g,ba as _,bb as A,bc as R,bd as I,be as v,bf as C,bg as N,aR as O,bh as D,bi as b,bj as w,bk as P,bl as L,bm as k,bn as F,bo as G,s as U,bp as M,F as x,bq as H,H as K,q as V,G as W,J as Y,p as $,br as j}from"./ui-components-Dq_j4_BI.js";import{n as q,m as B,k as Q,l as z,o as J,p as X,v as Z,q as ee,u as te}from"./odigos-context-DzuZq_D5.js";import{ApolloProvider as re,useLazyQuery as ae,useApolloClient as ne,useQuery as oe}from"@apollo/client/react";import{ErrorLink as se}from"@apollo/client/link/error";import{SetContextLink as ie}from"@apollo/client/link/context";import{getMainDefinition as ce}from"@apollo/client/utilities";import{CombinedGraphQLErrors as le,ServerError as de}from"@apollo/client/errors";import{HttpLink as ue,ApolloLink as me,ApolloClient as pe,InMemoryCache as fe,gql as Ee}from"@apollo/client";const ye=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},he=a(null),Se=()=>{const e=r(he);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},Te=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new ue({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new se(({error:t})=>{le.is(t)?t.errors.some(e=>ye(e.message))&&e.onAuthError?.():(de.is(t)&&401===t.statusCode||ye(t.message))&&e.onAuthError?.()}),a=new ie(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=me.from(n);e.wsLink&&(o=me.split(({query:e})=>{const t=ce(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new pe({link:o,cache:new fe({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(re,{client:s,children:e(he.Provider,{value:i,children:o})})},ge=he,_e=({connectionIds:r,children:a})=>{const n=Se(),o=t(()=>({operations:n.operations,context:{...n.context,connectionIds:r},apolloConfig:n.apolloConfig}),[n.operations,n.context,n.apolloConfig,r.join(",")]);return e(ge.Provider,{value:o,children:a})},Ae=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},Re=e=>{const{addNotification:t}=c(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Ae(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(u.Error,e,t,a),notifySuccess:(e,t,a)=>r(u.Success,e,t,a),notifyPending:(e,t)=>r(u.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})}}},Ie=e=>{e({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})},ve=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ce=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Ne=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},Oe=(e,t)=>e.client??t,De=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const o=Ce(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=Oe(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?Ne(e.error):void 0}}catch(e){return{error:Ne(e)}}},be=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(Oe(t,e),r,a)}catch(e){return{error:Ne(e)}}const n=Ce(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=Oe(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:Ne(e)}}},we=async(e,t,r,a,n)=>{if(!t)return ve("Multi fetch operation not configured");if(!r.length)return ve("No proxy ids supplied for multi fetch");const o=Oe(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=Ne(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await De(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Pe=Ee`
2
2
  query OdigosApiNoop {
3
3
  __typename
4
4
  }