@nocobase/portal-template-default 1.0.15 → 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-iG-ADes-.js → LineDraw-BBB5hwuJ.js} +1 -1
- package/dist/assets/{SymbolDraw-DXoSw1tM.js → SymbolDraw-CKS3uUb_.js} +1 -1
- package/dist/assets/{VisualMapping-C_ee4Eht.js → VisualMapping-BCwaW3TD.js} +1 -1
- package/dist/assets/auth-method-demo-BdCCvEEz.js +1 -0
- package/dist/assets/{auto-login-provider-5Uxza9Ms.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-CyqG1QME.js → cas-sign-in-button-BZCa4lR6.js} +1 -1
- package/dist/assets/{components-D-ptYjX_.js → components-_g-GjQeV.js} +3 -3
- package/dist/assets/{configuration-gate-C08mkkiX.js → configuration-gate-B4XVz7tS.js} +1 -1
- package/dist/assets/{createClipPathFromCoordSys-wj34-b1B.js → createClipPathFromCoordSys-z9Kmh-tu.js} +1 -1
- package/dist/assets/createSeriesDataSimply-CPqysF0K.js +1 -0
- package/dist/assets/{customGraphicKeyframeAnimation-DWrhrHL_.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-DSWsSruv.js → dingtalk-sign-in-button-DMPgE5kT.js} +1 -1
- package/dist/assets/{echarts-preview-DxHNfq1C.js → echarts-preview-R96Pbqmz.js} +1 -1
- package/dist/assets/{echarts-runtime-D8kXn6ME.js → echarts-runtime-Ce_z2eX_.js} +3 -3
- package/dist/assets/{echarts-runtime-advanced-QY8v95qK.js → echarts-runtime-advanced-Dr80KHJR.js} +1 -1
- package/dist/assets/{echarts-runtime-common-D-yqAK-r.js → echarts-runtime-common-DB95Yfc1.js} +1 -1
- package/dist/assets/{echarts-runtime-components-P4-i8jPU.js → echarts-runtime-components-DCJEaTJk.js} +1 -1
- package/dist/assets/{echarts-runtime-hierarchy-ByQZ-DbP.js → echarts-runtime-hierarchy-CezgZs9O.js} +1 -1
- package/dist/assets/{floating-BFVEyPEp.js → floating-O9WmiDXk.js} +2 -2
- package/dist/assets/index-BBKV6O5d.css +1 -0
- package/dist/assets/{index-Btk35Nx-.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-um5hdKdZ.js → index-DgB7uTMs.js} +2 -2
- package/dist/assets/{index-CwNxd66J.js → index-DroUAK80.js} +1 -1
- package/dist/assets/index-WKvygTBp.js +59 -0
- package/dist/assets/{labelHelper-DQqRy3a_.js → labelHelper-Dk5jkiD-.js} +1 -1
- package/dist/assets/ldap-sign-in-form-CKN4l7qM.js +1 -0
- package/dist/assets/{oidc-sign-in-button-CQdRcR_p.js → oidc-sign-in-button-BIRonrpC.js} +1 -1
- package/dist/assets/{page-context-CnQ4GYM7.js → page-context-DAiW_dId.js} +3 -3
- 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-DN_Vv6OL.js → sectorHelper-BuxrrJrA.js} +1 -1
- package/dist/assets/shortcut-BhKXxJLs.js +47 -0
- package/dist/assets/{sms-sign-in-form-DTX9GV2I.js → sms-sign-in-form-DKpxRDdZ.js} +1 -1
- package/dist/assets/{static.browser-jI1psK0d.js → static.browser-kzzpH0Xt.js} +8 -8
- package/dist/assets/switch-BdVxPIVU.js +1 -0
- package/dist/assets/{tool-cards-DFttLAfo.js → tool-cards-CpczIke-.js} +3 -3
- package/dist/assets/{use-authenticator-sign-in-CRGjzXju.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-C9j8wfCD.js → use-wecom-sign-in-dIqMtcN9.js} +1 -1
- package/dist/assets/wecom-sign-in-button-Dn_2zDab.js +1 -0
- 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/components/auth/sign-up-form.tsx +287 -59
- package/src/components/auth/types.ts +23 -1
- 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-DaOCuvsq.js +0 -1
- package/dist/assets/auto-login-provider-DyaPGK2D.js +0 -1
- package/dist/assets/auto-redirect-provider-CfwRvYOI.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/calendar-DjDRfD5t.js +0 -1
- package/dist/assets/card-DuQBOS6A.js +0 -1
- package/dist/assets/createSeriesDataSimply-D0A6SAVQ.js +0 -1
- package/dist/assets/demo-BYWHeKUe.js +0 -1
- package/dist/assets/demo-CPWoNtx8.js +0 -1
- package/dist/assets/demo-CyvJk5zV.js +0 -1
- package/dist/assets/demo-D4OiKplc.js +0 -1
- package/dist/assets/demo-DBueJg0m.js +0 -1
- package/dist/assets/demo-DkIhyiRK.js +0 -1
- package/dist/assets/demo-tpTjO0sC.js +0 -1
- package/dist/assets/index-BgCbGDMc.js +0 -43
- package/dist/assets/index-MB-jfQld.js +0 -686
- package/dist/assets/index-NH3aqqQz.css +0 -1
- package/dist/assets/index-gFtCXH3o.js +0 -58
- package/dist/assets/ldap-sign-in-form--6Gt3yGq.js +0 -1
- package/dist/assets/prompt-card-B2RS4nt2.js +0 -1
- package/dist/assets/prompt-output-DZHRM2ft.js +0 -1
- package/dist/assets/saml-sign-in-button-BHL5a0JV.js +0 -1
- package/dist/assets/shortcut-C5x5LQWU.js +0 -47
- package/dist/assets/switch-CRL8PmRI.js +0 -1
- package/dist/assets/use-dingtalk-sign-in-8WYzJ2jf.js +0 -1
- package/dist/assets/wecom-sign-in-button-mIS1zGSU.js +0 -1
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{t as U,v as T,j as e,A as G,b as A,w as X,l as Y,m as Z,n as B,o as w,p as ee,q as v,x as se,C as te,k as D,I as k,T as re,B as W,y as ie,z as c,U as q,D as u,P as ne,E as ae,F as oe,G as le}from"./index-MB-jfQld.js";import{C as m,a as h,b as p,c as P,d as x}from"./card-DuQBOS6A.js";import{P as de}from"./prompt-output-DZHRM2ft.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 ce=[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]],L=U("layout-panel-top",ce);/**
|
|
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 me=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],V=U("lock-keyhole",me);/**
|
|
12
|
-
* @license lucide-react v0.487.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ue=[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]],he=U("user-round-cog",ue),O=s=>({resource:s.resource,action:s.action,id:s.id,field:s.field,dataSourceKey:s.dataSourceKey});function pe({children:s,anyOf:t,allOf:r,roles:i,fallback:a=e.jsx(G,{})}){const n=T(),o=!(t!=null&&t.length)||t.some(g=>n(O(g))),f=!(r!=null&&r.length)||r.every(g=>n(O(g)));return n({roles:i})&&o&&f?s:a}function z({children:s,resource:t,action:r,id:i,dataSourceKey:a,fallback:n="hidden"}){return T()({resource:t,action:r,id:i,dataSourceKey:a})?s:n==="hidden"?null:n==="forbidden"?e.jsx(G,{className:"min-h-40"}):n}function C({children:s,resource:t,action:r,field:i,dataSourceKey:a,fallback:n=null}){return T()({resource:t,action:r,field:i,dataSourceKey:a})?s:n}function d({children:s,roles:t,permissions:r={},recordPermissions:i=[]}){const a=A.useMemo(()=>{const n=Array.from(new Set(Object.keys(r).map(l=>l.slice(0,l.lastIndexOf(":"))))),o={status:"ready",permissions:{currentRole:t.length>1?"__union__":t[0],roles:t,roleMode:t.length>1?"allow-use-union":"default",resources:n,actions:r,actionAlias:{list:"list",get:"get",create:"create",update:"update",destroy:"destroy"},snippets:[]}},f=new Map(i.map(l=>[`${l.dataSourceKey??"main"}:${l.resource}:${l.action}:${l.id}`,l.allowed]));return{getState:()=>o,subscribe:()=>()=>{},load:async()=>o,retry:async()=>o,clear:()=>{},recordPermissions:{getState:()=>f,subscribe:()=>()=>{},getPermission:({dataSourceKey:l="main",resource:g,action:J,id:Q})=>f.get(`${l}:${g}:${J}:${Q}`)}}},[r,i,t]);return e.jsx(X,{store:a,children:s})}const xe=[["roles","RoleConstraint","undefined","Checks the current effective roles with anyOf, allOf, and noneOf."],["resource / action","string","undefined","Checks a NocoBase resource action. When roles are also present, both checks must pass."],["id / field","BaseKey / string","undefined","Optionally narrows the decision to one record or field."],["fallback","ReactNode","null","Renders when the access request is denied."]],fe=[["anyOf","AclPermission[]","undefined","Allows the page when any listed permission is available."],["allOf","AclPermission[]","undefined","Requires every listed permission before rendering the page."],["roles","RoleConstraint","undefined","Requires the current effective roles to match anyOf, allOf, and noneOf constraints."],["fallback","ReactNode","AccessDenied","Replaces the complete page when its permission test fails."],["children","ReactNode","required","The protected page content."]],ge=[["resource","string","required","NocoBase collection or ACL resource name."],["action","string","required","Resource action such as list, show, create, edit, or delete."],["id","BaseKey","undefined","Optional record ID for record-scoped permission checks."],["dataSourceKey","string","undefined","Selects a non-main NocoBase data source."],["fallback",'"hidden" | "forbidden" | ReactNode','"hidden"',"Hides the region or replaces it with a local denied state."],["children","ReactNode","required","The protected page region."]],je=[["resource","string","required","NocoBase collection containing the field."],["action","string","required","The action whose field whitelist should be checked."],["field","string","required","Exact NocoBase field name."],["dataSourceKey","string","undefined","Selects a non-main NocoBase data source."],["fallback","ReactNode","null","Optional read-only replacement for a denied field."],["children","ReactNode","required","The protected field or field group."]],be=[["AclStoreProvider","{ store, children }","required","Connects React ACL hooks and components to the application aclStore. The Starter mounts it at the application root."],["useGetRoles","() => QueryResult<string[]>","-","Returns the current effective ACL role names, including all participating roles in union mode."]];function ye(){return e.jsxs("section",{className:"space-y-5 border-t pt-8",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Permission boundaries"}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:"Components behind the patterns"}),e.jsx("p",{className:"mt-1.5 max-w-3xl text-sm leading-6 text-muted-foreground",children:"Use the smallest boundary that matches the intended user experience: complete page, independent region, or individual field."})]}),e.jsxs("div",{className:"space-y-7",children:[e.jsx(j,{title:"CanAccess",description:"The Starter access boundary for role-only, resource-only, or combined permission checks.",rows:xe}),e.jsx(j,{title:"AclPage",description:"Protects a complete route or business page. This corresponds to the Page permission pattern above.",rows:fe}),e.jsx(j,{title:"AclRegion",description:"Protects one independent area inside a larger page. This corresponds to the Region permission pattern.",rows:ge}),e.jsx(j,{title:"AclField",description:"Protects one field or field group. This corresponds to the Field permission pattern.",rows:je}),e.jsx(j,{title:"ACL context APIs",description:"Read the active role context from the application ACL store. Demo previews use an isolated in-memory store with the same evaluator.",rows:be})]})]})}function j({title:s,description:t,rows:r}){return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:s}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t})]}),e.jsx(m,{className:"gap-0 overflow-hidden py-0",children:e.jsxs(Y,{children:[e.jsx(Z,{children:e.jsxs(B,{children:[e.jsx(w,{children:"Prop"}),e.jsx(w,{children:"Type"}),e.jsx(w,{children:"Default"}),e.jsx(w,{children:"Description"})]})}),e.jsx(ee,{children:r.map(([i,a,n,o])=>e.jsxs(B,{children:[e.jsx(v,{className:"font-mono text-xs font-medium",children:i}),e.jsx(v,{className:"font-mono text-xs text-muted-foreground",children:a}),e.jsx(v,{className:"font-mono text-xs text-muted-foreground",children:n}),e.jsx(v,{className:"min-w-72 whitespace-normal text-muted-foreground",children:o})]},i))})]})})]})}function we({config:s}){const[t,r]=A.useState(s.defaultScene),[i,a]=A.useState(s.defaultTarget),n=A.useMemo(()=>`Build a complete NocoBase ACL scene in the NocoBase Admin Starter.
|
|
17
|
-
|
|
18
|
-
Business scene
|
|
19
|
-
- Page or feature: ${t}
|
|
20
|
-
- Permission target: ${i}
|
|
21
|
-
- Use realistic fixed sample content so the permission behavior is visible immediately.
|
|
22
|
-
- Build the complete page section and user flow, not an isolated ACL snippet.
|
|
23
|
-
|
|
24
|
-
ACL scenario
|
|
25
|
-
${s.requirements}
|
|
26
|
-
|
|
27
|
-
Implementation contract
|
|
28
|
-
- Use the Starter's built-in NocoBase accessControlProvider and ACL store.
|
|
29
|
-
- NocoBase roles:check is the source of truth. Do not create a second permission store. Use configured role names only when the requirement explicitly includes a role constraint.
|
|
30
|
-
- Import the Starter CanAccess from @/components/access-control/can-access. Use it with AclPage, AclRegion, and AclField for permission presentation. Do not copy their checks into local booleans or role comparisons.
|
|
31
|
-
- Use useGetRoles only when UI needs to display or pass through the current effective ACL roles; it is not a replacement permission evaluator.
|
|
32
|
-
- Keep backend ACL enforcement in place; frontend checks only control presentation and navigation.
|
|
33
|
-
- Import reusable components from the installed local entry point at @/extensions/nocobase-acl when page composition is needed.
|
|
34
|
-
- Resource actions use the application names list, show, create, edit, and delete. Let the Starter map them to NocoBase list/get/create/update/destroy.
|
|
35
|
-
- Preserve dataSourceKey when the collection belongs to a non-main data source.
|
|
36
|
-
- Show an understandable forbidden or hidden state where appropriate.
|
|
37
|
-
- Deliver complete React component code, resource metadata, route integration, and the visible sample UI.`,[s.requirements,t,i]);return e.jsxs("details",{className:"group rounded-xl border bg-muted/15",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium marker:hidden",children:[e.jsx(se,{className:"size-4 text-primary"}),"Prompt generator",e.jsx("span",{className:"ml-auto text-xs font-normal text-muted-foreground",children:s.title}),e.jsx(te,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-180"})]}),e.jsxs("div",{className:"grid items-start gap-5 border-t p-4 xl:grid-cols-[360px_minmax(0,1fr)]",children:[e.jsxs(m,{className:"gap-0 py-0",children:[e.jsxs(h,{className:"border-b py-4",children:[e.jsx(p,{className:"text-base",children:"Scenario settings"}),e.jsx(P,{children:s.description})]}),e.jsxs(x,{className:"space-y-5 py-5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:`${s.title}-scene`,children:"Business scene"}),e.jsx(k,{id:`${s.title}-scene`,value:t,onChange:o=>r(o.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(D,{htmlFor:`${s.title}-target`,children:"Permission target"}),e.jsx(re,{id:`${s.title}-target`,value:i,onChange:o=>a(o.target.value),className:"min-h-24"})]})]})]}),e.jsx(de,{description:"Updates as you change the business scene and permission target.",prompt:n})]})]})}function b({eyebrow:s,title:t,description:r,children:i,prompt:a}){return e.jsxs("section",{className:"space-y-5 border-t pt-8",children:[e.jsxs("div",{children:[e.jsx(W,{variant:"outline",children:s}),e.jsx("h2",{className:"mt-3 text-2xl font-semibold tracking-[-0.025em]",children:t}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground",children:r})]}),i,e.jsx(we,{config:a})]})}const R=[{id:1,name:"Alex Johnson",username:"alex",email:"alex@example.com",phone:"+1 202 555 0148",role:"Administrator"},{id:2,name:"Jamie Chen",username:"jamie",email:"jamie@example.com",phone:"+1 202 555 0186",role:"Member"},{id:3,name:"Morgan Lee",username:"morgan",email:"morgan@example.com",phone:"+1 202 555 0162",role:"Member"}],$={anyOf:["admin"]},ve={"users:list":{},"departments:list":{}},Ne={"users:list":{}},Ae={"users:get":{},"users:create":{},"users:update":{},"users:destroy":{}},ke={"users:get":{},"users:update":{},"users:destroy":{}},Pe=R.flatMap(s=>[{resource:"users",action:"update",id:s.id,allowed:!1},{resource:"users",action:"destroy",id:s.id,allowed:!1}]),Re={"users:update":{fields:["nickname","email","phone"]}},Ce={"users:update":{fields:["nickname"]}};function qe(){return e.jsxs("div",{className:"space-y-10 pb-12",children:[e.jsxs("header",{className:"space-y-2",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-[-0.025em] sm:text-3xl",children:"Permission patterns"}),e.jsx("p",{className:"max-w-3xl text-sm leading-6 text-muted-foreground",children:"Compare the authorized and restricted outcomes of navigation, pages, regions, record actions, and form fields using the same fixed data."})]}),e.jsx(b,{eyebrow:"Navigation permission",title:"Role-restricted routes disappear from navigation",description:"A route outside the current effective role is removed from the sidebar and its direct URL is guarded. Other accessible navigation remains unchanged.",prompt:{title:"Resource navigation",description:"Generate application resources, sidebar behavior, and guarded routes backed by NocoBase collections.",defaultScene:"User and role administration",defaultTarget:"Allow administrators to open Users, but remove it from navigation and block its direct URL for other roles.",requirements:`- Put role constraints on the route resource through meta.acl.roles using anyOf, allOf, or noneOf.
|
|
38
|
-
- Use meta.acl.type = "authenticated" when the route itself is role-controlled and its inner regions perform collection checks.
|
|
39
|
-
- Let the Starter filter inaccessible sidebar items and choose the first accessible default route.
|
|
40
|
-
- Wrap list, create, show, and edit routes with the Starter CanAccess and provide an AccessDenied fallback.
|
|
41
|
-
- Mark non-collection utility pages as authenticated, snippet, route, or acl: false instead of treating them as collections.
|
|
42
|
-
- If a parent route is denied but an accessible child remains, navigation must continue to the child route.`},children:e.jsx(y,{allowedTitle:"Users permission granted",deniedTitle:"Users permission denied",allowed:e.jsx(d,{roles:["admin"],children:e.jsx(E,{})}),denied:e.jsx(d,{roles:["member"],children:e.jsx(E,{})})})}),e.jsx(b,{eyebrow:"Page permission",title:"A complete page is either available or replaced",description:"Page-level permission is useful when the whole route has one business purpose. Denial produces an understandable destination instead of a blank screen.",prompt:{title:"Page permission",description:"Generate a complete page whose availability depends on NocoBase permissions.",defaultScene:"User directory and account administration page",defaultTarget:"Allow administrators and user managers to render the complete page.",requirements:`- Wrap the complete business page with AclPage.
|
|
43
|
-
- Use the AclPage roles prop with anyOf, allOf, or noneOf for page-level role access.
|
|
44
|
-
- Keep anyOf and allOf for resource permissions when the page also needs collection access.
|
|
45
|
-
- Provide a useful page-level fallback instead of rendering an empty screen.
|
|
46
|
-
- Keep each inner data region independently protected when the page combines multiple collections.`},children:e.jsx(y,{allowedTitle:"Page allowed",deniedTitle:"Page denied",allowed:e.jsx(d,{roles:["user-manager"],children:e.jsx(F,{})}),denied:e.jsx(d,{roles:["member"],children:e.jsx(F,{})})})}),e.jsx(b,{eyebrow:"Region permission",title:"Only the protected region changes",description:"On a page with multiple resources, denying Departments hides only that panel and must not affect the Users table.",prompt:{title:"Region permission",description:"Generate a multi-resource page where each region follows its own collection ACL.",defaultScene:"Organization management dashboard",defaultTarget:"Keep Users visible while hiding the denied Departments panel.",requirements:`- Keep the outer page visible when its page-level permission is satisfied.
|
|
47
|
-
- Wrap every collection-backed panel in its own AclRegion.
|
|
48
|
-
- Enable each data query only when the corresponding list permission is allowed.
|
|
49
|
-
- Use fallback="hidden" so denied regions do not reveal unavailable resources or placeholders.
|
|
50
|
-
- Never use permission for one collection to hide unrelated tables or controls.`},children:e.jsx(y,{allowedTitle:"Both regions allowed",deniedTitle:"Departments resource hidden",allowed:e.jsx(d,{roles:["member"],permissions:ve,children:e.jsx(I,{})}),denied:e.jsx(d,{roles:["member"],permissions:Ne,children:e.jsx(I,{})})})}),e.jsx(b,{eyebrow:"Action and record permission",title:"Only unavailable actions are removed",description:"Collection permission controls global actions such as Create. Record ACL metadata controls Edit and Delete for each individual row.",prompt:{title:"Action permission",description:"Generate a data table whose toolbar and row actions respond to collection and record scopes.",defaultScene:"User administration table",defaultTarget:"Allow all actions for one user record and show a view-only row when update and delete are denied.",requirements:`- Use the Starter dataProvider so X-With-ACL-Meta captures NocoBase allowedActions from list, get, and getMany responses.
|
|
51
|
-
- Use the built-in Create, Show, Edit, and Delete buttons; do not manually compare user IDs or role names.
|
|
52
|
-
- Collection-level denial hides the action everywhere.
|
|
53
|
-
- Record-level allowedActions must hide or disable only the affected row action.
|
|
54
|
-
- Keep 403 responses authenticated and let NocoBase perform the final action validation.`},children:e.jsx(y,{allowedTitle:"Create and row actions allowed",deniedTitle:"Create, Update, and Delete denied",allowed:e.jsx(d,{roles:["admin"],permissions:Ae,children:e.jsx(K,{})}),denied:e.jsx(d,{roles:["viewer"],permissions:ke,recordPermissions:Pe,children:e.jsx(K,{})})})}),e.jsx(b,{eyebrow:"Field permission",title:"A form can mix editable, read-only, and hidden fields",description:"Field ACL does not have to hide the complete form. Only protected inputs change, while permitted fields remain usable.",prompt:{title:"Field permission",description:"Generate a form or detail page whose individual fields follow NocoBase field ACL.",defaultScene:"User profile edit form",defaultTarget:"Allow nickname editing, make email read-only, and hide phone when those fields are denied.",requirements:`- Wrap each protected field or field group with AclField.
|
|
55
|
-
- Pass the collection resource, application action, and exact field name.
|
|
56
|
-
- Choose whether a denied field is hidden, replaced by read-only output, or shown with a custom fallback.
|
|
57
|
-
- Do not infer field access from the overall edit permission.
|
|
58
|
-
- Submit only values the current UI is allowed to edit; NocoBase still performs final field validation.`},children:e.jsx(y,{allowedTitle:"All fields editable",deniedTitle:"Email read-only and phone hidden",allowed:e.jsx(d,{roles:["admin"],permissions:Re,children:e.jsx(M,{})}),denied:e.jsx(d,{roles:["member"],permissions:Ce,children:e.jsx(M,{})})})}),e.jsx(ye,{})]})}function y({allowedTitle:s,deniedTitle:t,allowed:r,denied:i}){return e.jsxs("div",{className:"grid items-start gap-5 xl:grid-cols-2",children:[e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-700 dark:text-emerald-400",children:[e.jsx(ie,{className:"size-4"}),s]}),r]}),e.jsxs("div",{className:"min-w-0 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-700 dark:text-amber-400",children:[e.jsx(V,{className:"size-4"}),t]}),i]})]})}function E(){return e.jsxs("div",{className:"grid min-h-48 grid-cols-[150px_minmax(0,1fr)] overflow-hidden rounded-xl border bg-background",children:[e.jsxs("aside",{className:"border-r bg-muted/35 p-3",children:[e.jsx("div",{className:"mb-3 text-xs font-semibold text-muted-foreground",children:"Workspace"}),e.jsx(S,{icon:e.jsx(L,{}),label:"Dashboard"}),e.jsx(c,{roles:$,children:e.jsx(S,{icon:e.jsx(q,{}),label:"Users",active:!0})}),e.jsx(S,{icon:e.jsx(he,{}),label:"Roles"})]}),e.jsx("div",{className:"flex items-center justify-center p-5 text-center",children:e.jsx(c,{roles:$,fallback:e.jsxs("div",{children:[e.jsx(L,{className:"mx-auto size-7 text-muted-foreground"}),e.jsx("div",{className:"mt-2 font-medium",children:"Dashboard"}),e.jsx("div",{className:"mt-1 max-w-48 text-xs text-muted-foreground",children:"Users is absent from navigation and its direct route is guarded."})]}),children:e.jsxs("div",{children:[e.jsx(q,{className:"mx-auto size-7 text-primary"}),e.jsx("div",{className:"mt-2 font-medium",children:"Users"}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:"Route is available"})]})})})]})}function S({icon:s,label:t,active:r=!1}){return e.jsxs("div",{className:`mb-1 flex items-center gap-2 rounded-md px-2 py-2 text-xs ${r?"bg-primary text-primary-foreground":"text-muted-foreground"}`,children:[e.jsx("span",{className:"[&_svg]:size-3.5",children:s}),t]})}function F(){return e.jsx(pe,{roles:{anyOf:["admin","user-manager"]},fallback:e.jsx(Ue,{}),children:e.jsx(Se,{})})}function Se(){return e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"User directory"}),e.jsx(P,{children:"3 users"})]}),e.jsx(x,{children:e.jsx(H,{})})]})}function Ue(){return e.jsx("div",{className:"flex min-h-64 items-center justify-center rounded-xl border border-dashed bg-background p-6 text-center",children:e.jsxs("div",{children:[e.jsx(V,{className:"mx-auto size-8 text-muted-foreground"}),e.jsx("div",{className:"mt-3 font-medium",children:"You cannot open this page"}),e.jsx("p",{className:"mx-auto mt-1 max-w-xs text-sm text-muted-foreground",children:"Ask an administrator for access to the user directory or return to an available page."}),e.jsx(u,{className:"mt-4",variant:"outline",size:"sm",children:"Return to dashboard"})]})})}function I(){return e.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border bg-background p-3 md:flex-row",children:[e.jsx(z,{resource:"users",action:"list",children:e.jsxs(m,{size:"sm",className:"min-w-0 flex-1",children:[e.jsx(h,{children:e.jsx(p,{children:"Users"})}),e.jsx(x,{children:e.jsx(H,{limit:2})})]})}),e.jsx(z,{resource:"departments",action:"list",children:e.jsxs(m,{size:"sm",className:"md:w-56",children:[e.jsx(h,{children:e.jsx(p,{children:"Departments"})}),e.jsxs(x,{className:"space-y-2",children:[e.jsx(_,{title:"Engineering",name:"engineering"}),e.jsx(_,{title:"Operations",name:"operations"})]})]})})]})}function K(){return e.jsxs(m,{children:[e.jsxs(h,{className:"flex-row items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx(p,{children:"Users"}),e.jsx(P,{children:"Record actions"})]}),e.jsx(c,{resource:"users",action:"create",children:e.jsxs(u,{size:"sm",children:[e.jsx(ne,{})," New user"]})})]}),e.jsx(x,{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[420px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-3 font-medium",children:"User"}),e.jsx("th",{className:"pb-3 font-medium",children:"Role"}),e.jsx("th",{className:"pb-3 text-right font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:R.slice(0,2).map(s=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"py-3 font-medium",children:s.name}),e.jsx("td",{className:"py-3 text-muted-foreground",children:s.role}),e.jsx("td",{className:"py-3",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(c,{resource:"users",action:"show",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"View user",children:e.jsx(ae,{})})}),e.jsx(c,{resource:"users",action:"edit",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"Edit user",children:e.jsx(oe,{})})}),e.jsx(c,{resource:"users",action:"delete",id:s.id,children:e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":"Delete user",children:e.jsx(le,{})})})]})})]},s.id))})]})})]})}function M(){const s=R[1];return e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(p,{children:"Edit profile"}),e.jsx(P,{children:s.name})]}),e.jsxs(x,{className:"space-y-4",children:[e.jsx(C,{resource:"users",action:"edit",field:"nickname",children:e.jsx(N,{label:"Nickname",children:e.jsx(k,{defaultValue:s.name})})}),e.jsx(C,{resource:"users",action:"edit",field:"email",fallback:e.jsx(N,{label:"Email",children:e.jsxs("div",{className:"rounded-md border bg-muted/45 px-3 py-2 text-sm text-muted-foreground",children:[s.email,e.jsx(W,{className:"ml-2",variant:"outline",children:"Read only"})]})}),children:e.jsx(N,{label:"Email",children:e.jsx(k,{defaultValue:s.email})})}),e.jsx(C,{resource:"users",action:"edit",field:"phone",children:e.jsx(N,{label:"Phone",children:e.jsx(k,{defaultValue:s.phone})})}),e.jsx(c,{resource:"users",action:"edit",children:e.jsx(u,{size:"sm",children:"Save changes"})})]})]})}function N({label:s,children:t}){return e.jsxs("label",{className:"block space-y-2",children:[e.jsx("span",{className:"text-xs font-medium",children:s}),t]})}function H({limit:s=3}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[360px] text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left text-muted-foreground",children:[e.jsx("th",{className:"pb-3 font-medium",children:"User"}),e.jsx("th",{className:"pb-3 font-medium",children:"Email"})]})}),e.jsx("tbody",{children:R.slice(0,s).map(t=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsxs("td",{className:"py-3",children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsx("div",{className:"text-xs text-muted-foreground",children:t.username})]}),e.jsx("td",{className:"py-3 text-muted-foreground",children:t.email})]},t.id))})]})})}function _({title:s,name:t}){return e.jsxs("div",{className:"rounded-lg border px-3 py-2",children:[e.jsx("div",{className:"text-sm font-medium",children:s}),e.jsx("div",{className:"mt-0.5 font-mono text-xs text-muted-foreground",children:t})]})}export{qe as AclPatternsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as i,j as s,k as l,I as x,b6 as g,D as f}from"./index-MB-jfQld.js";import{u as j}from"./use-authenticator-sign-in-CRGjzXju.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-MB-jfQld.js";import{P as p}from"./prompt-output-DZHRM2ft.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,bx as y,c as i}from"./index-MB-jfQld.js";import{C as j}from"./card-DuQBOS6A.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:x,title:m="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:m}),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",x),children:t})]})}export{C as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aZ as m,b as o,a_ as g,a$ as d,j as a,aT as f,aV as h,aW as x,D as b,b0 as v,r as S}from"./index-MB-jfQld.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(b,{type:"button",variant:"outline",className:"w-full",disabled:!e&&t,onClick:e??i,children:[a.jsx(v,{}),!e&&t?"Redirecting…":S(r.title||r.authTypeTitle||"SAML")]})]})}export{j as default};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import{b as n,a7 as ge,a8 as St,a9 as tt,aa as st,ab as se,j as e,ac as It,ad as at,ae as Pt,af as At,ag as nt,ah as xe,ai as Mt,aj as Tt,ak as rt,al as ot,am as fe,an as Et,ao as Rt,ap as $t,c as le,C as Bt,aq as Ut,ar as it,as as Dt,at as Vt,au as Wt,av as Ft,aw as Fe,ax as zt,ay as Ot,az as Kt,aA as Lt,aB as ze,aC as qt,aD as Gt,aE as Ht,aF as _t,aG as Jt,aH as Xt,y as Yt,aI as lt,a4 as Qt,aJ as Zt,B as Se,aK as es,aL as Pe,Y as Oe,K as Ke,N as Le,a0 as ts,aM as Ie,d as Q,e as Z,f as ee,g as te,i as W,I as qe,D as pe,P as ss,G as as,h as ns,aN as rs,T as Ge,a1 as os,aO as is}from"./index-MB-jfQld.js";import{C as he,a as Ae,b as Me,d as Te}from"./card-DuQBOS6A.js";import{u as ls,S as He}from"./switch-CRL8PmRI.js";import{P as ds}from"./prompt-card-B2RS4nt2.js";import{A as cs}from"./configuration-gate-C08mkkiX.js";import"./prompt-output-DZHRM2ft.js";const us=n.createContext({disabled:!1});function ms(){return n.useContext(us)}const ps=n.createContext(void 0);function hs(s=!0){const a=n.useContext(ps);if(a===void 0&&!s)throw new Error(ge(3));return a}const dt=n.createContext(void 0);function ct(){const s=n.useContext(dt);if(s===void 0)throw new Error(ge(10));return s}const xs={value:()=>null},fs=n.forwardRef(function(a,l){const{render:x,className:P,disabled:m=!1,hiddenUntilFound:h,keepMounted:d,loopFocus:v,onValueChange:f,multiple:M=!1,orientation:k="vertical",value:T,defaultValue:j,style:S,...y}=a,E=St(),I=n.useMemo(()=>{if(T===void 0)return j??[]},[T,j]),C=n.useRef([]),[c,w]=tt({controlled:T,default:I,name:"Accordion",state:"value"}),V=st(($,K,g)=>{if(M)if(K){const N=c.slice();if(N.push($),f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c.filter(q=>q!==$);if(f==null||f(N,g),g.isCanceled)return;w(N)}else{const N=c[0]===$?[]:[$];if(f==null||f(N,g),g.isCanceled)return;w(N)}}),b=n.useMemo(()=>({value:c,disabled:m,orientation:k}),[c,m,k]),R=n.useMemo(()=>({disabled:m,handleValueChange:V,hiddenUntilFound:h??!1,keepMounted:d??!1,state:b,value:c}),[m,V,h,d,b,c]),p=se("div",a,{state:b,ref:l,props:[{dir:E},y],stateAttributesMapping:xs});return e.jsx(dt.Provider,{value:R,children:e.jsx(It,{elementsRef:C,children:p})})}),ut=n.createContext(void 0);function Ee(){const s=n.useContext(ut);if(s===void 0)throw new Error(ge(9));return s}let gs=(function(s){return s.index="data-index",s.disabled="data-disabled",s.open="data-open",s})({});const Re={...Pt,index:s=>Number.isInteger(s)?{[gs.index]:String(s)}:null,...at,value:()=>null},bs=n.forwardRef(function(a,l){const{className:x,disabled:P=!1,onOpenChange:m,render:h,value:d,style:v,...f}=a,{ref:M,index:k}=At(),T=nt(l,M),{disabled:j,handleValueChange:S,state:y,value:E}=ct(),I=xe(),C=d??I,c=P||j,w=n.useMemo(()=>{if(!E)return!1;for(let B=0;B<E.length;B+=1)if(E[B]===C)return!0;return!1},[E,C]),V=st((B,F)=>{m==null||m(B,F),!F.isCanceled&&S(C,B,F)}),b=Mt({open:w,onOpenChange:V,disabled:c}),R=n.useMemo(()=>({open:b.open,disabled:b.disabled,transitionStatus:b.transitionStatus}),[b.open,b.disabled,b.transitionStatus]),p=n.useMemo(()=>({...b,onOpenChange:V,state:R}),[b,R,V]),$=n.useMemo(()=>({...y,hidden:!w&&!b.mounted,index:k,disabled:c,open:w}),[b.mounted,c,k,w,y]),K=xe(),[g,N]=n.useState(),q=n.useMemo(()=>({open:w,state:$,setTriggerId:N,triggerId:g??K}),[K,w,$,N,g]),G=se("div",a,{state:$,ref:T,props:f,stateAttributesMapping:Re});return e.jsx(Tt.Provider,{value:p,children:e.jsx(ut.Provider,{value:q,children:G})})}),ks=n.forwardRef(function(a,l){const{render:x,className:P,style:m,...h}=a,{state:d}=Ee();return se("h3",a,{state:d,ref:l,props:h,stateAttributesMapping:Re})}),vs=n.forwardRef(function(a,l){const{disabled:x,className:P,id:m,render:h,nativeButton:d=!0,style:v,...f}=a,{panelId:M,open:k,handleTrigger:T,disabled:j}=rt(),S=x||j,{getButtonProps:y,buttonRef:E}=ot({disabled:S,focusableWhenDisabled:!0,native:d}),{state:I,setTriggerId:C,triggerId:c}=Ee();return fe(()=>(m&&C(m),()=>{C(void 0)}),[m,C]),se("button",a,{state:I,ref:[l,E],props:[{"aria-controls":k?M:void 0,"aria-expanded":k,id:c,onClick:T},f,y],stateAttributesMapping:Et})});let _e=(function(s){return s.accordionPanelHeight="--accordion-panel-height",s.accordionPanelWidth="--accordion-panel-width",s})({});const js=n.forwardRef(function(a,l){const{className:x,hiddenUntilFound:P,keepMounted:m,id:h,render:d,style:v,...f}=a,{hiddenUntilFound:M,keepMounted:k}=ct(),{mounted:T,onOpenChange:j,open:S,panelId:y,setMounted:E,setOpen:I,setPanelIdState:C,transitionStatus:c}=rt(),w=P??M,V=m??k;fe(()=>{if(h)return C(h),()=>{C(void 0)}},[h,C]);const{height:b,props:R,ref:p,shouldPreventOpenAnimation:$,shouldRender:K,transitionStatus:g,width:N}=Rt({externalRef:l,hiddenUntilFound:w,id:h??y,keepMounted:V,mounted:T,onOpenChange:j,open:S,setMounted:E,setOpen:I,transitionStatus:c}),{state:q,triggerId:G}=Ee(),B={...q,transitionStatus:g},F=$t(v,B),ae=se("div",{...a,style:void 0},{state:B,ref:p,props:[R,{"aria-labelledby":G,role:"region",style:{[_e.accordionPanelHeight]:b===void 0?"auto":`${b}px`,[_e.accordionPanelWidth]:N===void 0?"auto":`${N}px`}},f,F?{style:F}:void 0,$?{style:{animationName:"none"}}:void 0],stateAttributesMapping:Re});return K?ae:null});function ys({className:s,...a}){return e.jsx(fs,{"data-slot":"accordion",className:le("flex w-full flex-col",s),...a})}function ws({className:s,...a}){return e.jsx(bs,{"data-slot":"accordion-item",className:le("not-last:border-b",s),...a})}function Cs({className:s,children:a,...l}){return e.jsx(ks,{className:"flex",children:e.jsxs(vs,{"data-slot":"accordion-trigger",className:le("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",s),...l,children:[a,e.jsx(Bt,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),e.jsx(Ut,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Ns({className:s,children:a,...l}){return e.jsx(js,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up",...l,children:e.jsx("div",{className:le("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",s),children:a})})}function Ss(s){if(!s)return null;for(const a of s.elements){const l=a.tagName;if(l==="BUTTON"||l==="INPUT"){const x=a;if(x.type==="submit")return x}}return null}let Je=(function(s){return s.checked="data-checked",s.unchecked="data-unchecked",s.indeterminate="data-indeterminate",s.disabled="data-disabled",s.readonly="data-readonly",s.required="data-required",s.valid="data-valid",s.invalid="data-invalid",s.touched="data-touched",s.dirty="data-dirty",s.filled="data-filled",s.focused="data-focused",s})({});function mt(s){return n.useMemo(()=>({checked(a){return s.indeterminate?{}:a?{[Je.checked]:""}:{[Je.unchecked]:""}},...it}),[s.indeterminate])}const pt=n.createContext(void 0);function Is(){const s=n.useContext(pt);if(s===void 0)throw new Error(ge(14));return s}const Ps="data-parent",As=n.forwardRef(function(a,l){const{checked:x,className:P,defaultChecked:m=!1,"aria-labelledby":h,disabled:d=!1,form:v,id:f,indeterminate:M=!1,inputRef:k,name:T,onCheckedChange:j,parent:S=!1,readOnly:y=!1,render:E,required:I=!1,uncheckedValue:C,value:c,nativeButton:w=!1,style:V,...b}=a,{clearErrors:R}=Dt(),{disabled:p,name:$,setDirty:K,setFilled:g,setFocused:N,setTouched:q,state:G,validationMode:B,validityData:F,validation:ae}=Vt(),de=ms(),{labelId:ce,controlId:t,registerControlId:o,getDescriptionProps:r}=Wt(),i=hs(),z=i==null?void 0:i.parent,H=z&&i.allValues,A=p||de.disabled||(i==null?void 0:i.disabled)||d,ne=$??T,U=c??ne,$e=xe(),xt=xe();let _=t;H?_=S?xt:`${z.id}-${U}`:f&&(_=f);let be={};H&&(S?be=i.parent.getParentProps():U&&(be=i.parent.getChildProps(U)));const{checked:Be=x,indeterminate:ft=M,onCheckedChange:ke,...gt}=be,re=i==null?void 0:i.value,Ue=i==null?void 0:i.setValue,De=i==null?void 0:i.defaultValue,ve=n.useRef(null),ue=Ft(()=>Symbol("checkbox-control")),je=n.useRef(!1),{getButtonProps:bt,buttonRef:kt}=ot({disabled:A,native:w}),oe=(i==null?void 0:i.validation)??ae,[O,vt]=tt({controlled:U&&re&&!S?re.includes(U):Be,default:U&&De&&!S?De.includes(U):m,name:"Checkbox",state:"checked"}),ye=H?!!Be:O,ie=H&&ft||M;fe(()=>{o!==Fe&&(je.current=!0,o(ue.current,_))},[_,o,ue]),n.useEffect(()=>{const u=ue.current;return()=>{!je.current||o===Fe||(je.current=!1,o(u,void 0))}},[o,ue]),zt(ve,$e,O,void 0,!i&&!A,T);const J=n.useRef(null),jt=nt(k,J,oe.inputRef,oe.registerInput),yt=ls(h,ce,J,!w,_??void 0);fe(()=>{J.current&&(J.current.indeterminate=ie,O&&g(!0))},[O,ie,g]),Ot(O,()=>{i||(R(ne),g(O),K(O!==F.initialValue),oe.change(O))});const wt=Kt({checked:O,disabled:A,form:v,name:S?void 0:ne,id:w?void 0:_??void 0,required:I,ref:jt,style:ne?qt:Gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(u){if(u.nativeEvent.defaultPrevented)return;if(y){u.preventDefault();return}const L=u.currentTarget.checked,X=Ht(_t,u.nativeEvent);if(j==null||j(L,X),!X.isCanceled&&(ke==null||ke(L,X),!X.isCanceled&&(vt(L),U&&re&&Ue&&!S&&!H))){const Y=L?[...re,U]:re.filter(me=>me!==U);Ue(Y,X)}},onFocus(){var u;(u=ve.current)==null||u.focus()}},c!==void 0?{value:(i?O&&c:c)||""}:Lt,r,u=>oe.getValidationProps(A,u));n.useEffect(()=>{if(!z||!U)return;const u=z.disabledStatesRef.current;return u.set(U,A),()=>{u.delete(U)}},[z,A,U]);const we=n.useMemo(()=>({...G,checked:ye,disabled:A,readOnly:y,required:I,indeterminate:ie}),[G,ye,A,y,I,ie]),Ct=mt(we),Nt=se("span",a,{state:we,ref:[kt,ve,l,i==null?void 0:i.registerControlRef],props:[{id:w?_??void 0:$e,role:"checkbox","aria-checked":ie?"mixed":ye,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":yt,[Ps]:S?"":void 0,onFocus(){A||N(!0)},onBlur(){const u=J.current;u&&(q(!0),N(!1),B==="onBlur"&&oe.commit(i?re:u.checked))},onKeyDown(u){var Ve;if(u.key!=="Enter"||(u.preventBaseUIHandler(),u.defaultPrevented))return;const L=((Ve=J.current)==null?void 0:Ve.form)??null,X=u.currentTarget,Y=u.nativeEvent,me=u.preventDefault,Ce=Y.preventDefault;let Ne=!1;u.preventDefault=()=>{Ne=!0,me.call(u)},Y.preventDefault=()=>{Ne=!0,Ce.call(Y)},Ce.call(Y),ze(X).queueMicrotask(()=>{var We;u.preventDefault=me,Y.preventDefault=Ce,Ne||(We=Ss(L))==null||We.click()})},onClick(u){if(y||A)return;u.preventDefault();const L=J.current;L&&L.dispatchEvent(new(ze(L)).PointerEvent("click",{bubbles:!0,shiftKey:u.shiftKey,ctrlKey:u.ctrlKey,altKey:u.altKey,metaKey:u.metaKey}))}},b,gt,bt,r,u=>oe.getValidationProps(A,u)],stateAttributesMapping:Ct});return e.jsxs(pt.Provider,{value:we,children:[Nt,!O&&!i&&ne&&!S&&C!==void 0&&e.jsx("input",{type:"hidden",form:v,name:ne,value:C,disabled:A}),e.jsx("input",{...wt,suppressHydrationWarning:!0})]})}),Ms=n.forwardRef(function(a,l){const{render:x,className:P,style:m,keepMounted:h=!1,...d}=a,v=Is(),f=v.checked||v.indeterminate,{mounted:M,transitionStatus:k,setMounted:T}=Jt(f),j=n.useRef(null),S={...v,transitionStatus:k};Xt({open:f,ref:j,onComplete(){f||T(!1)}});const E={...mt(v),...at,...it},I=h||M,C=se("span",a,{ref:[l,j],state:S,stateAttributesMapping:E,props:d});return I?C:null});function Ts({className:s,...a}){return e.jsx(As,{"data-slot":"checkbox",className:le("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",s),...a,children:e.jsx(Ms,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(Yt,{})})})}const Xe={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"]}},Ye={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"]}},Qe={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"]}},D={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."},Es=[D,{id:"TK-1041",title:"Unable to update profile"},{id:"TK-1038",title:"Invoice export formatting"}],ht=s=>!["nathan","dara"].includes(s.username.toLowerCase());function Ks(){return e.jsx(cs,{children:e.jsx(Rs,{})})}function Rs(){const{employees:s}=lt(),a=Qt(),l=s.filter(ht),x=l.find(v=>v.username.toLowerCase()==="atlas")??l[0],P=l.find(v=>v.username!==x.username)??x,m=l.find(v=>v.username.toLowerCase()==="atlas")??l.find(v=>v.username!==x.username)??x,h=Zt({id:"support-ticket-detail",title:`${D.id} · ${D.title}`,kind:"record-detail",getContext:()=>({resource:"supportTickets",record:D})}),d=n.useMemo(()=>({[x.username]:[Xe,Ye],...P.username!==x.username?{[P.username]:[Qe]}:{}}),[x.username,P.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(Se,{variant:"secondary",children:"AI Components"}),e.jsx(Se,{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(es,{context:{type:"page-element",id:"support-ticket-detail",title:`${D.id} · ${D.title}`},children:e.jsxs(he,{ref:h,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:D.id}),e.jsx(Se,{variant:"outline",children:D.status})]}),e.jsx("h3",{className:"mt-2 text-lg font-semibold tracking-tight",children:D.title})]}),e.jsx(Pe,{aiEmployee:x.username,tasks:[Xe,Ye],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:D.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:D.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:D.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 ",m.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(Oe,{id:"shortcut-embedded-chat",controller:a,defaultEmployee:m.username,children:e.jsxs("div",{className:"grid items-stretch gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs(he,{children:[e.jsx(Ae,{children:e.jsx(Me,{className:"text-base",children:"Risk review workspace"})}),e.jsxs(Te,{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(Pe,{aiEmployee:m.username,target:a,tasks:[Qe],auto:!1,context:[{type:"table",title:"Open ticket queue",content:Es}],label:`Ask ${m.nickname}`,size:36})]})]}),e.jsx(Ke,{className:"h-[560px] min-h-0",children:e.jsx(Le,{})})]})})]}),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(he,{children:[e.jsx(Ae,{children:e.jsx(Me,{className:"text-base",children:"Employee task bindings"})}),e.jsxs(Te,{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"}),P.username!==x.username?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2",children:P.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(Oe,{id:"employee-task-scenario-chat",defaultEmployee:x.username,employeeTasks:d,children:e.jsx(Ke,{className:"h-[620px] min-h-0",children:e.jsx(Le,{})})})]})]}),e.jsx(Us,{embeddedController:a})]})}const $s=[{value:"ticket-analysis",label:"Ticket analysis"},{value:"response-drafting",label:"Response drafting"},{value:"workflow-design",label:"Workflow design"}],Bs=[{value:"inspect-record",label:"Inspect record"},{value:"search-records",label:"Search records"},{value:"update-record",label:"Update record"}],Ze=[{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:`${D.id} · ${D.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 Us({embeddedController:s}){var B,F,ae,de,ce;const{employees:a,models:l}=lt(),{registeredCount:x,startPicking:P}=ts(),m=a.filter(ht),h=m.find(t=>t.username.toLowerCase()==="atlas")??m[0],[d,v]=n.useState("shortcut"),[f,M]=n.useState("the ticket detail header actions"),[k,T]=n.useState(h.username),[j,S]=n.useState(h.username),[y,E]=n.useState("global-side-panel"),[I,C]=n.useState("embedded"),[c,w]=n.useState(()=>Ze.map(t=>({...t,employee:h.username}))),[V,b]=n.useState(Ze[0].id),R=d==="chat-tasks"?c.filter(t=>t.employee===j):c,p=R.find(t=>t.id===V)??R[0],$=n.useMemo(()=>c.map(t=>{const o=Ie(l,t.model),r=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:o?{llmService:o.llmService,model:o.value}:void 0,webSearch:t.webSearch,skillSettings:r?{skills:t.skillsMode==="custom"?t.skills:void 0,tools:t.toolsMode==="custom"?t.tools:void 0}:void 0}}),[l,c]),K=n.useMemo(()=>{const t=(r,i)=>{var H;const z=r.model==="default"?"Use the AI employee default":((H=l.find(A=>A.value===r.model))==null?void 0:H.label)??r.model;return`${i+1}. ${r.title}
|
|
2
|
-
- Background: ${r.background||"None"}
|
|
3
|
-
- Default user message: ${r.userMessage||"None"}
|
|
4
|
-
- Send automatically: ${r.autoSend}
|
|
5
|
-
- Work context: ${r.workContext.map(A=>A.title??A.id).join(", ")||"Inherit the surrounding context"}
|
|
6
|
-
- Model: ${z}
|
|
7
|
-
- Web search: ${r.webSearch}
|
|
8
|
-
- Skills: ${r.skillsMode==="preset"?"Use the AI employee defaults":r.skills.join(", ")||"Disabled"}
|
|
9
|
-
- Tools: ${r.toolsMode==="preset"?"Use the AI employee defaults":r.tools.join(", ")||"Disabled"}`},o=d==="chat-tasks"?Array.from(new Set(c.map(r=>r.employee))).map(r=>{const i=c.filter(z=>z.employee===r);return`AI employee: ${r}
|
|
10
|
-
${i.map(t).join(`
|
|
11
|
-
`)}`}).join(`
|
|
12
|
-
|
|
13
|
-
`):c.map(t).join(`
|
|
14
|
-
`);if(d==="chat-tasks"){const r={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 ${f} using ${r}.
|
|
15
|
-
|
|
16
|
-
Employee task bindings:
|
|
17
|
-
${o}
|
|
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 ${f}.
|
|
30
|
-
|
|
31
|
-
Shortcut configuration:
|
|
32
|
-
- AI employee: ${k}
|
|
33
|
-
- Target conversation: ${y==="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
|
-
${o}
|
|
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
|
-
- ${y==="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,k,d,f,l,y,c]),g=t=>{p&&w(o=>o.map(r=>r.id===p.id?{...r,...t}:r))},N=()=>{const t=`task-${crypto.randomUUID()}`;w(o=>[...o,{id:t,employee:d==="chat-tasks"?j:k,title:`Task ${o.length+1}`,background:"",userMessage:"",autoSend:!1,workContext:[],model:"default",webSearch:!1,skillsMode:"preset",skills:[],toolsMode:"preset",tools:[]}]),b(t)},q=t=>{if(c.length===1)return;const o=c.filter(r=>r.id!==t);if(w(o),V===t){const r=d==="chat-tasks"?o.find(i=>i.employee===j):o[0];b((r==null?void 0:r.id)??"")}},G=(t,o,r)=>{if(!p)return;const i=p[t];g({[t]:r?[...i,o]:i.filter(z=>z!==o)})};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(he,{className:"gap-0 py-0",children:[e.jsx(Ae,{className:"py-4",children:e.jsx(Me,{className:"text-base",children:"Employee task configuration"})}),e.jsxs(Te,{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(Q,{value:d,onValueChange:t=>{if(!t)return;const o=t;v(o),M(o==="shortcut"?"the ticket detail header actions":"the ticket detail page");const r=o==="chat-tasks"?c.find(i=>i.employee===j):c[0];b((r==null?void 0:r.id)??"")},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:d==="shortcut"?"Contextual Shortcut":"Tasks inside a chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"shortcut",children:"Contextual Shortcut"}),e.jsx(W,{value:"chat-tasks",children:"Tasks inside a chat"})]})]})]}),d==="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(Q,{value:j,onValueChange:t=>{var o;t&&(S(t),b(((o=c.find(r=>r.employee===t))==null?void 0:o.id)??""))},children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((B=m.find(t=>t.username===j))==null?void 0:B.nickname)??j})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{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:[d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"AI employee"}),e.jsxs(Q,{value:k,onValueChange:t=>t&&T(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:((F=m.find(t=>t.username===k))==null?void 0:F.nickname)??k})}),e.jsx(te,{children:m.map(t=>e.jsx(W,{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(qe,{value:f,onChange:t=>M(t.target.value)})]}),d==="chat-tasks"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Chat container"}),e.jsxs(Q,{value:I,onValueChange:t=>t&&C(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:{page:"Page",embedded:"Embedded block","side-panel":"Side panel",dialog:"Dialog"}[I]})}),e.jsxs(te,{children:[e.jsx(W,{value:"page",children:"Page"}),e.jsx(W,{value:"embedded",children:"Embedded block"}),e.jsx(W,{value:"side-panel",children:"Side panel"}),e.jsx(W,{value:"dialog",children:"Dialog"})]})]})]}):null]}),d==="shortcut"?e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Target conversation"}),e.jsxs(Q,{value:y,onValueChange:t=>t&&E(t),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{children:y==="global-side-panel"?"Global side panel":"Embedded chat"})}),e.jsxs(te,{children:[e.jsx(W,{value:"global-side-panel",children:"Global side panel"}),e.jsx(W,{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:[R.length," configured task",R.length===1?"":"s",d==="chat-tasks"?" for this employee":""]})]}),e.jsxs(pe,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(ss,{})," Add task"]})]}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:R.map((t,o)=>e.jsxs("div",{className:t.id===(p==null?void 0:p.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:()=>b(t.id),children:[e.jsxs("span",{className:"block truncate text-xs font-medium",children:[o+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(pe,{variant:"ghost",size:"icon-xs",disabled:c.length===1,"aria-label":`Remove ${t.title}`,onClick:()=>q(t.id),children:e.jsx(as,{})})]},t.id))})]}),p?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(qe,{value:p.title,onChange:t=>g({title:t.target.value})})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Model"}),e.jsxs(Q,{value:p.model,onValueChange:t=>t&&g({model:t}),children:[e.jsx(Z,{className:"w-full",children:e.jsx(ee,{className:"min-w-0 overflow-hidden",children:e.jsx("span",{className:"block min-w-0 truncate",title:p.model==="default"?"Use employee default":((ae=Ie(l,p.model))==null?void 0:ae.label)??p.model,children:p.model==="default"?"Use employee default":((de=Ie(l,p.model))==null?void 0:de.label)??p.model})})}),e.jsxs(te,{children:[e.jsx(W,{value:"default",children:"Use employee default"}),e.jsx(ns,{}),e.jsx(rs,{models:l})]})]})]})]}),e.jsxs("label",{className:"block space-y-2 text-xs font-medium",children:[e.jsx("span",{children:"Default user message"}),e.jsx(Ge,{className:"min-h-16",value:p.userMessage,onChange:t=>g({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(He,{size:"sm",checked:p.autoSend,onCheckedChange:t=>g({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(pe,{variant:"outline",size:"sm",disabled:x===0,onClick:()=>P({onSelect:t=>g({workContext:[{type:t.type,id:t.id,title:t.title,kind:t.kind}]})}),children:[e.jsx(os,{})," Pick context"]})]}),p.workContext.map((t,o)=>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(pe,{variant:"ghost",size:"icon-xs","aria-label":"Remove task context",onClick:()=>g({workContext:[]}),children:e.jsx(is,{})})]},`${t.type}:${t.id??o}`))]}),e.jsx(ys,{children:e.jsxs(ws,{value:"advanced-task-settings",className:"rounded-lg border px-3",children:[e.jsx(Cs,{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(Ns,{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(Ge,{className:"min-h-16",value:p.background,onChange:t=>g({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(He,{size:"sm",checked:p.webSearch,onCheckedChange:t=>g({webSearch:t})})]}),e.jsx(et,{title:"Skills",mode:p.skillsMode,values:p.skills,options:$s,onModeChange:t=>g({skillsMode:t}),onToggle:(t,o)=>G("skills",t,o)}),e.jsx(et,{title:"Tools",mode:p.toolsMode,values:p.tools,options:Bs,onModeChange:t=>g({toolsMode:t}),onToggle:(t,o)=>G("tools",t,o)})]})]})})]}):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:d==="shortcut"?"Live shortcut preview":"Chat-bound task configuration"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:d==="shortcut"?"Multiple tasks appear in the chat empty state after opening.":"Use the third scenario above to preview employee switching."})]}),d==="shortcut"?e.jsx(Pe,{aiEmployee:k,tasks:$,target:y==="embedded"?s:void 0,label:`Ask ${((ce=m.find(t=>t.username===k))==null?void 0:ce.nickname)??k}`,size:34}):null]})]})]}),e.jsx(ds,{title:d==="shortcut"?"Add an AI employee task shortcut":"Add employee tasks to a chat",description:d==="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:K})]})]})}function et({title:s,mode:a,values:l,options:x,onModeChange:P,onToggle:m}){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:s}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Preset inherits the AI employee configuration."})]}),e.jsxs(Q,{value:a,onValueChange:h=>h&&P(h),children:[e.jsx(Z,{size:"sm",className:"w-28",children:e.jsx(ee,{children:a==="preset"?"Preset":"Custom"})}),e.jsxs(te,{children:[e.jsx(W,{value:"preset",children:"Preset"}),e.jsx(W,{value:"custom",children:"Custom"})]})]})]}),a==="custom"?e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:x.map(h=>e.jsxs("label",{className:"flex items-center gap-2 rounded-md bg-muted/40 px-2.5 py-2 text-xs",children:[e.jsx(Ts,{checked:l.includes(h.value),onCheckedChange:d=>m(h.value,d)}),e.jsx("span",{children:h.label})]},h.value))}):null]})}export{Ks as ShortcutPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as s,ah as T,am as V,a7 as re,ar as ie,as as se,at as le,au as ce,ag as oe,aY as ue,a9 as fe,ax as pe,ay as he,al as be,az as ge,aA as me,ab as q,j as m,aB as ve,aC as ke,aD as ye,aE as xe,aF as we,c as Ee}from"./index-MB-jfQld.js";function Be(e,t,n,l=!0,i){const[f,p]=s.useState(),o=T(i?`${i}-label`:void 0),w=e??t??f;return V(()=>{const v=e||t||!l?void 0:Ce(n.current,o);f!==v&&p(v)}),w}function Ce(e,t){const n=Pe(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function Pe(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const n=e.id;if(n){const i=e.nextElementSibling;if(i&&i.htmlFor===n)return i}const l=e.labels;return l&&l[0]}const H=s.createContext(void 0);function ze(){const e=s.useContext(H);if(e===void 0)throw new Error(re(63));return e}let N=(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 O={...ie,checked(e){return e?{[N.checked]:""}:{[N.unchecked]:""}}},Le=s.forwardRef(function(t,n){const{checked:l,className:i,defaultChecked:f,"aria-labelledby":p,form:o,id:w,inputRef:v,name:C,nativeButton:k=!1,onCheckedChange:E,readOnly:h=!1,required:y=!1,disabled:W=!1,render:Fe,uncheckedValue:P,value:z,style:Ie,...Y}=t,{clearErrors:J}=se(),{state:L,setTouched:U,setDirty:_,validityData:$,setFilled:B,setFocused:R,validationMode:G,disabled:Q,name:X,validation:b}=le(),{labelId:Z}=ce(),d=Q||W,g=X??C,c=s.useRef(null),S=oe(c,v,b.inputRef),x=s.useRef(null),F=T(),I=ue({id:w,implicit:!1,controlRef:x}),K=k?void 0:I,[r,A]=fe({controlled:l,default:!!f,name:"Switch",state:"checked"});pe(x,F,r,void 0,!d,C),V(()=>{c.current&&B(c.current.checked)},[c,B]),he(r,()=>{J(g),_(r!==$.initialValue),B(r),b.change(r)});const{getButtonProps:D,buttonRef:ee}=be({disabled:d,native:k}),ae=Be(p,Z,c,!k,K),te={id:k?I:F,role:"switch","aria-checked":r,"aria-readonly":h||void 0,"aria-required":y||void 0,"aria-labelledby":ae,onFocus(){d||R(!0)},onBlur(){const a=c.current;!a||d||(U(!0),R(!1),G==="onBlur"&&b.commit(a.checked))},onClick(a){if(h||d)return;a.preventDefault();const u=c.current;u&&u.dispatchEvent(new(ve(u)).PointerEvent("click",{bubbles:!0,shiftKey:a.shiftKey,ctrlKey:a.ctrlKey,altKey:a.altKey,metaKey:a.metaKey}))}},ne=ge({checked:r,disabled:d,form:o,id:K,name:g,required:y,style:g?ke:ye,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:S,onChange(a){if(a.nativeEvent.defaultPrevented)return;if(h){a.preventDefault();return}const u=a.currentTarget.checked,M=xe(we,a.nativeEvent);E==null||E(u,M),!M.isCanceled&&A(u)},onFocus(){var a;(a=x.current)==null||a.focus()}},a=>b.getValidationProps(d,a),z!==void 0?{value:z}:me),j=s.useMemo(()=>({...L,checked:r,disabled:d,readOnly:h,required:y}),[L,r,d,h,y]),de=q("span",t,{state:j,ref:[n,x,ee],props:[te,Y,D,a=>b.getValidationProps(d,a)],stateAttributesMapping:O});return m.jsxs(H.Provider,{value:j,children:[de,!r&&g&&P!==void 0&&m.jsx("input",{type:"hidden",form:o,name:g,value:P,disabled:d}),m.jsx("input",{...ne,suppressHydrationWarning:!0})]})}),Re=s.forwardRef(function(t,n){const{render:l,className:i,style:f,...p}=t,o=ze();return q("span",t,{state:o,ref:n,stateAttributesMapping:O,props:p})});function je({className:e,size:t="default",...n}){return m.jsx(Le,{"data-slot":"switch","data-size":t,className:Ee("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),...n,children:m.jsx(Re,{"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{je as S,Be as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aZ as g,b as t,a_ as d,a$ as i}from"./index-MB-jfQld.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,D as c,b8 as d,r as p,aT as x,aV as m,aW as g,b9 as u,ba as T,bb as j}from"./index-MB-jfQld.js";import{u as b}from"./use-wecom-sign-in-C9j8wfCD.js";function f(e){return typeof e=="string"?e.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim():""}function W({authenticator:e,onSignIn:i}){var a;const{signIn:o,isPending:t,error:n}=b(e),r=f((a=e.options)==null?void 0:a.btnTooltip),l=s.jsxs(c,{type:"button",variant:"outline",className:"w-full",disabled:!i&&t,onClick:i??o,children:[s.jsx(d,{}),!i&&t?"Redirecting…":p(e.title||e.authTypeTitle||"Sign in via WeCom")]});return s.jsxs("div",{className:"space-y-3",children:[n&&s.jsxs(x,{variant:"destructive",children:[s.jsx(m,{children:"WeCom sign-in failed"}),s.jsx(g,{children:n.message})]}),r?s.jsxs(u,{children:[s.jsx(T,{render:l}),s.jsx(j,{side:"right",className:"max-w-xs",children:r})]}):l]})}export{W as default};
|