@nocobase/portal-template-default 1.0.16 → 1.0.17
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/AGENTS.md +8 -0
- package/README.MD +4 -0
- package/dist/assets/{LineDraw-vPRTWiQ5.js → LineDraw-BBB5hwuJ.js} +1 -1
- package/dist/assets/{SymbolDraw-DOl_Tss3.js → SymbolDraw-CKS3uUb_.js} +1 -1
- package/dist/assets/{VisualMapping-j08W3KBm.js → VisualMapping-BCwaW3TD.js} +1 -1
- package/dist/assets/auth-method-demo-BdCCvEEz.js +1 -0
- package/dist/assets/{auto-login-provider-Bukw7zEe.js → auto-login-provider-DO5Il6Dp.js} +2 -2
- package/dist/assets/auto-login-provider-TQ08B6-i.js +1 -0
- package/dist/assets/auto-redirect-provider-ButXp0A3.js +1 -0
- package/dist/assets/auto-redirect-provider-DnGGP2Vn.js +1 -0
- package/dist/assets/auto-redirect-provider-ja-vFPaF.js +1 -0
- package/dist/assets/calendar-C7xnRgOT.js +1 -0
- package/dist/assets/{cas-sign-in-button-BQn3Mttx.js → cas-sign-in-button-BZCa4lR6.js} +1 -1
- package/dist/assets/{components-BT5mL9gW.js → components-_g-GjQeV.js} +3 -3
- package/dist/assets/{configuration-gate-BJoadoA6.js → configuration-gate-B4XVz7tS.js} +1 -1
- package/dist/assets/{createClipPathFromCoordSys-m8IbnJ1z.js → createClipPathFromCoordSys-z9Kmh-tu.js} +1 -1
- package/dist/assets/createSeriesDataSimply-CPqysF0K.js +1 -0
- package/dist/assets/{customGraphicKeyframeAnimation-CYLPurwK.js → customGraphicKeyframeAnimation-DMU5crAu.js} +1 -1
- package/dist/assets/demo-BPlae2bp.js +1 -0
- package/dist/assets/demo-Bj_Y0RrW.js +1 -0
- package/dist/assets/demo-CKPAQOib.js +1 -0
- package/dist/assets/demo-CXRTPvIx.js +1 -0
- package/dist/assets/demo-DJuVDu1n.js +1 -0
- package/dist/assets/demo-DUmWU7ik.js +1 -0
- package/dist/assets/demo-NhIzFRE1.js +1 -0
- package/dist/assets/{dingtalk-sign-in-button-DSluFaP9.js → dingtalk-sign-in-button-DMPgE5kT.js} +1 -1
- package/dist/assets/{echarts-preview-mRXoEciY.js → echarts-preview-R96Pbqmz.js} +1 -1
- package/dist/assets/{echarts-runtime-CvLr4Slh.js → echarts-runtime-Ce_z2eX_.js} +3 -3
- package/dist/assets/{echarts-runtime-advanced-BC1tvfQ0.js → echarts-runtime-advanced-Dr80KHJR.js} +1 -1
- package/dist/assets/{echarts-runtime-common-DhNaV5B8.js → echarts-runtime-common-DB95Yfc1.js} +1 -1
- package/dist/assets/{echarts-runtime-components-BiioS8t1.js → echarts-runtime-components-DCJEaTJk.js} +1 -1
- package/dist/assets/{echarts-runtime-hierarchy-CAWqYvFh.js → echarts-runtime-hierarchy-CezgZs9O.js} +1 -1
- package/dist/assets/{floating-RVbHvIiD.js → floating-O9WmiDXk.js} +2 -2
- package/dist/assets/index-BBKV6O5d.css +1 -0
- package/dist/assets/{index-Dw20Lzpp.js → index-CPzehPGe.js} +3 -3
- package/dist/assets/index-Cc6awvdg.js +1064 -0
- package/dist/assets/index-ChA0z9ke.js +38 -0
- package/dist/assets/{index-BysibBZu.js → index-DgB7uTMs.js} +2 -2
- package/dist/assets/{index-C-tdHirk.js → index-DroUAK80.js} +1 -1
- package/dist/assets/index-WKvygTBp.js +59 -0
- package/dist/assets/{labelHelper-DbITmOUW.js → labelHelper-Dk5jkiD-.js} +1 -1
- package/dist/assets/ldap-sign-in-form-CKN4l7qM.js +1 -0
- package/dist/assets/{oidc-sign-in-button-Cgpa8Qzj.js → oidc-sign-in-button-BIRonrpC.js} +1 -1
- package/dist/assets/{page-context-AU6RU0Qi.js → page-context-DAiW_dId.js} +4 -4
- package/dist/assets/prompt-card-rGZqpqkF.js +1 -0
- package/dist/assets/prompt-output-B4h3uLWf.js +1 -0
- package/dist/assets/saml-sign-in-button-B4ugaLIb.js +1 -0
- package/dist/assets/{sectorHelper-C6L782Ue.js → sectorHelper-BuxrrJrA.js} +1 -1
- package/dist/assets/shortcut-BhKXxJLs.js +47 -0
- package/dist/assets/{sms-sign-in-form-Bo2WLZuP.js → sms-sign-in-form-DKpxRDdZ.js} +1 -1
- package/dist/assets/{static.browser-CoPxsICt.js → static.browser-kzzpH0Xt.js} +1 -1
- package/dist/assets/switch-BdVxPIVU.js +1 -0
- package/dist/assets/{tool-cards-ipgJ_3Ec.js → tool-cards-CpczIke-.js} +3 -3
- package/dist/assets/{use-authenticator-sign-in-BzFeh7qe.js → use-authenticator-sign-in-CIj210ry.js} +1 -1
- package/dist/assets/use-dingtalk-sign-in-BW4kkXD3.js +1 -0
- package/dist/assets/{use-wecom-sign-in-PPIMLvGa.js → use-wecom-sign-in-dIqMtcN9.js} +1 -1
- package/dist/assets/{wecom-sign-in-button-rUq9RW8R.js → wecom-sign-in-button-Dn_2zDab.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/index.raw.html +2 -2
- package/package.json +9 -1
- package/src/App.tsx +5 -2
- package/src/app/extension.ts +2 -0
- package/src/app/extensions.tsx +18 -6
- package/src/app/route-access-guard.tsx +22 -0
- package/src/app/route-runtime.ts +173 -0
- package/src/app/routes.tsx +2 -2
- package/src/components/app-shell/header.tsx +56 -1
- package/src/components/app-shell/sidebar.tsx +14 -2
- package/src/extensions/nocobase-acl/README.md +28 -14
- package/src/extensions/nocobase-acl/demo/index.tsx +87 -15
- package/src/extensions/nocobase-acl/demo/prompt-generator.tsx +1 -0
- package/src/extensions/nocobase-mail/README.md +74 -0
- package/src/extensions/nocobase-mail/components/index.ts +79 -0
- package/src/extensions/nocobase-mail/components/mail-api.ts +423 -0
- package/src/extensions/nocobase-mail/components/mail-attachment-list.tsx +67 -0
- package/src/extensions/nocobase-mail/components/mail-compose-attachments.tsx +166 -0
- package/src/extensions/nocobase-mail/components/mail-compose.tsx +1071 -0
- package/src/extensions/nocobase-mail/components/mail-detail.tsx +653 -0
- package/src/extensions/nocobase-mail/components/mail-draft-autosave.ts +26 -0
- package/src/extensions/nocobase-mail/components/mail-empty.tsx +48 -0
- package/src/extensions/nocobase-mail/components/mail-filters.tsx +277 -0
- package/src/extensions/nocobase-mail/components/mail-inbox.tsx +544 -0
- package/src/extensions/nocobase-mail/components/mail-inline-images.ts +69 -0
- package/src/extensions/nocobase-mail/components/mail-label-badge.tsx +25 -0
- package/src/extensions/nocobase-mail/components/mail-label-manager.tsx +271 -0
- package/src/extensions/nocobase-mail/components/mail-labels-editor.tsx +267 -0
- package/src/extensions/nocobase-mail/components/mail-mass-tracking.tsx +271 -0
- package/src/extensions/nocobase-mail/components/mail-note-editor.tsx +99 -0
- package/src/extensions/nocobase-mail/components/mail-recipient-input.tsx +260 -0
- package/src/extensions/nocobase-mail/components/mail-reply-quote.ts +28 -0
- package/src/extensions/nocobase-mail/components/mail-rich-editor.tsx +287 -0
- package/src/extensions/nocobase-mail/components/mail-send-actions.tsx +238 -0
- package/src/extensions/nocobase-mail/components/mail-senders.ts +61 -0
- package/src/extensions/nocobase-mail/components/mail-settings-drawer.tsx +708 -0
- package/src/extensions/nocobase-mail/components/mail-showcase-layout.tsx +64 -0
- package/src/extensions/nocobase-mail/components/mail-signature-manager.tsx +258 -0
- package/src/extensions/nocobase-mail/components/mail-signatures.ts +25 -0
- package/src/extensions/nocobase-mail/components/mail-table.tsx +476 -0
- package/src/extensions/nocobase-mail/components/mail-template-manager.tsx +204 -0
- package/src/extensions/nocobase-mail/components/mail-toolbar.tsx +155 -0
- package/src/extensions/nocobase-mail/components/mail-unread.tsx +111 -0
- package/src/extensions/nocobase-mail/components/types.ts +297 -0
- package/src/extensions/nocobase-mail/components/use-mail-compose.tsx +262 -0
- package/src/extensions/nocobase-mail/components/use-mail-mass-messages.ts +54 -0
- package/src/extensions/nocobase-mail/components/use-mail-messages.ts +113 -0
- package/src/extensions/nocobase-mail/components/use-mail-signatures.ts +122 -0
- package/src/extensions/nocobase-mail/components/use-mail-templates.ts +54 -0
- package/src/extensions/nocobase-mail/extension.tsx +105 -0
- package/src/extensions/nocobase-mail/index.ts +1 -0
- package/src/extensions/nocobase-mail/mail-demo-pages.tsx +503 -0
- package/src/extensions/nocobase-mail/mail-pages.tsx +201 -0
- package/src/extensions/nocobase-mail/tests/mail-quote-html-regression.mjs +51 -0
- package/src/extensions/nocobase-mail/tests/mail-regression.mjs +649 -0
- package/src/extensions/nocobase-users-example/app-routes.tsx +121 -0
- package/src/extensions/nocobase-users-example/extension.tsx +2 -100
- package/src/extensions/nocobase-users-example/index.ts +1 -0
- package/src/lib/nocobase/acl/menu.ts +17 -3
- package/src/lib/nocobase/acl/types.ts +4 -0
- package/src/locales/en-US.ts +2 -1
- package/src/locales/zh-CN.ts +2 -1
- package/src/providers/runtime-config.ts +18 -0
- package/src/routes.tsx +10 -0
- package/src/vite-env.d.ts +3 -0
- package/vite.config.ts +8 -0
- package/dist/assets/auth-method-demo-B2qcpY8z.js +0 -1
- package/dist/assets/auto-login-provider-BMtzvdxG.js +0 -1
- package/dist/assets/auto-redirect-provider-C6GNPg5r.js +0 -1
- package/dist/assets/auto-redirect-provider-D5c6kN2R.js +0 -1
- package/dist/assets/auto-redirect-provider-iTzGEDpU.js +0 -1
- package/dist/assets/calendar-Dv2RNnsr.js +0 -1
- package/dist/assets/card-C9Hpeq1c.js +0 -1
- package/dist/assets/createSeriesDataSimply-DKUV5b5e.js +0 -1
- package/dist/assets/demo-BWGOwqtJ.js +0 -1
- package/dist/assets/demo-BWbcvkya.js +0 -1
- package/dist/assets/demo-DIASSPgn.js +0 -1
- package/dist/assets/demo-DuZ6asUU.js +0 -1
- package/dist/assets/demo-Dxcy4bDE.js +0 -1
- package/dist/assets/demo-YpEC76uw.js +0 -1
- package/dist/assets/demo-wzkoR8T2.js +0 -1
- package/dist/assets/index-CBZbj45X.js +0 -58
- package/dist/assets/index-CgkdZ6Oc.js +0 -686
- package/dist/assets/index-NH3aqqQz.css +0 -1
- package/dist/assets/index-hSBzW-VA.js +0 -43
- package/dist/assets/ldap-sign-in-form-BOMNDTkK.js +0 -1
- package/dist/assets/prompt-card-FWugRgi-.js +0 -1
- package/dist/assets/prompt-output-DMTuTNab.js +0 -1
- package/dist/assets/saml-sign-in-button-qt8bMeoQ.js +0 -1
- package/dist/assets/shortcut-Bu7jT_-w.js +0 -47
- package/dist/assets/switch-DQkkIE7G.js +0 -1
- package/dist/assets/use-dingtalk-sign-in-mrq6K5Yx.js +0 -1
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
* @license lucide-react v0.487.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ge=[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]],be=K("app-window",ge);/**
|
|
7
|
-
* @license lucide-react v0.487.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const fe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],ve=K("columns-3",fe),L=[{value:"embedded",title:"Embedded block",description:"Place chat inside a dashboard, record page, or workspace region.",action:"Preview block",icon:ve},{value:"page",title:"Dedicated page",description:"Give the conversation a full route and the largest working area.",action:"Preview page",icon:be},{value:"side-panel",title:"Push side panel",description:"Keep the page operable while the content narrows for chat.",action:"Open panel",icon:Y},{value:"dialog",title:"Dialog",description:"Open a focused conversation from an action without changing route.",action:"Open dialog",icon:ee},{value:"mobile",title:"Mobile container",description:"Use the same component in a narrow, touch-friendly viewport.",action:"Preview mobile",icon:se}];function we({value:s,onValueChange:n,windowProps:o}){var c;return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-5",children:L.map(i=>{const m=i.icon,u=i.value===s;return e.jsxs(x,{"data-active":u,className:"gap-0 py-0 transition-colors data-active:border-foreground/35 data-active:bg-muted/20",children:[e.jsxs(T,{className:"p-4",children:[e.jsx("div",{className:"mb-3 flex size-9 items-center justify-center rounded-lg border bg-background",children:e.jsx(m,{className:"size-4 text-muted-foreground"})}),e.jsx(M,{className:"text-sm",children:i.title}),e.jsx("p",{className:"min-h-15 text-xs leading-5 text-muted-foreground",children:i.description})]}),e.jsx(E,{className:"border-t p-3",children:e.jsx(g,{variant:u?"secondary":"ghost",size:"sm",className:"w-full",onClick:()=>n(i.value),children:i.action})})]},i.value)})}),e.jsxs(x,{className:"gap-0 py-0",children:[e.jsxs("div",{className:"flex min-h-12 items-center justify-between border-b px-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Container preview"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:(c=L.find(i=>i.value===s))==null?void 0:c.title})]}),e.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:Ne(s)})]}),e.jsxs("div",{className:"flex min-h-[650px] justify-center bg-muted/15 p-3 sm:p-5",children:[s==="embedded"?e.jsx(S,{className:"h-[610px] w-full max-w-3xl shadow-sm",children:e.jsx(j,{...o})}):null,s==="page"?e.jsx(_,{className:"h-[610px] min-h-0 w-full",children:e.jsx(j,{...o})}):null,s==="mobile"?e.jsx("div",{className:"w-full max-w-[390px] rounded-[2rem] border-4 border-foreground/10 bg-background p-1 shadow-xl",children:e.jsx(S,{className:"h-[610px] rounded-[1.55rem] border-0",children:e.jsx(j,{...o})})}):null,s==="side-panel"||s==="dialog"?e.jsx(je,{mode:s,onOpen:()=>n(s)}):null]})]})]})}function je({mode:s,onOpen:n}){return e.jsxs("div",{className:"grid w-full max-w-4xl grid-cols-[200px_minmax(0,1fr)] overflow-hidden rounded-xl border bg-background shadow-sm",children:[e.jsxs("div",{className:"border-r bg-muted/30 p-4",children:[e.jsx("div",{className:"h-5 w-24 rounded bg-muted"}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsx("div",{className:"h-8 rounded bg-muted"}),e.jsx("div",{className:"h-8 rounded bg-muted/70"}),e.jsx("div",{className:"h-8 rounded bg-muted/70"})]})]}),e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-sm text-center",children:[e.jsx("div",{className:"mx-auto mb-4 h-24 rounded-xl border bg-muted/20"}),e.jsx("h3",{className:"text-sm font-medium",children:s==="side-panel"?"Chat opens beside the current page":"Chat opens above the current page"}),e.jsx("p",{className:"mt-2 text-xs leading-5 text-muted-foreground",children:s==="side-panel"?"The live preview pushes this page narrower instead of blocking interaction.":"The live preview uses a focused dialog while preserving the page underneath."}),e.jsx(g,{className:"mt-4",size:"sm",onClick:n,children:s==="side-panel"?"Open side panel":"Open dialog"})]})})]})}const Ne=s=>{switch(s){case"page":return"<ChatPage />";case"side-panel":return'<ChatSurface variant="side-panel" />';case"dialog":return'<ChatSurface variant="dialog" />';case"mobile":return"<ChatInline /> · 390px";default:return"<ChatInline />"}},ye=[{id:"message-presentation-user",role:"user",parts:[{type:"text",text:"Review the support workspace and propose the most useful dashboard."}]},{id:"message-presentation-assistant",role:"assistant",parts:[{type:"reasoning",text:"I should inspect the existing collections first, then keep the recommendation focused on operational decisions.",state:"done"},{type:"dynamic-tool",toolName:"inspectDataModel",toolCallId:"message-presentation-tool",state:"output-available",input:{collections:["tickets","categories","users"]},output:{collectionsFound:3}},{type:"text",text:"Start with open workload, ownership gaps, SLA risk, and the created-versus-resolved trend. That gives the team one clear operational view without duplicating the underlying NocoBase rules."}]}],Ce=[{key:"web-search",label:"Web search",icon:e.jsx(D,{})}];function Ae(){return e.jsxs("div",{className:"grid items-start gap-4 xl:grid-cols-2",children:[e.jsxs(x,{className:"gap-0 py-0",children:[e.jsxs(T,{className:"border-b py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:"outline",children:"Inline messages"}),e.jsx(M,{className:"text-base",children:"Standard conversation transcript"})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"This fixed example shows where reasoning, a normal tool call, and the final assistant response appear in one message sequence."})]}),e.jsx(E,{className:"bg-muted/15 p-4",children:e.jsx(S,{className:"h-[520px] bg-background shadow-sm",children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"relative flex h-12 shrink-0 items-center justify-between border-b px-2.5",children:[e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Conversations",children:e.jsx(ae,{})}),e.jsx("div",{className:"pointer-events-none absolute left-1/2 max-w-[55%] -translate-x-1/2 truncate text-sm font-medium",children:"Support workspace review"}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"New conversation",children:e.jsx(te,{})})]}),e.jsx(ne,{className:"h-full",messages:ye,showMessageActions:!1}),e.jsx("div",{className:"shrink-0 bg-card px-4 pt-2 pb-3",children:e.jsxs("div",{className:"rounded-xl border bg-background px-3 py-2.5 shadow-sm",children:[e.jsx("div",{className:"min-h-10 text-sm text-muted-foreground",children:"Message your AI employee…"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Attach file",children:e.jsx(oe,{})}),e.jsx(g,{size:"icon-sm","aria-label":"Send message",children:e.jsx(ie,{})})]})]})})]})})})]}),e.jsxs(x,{className:"gap-0 py-0",children:[e.jsxs(T,{className:"border-b py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(P,{variant:"outline",children:"Compact composer"}),e.jsx(M,{className:"text-base",children:"Open the transcript only when needed"})]}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"The compact variant keeps only the chat header and composer. Its history button opens a dialog with conversation switching and the selected transcript."})]}),e.jsx(E,{className:"bg-muted/15 p-4",children:e.jsx(R,{id:"message-presentation-compact-demo",children:e.jsx(H,{className:"bg-background",composerActions:Ce,showModelSelector:!1,disclaimer:!1})})})]})]})}const Z=[{value:"embedded",label:"Inside the page",description:"Embed chat in the selected content region."},{value:"page",label:"Dedicated page",description:"Create a full route for the AI conversation."},{value:"side-panel",label:"Right side panel",description:"Push the page narrower while chat is open."},{value:"dialog",label:"Dialog",description:"Open chat from a button or page action."},{value:"mobile",label:"Mobile region",description:"Optimize the embedded container for a narrow viewport."}],ke={conversationList:!0,employeeSelector:!0,modelSelector:!0,userPrompt:!0,pageElement:!0,upload:!0,webSearch:!0,panelExpansion:!0};function Ie(){return e.jsx(R,{id:"prompt-generator-preview",children:e.jsx(Se,{})})}function Se(){const{id:s,addWorkContext:n,focusComposer:o}=F(),{registeredCount:c,startPicking:i}=G(),[m,u]=l.useState("the current page's main content area"),[r,N]=l.useState("embedded"),[h,y]=l.useState("450"),[p,C]=l.useState("transcript"),[a,W]=l.useState(ke),A=l.useMemo(()=>{const t=[];return a.pageElement&&t.push({key:"pick-page-element",label:"Pick page element",icon:e.jsx(V,{}),disabled:c===0,onClick:()=>i({chatId:s,onSelect:f=>{n(f),o()}})}),a.webSearch&&t.push({key:"web-search",label:"Web search",icon:e.jsx(D,{})}),t},[n,a.pageElement,a.webSearch,s,o,c,i]),d=(t,f)=>{W(X=>({...X,[t]:f}))},J=l.useMemo(()=>{const t={embedded:"Render ChatInline inside the target content region and keep its width fluid within the parent container.",page:"Create a dedicated route and render ChatPage with AIChatWindow filling the available page content.","side-panel":`Use ChatSurface with variant="side-panel" on the right and a ${h}px width. Opening chat must push the page narrower instead of covering it on desktop; mobile may use an overlay.`,dialog:'Open ChatSurface with variant="dialog" from a page action. Keep conversation state in AIProvider/AIChatProvider so closing the dialog does not discard it.',mobile:"Render ChatInline in the target region with a mobile-first width around 390px and preserve the same responsive AIChatWindow API."}[r];return`Add the standard NocoBase AI conversation to ${m||"the target page"}.
|
|
12
|
-
|
|
13
|
-
Placement:
|
|
14
|
-
- ${t}
|
|
15
|
-
- Keep AIChatWindow position-independent. The surface wrapper owns placement and dimensions.
|
|
16
|
-
|
|
17
|
-
Message presentation:
|
|
18
|
-
- ${p==="transcript"?"Render the full AIChatMessageList inline as part of AIChatWindow.":"Use AIChatCompact for the working surface and open AIChatHistoryDialog when the user requests the full transcript."}
|
|
19
|
-
|
|
20
|
-
Conversation capabilities:
|
|
21
|
-
- Conversation list: ${a.conversationList}
|
|
22
|
-
- AI employee selector: ${a.employeeSelector}
|
|
23
|
-
- Model selector: ${a.modelSelector}
|
|
24
|
-
- Personalized prompt editor: ${a.userPrompt}
|
|
25
|
-
- Pick page element: ${a.pageElement}
|
|
26
|
-
- Upload action: ${a.upload}
|
|
27
|
-
- Web search action: ${a.webSearch}
|
|
28
|
-
- Side panel can expand to a 95% dialog and collapse back: ${a.panelExpansion}
|
|
29
|
-
- Tool approval follows NocoBase permissions. Always show Allow / Deny when the backend marks a tool as ASK.
|
|
30
|
-
|
|
31
|
-
Implementation requirements:
|
|
32
|
-
- Use AIProvider at application level and AIChatProvider with a stable id for this chat instance.
|
|
33
|
-
- Wrap the application content with AIPageElementProvider when page-element picking is enabled.
|
|
34
|
-
- Register selectable React components with useAIPageElement and return serializable business context from getContext.
|
|
35
|
-
- Reuse AIChatWindow and the existing providers; do not duplicate message, streaming, reasoning, or tool-call state.
|
|
36
|
-
- When the right panel is expandable, render one AIChatWindow inside ChatSurface and change only its variant between "side-panel" and "dialog". Put ChatSurfaceActions in the window header.
|
|
37
|
-
- Keep the generic Tool Call shell responsible for status, ASK approval, errors, and disclosure. Register business-specific bodies through AIToolRendererProvider.
|
|
38
|
-
- Include the built-in specialized Tool Card renderers. This is part of the standard AI chat capability, not an optional page setting.
|
|
39
|
-
- Register browser-side tool implementations through AIProvider.toolInvokers. After all interrupted calls are approved, the provider executes these handlers and sends their results when resuming the NocoBase conversation.
|
|
40
|
-
- Pass application actions through composerActions.
|
|
41
|
-
- AIChatProvider handles NocoBase ASK decisions and resumes tool execution. Use onToolCallDecision only for application-specific side effects or telemetry.
|
|
42
|
-
- Use shadcn/Base UI components only; do not introduce Ant Design, Radix, or Zustand.
|
|
43
|
-
- Match the existing NocoBase ChatBox behavior and black/white/gray visual system.`},[a,p,h,r,m]),b=p==="transcript"?e.jsx(j,{composerActions:A,showConversationToggle:a.conversationList,showEmployeeSelector:a.employeeSelector,showModelSelector:a.modelSelector,showUserPrompt:a.userPrompt,enableAttachments:a.upload,attachmentActionIndex:a.pageElement?1:0,disclaimer:!1,onToolCallDecision:async()=>{}}):e.jsx(H,{className:"h-full rounded-none border-0",composerActions:A,showEmployeeSelector:a.employeeSelector,showModelSelector:a.modelSelector,showUserPrompt:a.userPrompt,enableAttachments:a.upload,disclaimer:!1,onToolCallDecision:async()=>{}}),Q=r==="page"?e.jsx(_,{className:"h-[430px] min-h-0 w-full max-w-none",children:b}):r==="side-panel"?e.jsxs("div",{className:"flex h-[430px] w-full overflow-hidden rounded-xl border bg-card shadow-sm",children:[e.jsxs("div",{className:"hidden min-w-0 flex-1 space-y-4 bg-muted/20 p-5 sm:block",children:[e.jsx("div",{className:"h-7 w-40 rounded-md bg-muted"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx("div",{className:"h-24 rounded-lg border bg-background"}),e.jsx("div",{className:"h-24 rounded-lg border bg-background"})]}),e.jsx("div",{className:"h-48 rounded-lg border bg-background"})]}),e.jsx("aside",{className:"h-full max-w-full shrink-0 border-l bg-card",style:{width:`${h}px`},children:b})]}):r==="dialog"?e.jsxs("div",{className:"relative h-[430px] w-full overflow-hidden rounded-xl border bg-muted/30 p-5",children:[e.jsxs("div",{className:"space-y-3 opacity-45",children:[e.jsx("div",{className:"h-7 w-44 rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-24 rounded-lg bg-background"}),e.jsx("div",{className:"h-48 rounded-lg bg-background"})]}),e.jsx("div",{className:"absolute inset-4 overflow-hidden rounded-xl border bg-card shadow-2xl sm:inset-8",children:b})]}):r==="mobile"?e.jsx("div",{className:"h-[430px] w-full max-w-[390px] overflow-hidden rounded-[2rem] border-4 border-foreground/15 bg-card shadow-lg",children:b}):e.jsx(S,{className:"h-[430px] w-full max-w-2xl",children:b});return 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.jsxs(T,{className:"border-b py-4",children:[e.jsx(M,{className:"text-base",children:"Describe the integration"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Choose where chat belongs and which capabilities the target page needs."})]}),e.jsxs(E,{className:"space-y-5 p-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-xs font-medium",htmlFor:"ai-chat-target",children:"Target page or region"}),e.jsx(re,{id:"ai-chat-target",value:m,onChange:t=>u(t.target.value),placeholder:"e.g. the ticket detail page"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium",children:"Placement"}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-1",children:Z.map(t=>e.jsxs("button",{type:"button","data-active":r===t.value,className:"rounded-lg border px-3 py-2.5 text-left transition-colors hover:bg-muted/40 data-active:border-foreground/35 data-active:bg-muted/60",onClick:()=>N(t.value),children:[e.jsx("span",{className:"block text-sm font-medium",children:t.label}),e.jsx("span",{className:"mt-0.5 block text-xs leading-5 text-muted-foreground",children:t.description})]},t.value))})]}),r==="side-panel"?e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium",children:"Side panel width"}),e.jsxs(O,{value:h,onValueChange:t=>t&&y(t),children:[e.jsx(z,{className:"w-full",children:e.jsxs(U,{children:[h,"px"]})}),e.jsxs(B,{children:[e.jsx(v,{value:"400",children:"400px"}),e.jsx(v,{value:"450",children:"450px · NocoBase default"}),e.jsx(v,{value:"520",children:"520px"})]})]})]}):null,e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium",children:"Message presentation"}),e.jsxs(O,{value:p,onValueChange:t=>t&&C(t),children:[e.jsx(z,{className:"w-full",children:e.jsx(U,{children:p==="transcript"?"Full transcript":"Compact + history dialog"})}),e.jsxs(B,{children:[e.jsx(v,{value:"transcript",children:"Full transcript"}),e.jsx(v,{value:"compact-history-dialog",children:"Compact + history dialog"})]})]})]}),e.jsxs("div",{className:"space-y-1 border-t pt-4",children:[e.jsx("div",{className:"mb-2 text-xs font-medium",children:"Capabilities"}),Object.keys(a).map(t=>e.jsxs("label",{className:"flex items-center justify-between gap-4 py-1.5 text-sm",children:[e.jsx("span",{className:"min-w-0",children:e.jsx("span",{className:"block",children:Pe(t)})}),e.jsx(xe,{size:"sm",checked:a[t],onCheckedChange:f=>d(t,f)})]},t))]})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs(x,{className:"gap-0 overflow-hidden py-0",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Capabilities preview"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"The selected controls are rendered on the real AIChatWindow."})]}),e.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:Te(r)})]}),e.jsx("div",{className:"flex justify-center bg-muted/20 p-3 sm:p-4",children:Q})]}),e.jsx(ue,{title:"Generated implementation prompt",description:"Updates from the selected page, placement, and capabilities.",prompt:J,promptClassName:"max-h-[760px] min-h-[520px]"})]})]})}const Pe=s=>({conversationList:"Conversation list",employeeSelector:"AI employee selector",modelSelector:"Model selector",userPrompt:"Personalized prompt editor",pageElement:"Pick page element",upload:"Upload files",webSearch:"Web search",panelExpansion:"Panel expand / collapse"})[s],Te=s=>{var n;return((n=Z.find(o=>o.value===s))==null?void 0:n.label)??s},Me=[["className","string","undefined","Adds layout or sizing classes to the root conversation window."],["headerActions","ReactNode","undefined","Adds surface actions such as expand, collapse, or close to the header."],["composerActions","AIChatComposerAction[]","[]","Application-specific buttons rendered in the composer toolbar."],["showConversationToggle","boolean","true","Shows the conversation-list control."],["showNewConversation","boolean","true","Shows the new-conversation action."],["showEmployeeSelector","boolean","true","Shows the AI employee selector in the composer."],["showModelSelector","boolean","true","Shows the model selector in the composer."],["showUserPrompt","boolean","true","Shows the personalized AI employee prompt editor."],["enableAttachments","boolean","false","Enables file picker, drag-and-drop, and pasted-image uploads."],["attachmentActionIndex","number","0","Places the attachment action at a specific position in the composer toolbar."],["onToolCallDecision","(decision: AIToolCallDecision) => void | Promise<void>","undefined","Observes approve, reject, or edit decisions after AIChatProvider has processed them; use it for application side effects or telemetry."],["placeholder","string","Message your AI employee…","Composer placeholder text."],["disclaimer","ReactNode | false","Default disclaimer","Customizes or hides the footer disclaimer."]],Ee=[["variant",'"side-panel" | "dialog"',"required","Changes only the outer presentation while keeping the same chat window mounted."],["open","boolean","required","Controls whether the surface is open."],["onOpenChange","(open: boolean) => void","required","Receives close requests from Escape, the dialog backdrop, or surface actions."],["side",'"left" | "right"','"right"',"Chooses the side used by the side-panel variant."],["width","number | string","450","Sets the width used by the side-panel variant."],["closeOnEscape","boolean","true","Allows Escape to close the active surface."],["showCloseHandle","boolean","false","Shows an outside close handle for the side-panel variant."]];function Be(){return e.jsx(me,{children:e.jsx(R,{id:"ai-chat-demo",children:e.jsx(We,{})})})}function We(){const[s,n]=l.useState("embedded"),[o,c]=l.useState(!1),[i,m]=l.useState(!1),{id:u,addWorkContext:r,focusComposer:N}=F(),{registeredCount:h,startPicking:y}=G(),p=l.useMemo(()=>[{key:"pick-page-element",label:"Pick page element",icon:e.jsx(V,{}),disabled:h===0,onClick:()=>{o&&s==="dialog"&&n("side-panel"),y({chatId:u,onSelect:d=>{r(d),N()}})}},{key:"web-search",label:"Web search",icon:e.jsx(D,{}),active:i,onClick:()=>{m(d=>!d)}}],[r,u,s,N,h,y,o,i]),C=l.useMemo(()=>({composerActions:p,enableAttachments:!0,attachmentActionIndex:1,onToolCallDecision:async()=>{}}),[p]),a=()=>{c(!1)},W={...C,headerActions:e.jsx(pe,{expanded:s==="dialog",onExpandedChange:d=>{n(d?"dialog":"side-panel")},onClose:a})},A=d=>{n(d),c(d==="side-panel"||d==="dialog")};return e.jsxs("div",{"data-open":o&&s==="side-panel","data-side":"right",className:"chat-side-panel-layout @container min-w-0",style:{"--chat-side-panel-width":"450px"},children:[e.jsxs("div",{className:"space-y-14 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(P,{variant:"secondary",children:"AI Components"}),e.jsx(P,{variant:"outline",children:"Preview"})]}),e.jsx("h1",{className:"mt-4 text-3xl font-semibold tracking-[-0.035em]",children:"AI Chat Window"}),e.jsx("p",{className:"mt-3 max-w-3xl text-sm leading-6 text-muted-foreground",children:"A position-independent NocoBase AI employee conversation component. Explore message interactions independently, place the same chat in different containers, then generate an implementation prompt for a target page."})]})}),e.jsxs("section",{className:"space-y-5",children:[e.jsx(w,{eyebrow:"Container patterns",title:"Use the same conversation window wherever the product needs it",description:"The provider owns conversation state. Page, embedded block, push side panel, dialog, and mobile containers only decide placement and dimensions."}),e.jsx(we,{value:s,onValueChange:A,windowProps:C})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsx(w,{eyebrow:"Message presentation",title:"Choose how much conversation history the page should expose",description:"Use the complete transcript for conversational work, or a compact worker surface that opens message history only when the user asks for it."}),e.jsx(Ae,{})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsx(w,{eyebrow:"Prompt generator",title:"Describe where chat belongs, then copy an implementation prompt",description:"This replaces a generic prop configuration panel with a task-oriented generator: choose the target area, placement mode, and required capabilities."}),e.jsx(Ie,{})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsx(w,{eyebrow:"Component API",title:"ChatSurface props",description:"Use variant as the single presentation switch. The child AIChatWindow remains the same React instance while the surface changes shape."}),e.jsx(q,{rows:Ee})]}),e.jsxs("section",{className:"space-y-5",children:[e.jsx(w,{eyebrow:"Component API",title:"AIChatWindow props",description:"The core window stays reusable while business pages provide placement, composer actions, and tool-approval behavior."}),e.jsx(q,{rows:Me})]})]}),e.jsx(le,{open:o,variant:s==="dialog"?"dialog":"side-panel",onOpenChange:c,width:450,children:e.jsx(j,{...W})})]})}function q({rows:s}){return e.jsx(x,{className:"gap-0 overflow-hidden py-0",children:e.jsxs(ce,{children:[e.jsx(de,{children:e.jsxs($,{children:[e.jsx(k,{children:"Prop"}),e.jsx(k,{children:"Type"}),e.jsx(k,{children:"Default"}),e.jsx(k,{children:"Description"})]})}),e.jsx(he,{children:s.map(([n,o,c,i])=>e.jsxs($,{children:[e.jsx(I,{className:"font-mono text-xs font-medium",children:n}),e.jsx(I,{className:"font-mono text-xs text-muted-foreground",children:o}),e.jsx(I,{className:"font-mono text-xs text-muted-foreground",children:c}),e.jsx(I,{className:"min-w-80 whitespace-normal text-muted-foreground",children:i})]},n))})]})})}function w({eyebrow:s,title:n,description:o}){return e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:s}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:n}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:o})]})}export{Be as AIChatPage};
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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,47 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
import{b as s,a7 as ne,aI as de,aJ as re,aK as se,aL as ie,ag as le,ah as ce,aM as oe,a9 as ue,aN as fe,am as pe,aO as he,al as ve,aP as be,aQ as ge,aR as me,ab as F,j as f,aS as ke,aT as ye,aU as xe,aV as we,aW as Ce,c as Pe}from"./index-CgkdZ6Oc.js";const L=s.createContext(void 0);function Ee(){const e=s.useContext(L);if(e===void 0)throw new Error(ne(63));return e}let j=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const T={...de,checked(e){return e?{[j.checked]:""}:{[j.unchecked]:""}}},ze=s.forwardRef(function(d,l){const{checked:y,className:V,defaultChecked:x,"aria-labelledby":g,form:p,id:N,inputRef:q,name:w,nativeButton:h=!1,onCheckedChange:m,readOnly:c=!1,required:v=!1,disabled:H=!1,render:Re,uncheckedValue:C,value:P,style:Be,...O}=d,{clearErrors:W}=re(),{state:E,setTouched:J,setDirty:S,validityData:U,setFilled:k,setFocused:z,validationMode:Q,disabled:Y,name:_,validation:o}=se(),{labelId:G}=ie(),t=Y||H,u=_??w,r=s.useRef(null),X=le(r,q,o.inputRef),b=s.useRef(null),I=ce(),R=oe({id:N,implicit:!1,controlRef:b}),B=h?void 0:R,[n,Z]=ue({controlled:y,default:!!x,name:"Switch",state:"checked"});fe(b,I,n,void 0,!t,w),pe(()=>{r.current&&k(r.current.checked)},[r,k]),he(n,()=>{W(u),S(n!==U.initialValue),k(n),o.change(n)});const{getButtonProps:$,buttonRef:D}=ve({disabled:t,native:h}),A=be(g,G,r,!h,B),ee={id:h?R:I,role:"switch","aria-checked":n,"aria-readonly":c||void 0,"aria-required":v||void 0,"aria-labelledby":A,onFocus(){t||z(!0)},onBlur(){const a=r.current;!a||t||(J(!0),z(!1),Q==="onBlur"&&o.commit(a.checked))},onClick(a){if(c||t)return;a.preventDefault();const i=r.current;i&&i.dispatchEvent(new(ke(i)).PointerEvent("click",{bubbles:!0,shiftKey:a.shiftKey,ctrlKey:a.ctrlKey,altKey:a.altKey,metaKey:a.metaKey}))}},ae=ge({checked:n,disabled:t,form:p,id:B,name:u,required:v,style:u?ye:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:X,onChange(a){if(a.nativeEvent.defaultPrevented)return;if(c){a.preventDefault();return}const i=a.currentTarget.checked,M=we(Ce,a.nativeEvent);m==null||m(i,M),!M.isCanceled&&Z(i)},onFocus(){var a;(a=b.current)==null||a.focus()}},a=>o.getValidationProps(t,a),P!==void 0?{value:P}:me),K=s.useMemo(()=>({...E,checked:n,disabled:t,readOnly:c,required:v}),[E,n,t,c,v]),te=F("span",d,{state:K,ref:[l,b,D],props:[ee,O,$,a=>o.getValidationProps(t,a)],stateAttributesMapping:T});return f.jsxs(L.Provider,{value:K,children:[te,!n&&u&&C!==void 0&&f.jsx("input",{type:"hidden",form:p,name:u,value:C,disabled:t}),f.jsx("input",{...ae,suppressHydrationWarning:!0})]})}),Ie=s.forwardRef(function(d,l){const{render:y,className:V,style:x,...g}=d,p=Ee();return F("span",d,{state:p,ref:l,stateAttributesMapping:T,props:g})});function Me({className:e,size:d="default",...l}){return f.jsx(ze,{"data-slot":"switch","data-size":d,className:Pe("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...l,children:f.jsx(Ie,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{Me as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aX as g,b as t,aY as d,aZ as i}from"./index-CgkdZ6Oc.js";function w(){return typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes("dingtalk")}function k(n){const[r]=g(),[c,o]=t.useState(!1),[l,s]=t.useState(),u=t.useMemo(()=>{if(r.get("authenticator")!==n.name)return;const e=r.get("error");return e?new Error(e):void 0},[n.name,r]);return{signIn:t.useCallback(async()=>{s(void 0),o(!0);try{const e=d(r.get("to")||r.get("redirect")||"/"),a=await i.action("dingtalk","getAuthUrl",{method:"POST",authenticator:n.name,includeRole:!1,withAclMeta:!1,body:{redirect:e}});if(!(a!=null&&a.url))throw new Error("NocoBase did not return a DingTalk authorization URL.");window.location.replace(i.resolveUrl(a.url))}catch(e){s(e instanceof Error?e:new Error("Unable to start DingTalk sign-in.")),o(!1)}},[n.name,r]),isPending:c,error:l??u}}export{w as i,k as u};
|