@nocobase/portal-template-default 1.0.14 → 1.0.16
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/assets/{LineDraw-iG-ADes-.js → LineDraw-vPRTWiQ5.js} +1 -1
- package/dist/assets/{SymbolDraw-DXoSw1tM.js → SymbolDraw-DOl_Tss3.js} +1 -1
- package/dist/assets/{VisualMapping-C_ee4Eht.js → VisualMapping-j08W3KBm.js} +1 -1
- package/dist/assets/{auth-method-demo-DaOCuvsq.js → auth-method-demo-B2qcpY8z.js} +1 -1
- package/dist/assets/auto-login-provider-BMtzvdxG.js +1 -0
- package/dist/assets/{auto-login-provider-5Uxza9Ms.js → auto-login-provider-Bukw7zEe.js} +2 -2
- package/dist/assets/auto-redirect-provider-C6GNPg5r.js +1 -0
- package/dist/assets/auto-redirect-provider-D5c6kN2R.js +1 -0
- package/dist/assets/{auto-redirect-provider-CfwRvYOI.js → auto-redirect-provider-iTzGEDpU.js} +1 -1
- package/dist/assets/{calendar-DjDRfD5t.js → calendar-Dv2RNnsr.js} +1 -1
- package/dist/assets/{card-DuQBOS6A.js → card-C9Hpeq1c.js} +1 -1
- package/dist/assets/{cas-sign-in-button-CyqG1QME.js → cas-sign-in-button-BQn3Mttx.js} +1 -1
- package/dist/assets/{components-D-ptYjX_.js → components-BT5mL9gW.js} +1 -1
- package/dist/assets/{configuration-gate-C08mkkiX.js → configuration-gate-BJoadoA6.js} +1 -1
- package/dist/assets/{createClipPathFromCoordSys-wj34-b1B.js → createClipPathFromCoordSys-m8IbnJ1z.js} +1 -1
- package/dist/assets/createSeriesDataSimply-DKUV5b5e.js +1 -0
- package/dist/assets/{customGraphicKeyframeAnimation-DWrhrHL_.js → customGraphicKeyframeAnimation-CYLPurwK.js} +1 -1
- package/dist/assets/{demo-DkIhyiRK.js → demo-BWGOwqtJ.js} +1 -1
- package/dist/assets/{demo-D4OiKplc.js → demo-BWbcvkya.js} +1 -1
- package/dist/assets/{demo-BYWHeKUe.js → demo-DIASSPgn.js} +1 -1
- package/dist/assets/{demo-DBueJg0m.js → demo-DuZ6asUU.js} +1 -1
- package/dist/assets/{demo-CPWoNtx8.js → demo-Dxcy4bDE.js} +1 -1
- package/dist/assets/{demo-CyvJk5zV.js → demo-YpEC76uw.js} +1 -1
- package/dist/assets/{demo-tpTjO0sC.js → demo-wzkoR8T2.js} +1 -1
- package/dist/assets/{dingtalk-sign-in-button-DSWsSruv.js → dingtalk-sign-in-button-DSluFaP9.js} +1 -1
- package/dist/assets/{echarts-preview-DxHNfq1C.js → echarts-preview-mRXoEciY.js} +1 -1
- package/dist/assets/{echarts-runtime-D8kXn6ME.js → echarts-runtime-CvLr4Slh.js} +3 -3
- package/dist/assets/{echarts-runtime-advanced-QY8v95qK.js → echarts-runtime-advanced-BC1tvfQ0.js} +1 -1
- package/dist/assets/{echarts-runtime-common-D-yqAK-r.js → echarts-runtime-common-DhNaV5B8.js} +1 -1
- package/dist/assets/{echarts-runtime-components-P4-i8jPU.js → echarts-runtime-components-BiioS8t1.js} +1 -1
- package/dist/assets/{echarts-runtime-hierarchy-ByQZ-DbP.js → echarts-runtime-hierarchy-CAWqYvFh.js} +1 -1
- package/dist/assets/{floating-BFVEyPEp.js → floating-RVbHvIiD.js} +1 -1
- package/dist/assets/{index-um5hdKdZ.js → index-BysibBZu.js} +1 -1
- package/dist/assets/{index-CwNxd66J.js → index-C-tdHirk.js} +1 -1
- package/dist/assets/{index-gFtCXH3o.js → index-CBZbj45X.js} +1 -1
- package/dist/assets/index-CgkdZ6Oc.js +686 -0
- package/dist/assets/{index-Btk35Nx-.js → index-Dw20Lzpp.js} +3 -3
- package/dist/assets/{index-BgCbGDMc.js → index-hSBzW-VA.js} +1 -1
- package/dist/assets/{labelHelper-DQqRy3a_.js → labelHelper-DbITmOUW.js} +1 -1
- package/dist/assets/{ldap-sign-in-form--6Gt3yGq.js → ldap-sign-in-form-BOMNDTkK.js} +1 -1
- package/dist/assets/{oidc-sign-in-button-CQdRcR_p.js → oidc-sign-in-button-Cgpa8Qzj.js} +1 -1
- package/dist/assets/{page-context-CnQ4GYM7.js → page-context-AU6RU0Qi.js} +4 -4
- package/dist/assets/prompt-card-FWugRgi-.js +1 -0
- package/dist/assets/{prompt-output-DZHRM2ft.js → prompt-output-DMTuTNab.js} +1 -1
- package/dist/assets/{saml-sign-in-button-BHL5a0JV.js → saml-sign-in-button-qt8bMeoQ.js} +1 -1
- package/dist/assets/{sectorHelper-DN_Vv6OL.js → sectorHelper-C6L782Ue.js} +1 -1
- package/dist/assets/shortcut-Bu7jT_-w.js +47 -0
- package/dist/assets/{sms-sign-in-form-DTX9GV2I.js → sms-sign-in-form-Bo2WLZuP.js} +1 -1
- package/dist/assets/{static.browser-jI1psK0d.js → static.browser-CoPxsICt.js} +8 -8
- package/dist/assets/switch-DQkkIE7G.js +1 -0
- package/dist/assets/{tool-cards-DFttLAfo.js → tool-cards-ipgJ_3Ec.js} +1 -1
- package/dist/assets/{use-authenticator-sign-in-CRGjzXju.js → use-authenticator-sign-in-BzFeh7qe.js} +1 -1
- package/dist/assets/{use-dingtalk-sign-in-8WYzJ2jf.js → use-dingtalk-sign-in-mrq6K5Yx.js} +1 -1
- package/dist/assets/{use-wecom-sign-in-C9j8wfCD.js → use-wecom-sign-in-PPIMLvGa.js} +1 -1
- package/dist/assets/wecom-sign-in-button-rUq9RW8R.js +1 -0
- package/dist/index.html +1 -1
- package/dist/index.raw.html +1 -1
- package/package.json +1 -1
- package/scripts/build-html.mjs +59 -2
- package/src/components/auth/sign-up-form.tsx +287 -59
- package/src/components/auth/types.ts +23 -1
- package/dist/assets/auto-login-provider-DyaPGK2D.js +0 -1
- package/dist/assets/auto-redirect-provider-Cr3jmYts.js +0 -1
- package/dist/assets/auto-redirect-provider-QkJQRBbG.js +0 -1
- package/dist/assets/createSeriesDataSimply-D0A6SAVQ.js +0 -1
- package/dist/assets/index-MB-jfQld.js +0 -686
- package/dist/assets/prompt-card-B2RS4nt2.js +0 -1
- package/dist/assets/shortcut-C5x5LQWU.js +0 -47
- package/dist/assets/switch-CRL8PmRI.js +0 -1
- package/dist/assets/wecom-sign-in-button-mIS1zGSU.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{t as E,b as c,
|
|
1
|
+
import{t as E,b as c,bg as L,bh as B,j as e,bi as T,bj as G,bk as V,bl as _,bm as H,bn as M,bo as X,D as i,ax as J,c as A,k as O,d as Q,e as W,f as Y,g as Z,i as ee,I as te,bp as x,bq as f,br as b,B as g,a$ as ae,bs as se,bt as re,bu as oe}from"./index-CgkdZ6Oc.js";import{C as v,a as y,b as C,c as R,d as D}from"./card-C9Hpeq1c.js";import{P as ne}from"./prompt-output-DMTuTNab.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],N=E("arrow-right",ie);function U({title:t,description:a,actions:s,children:o,closeLabel:p,closeTo:w,beforeClose:r,className:I,nested:z}){const k=c.useContext(
|
|
6
|
+
*/const ie=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],N=E("arrow-right",ie);function U({title:t,description:a,actions:s,children:o,closeLabel:p,closeTo:w,beforeClose:r,className:I,nested:z}){const k=c.useContext(L),$=k>0,{open:S,setOpen:P,close:n,navigateAfterClose:q}=B({closeTo:w,beforeClose:r,animated:!0}),F=c.useCallback((d,K)=>{if(d){P(!0);return}K.cancel(),n()},[n,P]);return e.jsx(T.Provider,{value:n,children:e.jsx(L.Provider,{value:k+1,children:e.jsxs(G,{open:S,onOpenChange:F,onOpenChangeComplete:d=>{d||q()},children:[e.jsxs(V,{children:[$?e.jsx(le,{open:S,onClose:n}):e.jsx(_,{className:"fixed inset-0 isolate z-50 bg-black/10 duration-150 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",onClick:d=>{d.stopPropagation(),n()}}),e.jsxs(H,{className:A("fixed top-1/2 left-1/2 z-50 flex max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl bg-popover text-sm text-popover-foreground ring-1 ring-foreground/10 duration-150 outline-none sm:max-w-2xl data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",I),children:[e.jsxs("header",{className:"relative shrink-0 border-b px-5 py-4 pr-14 text-left",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx(M,{className:"font-heading truncate text-lg font-medium",children:t}),a?e.jsx(X,{className:"text-sm text-muted-foreground",children:a}):null]}),s?e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:s}):null]}),e.jsxs(i,{type:"button",variant:"ghost",size:"icon-sm",className:"absolute top-3 right-3",onClick:()=>void n(),children:[e.jsx(J,{}),e.jsx("span",{className:"sr-only",children:p})]})]}),o]})]}),z]})})})}function le({open:t,onClose:a}){return e.jsx("div",{role:"presentation","aria-hidden":"true",className:A("fixed inset-0 isolate z-50 bg-black/10 transition-opacity duration-150 supports-backdrop-filter:backdrop-blur-xs",t?"opacity-100":"pointer-events-none opacity-0"),onClick:s=>{s.stopPropagation(),a()}})}function de({children:t,closeTo:a,beforeClose:s}){const{close:o}=B({closeTo:a,beforeClose:s,animated:!1});return e.jsx(T.Provider,{value:o,children:t})}const m=[{id:"drawer",number:"1",title:"Drawer route",description:"Keep the current page mounted and open one URL-backed drawer.",path:"drawer",routeShape:"Page → Drawer"},{id:"dialog",number:"2",title:"Dialog route",description:"Open focused content in a modal while preserving the page URL history.",path:"dialog",routeShape:"Page → Dialog"},{id:"page",number:"3",title:"Child page",description:"Replace the current page instead of rendering the child inside an overlay.",path:"page",routeShape:"Page → Child page"},{id:"nested-drawers",number:"4",title:"Second-level drawer",description:"Push the lower drawer outward and keep the top drawer at a stable size.",path:"drawer/second",routeShape:"Page → Drawer → Drawer"},{id:"page-drawer-dialog",number:"5",title:"Page, drawer, and dialog",description:"Compose different presentation types without coupling business content to them.",path:"page/drawer/dialog",routeShape:"Child page → Drawer → Dialog"}];function ce(t,a){const s={drawer:"Keep the current page mounted and open the target content with RouteDrawer. Closing the drawer returns to the page route.",dialog:"Keep the current page mounted and open the target content with RouteDialog. The dialog route must be directly addressable and dismissible through the shared close lifecycle.",page:"Render the target content as a real child page with RoutePage. Register it as a page route branch rather than placing it inside a drawer outlet.","nested-drawers":"Create a parent RouteDrawer with an Outlet and pass the rendered child outlet through its nested prop. The second RouteDrawer must push the lower drawer outward, keep equal widths, and close back to the parent route.","page-drawer-dialog":"Render a RoutePage first, place a RouteDrawer route inside that page, then render a RouteDialog as the drawer's nested route. Closing each layer must return to the immediately lower URL."}[t.id];return`Build ${a||"the requested workflow"} with the installed NocoBase route surfaces.
|
|
7
7
|
|
|
8
8
|
Scenario:
|
|
9
9
|
- ${t.routeShape}
|
|
@@ -20,4 +20,4 @@ Implementation requirements:
|
|
|
20
20
|
- Direct URL entry, refresh, browser back/forward, Escape, the close button, and backdrop dismissal must all restore the correct layer stack.
|
|
21
21
|
- Apply Refine CanAccess with an AccessDenied fallback to each business resource/action independently; do not rely on a parent list permission for unrelated child pages.
|
|
22
22
|
|
|
23
|
-
Deliver the complete route definitions and React components using the application's existing design system.`}function ue(){const[t,a]=c.useState("drawer"),[s,o]=c.useState("a customer detail workflow"),p=m.find(r=>r.id===t)??m[0],w=c.useMemo(()=>ce(p,s),[p,s]);return e.jsxs(v,{children:[e.jsxs(y,{children:[e.jsx(C,{children:"Prompt generator"}),e.jsx(R,{children:"Generate a complete routing scenario, not just an isolated overlay component."})]}),e.jsxs(D,{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(
|
|
23
|
+
Deliver the complete route definitions and React components using the application's existing design system.`}function ue(){const[t,a]=c.useState("drawer"),[s,o]=c.useState("a customer detail workflow"),p=m.find(r=>r.id===t)??m[0],w=c.useMemo(()=>ce(p,s),[p,s]);return e.jsxs(v,{children:[e.jsxs(y,{children:[e.jsx(C,{children:"Prompt generator"}),e.jsx(R,{children:"Generate a complete routing scenario, not just an isolated overlay component."})]}),e.jsxs(D,{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"route-surface-scenario",children:"Scenario"}),e.jsxs(Q,{value:t,onValueChange:r=>a(r),children:[e.jsx(W,{id:"route-surface-scenario",className:"w-full",children:e.jsx(Y,{})}),e.jsx(Z,{children:m.map(r=>e.jsxs(ee,{value:r.id,children:[r.number,". ",r.title]},r.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{htmlFor:"route-surface-target",children:"Business target"}),e.jsx(te,{id:"route-surface-target",value:s,onChange:r=>o(r.target.value)})]})]}),e.jsx(ne,{title:"Generated routing prompt",description:"Updates as you change the scenario and business target.",prompt:w,promptClassName:"min-h-80"})]})]})}const j="/route-surfaces";function l(){const{pathname:t}=ae(),a=t.indexOf(j);return a>=0?t.slice(0,a+j.length):j}function xe(){const t=x(),a=f();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{variant:"secondary",children:"Route surfaces"}),e.jsx("h1",{className:"font-heading text-3xl font-semibold tracking-tight",children:"URL-backed pages and overlays"}),e.jsx("p",{className:"max-w-3xl text-muted-foreground",children:"Keep business content independent from whether it appears as a page, drawer, dialog, or nested combination. Every preview below supports a direct URL and browser history."})]}),e.jsx("div",{className:"grid gap-4 lg:grid-cols-2 xl:grid-cols-3",children:m.map(s=>e.jsxs(v,{className:"flex flex-col",children:[e.jsxs(y,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(g,{variant:"outline",children:["Scenario ",s.number]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:s.routeShape})]}),e.jsx(C,{children:s.title}),e.jsx(R,{children:s.description})]}),e.jsx(D,{className:"mt-auto",children:e.jsxs(i,{type:"button",variant:"outline",className:"w-full",onClick:()=>t(s.path),children:["Open preview",e.jsx(N,{})]})})]},s.id))}),e.jsx(ue,{})]}),a]})}function fe(){const t=x(),a=f(),s=l();return e.jsx(b,{title:"Customer details",description:"A routed drawer keeps the scenario page mounted behind it.",closeLabel:"Close",closeTo:s,nested:a,children:e.jsx(u,{label:"Drawer",title:"Northwind renewal",description:"Business content does not know that it is rendered inside a drawer.",children:e.jsxs(i,{onClick:()=>t("second"),children:["Open second-level drawer",e.jsx(N,{})]})})})}function we(){const t=l();return e.jsx(b,{title:"Renewal activity",description:"The lower drawer is pushed outward and remains behind the layer mask.",closeLabel:"Close",closeTo:`${t}/drawer`,children:e.jsx(u,{label:"Second-level drawer",title:"Latest review",description:"Clicking this layer's backdrop closes only the top drawer."})})}function je(){const t=l();return e.jsx(U,{title:"Approve renewal",description:"A modal route for a focused decision.",closeLabel:"Close",closeTo:t,children:e.jsx(u,{label:"Dialog",title:"Approval required",description:"The page stays mounted while the URL represents the active dialog."})})}function be(){const t=f(),a=l();return e.jsx(de,{closeTo:a,children:e.jsx(pe,{nested:t})})}function pe({nested:t}){const a=se(),s=x();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{variant:"secondary",children:"Child page"}),e.jsx("h1",{className:"font-heading text-3xl font-semibold tracking-tight",children:"Customer workspace"}),e.jsx("p",{className:"text-muted-foreground",children:"This route replaces the Demo home instead of rendering inside its Outlet."})]}),e.jsxs(i,{variant:"outline",onClick:()=>void a(),children:[e.jsx(re,{}),"Back to scenarios"]})]}),e.jsxs(v,{children:[e.jsxs(y,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"size-5 text-primary"}),e.jsx(C,{children:"Page-owned workflow"})]}),e.jsx(R,{children:"A page can still host routed overlays without becoming coupled to their content."})]}),e.jsx(D,{children:e.jsx(i,{onClick:()=>s("drawer"),children:"Open page drawer"})})]})]}),t]})}function ve(){const t=x(),a=f(),s=l();return e.jsx(b,{title:"Customer activity",description:"This drawer belongs to the child page route.",closeLabel:"Close",closeTo:`${s}/page`,nested:a,children:e.jsx(u,{label:"Page drawer",title:"Renewal conversation",description:"Open a dialog above this drawer to test mixed presentation types.",children:e.jsxs(i,{onClick:()=>t("dialog"),children:["Open confirmation dialog",e.jsx(N,{})]})})})}function ye(){const t=l();return e.jsx(U,{title:"Confirm follow-up",description:"The dialog is nested in the drawer route subtree.",closeLabel:"Close",closeTo:`${t}/page/drawer`,children:e.jsx(u,{label:"Nested dialog",title:"Schedule a follow-up?",description:"Closing returns to the drawer; closing the drawer then returns to the page."})})}function u({label:t,title:a,description:s,children:o}){return e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:e.jsxs("div",{className:"space-y-5",children:[e.jsx(g,{variant:"outline",children:t}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-xl font-semibold",children:a}),e.jsx("p",{className:"text-muted-foreground",children:s})]}),e.jsxs("div",{className:"grid gap-3 rounded-lg border bg-muted/30 p-4 sm:grid-cols-2",children:[e.jsx(h,{label:"Owner",value:"Ada Lovelace"}),e.jsx(h,{label:"Status",value:"In review"}),e.jsx(h,{label:"Value",value:"$48,000"}),e.jsx(h,{label:"Renewal",value:"September 30"})]}),o?e.jsx("div",{children:o}):null]})})}function h({label:t,value:a}){return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:t}),e.jsx("div",{className:"font-medium",children:a})]})}export{je as DemoDialogRoute,fe as DemoDrawerRoute,ye as DemoPageDrawerDialogRoute,ve as DemoPageDrawerRoute,be as DemoPageRoute,we as DemoSecondDrawerRoute,xe as RouteSurfacesDemoHome};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as K,j as e,H as Y,M as ee,J as se,D as g,K as S,N as j,O as _,B as P,Q as ae,R as te,V as ne,W as oe,X as ie,Y as R,Z as H,_ as D,$ as F,a0 as G,b as l,a1 as V,I as re,d as O,e as z,f as U,g as B,i as v,a2 as le,l as ce,m as de,n as $,o as k,p as he,q as I,a3 as pe}from"./index-
|
|
1
|
+
import{t as K,j as e,H as Y,M as ee,J as se,D as g,K as S,N as j,O as _,B as P,Q as ae,R as te,V as ne,W as oe,X as ie,Y as R,Z as H,_ as D,$ as F,a0 as G,b as l,a1 as V,I as re,d as O,e as z,f as U,g as B,i as v,a2 as le,l as ce,m as de,n as $,o as k,p as he,q as I,a3 as pe}from"./index-CgkdZ6Oc.js";import{C as x,a as T,b as M,d as E}from"./card-C9Hpeq1c.js";import{A as me}from"./configuration-gate-BJoadoA6.js";import{P as ue}from"./prompt-output-DMTuTNab.js";import{S as xe}from"./switch-DQkkIE7G.js";/**
|
|
2
2
|
* @license lucide-react v0.487.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ar as t,H as u}from"./echarts-runtime-
|
|
1
|
+
import{ar as t,H as u}from"./echarts-runtime-CvLr4Slh.js";function o(r,l){var e=r.mapDimensionsAll("defaultedLabel"),a=e.length;if(a===1){var n=t(r,l,e[0]);return n!=null?n+"":null}else if(a){for(var s=[],f=0;f<e.length;f++)s.push(t(r,l,e[f]));return s.join(" ")}}function v(r,l){var e=r.mapDimensionsAll("defaultedLabel");if(!u(l))return l+"";for(var a=[],n=0;n<e.length;n++){var s=r.getDimensionIndex(e[n]);s>=0&&a.push(l[s])}return a.join(" ")}export{o as a,v as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as i,j as s,k as l,I as x,
|
|
1
|
+
import{b as i,j as s,k as l,I as x,b4 as g,D as f}from"./index-CgkdZ6Oc.js";import{u as j}from"./use-authenticator-sign-in-BzFeh7qe.js";function w(e){return j(e)}function b({authenticator:e,onSignIn:t}){var o;const[n,c]=i.useState(""),[r,d]=i.useState(""),{signIn:p,isPending:u}=w(e.name),m=((o=e.options)==null?void 0:o.autoSignup)===!0;return s.jsxs("form",{className:"space-y-5",onSubmit:a=>{if(a.preventDefault(),t){t({account:n,password:r});return}p({account:n,password:r})},children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(l,{htmlFor:`${e.name}-ldap-account`,children:"Account"}),s.jsx(x,{id:`${e.name}-ldap-account`,value:n,onChange:a=>c(a.target.value),autoComplete:"username",required:!0})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(l,{htmlFor:`${e.name}-ldap-password`,children:"Password"}),s.jsx(g,{id:`${e.name}-ldap-password`,value:r,onChange:a=>d(a.target.value),autoComplete:"current-password",required:!0})]}),s.jsx(f,{type:"submit",className:"w-full",disabled:!t&&u,children:!t&&u?"Signing in…":"Sign in"}),m&&s.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"An account will be created automatically after the first successful LDAP sign-in."})]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aX as g,b as o,aY as m,aZ as d,j as t,aD as f,aF as h,aG as x,D as v,a_ as b,r as p}from"./index-CgkdZ6Oc.js";function w(r){const[e]=g(),[i,a]=o.useState(!1),[n,l]=o.useState(),u=o.useMemo(()=>{if(e.get("authenticator")!==r.name)return;const s=e.get("error");return s?new Error(s):void 0},[r.name,e]);return{signIn:o.useCallback(async()=>{l(void 0),a(!0);try{const s=m(e.get("to")||e.get("redirect")||"/"),c=await d.action("oidc","getAuthUrl",{method:"POST",authenticator:r.name,includeRole:!1,withAclMeta:!1,body:{redirect:s}});if(!c)throw new Error("NocoBase did not return an OIDC authorization URL.");window.location.replace(d.resolveUrl(c))}catch(s){l(s instanceof Error?s:new Error("Unable to start OIDC sign-in.")),a(!1)}},[r.name,e]),isPending:i,error:n??u}}function E({authenticator:r,onSignIn:e}){const{signIn:i,isPending:a,error:n}=w(r);return t.jsxs("div",{className:"space-y-3",children:[n&&t.jsxs(f,{variant:"destructive",children:[t.jsx(h,{children:"OIDC sign-in failed"}),t.jsx(x,{children:n.message})]}),t.jsxs(v,{type:"button",variant:"outline",className:"w-full",disabled:!e&&a,onClick:e??i,children:[t.jsx(b,{}),!e&&a?"Redirecting…":p(r.title||r.authTypeTitle||"OIDC")]})]})}export{E as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ar as F,b as t,j as e,k as i,I as y,T as U,d as k,e as N,f as C,g as S,i as l,Y as R,$ as ce,a0 as de,a1 as me,_ as ue,as as M,B as b,K as $,N as B,a4 as D,au as _,at as J,az as he,aA as xe,D as pe,aB as ge}from"./index-CgkdZ6Oc.js";import{C as j,a as A,b as T,d as P}from"./card-C9Hpeq1c.js";import{A as je}from"./configuration-gate-BJoadoA6.js";import{S as fe}from"./switch-DQkkIE7G.js";import{P as ve}from"./prompt-card-FWugRgi-.js";import"./prompt-output-DMTuTNab.js";function ye(n,r){for(const[o,c]of Object.entries(r)){const u=o;n.setValue(u,c,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0})}}const be=n=>!["nathan","dara"].includes(n.toLowerCase());function we(){var Y,X;const{employees:n}=F(),r=n.filter(a=>be(a.username)),[o,c]=t.useState(((Y=r[0])==null?void 0:Y.username)??((X=n[0])==null?void 0:X.username)??""),[u,d]=t.useState("Customer renewal workspace"),[p,g]=t.useState("Show a customer renewal detail with account health, contract value, renewal date, owner, recent activity, and a working AI conversation beside it."),[m,f]=t.useState("Review renewal risk"),[s,I]=t.useState("Review this customer renewal, identify risks, and recommend the next action."),[h,v]=t.useState(!1),[w,K]=t.useState("shortcut"),[x,z]=t.useState("renewal-detail"),[L,ee]=t.useState("Customer renewal detail"),[q,te]=t.useState("context"),[H,se]=t.useState("update_renewal_plan"),[O,ae]=t.useState("Update the renewal risk level and the visible follow-up note on the page."),[W,ne]=t.useState("ASK"),re=t.useMemo(()=>{var Z;const a=((Z=n.find(le=>le.username===o))==null?void 0:Z.nickname)??o,Q=`{ type: "page-element", id: "${x}", title: "${L}" }`,G=w==="manual"?!1:h,oe={shortcut:`Place an AIEmployeeShortcut in the page header, visually separated from the registered business element. Target the embedded chat controller and configure this task on its tasks prop:
|
|
2
2
|
- Title: ${m}
|
|
3
3
|
- User message: ${s}
|
|
4
4
|
- Auto send: ${G}
|
|
@@ -45,7 +45,7 @@ AI employee and task
|
|
|
45
45
|
|
|
46
46
|
Business context
|
|
47
47
|
- Context id: ${x}
|
|
48
|
-
- Context title: ${
|
|
48
|
+
- Context title: ${L}
|
|
49
49
|
- Register a visible, meaningful business element with this stable id.
|
|
50
50
|
- Resolve its content at task or message send time so the AI always receives the latest displayed values.
|
|
51
51
|
- Prefer useAIPageElementHandle so the registered ref and context reference cannot drift apart.
|
|
@@ -68,6 +68,6 @@ Implementation requirements
|
|
|
68
68
|
- Manual Pick affects only the current composed message.
|
|
69
69
|
- Preserve NocoBase streaming, conversation history, Tool approval, and resume behavior.
|
|
70
70
|
- Use shadcn/Base UI components and the existing Registry components.
|
|
71
|
-
- Deliver the complete component code, including sample state, context registration, task configuration, chat layout, and all visible business UI.`},[h,q,x,V,o,n,w,p,u,s,m,O,H,W]);return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(j,{className:"gap-0 py-0",children:[e.jsx(A,{className:"border-b py-4",children:e.jsx(T,{children:"Scene settings"})}),e.jsxs(P,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-title",children:"Scene title"}),e.jsx(y,{id:"context-generator-scene-title",value:u,onChange:a=>d(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-brief",children:"Business scene"}),e.jsx(U,{id:"context-generator-scene-brief",value:p,onChange:a=>g(a.target.value),className:"min-h-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"AI employee"}),e.jsxs(k,{value:o,onValueChange:a=>a&&c(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsx(S,{children:(r.length?r:n).map(a=>e.jsx(l,{value:a.username,children:a.nickname},a.username))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-title",children:"Task title"}),e.jsx(y,{id:"context-generator-task-title",value:m,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-message",children:"Task message"}),e.jsx(U,{id:"context-generator-task-message",value:s,onChange:a=>I(a.target.value),className:"min-h-24"})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise fill the composer for review."})]}),e.jsx(fe,{checked:w==="manual"?!1:h,disabled:w==="manual",onCheckedChange:v})]}),w==="manual"?e.jsx("p",{className:"-mt-3 text-xs leading-5 text-muted-foreground",children:"Manual Pick keeps the message in the composer so context can be selected before sending."}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Context integration"}),e.jsxs(k,{value:w,onValueChange:a=>a&&K(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"shortcut",children:"Shortcut task"}),e.jsx(l,{value:"preset",children:"Conversation preset task"}),e.jsx(l,{value:"scope",children:"Scope inheritance"}),e.jsx(l,{value:"manual",children:"Manual Pick"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-id",children:"Context id"}),e.jsx(y,{id:"context-generator-id",value:x,onChange:a=>z(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-title",children:"Context title"}),e.jsx(y,{id:"context-generator-title",value:V,onChange:a=>ee(a.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Page capability"}),e.jsxs(k,{value:q,onValueChange:a=>a&&te(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"context",children:"Context only"}),e.jsx(l,{value:"form-filler",children:"Built-in Form filler"}),e.jsx(l,{value:"custom-tool",children:"Custom frontend Tool"})]})]})]}),q==="custom-tool"?e.jsxs("div",{className:"space-y-4 rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-name",children:"Tool name"}),e.jsx(y,{id:"context-generator-tool-name",value:H,onChange:a=>se(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-action",children:"Business action"}),e.jsx(U,{id:"context-generator-tool-action",value:O,onChange:a=>ae(a.target.value),className:"min-h-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Permission"}),e.jsxs(k,{value:W,onValueChange:a=>a&&ne(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"ASK",children:"ASK"}),e.jsx(l,{value:"ALLOW",children:"ALLOW"})]})]})]})]}):null]})]}),e.jsx(ve,{title:"Complete page context scene prompt",description:"Copy this prompt to generate the business page, AI interaction, context binding, and working conversation as one complete scene.",prompt:re})]})}function ke(){return e.jsx(F,{id:"page-element-demo",children:e.jsx(Ne,{})})}function Ne(){const[n,r]=t.useState("Northwind Studio"),[o,c]=t.useState("ops@northwind.test"),[u,d]=t.useState("high"),[p,g]=t.useState(!1),{id:m,addWorkContext:f,focusComposer:s}=ce(),{registeredCount:I,startPicking:h}=de(),v=t.useMemo(()=>[{key:"pick-page-element",label:"Pick page element",icon:e.jsx(me,{}),disabled:I===0,onClick:()=>h({chatId:m,onSelect:x=>{f(x),s()}})},{key:"web-search",label:"Web search",icon:e.jsx(ue,{}),active:p,onClick:()=>g(x=>!x)}],[f,m,s,I,h,p]),w=M({id:"customer-intake-form",title:"Customer intake form",kind:"form",getContext:()=>({form:"customer-intake",values:{customerName:n,contactEmail:o,priority:u}})}),K=M({id:"customer-health-summary",title:"Customer health summary",kind:"record-detail",getContext:()=>({resource:"customers",record:{name:n,plan:"Enterprise",healthScore:86,openRequests:3,renewalDate:"2026-09-30"}})});return e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] lg:grid-cols-[minmax(0,1fr)_390px]",children:[e.jsxs("div",{className:"space-y-4 bg-muted/15 p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Customer workspace"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"The form and detail card are registered page elements."})]}),e.jsx(b,{variant:"outline",children:"2 selectable elements"})]}),e.jsxs(j,{ref:w,className:"transition-shadow",children:[e.jsxs(A,{children:[e.jsx(T,{children:"Customer intake form"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Update a value, then pick this form to capture its current state."})]}),e.jsxs(P,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(i,{htmlFor:"page-context-customer-name",children:"Customer name"}),e.jsx(y,{id:"page-context-customer-name",value:n,onChange:x=>r(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"page-context-contact-email",children:"Contact email"}),e.jsx(y,{id:"page-context-contact-email",value:o,onChange:x=>c(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:u,onValueChange:x=>x&&d(x),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{ref:K,className:"transition-shadow",children:[e.jsx(A,{children:e.jsx(T,{children:"Customer health summary"})}),e.jsx(P,{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[["Plan","Enterprise"],["Health score","86 / 100"],["Open requests","3"],["Renewal","Sep 30, 2026"]].map(([x,z])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:x}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:z})]},x))})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card lg:border-l lg:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{composerActions:v,showConversationToggle:!1,enableAttachments:!0,attachmentActionIndex:1,disclaimer:!1})})})]})})}const L=n=>!["nathan","dara"].includes(n.username.toLowerCase());function Le(){return e.jsx(je,{children:e.jsx(Ce,{})})}function Ce(){return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"AI Components"}),e.jsx(b,{variant:"outline",children:"Conversation context"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Page context and frontend tools"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Connect AI employees to live React page state. Start with manual context selection, configure task context, then expose fixed or custom frontend capabilities that can safely update the page."})]})}),e.jsx(R,{eyebrow:"Manual context",title:"Pick page context while composing a message",description:"The user can pick any registered page element from the composer. Its current content is added to this message without changing task configuration.",children:e.jsx(ke,{})}),e.jsx(R,{eyebrow:"Task context · Shortcut",title:"Reference page context from a Shortcut task",description:"The Shortcut task stores a page-element reference in message.workContext and reads its latest content when the user starts the task.",children:e.jsx(Te,{})}),e.jsx(R,{eyebrow:"Task context · Conversation preset",title:"Reference page context from a conversation preset task",description:"The AIChatProvider employeeTasks configuration uses the same message.workContext reference, but exposes the task in the conversation empty state instead of through a Shortcut.",children:e.jsx(Pe,{})}),e.jsx(R,{eyebrow:"Task context · Scope inheritance",title:"Inherit the surrounding page context",description:"A Shortcut or AIChatProvider inside AIPageContextScope inherits that context. A task-level message.workContext still takes precedence when configured.",children:e.jsx(Ie,{})}),e.jsx(R,{eyebrow:"Built-in frontend tool",title:"Fill a registered React form with Form filler",description:"Form filler is registered once by AIProvider. The form exposes its identifier, field schema, live values, and setter through useAIForm; it is not part of the custom frontend Tool catalog.",children:e.jsx(Se,{})}),e.jsx(R,{eyebrow:"Custom frontend tool",title:"Expose a page-specific action to the AI employee",description:"A registered page element can advertise custom Tools through the NocoBase loadFrontendTool and executeFrontendTool protocol. The example uses ASK permission and updates only the local quote preview.",children:e.jsx(Ae,{})}),e.jsx(R,{eyebrow:"Prompt generator",title:"Generate a complete page context scene",description:"Describe the business scene, select the AI employee and task, then generate the full page surface, context binding, conversation layout, and optional frontend capability together.",children:e.jsx(we,{})})]})}function Se(){const{employees:n}=E(),r=n.find(s=>s.username==="form_assistant")??n.find(s=>s.username.toLowerCase()==="dex")??n.filter(L)[0],o=D(),[c,u]=t.useState("Acme Logistics is evaluating the enterprise plan. The main contact is Jordan Lee at jordan.lee@acme.test. This is a high-priority opportunity."),d=he({defaultValues:{company:"",contactName:"",email:"",priority:"normal"}}),p=t.useMemo(()=>[{name:"company",title:"Company",type:"string",required:!0},{name:"contactName",title:"Contact name",type:"string",required:!0},{name:"email",title:"Email",type:"email"},{name:"priority",title:"Priority",type:"string",enum:["low","normal","high"]}],[]),g=xe({id:"lead-intake-form",title:"Lead intake form",fields:p,getValues:d.getValues,setValues:s=>ye(d,s)}),m=t.useMemo(()=>({type:"page-element",id:"lead-intake-form",title:"Lead intake form",kind:"form"}),[]),f=t.useMemo(()=>({title:"Fill lead form",message:{user:`Extract the lead details from the following text and fill the current form. Do not submit it.
|
|
71
|
+
- Deliver the complete component code, including sample state, context registration, task configuration, chat layout, and all visible business UI.`},[h,q,x,L,o,n,w,p,u,s,m,O,H,W]);return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(j,{className:"gap-0 py-0",children:[e.jsx(A,{className:"border-b py-4",children:e.jsx(T,{children:"Scene settings"})}),e.jsxs(P,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-title",children:"Scene title"}),e.jsx(y,{id:"context-generator-scene-title",value:u,onChange:a=>d(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-scene-brief",children:"Business scene"}),e.jsx(U,{id:"context-generator-scene-brief",value:p,onChange:a=>g(a.target.value),className:"min-h-28"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"AI employee"}),e.jsxs(k,{value:o,onValueChange:a=>a&&c(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsx(S,{children:(r.length?r:n).map(a=>e.jsx(l,{value:a.username,children:a.nickname},a.username))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-title",children:"Task title"}),e.jsx(y,{id:"context-generator-task-title",value:m,onChange:a=>f(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-task-message",children:"Task message"}),e.jsx(U,{id:"context-generator-task-message",value:s,onChange:a=>I(a.target.value),className:"min-h-24"})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise fill the composer for review."})]}),e.jsx(fe,{checked:w==="manual"?!1:h,disabled:w==="manual",onCheckedChange:v})]}),w==="manual"?e.jsx("p",{className:"-mt-3 text-xs leading-5 text-muted-foreground",children:"Manual Pick keeps the message in the composer so context can be selected before sending."}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Context integration"}),e.jsxs(k,{value:w,onValueChange:a=>a&&K(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"shortcut",children:"Shortcut task"}),e.jsx(l,{value:"preset",children:"Conversation preset task"}),e.jsx(l,{value:"scope",children:"Scope inheritance"}),e.jsx(l,{value:"manual",children:"Manual Pick"})]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-id",children:"Context id"}),e.jsx(y,{id:"context-generator-id",value:x,onChange:a=>z(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-title",children:"Context title"}),e.jsx(y,{id:"context-generator-title",value:L,onChange:a=>ee(a.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Page capability"}),e.jsxs(k,{value:q,onValueChange:a=>a&&te(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"context",children:"Context only"}),e.jsx(l,{value:"form-filler",children:"Built-in Form filler"}),e.jsx(l,{value:"custom-tool",children:"Custom frontend Tool"})]})]})]}),q==="custom-tool"?e.jsxs("div",{className:"space-y-4 rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-name",children:"Tool name"}),e.jsx(y,{id:"context-generator-tool-name",value:H,onChange:a=>se(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"context-generator-tool-action",children:"Business action"}),e.jsx(U,{id:"context-generator-tool-action",value:O,onChange:a=>ae(a.target.value),className:"min-h-20"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Permission"}),e.jsxs(k,{value:W,onValueChange:a=>a&&ne(a),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"ASK",children:"ASK"}),e.jsx(l,{value:"ALLOW",children:"ALLOW"})]})]})]})]}):null]})]}),e.jsx(ve,{title:"Complete page context scene prompt",description:"Copy this prompt to generate the business page, AI interaction, context binding, and working conversation as one complete scene.",prompt:re})]})}function ke(){return e.jsx(R,{id:"page-element-demo",children:e.jsx(Ne,{})})}function Ne(){const[n,r]=t.useState("Northwind Studio"),[o,c]=t.useState("ops@northwind.test"),[u,d]=t.useState("high"),[p,g]=t.useState(!1),{id:m,addWorkContext:f,focusComposer:s}=ce(),{registeredCount:I,startPicking:h}=de(),v=t.useMemo(()=>[{key:"pick-page-element",label:"Pick page element",icon:e.jsx(me,{}),disabled:I===0,onClick:()=>h({chatId:m,onSelect:x=>{f(x),s()}})},{key:"web-search",label:"Web search",icon:e.jsx(ue,{}),active:p,onClick:()=>g(x=>!x)}],[f,m,s,I,h,p]),w=M({id:"customer-intake-form",title:"Customer intake form",kind:"form",getContext:()=>({form:"customer-intake",values:{customerName:n,contactEmail:o,priority:u}})}),K=M({id:"customer-health-summary",title:"Customer health summary",kind:"record-detail",getContext:()=>({resource:"customers",record:{name:n,plan:"Enterprise",healthScore:86,openRequests:3,renewalDate:"2026-09-30"}})});return e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] lg:grid-cols-[minmax(0,1fr)_390px]",children:[e.jsxs("div",{className:"space-y-4 bg-muted/15 p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Customer workspace"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"The form and detail card are registered page elements."})]}),e.jsx(b,{variant:"outline",children:"2 selectable elements"})]}),e.jsxs(j,{ref:w,className:"transition-shadow",children:[e.jsxs(A,{children:[e.jsx(T,{children:"Customer intake form"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Update a value, then pick this form to capture its current state."})]}),e.jsxs(P,{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[e.jsx(i,{htmlFor:"page-context-customer-name",children:"Customer name"}),e.jsx(y,{id:"page-context-customer-name",value:n,onChange:x=>r(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"page-context-contact-email",children:"Contact email"}),e.jsx(y,{id:"page-context-contact-email",value:o,onChange:x=>c(x.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:u,onValueChange:x=>x&&d(x),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{ref:K,className:"transition-shadow",children:[e.jsx(A,{children:e.jsx(T,{children:"Customer health summary"})}),e.jsx(P,{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[["Plan","Enterprise"],["Health score","86 / 100"],["Open requests","3"],["Renewal","Sep 30, 2026"]].map(([x,z])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:x}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:z})]},x))})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card lg:border-l lg:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{composerActions:v,showConversationToggle:!1,enableAttachments:!0,attachmentActionIndex:1,disclaimer:!1})})})]})})}const V=n=>!["nathan","dara"].includes(n.username.toLowerCase());function Ve(){return e.jsx(je,{children:e.jsx(Ce,{})})}function Ce(){return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"AI Components"}),e.jsx(b,{variant:"outline",children:"Conversation context"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Page context and frontend tools"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Connect AI employees to live React page state. Start with manual context selection, configure task context, then expose fixed or custom frontend capabilities that can safely update the page."})]})}),e.jsx(E,{eyebrow:"Manual context",title:"Pick page context while composing a message",description:"The user can pick any registered page element from the composer. Its current content is added to this message without changing task configuration.",children:e.jsx(ke,{})}),e.jsx(E,{eyebrow:"Task context · Shortcut",title:"Reference page context from a Shortcut task",description:"The Shortcut task stores a page-element reference in message.workContext and reads its latest content when the user starts the task.",children:e.jsx(Te,{})}),e.jsx(E,{eyebrow:"Task context · Conversation preset",title:"Reference page context from a conversation preset task",description:"The AIChatProvider employeeTasks configuration uses the same message.workContext reference, but exposes the task in the conversation empty state instead of through a Shortcut.",children:e.jsx(Pe,{})}),e.jsx(E,{eyebrow:"Task context · Scope inheritance",title:"Inherit the surrounding page context",description:"A Shortcut or AIChatProvider inside AIPageContextScope inherits that context. A task-level message.workContext still takes precedence when configured.",children:e.jsx(Ie,{})}),e.jsx(E,{eyebrow:"Built-in frontend tool",title:"Fill a registered React form with Form filler",description:"Form filler is registered once by AIProvider. The form exposes its identifier, field schema, live values, and setter through useAIForm; it is not part of the custom frontend Tool catalog.",children:e.jsx(Se,{})}),e.jsx(E,{eyebrow:"Custom frontend tool",title:"Expose a page-specific action to the AI employee",description:"A registered page element can advertise custom Tools through the NocoBase loadFrontendTool and executeFrontendTool protocol. The example uses ASK permission and updates only the local quote preview.",children:e.jsx(Ae,{})}),e.jsx(E,{eyebrow:"Prompt generator",title:"Generate a complete page context scene",description:"Describe the business scene, select the AI employee and task, then generate the full page surface, context binding, conversation layout, and optional frontend capability together.",children:e.jsx(we,{})})]})}function Se(){const{employees:n}=F(),r=n.find(s=>s.username==="form_assistant")??n.find(s=>s.username.toLowerCase()==="dex")??n.filter(V)[0],o=D(),[c,u]=t.useState("Acme Logistics is evaluating the enterprise plan. The main contact is Jordan Lee at jordan.lee@acme.test. This is a high-priority opportunity."),d=he({defaultValues:{company:"",contactName:"",email:"",priority:"normal"}}),p=t.useMemo(()=>[{name:"company",title:"Company",type:"string",required:!0},{name:"contactName",title:"Contact name",type:"string",required:!0},{name:"email",title:"Email",type:"email"},{name:"priority",title:"Priority",type:"string",enum:["low","normal","high"]}],[]),g=xe({id:"lead-intake-form",title:"Lead intake form",fields:p,getValues:d.getValues,setValues:s=>ye(d,s)}),m=t.useMemo(()=>({type:"page-element",id:"lead-intake-form",title:"Lead intake form",kind:"form"}),[]),f=t.useMemo(()=>({title:"Fill lead form",message:{user:`Extract the lead details from the following text and fill the current form. Do not submit it.
|
|
72
72
|
|
|
73
|
-
${c}`},autoSend:!0}),[c]);return e.jsx(J,{context:m,children:e.jsx(F,{id:"form-filler-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[610px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"space-y-5 bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Source content"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Edit this text, then ask the AI employee to fill the registered form below."})]}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:`Ask ${r.nickname}`,size:34})]})}),e.jsx(P,{children:e.jsx(U,{value:c,onChange:s=>u(s.target.value),className:"min-h-28"})})]}),e.jsxs("form",{ref:g,className:"rounded-xl border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b p-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Lead intake form"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Form filler changes visible values only. It never submits the form."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"useAIForm"}),e.jsx(pe,{type:"button",variant:"outline",size:"sm",onClick:()=>d.reset({company:"",contactName:"",email:"",priority:"normal"}),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-4 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-company",children:"Company"}),e.jsx(y,{id:"form-filler-company",...d.register("company")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-contact",children:"Contact name"}),e.jsx(y,{id:"form-filler-contact",...d.register("contactName")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-email",children:"Email"}),e.jsx(y,{id:"form-filler-email",type:"email",...d.register("email")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:d.watch("priority"),onValueChange:s=>s&&d.setValue("priority",s,{shouldDirty:!0,shouldTouch:!0}),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[610px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Ae(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState(0),[d,p]=t.useState("Not reviewed"),g=24e3,m=g*(1-c/100),f=t.useMemo(()=>[{name:"update_quote_discount",title:"Update quote discount",description:"Update the discount percentage and review note shown on the current quote. This changes the page preview only and does not save the quote.",permission:"ASK",inputSchema:{type:"object",properties:{discountPercent:{type:"number",minimum:0,maximum:30,description:"Discount percentage applied to the quote."},note:{type:"string",description:"Short explanation shown in the review note."}},required:["discountPercent","note"],additionalProperties:!1},execute:h=>{const v=h&&typeof h=="object"&&!Array.isArray(h)?h:{};return typeof v.discountPercent!="number"||v.discountPercent<0||v.discountPercent>30||typeof v.note!="string"?{status:"error",content:"Provide a discount from 0 to 30 and a review note."}:(u(v.discountPercent),p(v.note),{status:"success",content:`Updated the quote preview to a ${v.discountPercent}% discount.`})}}],[]),s=ge({id:"quote-review-card",title:"Quote review",kind:"record-detail",tools:f,getContext:()=>({resource:"quotes",record:{quoteNumber:"QT-2026-1048",customer:"Northwind Studio",baseAmount:g,discountPercent:c,total:m,approvalNote:d}})}),I=t.useMemo(()=>({title:"Apply review discount",message:{user:"Update the current quote preview to use a 12% discount and set the review note to 'Approved for the renewal discussion'."},autoSend:!0}),[]);return e.jsx(J,{context:s.context,children:e.jsx(F,{id:"custom-frontend-tool-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:s.ref,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Quote review"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"QT-2026-1048 · Northwind Studio"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",children:"Custom Tool"}),e.jsx(b,{variant:"secondary",children:"ASK"})]})]})}),e.jsxs(P,{className:"space-y-5",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:[["Base amount",`$${g.toLocaleString()}`],["Discount",`${c}%`],["Preview total",`$${m.toLocaleString()}`]].map(([h,v])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:h}),e.jsx("div",{className:"mt-1 font-medium",children:v})]},h))}),e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Review note"}),e.jsx("div",{className:"mt-1 text-sm",children:d})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsx("p",{className:"max-w-lg text-xs leading-5 text-muted-foreground",children:"The page element registers update_quote_discount. Its full input schema is loaded only when the AI chooses this Tool. Approval is controlled by the ASK permission."}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[I],label:`Ask ${r.nickname}`,size:34})]})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Te(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState("Payment callback reached the order service twelve minutes late."),[d,p]=t.useState("high"),g=t.useMemo(()=>({type:"page-element",id:"selected-support-case",title:"Selected support case"}),[]),m=M({id:"selected-support-case",title:"Selected support case",kind:"editable-record",getContext:()=>({resource:"supportTickets",values:{summary:c,severity:d}})}),f=t.useMemo(()=>({title:"Analyze selected case",message:{user:"Analyze the selected support case.",workContext:[g]},autoSend:!1}),[g]);return e.jsx(F,{id:"shortcut-task-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected support case"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value before running either task."})]}),e.jsx(b,{variant:"secondary",children:"Task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"selected-context-summary",children:"Summary"}),e.jsx(y,{id:"selected-context-summary",value:c,onChange:s=>u(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Severity"}),e.jsxs(k,{value:d,onValueChange:s=>s&&p(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"medium",children:"Medium"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{className:"mt-5 border-dashed bg-background/80",children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Task shortcut area"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This button is outside the selected page element. Its task explicitly references “Selected support case”."})]}),e.jsx(b,{variant:"outline",children:"Explicit reference"})]})}),e.jsx(P,{children:e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Analyze selected case",size:34})})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Pe(){const{employees:n}=E(),r=n.filter(L)[0],[o,c]=t.useState("Enterprise workspace expansion"),[u,d]=t.useState("likely"),p=t.useMemo(()=>({type:"page-element",id:"selected-opportunity",title:"Selected opportunity"}),[]),g=M({id:"selected-opportunity",title:"Selected opportunity",kind:"record-detail",getContext:()=>({resource:"opportunities",record:{name:o,forecast:u}})}),m=t.useMemo(()=>({title:"Prepare opportunity brief",message:{user:"Prepare a brief for the selected opportunity.",workContext:[p]},autoSend:!1}),[p]),f=t.useMemo(()=>({[r.username]:[m]}),[r.username,m]);return e.jsx(F,{id:"preset-task-context-demo",defaultEmployee:r.username,employeeTasks:f,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:g,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected opportunity"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value, then select the preset task in the chat."})]}),e.jsx(b,{variant:"secondary",children:"Preset task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"preset-context-opportunity",children:"Opportunity"}),e.jsx(y,{id:"preset-context-opportunity",value:o,onChange:s=>c(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Forecast"}),e.jsxs(k,{value:u,onValueChange:s=>s&&d(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"pipeline",children:"Pipeline"}),e.jsx(l,{value:"likely",children:"Likely"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"No Shortcut is used here. “Prepare opportunity brief” comes from AIChatProvider.employeeTasks and appears in the conversation empty state."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Ie(){const{employees:n}=E(),r=n.filter(L)[0],o=D(),[c,u]=t.useState("Northwind Finance"),[d,p]=t.useState("negotiation"),g=t.useMemo(()=>({type:"page-element",id:"inherited-renewal-context",title:"Current account renewal"}),[]),m=M({id:"inherited-renewal-context",title:"Current account renewal",kind:"record-detail",getContext:()=>({resource:"accounts",record:{accountName:c,stage:d}})}),f=t.useMemo(()=>({title:"Review current renewal",message:{user:"Review the current account renewal."},autoSend:!1}),[]),s=t.useMemo(()=>({title:"Recommend next renewal action",message:{user:"Recommend the next renewal action."},autoSend:!1}),[]),I=t.useMemo(()=>({[r.username]:[s]}),[r.username,s]);return e.jsx(J,{context:g,children:e.jsx(F,{id:"inherited-context-demo",controller:o,defaultEmployee:r.username,employeeTasks:I,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Current account renewal"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Shortcut and conversation are inside this context scope."})]}),e.jsx(b,{variant:"outline",children:"Inherited"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"inherited-account-name",children:"Account"}),e.jsx(y,{id:"inherited-account-name",value:c,onChange:h=>u(h.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Renewal stage"}),e.jsxs(k,{value:d,onValueChange:h=>h&&p(h),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"discovery",children:"Discovery"}),e.jsx(l,{value:"negotiation",children:"Negotiation"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Shortcut task without message.workContext"}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Review current renewal",size:34})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"The preset task “Recommend next renewal action” also has no task context, so it inherits this scope."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function R({eyebrow:n,title:r,description:o,children:c}){return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:n}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:r}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:o})]}),c]})}export{Le as PageContextPage};
|
|
73
|
+
${c}`},autoSend:!0}),[c]);return e.jsx(J,{context:m,children:e.jsx(R,{id:"form-filler-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[610px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"space-y-5 bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Source content"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"Edit this text, then ask the AI employee to fill the registered form below."})]}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:`Ask ${r.nickname}`,size:34})]})}),e.jsx(P,{children:e.jsx(U,{value:c,onChange:s=>u(s.target.value),className:"min-h-28"})})]}),e.jsxs("form",{ref:g,className:"rounded-xl border bg-card",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 border-b p-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Lead intake form"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Form filler changes visible values only. It never submits the form."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"secondary",children:"useAIForm"}),e.jsx(pe,{type:"button",variant:"outline",size:"sm",onClick:()=>d.reset({company:"",contactName:"",email:"",priority:"normal"}),children:"Clear"})]})]}),e.jsxs("div",{className:"grid gap-4 p-5 sm:grid-cols-2",children:[e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-company",children:"Company"}),e.jsx(y,{id:"form-filler-company",...d.register("company")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-contact",children:"Contact name"}),e.jsx(y,{id:"form-filler-contact",...d.register("contactName")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"form-filler-email",children:"Email"}),e.jsx(y,{id:"form-filler-email",type:"email",...d.register("email")})]}),e.jsxs("label",{className:"space-y-2",children:[e.jsx(i,{children:"Priority"}),e.jsxs(k,{value:d.watch("priority"),onValueChange:s=>s&&d.setValue("priority",s,{shouldDirty:!0,shouldTouch:!0}),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"normal",children:"Normal"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[610px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Ae(){const{employees:n}=F(),r=n.filter(V)[0],o=D(),[c,u]=t.useState(0),[d,p]=t.useState("Not reviewed"),g=24e3,m=g*(1-c/100),f=t.useMemo(()=>[{name:"update_quote_discount",title:"Update quote discount",description:"Update the discount percentage and review note shown on the current quote. This changes the page preview only and does not save the quote.",permission:"ASK",inputSchema:{type:"object",properties:{discountPercent:{type:"number",minimum:0,maximum:30,description:"Discount percentage applied to the quote."},note:{type:"string",description:"Short explanation shown in the review note."}},required:["discountPercent","note"],additionalProperties:!1},execute:h=>{const v=h&&typeof h=="object"&&!Array.isArray(h)?h:{};return typeof v.discountPercent!="number"||v.discountPercent<0||v.discountPercent>30||typeof v.note!="string"?{status:"error",content:"Provide a discount from 0 to 30 and a review note."}:(u(v.discountPercent),p(v.note),{status:"success",content:`Updated the quote preview to a ${v.discountPercent}% discount.`})}}],[]),s=ge({id:"quote-review-card",title:"Quote review",kind:"record-detail",tools:f,getContext:()=>({resource:"quotes",record:{quoteNumber:"QT-2026-1048",customer:"Northwind Studio",baseAmount:g,discountPercent:c,total:m,approvalNote:d}})}),I=t.useMemo(()=>({title:"Apply review discount",message:{user:"Update the current quote preview to use a 12% discount and set the review note to 'Approved for the renewal discussion'."},autoSend:!0}),[]);return e.jsx(J,{context:s.context,children:e.jsx(R,{id:"custom-frontend-tool-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:s.ref,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Quote review"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"QT-2026-1048 · Northwind Studio"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{variant:"outline",children:"Custom Tool"}),e.jsx(b,{variant:"secondary",children:"ASK"})]})]})}),e.jsxs(P,{className:"space-y-5",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:[["Base amount",`$${g.toLocaleString()}`],["Discount",`${c}%`],["Preview total",`$${m.toLocaleString()}`]].map(([h,v])=>e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:h}),e.jsx("div",{className:"mt-1 font-medium",children:v})]},h))}),e.jsxs("div",{className:"rounded-lg border bg-background p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Review note"}),e.jsx("div",{className:"mt-1 text-sm",children:d})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsx("p",{className:"max-w-lg text-xs leading-5 text-muted-foreground",children:"The page element registers update_quote_discount. Its full input schema is loaded only when the AI chooses this Tool. Approval is controlled by the ASK permission."}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[I],label:`Ask ${r.nickname}`,size:34})]})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function Te(){const{employees:n}=F(),r=n.filter(V)[0],o=D(),[c,u]=t.useState("Payment callback reached the order service twelve minutes late."),[d,p]=t.useState("high"),g=t.useMemo(()=>({type:"page-element",id:"selected-support-case",title:"Selected support case"}),[]),m=M({id:"selected-support-case",title:"Selected support case",kind:"editable-record",getContext:()=>({resource:"supportTickets",values:{summary:c,severity:d}})}),f=t.useMemo(()=>({title:"Analyze selected case",message:{user:"Analyze the selected support case.",workContext:[g]},autoSend:!1}),[g]);return e.jsx(R,{id:"shortcut-task-context-demo",controller:o,defaultEmployee:r.username,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsxs("div",{className:"bg-muted/15 p-4 sm:p-5",children:[e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected support case"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value before running either task."})]}),e.jsx(b,{variant:"secondary",children:"Task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"selected-context-summary",children:"Summary"}),e.jsx(y,{id:"selected-context-summary",value:c,onChange:s=>u(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Severity"}),e.jsxs(k,{value:d,onValueChange:s=>s&&p(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"low",children:"Low"}),e.jsx(l,{value:"medium",children:"Medium"}),e.jsx(l,{value:"high",children:"High"})]})]})]})]})]}),e.jsxs(j,{className:"mt-5 border-dashed bg-background/80",children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Task shortcut area"}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:"This button is outside the selected page element. Its task explicitly references “Selected support case”."})]}),e.jsx(b,{variant:"outline",children:"Explicit reference"})]})}),e.jsx(P,{children:e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Analyze selected case",size:34})})]})]}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Pe(){const{employees:n}=F(),r=n.filter(V)[0],[o,c]=t.useState("Enterprise workspace expansion"),[u,d]=t.useState("likely"),p=t.useMemo(()=>({type:"page-element",id:"selected-opportunity",title:"Selected opportunity"}),[]),g=M({id:"selected-opportunity",title:"Selected opportunity",kind:"record-detail",getContext:()=>({resource:"opportunities",record:{name:o,forecast:u}})}),m=t.useMemo(()=>({title:"Prepare opportunity brief",message:{user:"Prepare a brief for the selected opportunity.",workContext:[p]},autoSend:!1}),[p]),f=t.useMemo(()=>({[r.username]:[m]}),[r.username,m]);return e.jsx(R,{id:"preset-task-context-demo",defaultEmployee:r.username,employeeTasks:f,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:g,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Selected opportunity"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Change a value, then select the preset task in the chat."})]}),e.jsx(b,{variant:"secondary",children:"Preset task context"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"preset-context-opportunity",children:"Opportunity"}),e.jsx(y,{id:"preset-context-opportunity",value:o,onChange:s=>c(s.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Forecast"}),e.jsxs(k,{value:u,onValueChange:s=>s&&d(s),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"pipeline",children:"Pipeline"}),e.jsx(l,{value:"likely",children:"Likely"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"No Shortcut is used here. “Prepare opportunity brief” comes from AIChatProvider.employeeTasks and appears in the conversation empty state."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})}function Ie(){const{employees:n}=F(),r=n.filter(V)[0],o=D(),[c,u]=t.useState("Northwind Finance"),[d,p]=t.useState("negotiation"),g=t.useMemo(()=>({type:"page-element",id:"inherited-renewal-context",title:"Current account renewal"}),[]),m=M({id:"inherited-renewal-context",title:"Current account renewal",kind:"record-detail",getContext:()=>({resource:"accounts",record:{accountName:c,stage:d}})}),f=t.useMemo(()=>({title:"Review current renewal",message:{user:"Review the current account renewal."},autoSend:!1}),[]),s=t.useMemo(()=>({title:"Recommend next renewal action",message:{user:"Recommend the next renewal action."},autoSend:!1}),[]),I=t.useMemo(()=>({[r.username]:[s]}),[r.username,s]);return e.jsx(J,{context:g,children:e.jsx(R,{id:"inherited-context-demo",controller:o,defaultEmployee:r.username,employeeTasks:I,children:e.jsx(j,{className:"gap-0 overflow-hidden py-0",children:e.jsxs("div",{className:"grid min-h-[560px] xl:grid-cols-[minmax(0,1fr)_410px]",children:[e.jsx("div",{className:"bg-muted/15 p-4 sm:p-5",children:e.jsxs(j,{ref:m,children:[e.jsx(A,{children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Current account renewal"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Shortcut and conversation are inside this context scope."})]}),e.jsx(b,{variant:"outline",children:"Inherited"})]})}),e.jsxs(P,{className:"space-y-4",children:[e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{htmlFor:"inherited-account-name",children:"Account"}),e.jsx(y,{id:"inherited-account-name",value:c,onChange:h=>u(h.target.value)})]}),e.jsxs("label",{className:"block space-y-2",children:[e.jsx(i,{children:"Renewal stage"}),e.jsxs(k,{value:d,onValueChange:h=>h&&p(h),children:[e.jsx(N,{className:"w-full",children:e.jsx(C,{})}),e.jsxs(S,{children:[e.jsx(l,{value:"discovery",children:"Discovery"}),e.jsx(l,{value:"negotiation",children:"Negotiation"}),e.jsx(l,{value:"committed",children:"Committed"})]})]})]}),e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Shortcut task without message.workContext"}),e.jsx(_,{aiEmployee:r.username,target:o,tasks:[f],label:"Review current renewal",size:34})]}),e.jsx("div",{className:"rounded-lg border bg-background p-3 text-xs leading-5 text-muted-foreground",children:"The preset task “Recommend next renewal action” also has no task context, so it inherits this scope."})]})]})}),e.jsx("div",{className:"min-h-0 border-t bg-card xl:border-l xl:border-t-0",children:e.jsx($,{className:"h-[560px] rounded-none border-0",children:e.jsx(B,{showConversationToggle:!1,disclaimer:!1})})})]})})})})}function E({eyebrow:n,title:r,description:o,children:c}){return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:n}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:r}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:o})]}),c]})}export{Ve as PageContextPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./index-CgkdZ6Oc.js";import{P as p}from"./prompt-output-DMTuTNab.js";function x({title:r,description:t,prompt:m}){return o.jsx(p,{title:r,description:t,prompt:m,promptClassName:"max-h-[620px]"})}export{x as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,j as e,D as f,y as h,
|
|
1
|
+
import{b as o,j as e,D as f,y as h,bv as y,c as i}from"./index-CgkdZ6Oc.js";import{C as j}from"./card-C9Hpeq1c.js";function C({className:c,copiedLabel:n="Copied",copyErrorLabel:p="Clipboard access failed. Select the prompt and copy it manually.",copyLabel:d="Copy prompt",description:l,prompt:t,promptClassName:m,title:x="Generated prompt"}){const[s,a]=o.useState(!1),[u,r]=o.useState(!1);return e.jsxs(j,{className:i("min-w-0 gap-0 overflow-hidden py-0",c),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",children:x}),e.jsx("div",{className:"text-xs text-muted-foreground",children:l})]}),e.jsxs(f,{type:"button",size:"sm",className:"shrink-0",onClick:async()=>{try{await navigator.clipboard.writeText(t),r(!1),a(!0),window.setTimeout(()=>a(!1),1500)}catch{r(!0)}},children:[s?e.jsx(h,{}):e.jsx(y,{}),s?n:d]})]}),u?e.jsx("p",{className:"border-b px-4 py-2 text-xs text-destructive",children:p}):null,e.jsx("pre",{className:i("max-h-[560px] overflow-auto whitespace-pre-wrap bg-muted/25 p-5 font-mono text-xs leading-5 text-muted-foreground",m),children:t})]})}export{C as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{aX as m,b as o,aY as g,aZ as d,j as a,aD as f,aF as h,aG as x,D as v,a_ as S,r as b}from"./index-CgkdZ6Oc.js";function p(r){const[e]=m(),[i,t]=o.useState(!1),[n,l]=o.useState(),u=o.useMemo(()=>{if(e.get("authenticator")!==r.name)return;const s=e.get("error");return s?new Error(s):void 0},[r.name,e]);return{signIn:o.useCallback(async()=>{l(void 0),t(!0);try{const s=g(e.get("to")||e.get("redirect")||"/"),c=await d.action("saml","getAuthUrl",{method:"POST",authenticator:r.name,includeRole:!1,withAclMeta:!1,body:{redirect:s}});if(!c)throw new Error("NocoBase did not return a SAML authorization URL.");window.location.replace(d.resolveUrl(c))}catch(s){l(s instanceof Error?s:new Error("Unable to start SAML sign-in.")),t(!1)}},[r.name,e]),isPending:i,error:n??u}}function j({authenticator:r,onSignIn:e}){const{signIn:i,isPending:t,error:n}=p(r);return a.jsxs("div",{className:"space-y-3",children:[n&&a.jsxs(f,{variant:"destructive",children:[a.jsx(h,{children:"SAML sign-in failed"}),a.jsx(x,{children:n.message})]}),a.jsxs(v,{type:"button",variant:"outline",className:"w-full",disabled:!e&&t,onClick:e??i,children:[a.jsx(S,{}),!e&&t?"Redirecting…":b(r.title||r.authTypeTitle||"SAML")]})]})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as m,P as y,H as A,m as I,aq as R}from"./echarts-runtime-
|
|
1
|
+
import{_ as m,P as y,H as A,m as I,aq as R}from"./echarts-runtime-CvLr4Slh.js";var p=(function(){function u(){this.cx=0,this.cy=0,this.r0=0,this.r=0,this.startAngle=0,this.endAngle=Math.PI*2,this.clockwise=!0}return u})(),b=(function(u){m(s,u);function s(a){var r=u.call(this,a)||this;return r.type="sausage",r}return s.prototype.getDefaultShape=function(){return new p},s.prototype.buildPath=function(a,r){var e=r.cx,i=r.cy,o=Math.max(r.r0||0,0),h=Math.max(r.r,0),d=(h-o)*.5,v=o+d,t=r.startAngle,n=r.endAngle,c=r.clockwise,l=Math.PI*2,M=c?n-t<l:t-n<l;M||(t=n-(c?l:-l));var f=Math.cos(t),g=Math.sin(t),P=Math.cos(n),S=Math.sin(n);M?(a.moveTo(f*o+e,g*o+i),a.arc(f*v+e,g*v+i,d,-Math.PI+t,t,!c)):a.moveTo(f*h+e,g*h+i),a.arc(e,i,h,t,n,!c),a.arc(P*v+e,S*v+i,d,n-Math.PI*2,n-Math.PI,!c),o!==0&&a.arc(e,i,o,n,t,c)},s})(y);function k(u,s,a){var r=u.get("borderRadius");if(r==null)return a?{cornerRadius:0}:null;A(r)||(r=[r,r,r,r]);var e=Math.abs(s.r||0-s.r0||0);return{cornerRadius:I(r,function(i){return R(i,e)})}}export{b as S,k as g};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import{b as c,a7 as ye,a8 as Pe,a9 as Ee,aa as we,ab as G,j as e,ac as Re,ad as $e,ae as Ue,af as We,ag as ze,ah as de,ai as De,aj as Be,ak as Ne,al as Oe,am as Ce,an as Fe,ao as Le,ap as Ve,c as Y,C as qe,aq as _e,ar as Se,a4 as Ge,as as He,B as Q,at as Ke,au as ee,Y as ce,K as me,N as ue,a0 as Je,av as Z,d as O,e as F,f as L,g as V,i as S,I as he,D as J,P as Xe,G as Ye,h as Qe,aw as Ze,T as pe,a1 as et,ax as tt,ay as st}from"./index-CgkdZ6Oc.js";import{C as X,a as te,b as se,d as ae}from"./card-C9Hpeq1c.js";import{S as xe}from"./switch-DQkkIE7G.js";import{P as at}from"./prompt-card-FWugRgi-.js";import{A as nt}from"./configuration-gate-BJoadoA6.js";import"./prompt-output-DMTuTNab.js";const Ae=c.createContext(void 0);function Ie(){const a=c.useContext(Ae);if(a===void 0)throw new Error(ye(10));return a}const ot={value:()=>null},it=c.forwardRef(function(o,m){const{render:x,className:k,disabled:r=!1,hiddenUntilFound:u,keepMounted:i,loopFocus:y,onValueChange:g,multiple:$=!1,orientation:f="vertical",value:R,defaultValue:v,style:z,...w}=o,A=Pe(),I=c.useMemo(()=>{if(R===void 0)return v??[]},[R,v]),N=c.useRef([]),[d,b]=Ee({controlled:R,default:I,name:"Accordion",state:"value"}),M=we((P,D,p)=>{if($)if(D){const j=d.slice();if(j.push(P),g==null||g(j,p),p.isCanceled)return;b(j)}else{const j=d.filter(B=>B!==P);if(g==null||g(j,p),p.isCanceled)return;b(j)}else{const j=d[0]===P?[]:[P];if(g==null||g(j,p),p.isCanceled)return;b(j)}}),h=c.useMemo(()=>({value:d,disabled:r,orientation:f}),[d,r,f]),T=c.useMemo(()=>({disabled:r,handleValueChange:M,hiddenUntilFound:u??!1,keepMounted:i??!1,state:h,value:d}),[r,M,u,i,h,d]),l=G("div",o,{state:h,ref:m,props:[{dir:A},w],stateAttributesMapping:ot});return e.jsx(Ae.Provider,{value:T,children:e.jsx(Re,{elementsRef:N,children:l})})}),Me=c.createContext(void 0);function ne(){const a=c.useContext(Me);if(a===void 0)throw new Error(ye(9));return a}let lt=(function(a){return a.index="data-index",a.disabled="data-disabled",a.open="data-open",a})({});const oe={...Ue,index:a=>Number.isInteger(a)?{[lt.index]:String(a)}:null,...$e,value:()=>null},rt=c.forwardRef(function(o,m){const{className:x,disabled:k=!1,onOpenChange:r,render:u,value:i,style:y,...g}=o,{ref:$,index:f}=We(),R=ze(m,$),{disabled:v,handleValueChange:z,state:w,value:A}=Ie(),I=de(),N=i??I,d=k||v,b=c.useMemo(()=>{if(!A)return!1;for(let E=0;E<A.length;E+=1)if(A[E]===N)return!0;return!1},[A,N]),M=we((E,W)=>{r==null||r(E,W),!W.isCanceled&&z(N,E,W)}),h=De({open:b,onOpenChange:M,disabled:d}),T=c.useMemo(()=>({open:h.open,disabled:h.disabled,transitionStatus:h.transitionStatus}),[h.open,h.disabled,h.transitionStatus]),l=c.useMemo(()=>({...h,onOpenChange:M,state:T}),[h,T,M]),P=c.useMemo(()=>({...w,hidden:!b&&!h.mounted,index:f,disabled:d,open:b}),[h.mounted,d,f,b,w]),D=de(),[p,j]=c.useState(),B=c.useMemo(()=>({open:b,state:P,setTriggerId:j,triggerId:p??D}),[D,b,P,j,p]),q=G("div",o,{state:P,ref:R,props:g,stateAttributesMapping:oe});return e.jsx(Be.Provider,{value:l,children:e.jsx(Me.Provider,{value:B,children:q})})}),dt=c.forwardRef(function(o,m){const{render:x,className:k,style:r,...u}=o,{state:i}=ne();return G("h3",o,{state:i,ref:m,props:u,stateAttributesMapping:oe})}),ct=c.forwardRef(function(o,m){const{disabled:x,className:k,id:r,render:u,nativeButton:i=!0,style:y,...g}=o,{panelId:$,open:f,handleTrigger:R,disabled:v}=Ne(),z=x||v,{getButtonProps:w,buttonRef:A}=Oe({disabled:z,focusableWhenDisabled:!0,native:i}),{state:I,setTriggerId:N,triggerId:d}=ne();return Ce(()=>(r&&N(r),()=>{N(void 0)}),[r,N]),G("button",o,{state:I,ref:[m,A],props:[{"aria-controls":f?$:void 0,"aria-expanded":f,id:d,onClick:R},g,w],stateAttributesMapping:Fe})});let ge=(function(a){return a.accordionPanelHeight="--accordion-panel-height",a.accordionPanelWidth="--accordion-panel-width",a})({});const mt=c.forwardRef(function(o,m){const{className:x,hiddenUntilFound:k,keepMounted:r,id:u,render:i,style:y,...g}=o,{hiddenUntilFound:$,keepMounted:f}=Ie(),{mounted:R,onOpenChange:v,open:z,panelId:w,setMounted:A,setOpen:I,setPanelIdState:N,transitionStatus:d}=Ne(),b=k??$,M=r??f;Ce(()=>{if(u)return N(u),()=>{N(void 0)}},[u,N]);const{height:h,props:T,ref:l,shouldPreventOpenAnimation:P,shouldRender:D,transitionStatus:p,width:j}=Le({externalRef:m,hiddenUntilFound:b,id:u??w,keepMounted:M,mounted:R,onOpenChange:v,open:z,setMounted:A,setOpen:I,transitionStatus:d}),{state:B,triggerId:q}=ne(),E={...B,transitionStatus:p},W=Ve(y,E),H=G("div",{...o,style:void 0},{state:E,ref:l,props:[T,{"aria-labelledby":q,role:"region",style:{[ge.accordionPanelHeight]:h===void 0?"auto":`${h}px`,[ge.accordionPanelWidth]:j===void 0?"auto":`${j}px`}},g,W?{style:W}:void 0,P?{style:{animationName:"none"}}:void 0],stateAttributesMapping:oe});return D?H:null});function ut({className:a,...o}){return e.jsx(it,{"data-slot":"accordion",className:Y("flex w-full flex-col",a),...o})}function ht({className:a,...o}){return e.jsx(rt,{"data-slot":"accordion-item",className:Y("not-last:border-b",a),...o})}function pt({className:a,children:o,...m}){return e.jsx(dt,{className:"flex",children:e.jsxs(ct,{"data-slot":"accordion-trigger",className:Y("group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",a),...m,children:[o,e.jsx(qe,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),e.jsx(_e,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function xt({className:a,children:o,...m}){return e.jsx(mt,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...m,children:e.jsx("div",{className:Y("h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",a),children:o})})}const fe={title:"Analyze this ticket",message:{system:"Review the current ticket, identify operational risk, and suggest the next action.",user:"Analyze the current ticket and recommend the next action."},autoSend:!0,model:{llmService:"openai",model:"gpt-5"},webSearch:!0,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},be={title:"Draft a customer reply",message:{user:"Draft a concise customer reply for the current ticket."},autoSend:!1,skillSettings:{skills:["response-drafting"],tools:["inspect-record"]}},je={title:"Review operational risk",message:{system:"Review the current queue, identify operational risk, and prioritize the next actions.",user:"Review the current ticket queue and identify operational risk."},autoSend:!1,skillSettings:{skills:["ticket-analysis"],tools:["inspect-record"]}},C={id:"TK-1042",title:"Payment callback delayed",status:"Open",requester:"Northwind Finance",createdAt:"July 22, 2026 · 09:42",description:"Payment succeeded, but the callback reached the order service twelve minutes late. The customer needs an impact assessment and a response before the next settlement window."},gt=[C,{id:"TK-1041",title:"Unable to update profile"},{id:"TK-1038",title:"Invoice export formatting"}],Te=a=>!["nathan","dara"].includes(a.username.toLowerCase());function At(){return e.jsx(nt,{children:e.jsx(ft,{})})}function ft(){const{employees:a}=Se(),o=Ge(),m=a.filter(Te),x=m.find(y=>y.username.toLowerCase()==="atlas")??m[0],k=m.find(y=>y.username!==x.username)??x,r=m.find(y=>y.username.toLowerCase()==="atlas")??m.find(y=>y.username!==x.username)??x,u=He({id:"support-ticket-detail",title:`${C.id} · ${C.title}`,kind:"record-detail",getContext:()=>({resource:"supportTickets",record:C})}),i=c.useMemo(()=>({[x.username]:[fe,be],...k.username!==x.username?{[k.username]:[je]}:{}}),[x.username,k.username]);return e.jsxs("div",{className:"space-y-12 pb-12",children:[e.jsx("section",{className:"flex flex-wrap items-start justify-between gap-5 border-b pb-8",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Q,{variant:"secondary",children:"AI Components"}),e.jsx(Q,{variant:"outline",children:"Employee capability"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"Employee tasks"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Bind reusable tasks to AI employees. Tasks can appear directly inside a chat when the employee is selected, or be triggered from contextual buttons elsewhere in the application."})]})}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 1 · Multiple tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Trigger employee tasks from a business record"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"The Shortcut component can still sit in a detail header and provide the current record as work context. Opening it shows the configured analysis and reply tasks below the employee greeting."})]}),e.jsx(Ke,{context:{type:"page-element",id:"support-ticket-detail",title:`${C.id} · ${C.title}`},children:e.jsxs(X,{ref:u,className:"gap-0 overflow-hidden py-0",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 border-b p-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:C.id}),e.jsx(Q,{variant:"outline",children:C.status})]}),e.jsx("h3",{className:"mt-2 text-lg font-semibold tracking-tight",children:C.title})]}),e.jsx(ee,{aiEmployee:x.username,tasks:[fe,be],label:`Ask ${x.nickname}`,size:34})]}),e.jsxs("div",{className:"grid gap-5 p-5 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Requester"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:C.requester})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Created"}),e.jsx("div",{className:"mt-1 text-sm font-medium",children:C.createdAt})]})]}),e.jsxs("div",{className:"border-t p-5",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6",children:C.description})]})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 2 · Explicit target"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Send a shortcut task to a designated embedded chat"}),e.jsxs("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:["The shortcut receives the embedded chat Controller directly. Its Provider explicitly configures ",r.nickname," and an employee task set. It does not need a global target ID and cannot accidentally trigger another conversation on the same page."]})]}),e.jsx(ce,{id:"shortcut-embedded-chat",controller:o,defaultEmployee:r.username,children:e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(X,{children:[e.jsx(te,{children:e.jsx(se,{className:"text-base",children:"Risk review workspace"})}),e.jsxs(ae,{className:"space-y-5",children:[e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"The embedded chat starts without preset tasks. Clicking the Shortcut injects “Review operational risk” into this specific conversation, where the user can choose it before the request is placed in the composer."}),e.jsx(ee,{aiEmployee:r.username,target:o,tasks:[je],auto:!1,context:[{type:"table",title:"Open ticket queue",content:gt}],label:`Ask ${r.nickname}`,size:36})]})]}),e.jsx(me,{className:"h-[560px] min-h-0",children:e.jsx(ue,{})})]})})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Scenario 3 · Chat-bound tasks"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Show tasks when the selected employee changes"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"This conversation window binds task lists directly to business AI employees. Starting a new conversation or switching employees in the composer immediately replaces the empty-state tasks. Employees without a binding keep the normal greeting-only state."})]}),e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(X,{children:[e.jsx(te,{children:e.jsx(se,{className:"text-base",children:"Employee task bindings"})}),e.jsxs(ae,{className:"space-y-4 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"rounded-lg border bg-muted/25 p-3 font-mono text-xs leading-5",children:[e.jsx("div",{children:x.username}),e.jsx("div",{className:"pl-4",children:"Analyze this ticket"}),e.jsx("div",{className:"pl-4",children:"Draft a customer reply"}),k.username!==x.username?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2",children:k.username}),e.jsx("div",{className:"pl-4",children:"Review operational risk"})]}):null]}),e.jsx("p",{children:"Switch employees from the bottom of the chat to preview each configured task list."}),e.jsxs("p",{children:["The same ",e.jsx("code",{children:"employeeTasks"})," parameter works in page, embedded, side-panel, dialog, and mobile containers."]})]})]}),e.jsx(ce,{id:"employee-task-scenario-chat",defaultEmployee:x.username,employeeTasks:i,children:e.jsx(me,{className:"h-[620px] min-h-0",children:e.jsx(ue,{})})})]})]}),e.jsx(kt,{embeddedController:o})]})}const bt=[{value:"ticket-analysis",label:"Ticket analysis"},{value:"response-drafting",label:"Response drafting"},{value:"workflow-design",label:"Workflow design"}],jt=[{value:"inspect-record",label:"Inspect record"},{value:"search-records",label:"Search records"},{value:"update-record",label:"Update record"}],ke=[{id:"analyze-ticket",employee:"",title:"Analyze this ticket",background:"Identify operational risk and recommend the next action.",userMessage:"Analyze the current ticket and recommend the next action.",autoSend:!0,workContext:[{type:"page-element",id:"support-ticket-detail",title:`${C.id} · ${C.title}`}],model:"gpt-5",webSearch:!0,skillsMode:"custom",skills:["ticket-analysis"],toolsMode:"custom",tools:["inspect-record"]},{id:"draft-reply",employee:"",title:"Draft a customer reply",background:"Write a concise and helpful response using the ticket context.",userMessage:"Draft a customer reply for the current ticket.",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"custom",skills:["response-drafting"],toolsMode:"preset",tools:[]}];function kt({embeddedController:a}){var E,W,H,ie,le;const{employees:o,models:m}=Se(),{registeredCount:x,startPicking:k}=Je(),r=o.filter(Te),u=r.find(t=>t.username.toLowerCase()==="atlas")??r[0],[i,y]=c.useState("shortcut"),[g,$]=c.useState("the ticket detail header actions"),[f,R]=c.useState(u.username),[v,z]=c.useState(u.username),[w,A]=c.useState("global-side-panel"),[I,N]=c.useState("embedded"),[d,b]=c.useState(()=>ke.map(t=>({...t,employee:u.username}))),[M,h]=c.useState(ke[0].id),T=i==="chat-tasks"?d.filter(t=>t.employee===v):d,l=T.find(t=>t.id===M)??T[0],P=c.useMemo(()=>d.map(t=>{const n=Z(m,t.model),s=t.skillsMode==="custom"||t.toolsMode==="custom";return{title:t.title,message:{system:t.background||void 0,user:t.userMessage||void 0,workContext:t.workContext.length?t.workContext:void 0},autoSend:t.autoSend,model:n?{llmService:n.llmService,model:n.value}:void 0,webSearch:t.webSearch,skillSettings:s?{skills:t.skillsMode==="custom"?t.skills:void 0,tools:t.toolsMode==="custom"?t.tools:void 0}:void 0}}),[m,d]),D=c.useMemo(()=>{const t=(s,U)=>{var re;const _=s.model==="default"?"Use the AI employee default":((re=m.find(K=>K.value===s.model))==null?void 0:re.label)??s.model;return`${U+1}. ${s.title}
|
|
2
|
+
- Background: ${s.background||"None"}
|
|
3
|
+
- Default user message: ${s.userMessage||"None"}
|
|
4
|
+
- Send automatically: ${s.autoSend}
|
|
5
|
+
- Work context: ${s.workContext.map(K=>K.title??K.id).join(", ")||"Inherit the surrounding context"}
|
|
6
|
+
- Model: ${_}
|
|
7
|
+
- Web search: ${s.webSearch}
|
|
8
|
+
- Skills: ${s.skillsMode==="preset"?"Use the AI employee defaults":s.skills.join(", ")||"Disabled"}
|
|
9
|
+
- Tools: ${s.toolsMode==="preset"?"Use the AI employee defaults":s.tools.join(", ")||"Disabled"}`},n=i==="chat-tasks"?Array.from(new Set(d.map(s=>s.employee))).map(s=>{const U=d.filter(_=>_.employee===s);return`AI employee: ${s}
|
|
10
|
+
${U.map(t).join(`
|
|
11
|
+
`)}`}).join(`
|
|
12
|
+
|
|
13
|
+
`):d.map(t).join(`
|
|
14
|
+
`);if(i==="chat-tasks"){const s={page:"a dedicated page",embedded:"an embedded block in the page","side-panel":"a push side panel",dialog:"a dialog"}[I];return`Add an AI conversation window to ${g} using ${s}.
|
|
15
|
+
|
|
16
|
+
Employee task bindings:
|
|
17
|
+
${n}
|
|
18
|
+
|
|
19
|
+
Implementation requirements:
|
|
20
|
+
- Render AIChatWindow in the selected container and wrap it with AIChatProvider.
|
|
21
|
+
- Configure AIChatProvider with employeeTasks grouped by AI employee username.
|
|
22
|
+
- When the user starts a new conversation or switches AI employees, show the matching tasks below that employee’s greeting.
|
|
23
|
+
- Employees without configured tasks must keep the greeting-only empty state.
|
|
24
|
+
- Selecting a task must respect autoSend: either send immediately or fill the composer for review.
|
|
25
|
+
- Resolve task message.workContext when the task starts so selected page elements use their latest values.
|
|
26
|
+
- When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
|
|
27
|
+
- Preserve every task’s background prompt, model override, Web search setting, Skills, Tools, and work context.
|
|
28
|
+
- Keep the employeeTasks capability independent of the container so the same configuration works in page, embedded, side-panel, dialog, and mobile layouts.
|
|
29
|
+
- Use the existing AIProvider/AIChatProvider runtime with shadcn/Base UI components.`}return`Add an AI employee shortcut to ${g}.
|
|
30
|
+
|
|
31
|
+
Shortcut configuration:
|
|
32
|
+
- AI employee: ${f}
|
|
33
|
+
- Target conversation: ${w==="global-side-panel"?"the default global push side panel":"the embedded chat rendered in this page section"}
|
|
34
|
+
- Include the current record or form values as work context.
|
|
35
|
+
|
|
36
|
+
Tasks:
|
|
37
|
+
${n}
|
|
38
|
+
|
|
39
|
+
Implementation requirements:
|
|
40
|
+
- Use AIEmployeeShortcut and pass all configured tasks through its tasks prop.
|
|
41
|
+
- When multiple tasks are provided, open a new conversation and show the tasks below the AI employee greeting.
|
|
42
|
+
- Selecting a task must respect that task's autoSend setting: either send immediately or fill the composer for review.
|
|
43
|
+
- Resolve task message.workContext when the task starts so selected page elements use their latest values.
|
|
44
|
+
- When a task has no message.workContext, inherit the context surrounding the Shortcut or AIChatProvider.
|
|
45
|
+
- Preserve each task's background prompt, work context, model override, Web search setting, Skills, and Tools.
|
|
46
|
+
- ${w==="global-side-panel"?"Use the global AI chat controller; do not pass a target prop.":"Create a dedicated controller with useAIChatController(), bind it to the embedded AIChatProvider, and pass it through the shortcut target prop."}
|
|
47
|
+
- Use the existing AIProvider and AIChatProvider runtime with shadcn/Base UI components.`},[I,f,i,g,m,w,d]),p=t=>{l&&b(n=>n.map(s=>s.id===l.id?{...s,...t}:s))},j=()=>{const t=`task-${crypto.randomUUID()}`;b(n=>[...n,{id:t,employee:i==="chat-tasks"?v:f,title:`Task ${n.length+1}`,background:"",userMessage:"",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"preset",skills:[],toolsMode:"preset",tools:[]}]),h(t)},B=t=>{if(d.length===1)return;const n=d.filter(s=>s.id!==t);if(b(n),M===t){const s=i==="chat-tasks"?n.find(U=>U.employee===v):n[0];h((s==null?void 0:s.id)??"")}},q=(t,n,s)=>{if(!l)return;const U=l[t];p({[t]:s?[...U,n]:U.filter(_=>_!==n)})};return e.jsxs("section",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Employee tasks prompt"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Generate an integration prompt"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Choose whether tasks are exposed through a contextual Shortcut or directly by the selected employee in a chat. Both modes share the same task, model, Web search, Skills, and Tools configuration."})]}),e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(X,{className:"gap-0 py-0",children:[e.jsx(te,{className:"py-4",children:e.jsx(se,{className:"text-base",children:"Employee task configuration"})}),e.jsxs(ae,{className:"space-y-4 pb-4",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Integration"}),e.jsxs(O,{value:i,onValueChange:t=>{if(!t)return;const n=t;y(n),$(n==="shortcut"?"the ticket detail header actions":"the ticket detail page");const s=n==="chat-tasks"?d.find(U=>U.employee===v):d[0];h((s==null?void 0:s.id)??"")},children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{children:i==="shortcut"?"Contextual Shortcut":"Tasks inside a chat"})}),e.jsxs(V,{children:[e.jsx(S,{value:"shortcut",children:"Contextual Shortcut"}),e.jsx(S,{value:"chat-tasks",children:"Tasks inside a chat"})]})]})]}),i==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 border-t pt-4 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(O,{value:v,onValueChange:t=>{var n;t&&(z(t),h(((n=d.find(s=>s.employee===t))==null?void 0:n.id)??""))},children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{children:((E=r.find(t=>t.username===v))==null?void 0:E.nickname)??v})}),e.jsx(V,{children:r.map(t=>e.jsx(S,{value:t.username,children:t.nickname},t.username))})]}),e.jsx("span",{className:"block font-normal leading-5 text-muted-foreground",children:"Select an employee first, then configure the tasks shown in that employee’s new-conversation state."})]}):null,e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[i==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(O,{value:f,onValueChange:t=>t&&R(t),children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{children:((W=r.find(t=>t.username===f))==null?void 0:W.nickname)??f})}),e.jsx(V,{children:r.map(t=>e.jsx(S,{value:t.username,children:t.nickname},t.username))})]})]}):null,e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Placement"}),e.jsx(he,{value:g,onChange:t=>$(t.target.value)})]}),i==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Chat container"}),e.jsxs(O,{value:I,onValueChange:t=>t&&N(t),children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{children:{page:"Page",embedded:"Embedded block","side-panel":"Side panel",dialog:"Dialog"}[I]})}),e.jsxs(V,{children:[e.jsx(S,{value:"page",children:"Page"}),e.jsx(S,{value:"embedded",children:"Embedded block"}),e.jsx(S,{value:"side-panel",children:"Side panel"}),e.jsx(S,{value:"dialog",children:"Dialog"})]})]})]}):null]}),i==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Target conversation"}),e.jsxs(O,{value:w,onValueChange:t=>t&&A(t),children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{children:w==="global-side-panel"?"Global side panel":"Embedded chat"})}),e.jsxs(V,{children:[e.jsx(S,{value:"global-side-panel",children:"Global side panel"}),e.jsx(S,{value:"embedded",children:"Embedded chat"})]})]})]}):null,e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Tasks"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[T.length," configured task",T.length===1?"":"s",i==="chat-tasks"?" for this employee":""]})]}),e.jsxs(J,{variant:"outline",size:"sm",onClick:j,children:[e.jsx(Xe,{})," Add task"]})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:T.map((t,n)=>e.jsxs("div",{className:t.id===(l==null?void 0:l.id)?"flex items-center gap-2 rounded-lg border border-foreground/25 bg-muted/60 p-1":"flex items-center gap-2 rounded-lg border p-1",children:[e.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-1.5 text-left",onClick:()=>h(t.id),children:[e.jsxs("span",{className:"block truncate text-xs font-medium",children:[n+1,". ",t.title]}),e.jsxs("span",{className:"block text-[10px] text-muted-foreground",children:[t.autoSend?"Auto send":"Fill composer",t.workContext.length?" · Task context":"",t.webSearch?" · Web search":""]})]}),e.jsx(J,{variant:"ghost",size:"icon-xs",disabled:d.length===1,"aria-label":`Remove ${t.title}`,onClick:()=>B(t.id),children:e.jsx(Ye,{})})]},t.id))})]}),l?e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Title"}),e.jsx(he,{value:l.title,onChange:t=>p({title:t.target.value})})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Model"}),e.jsxs(O,{value:l.model,onValueChange:t=>t&&p({model:t}),children:[e.jsx(F,{className:"w-full",children:e.jsx(L,{className:"min-w-0 overflow-hidden",children:e.jsx("span",{className:"block min-w-0 truncate",title:l.model==="default"?"Use employee default":((H=Z(m,l.model))==null?void 0:H.label)??l.model,children:l.model==="default"?"Use employee default":((ie=Z(m,l.model))==null?void 0:ie.label)??l.model})})}),e.jsxs(V,{children:[e.jsx(S,{value:"default",children:"Use employee default"}),e.jsx(Qe,{}),e.jsx(Ze,{models:m})]})]})]})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Default user message"}),e.jsx(pe,{className:"min-h-16",value:l.userMessage,onChange:t=>p({userMessage:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Auto send"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Otherwise the message is placed in the composer."})]}),e.jsx(xe,{size:"sm",checked:l.autoSend,onCheckedChange:t=>p({autoSend:t})})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Work context"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Select a page context for this task. Without one, the task inherits its surrounding context."})]}),e.jsxs(J,{variant:"outline",size:"sm",disabled:x===0,onClick:()=>k({onSelect:t=>p({workContext:[{type:t.type,id:t.id,title:t.title,kind:t.kind}]})}),children:[e.jsx(et,{})," Pick context"]})]}),l.workContext.map((t,n)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted/50 px-2 py-1.5 text-xs",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.title??t.id??t.type}),e.jsx(J,{variant:"ghost",size:"icon-xs","aria-label":"Remove task context",onClick:()=>p({workContext:[]}),children:e.jsx(tt,{})})]},`${t.type}:${t.id??n}`))]}),e.jsx(ut,{children:e.jsxs(ht,{value:"advanced-task-settings",className:"rounded-lg border px-3",children:[e.jsx(pt,{className:"no-underline hover:no-underline",children:e.jsxs("span",{children:[e.jsx("span",{className:"block",children:"Advanced task settings"}),e.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:"Background, Web search, Skills, and Tools"})]})}),e.jsxs(xt,{className:"space-y-4 pt-1",children:[e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Background"}),e.jsx(pe,{className:"min-h-16",value:l.background,onChange:t=>p({background:t.target.value})})]}),e.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border px-3 py-2.5 text-sm",children:[e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"Web search"}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:"Subject to the selected LLM service capability."})]}),e.jsx(xe,{size:"sm",checked:l.webSearch,onCheckedChange:t=>p({webSearch:t})})]}),e.jsx(ve,{title:"Skills",mode:l.skillsMode,values:l.skills,options:bt,onModeChange:t=>p({skillsMode:t}),onToggle:(t,n)=>q("skills",t,n)}),e.jsx(ve,{title:"Tools",mode:l.toolsMode,values:l.tools,options:jt,onModeChange:t=>p({toolsMode:t}),onToggle:(t,n)=>q("tools",t,n)})]})]})})]}):null,e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t pt-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:i==="shortcut"?"Live shortcut preview":"Chat-bound task configuration"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:i==="shortcut"?"Multiple tasks appear in the chat empty state after opening.":"Use the third scenario above to preview employee switching."})]}),i==="shortcut"?e.jsx(ee,{aiEmployee:f,tasks:P,target:w==="embedded"?a:void 0,label:`Ask ${((le=r.find(t=>t.username===f))==null?void 0:le.nickname)??f}`,size:34}):null]})]})]}),e.jsx(at,{title:i==="shortcut"?"Add an AI employee task shortcut":"Add employee tasks to a chat",description:i==="shortcut"?"The prompt includes every task, capability override, and target conversation.":"The prompt groups configured tasks by business AI employee and selected chat container.",prompt:D})]})]})}function ve({title:a,mode:o,values:m,options:x,onModeChange:k,onToggle:r}){return e.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:a}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Preset inherits the AI employee configuration."})]}),e.jsxs(O,{value:o,onValueChange:u=>u&&k(u),children:[e.jsx(F,{size:"sm",className:"w-28",children:e.jsx(L,{children:o==="preset"?"Preset":"Custom"})}),e.jsxs(V,{children:[e.jsx(S,{value:"preset",children:"Preset"}),e.jsx(S,{value:"custom",children:"Custom"})]})]})]}),o==="custom"?e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:x.map(u=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md bg-muted/40 px-2.5 py-2 text-xs",children:[e.jsx(st,{checked:m.includes(u.value),onCheckedChange:i=>r(u.value,i)}),e.jsx("span",{children:u.label})]},u.value))}):null]})}export{At as ShortcutPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a,
|
|
1
|
+
import{b as a,aZ as y,j as e,aD as j,aF as b,aG as A,k as S,I as v,D as w}from"./index-CgkdZ6Oc.js";import{u as C}from"./use-authenticator-sign-in-BzFeh7qe.js";function E(n){var x;const s=C(n.name),[l,r]=a.useState(!1),[g,d]=a.useState(),[c,t]=a.useState(),[f,m]=a.useState(Date.now()),i=typeof((x=n.options)==null?void 0:x.verifier)=="string"?n.options.verifier:"";a.useEffect(()=>{if(!c||c<=Date.now())return;const u=window.setInterval(()=>m(Date.now()),1e3);return()=>window.clearInterval(u)},[c]);const h=a.useMemo(()=>c?Math.max(0,Math.ceil((c-f)/1e3)):0,[c,f]);return{sendCode:a.useCallback(async u=>{if(!u)throw new Error("Enter a phone number first.");if(!i)throw new Error("The SMS verifier is not configured.");if(!(h>0)){d(void 0),r(!0);try{const o=await y.action("smsOTP","publicCreate",{method:"POST",authenticator:null,includeRole:!1,withAclMeta:!1,body:{action:"auth:signIn",verifier:i,uuid:u}}),p=o!=null&&o.expiresAt?Date.parse(o.expiresAt):Date.now()+6e4;m(Date.now()),t(p)}catch(o){const p=o instanceof Error?o:new Error("Unable to send the verification code.");throw d(p),p}finally{r(!1)}}},[h,i]),signIn:(u,o)=>s.signIn({uuid:u,code:o}),isSendingCode:l,isSigningIn:s.isPending,retryAfter:h,error:g??s.error}}function N({authenticator:n,onSendCode:s,onSignIn:l}){var m;const[r,g]=a.useState(""),[d,c]=a.useState(""),t=E(n),f=((m=n.options)==null?void 0:m.autoSignup)===!0;return e.jsxs("form",{className:"space-y-5",onSubmit:i=>{if(i.preventDefault(),l){l({phone:r,code:d});return}t.signIn(r,d)},children:[t.error&&e.jsxs(j,{variant:"destructive",children:[e.jsx(b,{children:"SMS sign-in failed"}),e.jsx(A,{children:t.error.message})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:`${n.name}-phone`,children:"Phone"}),e.jsx(v,{id:`${n.name}-phone`,type:"tel",value:r,onChange:i=>g(i.target.value),autoComplete:"tel",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:`${n.name}-code`,children:"Verification code"}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] gap-2",children:[e.jsx(v,{id:`${n.name}-code`,inputMode:"numeric",value:d,onChange:i=>c(i.target.value),autoComplete:"one-time-code",required:!0}),e.jsx(w,{type:"button",variant:"outline",disabled:!s&&(t.isSendingCode||t.retryAfter>0)||!r,onClick:()=>{if(s){s(r);return}t.sendCode(r).catch(()=>{})},children:!s&&t.isSendingCode?"Sending…":!s&&t.retryAfter>0?`Retry in ${t.retryAfter}s`:"Send code"})]})]}),e.jsx(w,{type:"submit",className:"w-full",disabled:!l&&t.isSigningIn,children:!l&&t.isSigningIn?"Signing in…":"Sign in"}),f&&e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"An account will be created automatically if this phone number is new."})]})}export{N as default};
|