@nocobase/portal-template-default 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/.env.example +5 -0
  2. package/.github/workflows/publish.yml +106 -0
  3. package/.gitignore +33 -0
  4. package/AGENTS.md +19 -0
  5. package/README.MD +61 -180
  6. package/package.json +3 -5
  7. package/scripts/build-html.mjs +12 -0
  8. package/src/App.css +2 -0
  9. package/src/App.tsx +35 -186
  10. package/src/app/development.tsx +154 -0
  11. package/src/app/extension.ts +5 -0
  12. package/src/app/extensions.tsx +18 -4
  13. package/src/app/routes.tsx +65 -0
  14. package/src/components/access-control/acl-bootstrap.tsx +11 -3
  15. package/src/components/access-control/acl-gate.tsx +7 -6
  16. package/src/components/access-control/can-access.tsx +17 -0
  17. package/src/components/access-control/navigate-to-accessible-resource.tsx +8 -3
  18. package/src/components/app-shell/sidebar.tsx +21 -5
  19. package/src/components/auth/auto-redirect-provider.tsx +2 -1
  20. package/src/extensions/nocobase-acl/README.md +74 -0
  21. package/{registry → src/extensions}/nocobase-acl/components/acl-boundary.tsx +22 -25
  22. package/{registry → src/extensions}/nocobase-acl/components/role-switcher.tsx +26 -23
  23. package/src/extensions/nocobase-acl/demo/acl-preview-provider.tsx +81 -0
  24. package/{registry → src/extensions}/nocobase-acl/demo/boundary-api.tsx +58 -0
  25. package/{registry → src/extensions}/nocobase-acl/demo/index.tsx +243 -105
  26. package/{registry → src/extensions}/nocobase-acl/demo/prompt-generator.tsx +3 -1
  27. package/src/extensions/nocobase-acl/extension.tsx +73 -0
  28. package/{registry → src/extensions}/nocobase-ai/README.md +21 -5
  29. package/{registry → src/extensions}/nocobase-ai/components/chat/chat-composer.tsx +3 -1
  30. package/{registry → src/extensions}/nocobase-ai/components/chat/chat-messages.tsx +38 -3
  31. package/{registry → src/extensions}/nocobase-ai/components/chat/tool-call-card.tsx +1 -9
  32. package/{registry → src/extensions}/nocobase-ai/components/index.ts +5 -0
  33. package/src/extensions/nocobase-ai/components/surfaces/chat-dialog.tsx +17 -0
  34. package/src/extensions/nocobase-ai/components/surfaces/chat-side-panel.tsx +35 -0
  35. package/src/extensions/nocobase-ai/components/surfaces/chat-surface.tsx +108 -0
  36. package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-chat-floating-trigger.tsx +2 -2
  37. package/{registry → src/extensions}/nocobase-ai/demo/configuration-gate.tsx +4 -1
  38. package/{registry → src/extensions}/nocobase-ai/demo/container-showcase.tsx +2 -2
  39. package/{registry → src/extensions}/nocobase-ai/demo/floating.tsx +45 -15
  40. package/{registry → src/extensions}/nocobase-ai/demo/index.tsx +116 -74
  41. package/{registry → src/extensions}/nocobase-ai/demo/prompt-generator.tsx +3 -3
  42. package/{registry → src/extensions}/nocobase-ai/demo/tool-cards.tsx +2 -3
  43. package/src/extensions/nocobase-ai/extension.tsx +160 -0
  44. package/{registry → src/extensions}/nocobase-ai/global-ai-chat.tsx +12 -28
  45. package/{registry → src/extensions}/nocobase-ai/providers/ai-provider.tsx +14 -1
  46. package/{registry → src/extensions}/nocobase-ai/providers/chat-context.tsx +1 -0
  47. package/{registry → src/extensions}/nocobase-ai/providers/chat-provider.tsx +29 -8
  48. package/{registry → src/extensions}/nocobase-ai/providers/use-chat-attachments.ts +6 -1
  49. package/{registry → src/extensions}/nocobase-ai/providers/use-chat-work-context.ts +4 -1
  50. package/{registry → src/extensions}/nocobase-route-surfaces/README.md +2 -1
  51. package/{registry → src/extensions}/nocobase-route-surfaces/demo/index.tsx +33 -7
  52. package/{registry → src/extensions}/nocobase-route-surfaces/demo/scenarios.ts +20 -14
  53. package/{registry → src/extensions}/nocobase-route-surfaces/extension.tsx +55 -52
  54. package/src/{pages/users → extensions/nocobase-users-example}/create.tsx +4 -4
  55. package/src/{pages/users → extensions/nocobase-users-example}/edit.tsx +5 -9
  56. package/src/extensions/nocobase-users-example/extension.tsx +109 -0
  57. package/src/{pages/users → extensions/nocobase-users-example}/form-context.ts +11 -9
  58. package/src/extensions/nocobase-users-example/layout.tsx +16 -0
  59. package/src/{pages/users → extensions/nocobase-users-example}/list.tsx +1 -1
  60. package/src/extensions/nocobase-users-example/locales/en-US.ts +77 -0
  61. package/src/extensions/nocobase-users-example/locales/index.ts +8 -0
  62. package/src/extensions/nocobase-users-example/locales/zh-CN.ts +73 -0
  63. package/src/extensions/nocobase-users-example/optional-ai.ts +67 -0
  64. package/src/{pages/users → extensions/nocobase-users-example}/role-detail.tsx +4 -15
  65. package/src/{pages/users → extensions/nocobase-users-example}/routes.ts +1 -4
  66. package/src/extensions/nocobase-users-example/show.tsx +266 -0
  67. package/src/lib/nocobase/acl/context.ts +32 -0
  68. package/src/lib/nocobase/acl/evaluator.ts +186 -0
  69. package/src/lib/nocobase/acl/hooks.ts +40 -0
  70. package/src/lib/nocobase/acl/index.ts +4 -1
  71. package/src/lib/nocobase/acl/menu.ts +6 -6
  72. package/src/lib/nocobase/acl/record-permissions.ts +37 -7
  73. package/src/lib/nocobase/acl/store-provider.tsx +14 -0
  74. package/src/lib/nocobase/acl/store.ts +92 -86
  75. package/src/lib/nocobase/acl/types.ts +52 -32
  76. package/src/lib/nocobase/auth-session.ts +128 -0
  77. package/src/lib/nocobase/client.ts +48 -50
  78. package/src/locales/en-US.ts +0 -78
  79. package/src/locales/index.ts +2 -7
  80. package/src/locales/zh-CN.ts +0 -74
  81. package/src/providers/access-control.ts +43 -8
  82. package/src/providers/auth-callback.ts +1 -0
  83. package/src/providers/auth.ts +24 -26
  84. package/src/providers/constants.ts +0 -4
  85. package/src/providers/data.ts +14 -26
  86. package/src/providers/runtime-config.ts +40 -0
  87. package/src/vite-env.d.ts +9 -0
  88. package/tests/auth-session-regression.mjs +101 -0
  89. package/tsconfig.json +2 -1
  90. package/vite.config.ts +9 -1
  91. package/dist/assets/CoordinateSystem-C8P-Cleg.js +0 -1
  92. package/dist/assets/LegendVisualProvider-Bdgkckq-.js +0 -1
  93. package/dist/assets/LineDraw-C0m1GONT.js +0 -1
  94. package/dist/assets/SymbolDraw-CCospe5G.js +0 -1
  95. package/dist/assets/VisualMapping-Cbv1v7Cd.js +0 -1
  96. package/dist/assets/ai-employee-shortcut-B253WWow.js +0 -1
  97. package/dist/assets/calendar-B3dXXyIv.js +0 -1
  98. package/dist/assets/chat-inline-xpQ9iq4p.js +0 -1
  99. package/dist/assets/chat-side-panel-layout-BVWsp5rr.js +0 -1
  100. package/dist/assets/components-ChhJaNRc.js +0 -20
  101. package/dist/assets/configuration-gate-Dwdq_lxf.js +0 -1
  102. package/dist/assets/createClipPathFromCoordSys-uEftn1Mq.js +0 -1
  103. package/dist/assets/createSeriesDataSimply-CI7l7Ufv.js +0 -1
  104. package/dist/assets/customGraphicKeyframeAnimation-DE3jSfMd.js +0 -3
  105. package/dist/assets/echarts-preview-C-cNUtJF.js +0 -1
  106. package/dist/assets/echarts-runtime-CEgJbv68.js +0 -58
  107. package/dist/assets/echarts-runtime-advanced-Buhm2BHz.js +0 -1
  108. package/dist/assets/echarts-runtime-common-DLAdBAIa.js +0 -1
  109. package/dist/assets/echarts-runtime-components-ypnyLkYx.js +0 -1
  110. package/dist/assets/echarts-runtime-hierarchy-ClStquCF.js +0 -1
  111. package/dist/assets/floating-BarTmn-b.js +0 -13
  112. package/dist/assets/index-BJIcYTdc.js +0 -53
  113. package/dist/assets/index-C6xNKxpg.js +0 -656
  114. package/dist/assets/index-D4JQi1TM.js +0 -54
  115. package/dist/assets/index-YA7-AUO8.css +0 -1
  116. package/dist/assets/index-g8zWVpP9.js +0 -23
  117. package/dist/assets/labelHelper-C137W5gU.js +0 -1
  118. package/dist/assets/nocobase-ai-chat-VTMaZFQB.svg +0 -50
  119. package/dist/assets/page-context-Cxx11gzg.js +0 -73
  120. package/dist/assets/prompt-card-BsYMW_rq.js +0 -1
  121. package/dist/assets/sectorHelper-Fqgz3uEk.js +0 -1
  122. package/dist/assets/shortcut-xtghDP63.js +0 -47
  123. package/dist/assets/static.browser-CfQQzERe.js +0 -30
  124. package/dist/assets/switch-DrxImI8F.js +0 -1
  125. package/dist/assets/tool-cards-BGfsY8JF.js +0 -41
  126. package/dist/favicon.ico +0 -0
  127. package/dist/index.html +0 -40
  128. package/dist/index.raw.html +0 -46
  129. package/dist/logo-dark.png +0 -0
  130. package/dist/logo-mark-dark.png +0 -0
  131. package/dist/logo-mark.png +0 -0
  132. package/dist/logo.png +0 -0
  133. package/registry/nocobase-acl/README.md +0 -19
  134. package/registry/nocobase-acl/extension.tsx +0 -71
  135. package/registry/nocobase-acl/tests/acl-regression.mjs +0 -314
  136. package/registry/nocobase-ai/components/surfaces/chat-dialog.tsx +0 -31
  137. package/registry/nocobase-ai/components/surfaces/chat-side-panel.tsx +0 -74
  138. package/registry/nocobase-ai/extension.tsx +0 -158
  139. package/registry/nocobase-ai/tests/business-report-regression.mjs +0 -70
  140. package/registry/nocobase-ai/tests/form-filler-regression.mjs +0 -129
  141. package/registry/nocobase-ai/tests/frontend-tool-regression.mjs +0 -128
  142. package/registry/nocobase-ai/tests/page-context-regression.mjs +0 -48
  143. package/registry/nocobase-ai/tests/stream-regression.mjs +0 -207
  144. package/registry/nocobase-auth-cas/README.md +0 -6
  145. package/registry/nocobase-auth-cas/cas-sign-in-button.tsx +0 -41
  146. package/registry/nocobase-auth-cas/demo.tsx +0 -20
  147. package/registry/nocobase-auth-cas/extension.tsx +0 -46
  148. package/registry/nocobase-auth-cas/index.ts +0 -1
  149. package/registry/nocobase-auth-cas/use-cas-sign-in.ts +0 -29
  150. package/registry/nocobase-auth-dingtalk/README.md +0 -7
  151. package/registry/nocobase-auth-dingtalk/auto-login-provider.tsx +0 -154
  152. package/registry/nocobase-auth-dingtalk/demo.tsx +0 -23
  153. package/registry/nocobase-auth-dingtalk/dingtalk-sign-in-button.tsx +0 -45
  154. package/registry/nocobase-auth-dingtalk/extension.tsx +0 -55
  155. package/registry/nocobase-auth-dingtalk/index.ts +0 -4
  156. package/registry/nocobase-auth-dingtalk/use-dingtalk-sign-in.ts +0 -64
  157. package/registry/nocobase-auth-ldap/README.md +0 -6
  158. package/registry/nocobase-auth-ldap/demo.tsx +0 -21
  159. package/registry/nocobase-auth-ldap/extension.tsx +0 -46
  160. package/registry/nocobase-auth-ldap/index.ts +0 -1
  161. package/registry/nocobase-auth-ldap/ldap-sign-in-form.tsx +0 -69
  162. package/registry/nocobase-auth-ldap/use-ldap-sign-in.ts +0 -5
  163. package/registry/nocobase-auth-oidc/README.md +0 -11
  164. package/registry/nocobase-auth-oidc/auto-redirect-provider.tsx +0 -13
  165. package/registry/nocobase-auth-oidc/demo.tsx +0 -20
  166. package/registry/nocobase-auth-oidc/extension.tsx +0 -51
  167. package/registry/nocobase-auth-oidc/index.ts +0 -1
  168. package/registry/nocobase-auth-oidc/oidc-sign-in-button.tsx +0 -44
  169. package/registry/nocobase-auth-oidc/use-oidc-sign-in.ts +0 -58
  170. package/registry/nocobase-auth-saml/README.md +0 -6
  171. package/registry/nocobase-auth-saml/auto-redirect-provider.tsx +0 -13
  172. package/registry/nocobase-auth-saml/demo.tsx +0 -20
  173. package/registry/nocobase-auth-saml/extension.tsx +0 -51
  174. package/registry/nocobase-auth-saml/index.ts +0 -1
  175. package/registry/nocobase-auth-saml/saml-sign-in-button.tsx +0 -43
  176. package/registry/nocobase-auth-saml/use-saml-sign-in.ts +0 -51
  177. package/registry/nocobase-auth-sms/README.md +0 -7
  178. package/registry/nocobase-auth-sms/demo.tsx +0 -25
  179. package/registry/nocobase-auth-sms/extension.tsx +0 -46
  180. package/registry/nocobase-auth-sms/index.ts +0 -1
  181. package/registry/nocobase-auth-sms/sms-sign-in-form.tsx +0 -107
  182. package/registry/nocobase-auth-sms/use-sms-sign-in.ts +0 -88
  183. package/registry/nocobase-auth-wecom/README.md +0 -6
  184. package/registry/nocobase-auth-wecom/auto-login-provider.tsx +0 -21
  185. package/registry/nocobase-auth-wecom/demo.tsx +0 -23
  186. package/registry/nocobase-auth-wecom/extension.tsx +0 -49
  187. package/registry/nocobase-auth-wecom/index.ts +0 -1
  188. package/registry/nocobase-auth-wecom/use-wecom-sign-in.ts +0 -62
  189. package/registry/nocobase-auth-wecom/wecom-sign-in-button.tsx +0 -70
  190. package/registry/nocobase-i18n/README.md +0 -44
  191. package/registry/nocobase-i18n/components/index.ts +0 -1
  192. package/registry/nocobase-i18n/components/language-switcher.tsx +0 -138
  193. package/registry/nocobase-i18n/demo/index.tsx +0 -209
  194. package/registry/nocobase-i18n/demo/prompt-generator.tsx +0 -132
  195. package/registry/nocobase-i18n/extension.tsx +0 -45
  196. package/registry/nocobase-i18n/index.ts +0 -7
  197. package/registry/nocobase-i18n/locales/en-US.ts +0 -39
  198. package/registry/nocobase-i18n/locales/index.ts +0 -8
  199. package/registry/nocobase-i18n/locales/zh-CN.ts +0 -35
  200. package/registry/nocobase-i18n/provider.tsx +0 -44
  201. package/registry/nocobase-i18n/server-resources.ts +0 -166
  202. package/registry/nocobase-i18n/tests/i18n-regression.mjs +0 -51
  203. package/registry.config.json +0 -302
  204. package/scripts/registry.mjs +0 -164
  205. package/src/components/access-control/resource-access-guard.tsx +0 -21
  206. package/src/components/access-control/use-acl-runtime.ts +0 -28
  207. package/src/lib/nocobase/acl/action.ts +0 -147
  208. package/src/pages/users/layout.tsx +0 -15
  209. package/src/pages/users/show.tsx +0 -278
  210. /package/{registry → src/extensions}/nocobase-acl/components/index.ts +0 -0
  211. /package/{registry → src/extensions}/nocobase-acl/components/role-options.ts +0 -0
  212. /package/{registry → src/extensions}/nocobase-acl/demo/components.tsx +0 -0
  213. /package/{registry → src/extensions}/nocobase-acl/demo/lazy-route.tsx +0 -0
  214. /package/{registry → src/extensions}/nocobase-acl/demo/role-switcher-prompt-generator.tsx +0 -0
  215. /package/{registry → src/extensions}/nocobase-acl/demo/scenario-section.tsx +0 -0
  216. /package/{registry → src/extensions}/nocobase-acl/index.ts +0 -0
  217. /package/{registry → src/extensions}/nocobase-ai/adapters/react-hook-form.ts +0 -0
  218. /package/{registry → src/extensions}/nocobase-ai/assets/nocobase-ai-chat.svg +0 -0
  219. /package/{registry → src/extensions}/nocobase-ai/components/ai-root-provider.tsx +0 -0
  220. /package/{registry → src/extensions}/nocobase-ai/components/chat/ai-employee-avatar.tsx +0 -0
  221. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-attachment.tsx +0 -0
  222. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-compact.tsx +0 -0
  223. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-empty-state.tsx +0 -0
  224. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-header.tsx +0 -0
  225. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-history-dialog.tsx +0 -0
  226. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-message.tsx +0 -0
  227. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-window.tsx +0 -0
  228. /package/{registry → src/extensions}/nocobase-ai/components/chat/conversation-list.tsx +0 -0
  229. /package/{registry → src/extensions}/nocobase-ai/components/chat/markdown-message.tsx +0 -0
  230. /package/{registry → src/extensions}/nocobase-ai/components/chat/model-select-options.tsx +0 -0
  231. /package/{registry → src/extensions}/nocobase-ai/components/chat/reasoning-panel.tsx +0 -0
  232. /package/{registry → src/extensions}/nocobase-ai/components/chat/sub-agent-conversation.tsx +0 -0
  233. /package/{registry → src/extensions}/nocobase-ai/components/chat/user-prompt-editor.tsx +0 -0
  234. /package/{registry → src/extensions}/nocobase-ai/components/chat/work-context-chip.tsx +0 -0
  235. /package/{registry → src/extensions}/nocobase-ai/components/page-elements/ai-form.tsx +0 -0
  236. /package/{registry → src/extensions}/nocobase-ai/components/page-elements/page-element-provider.tsx +0 -0
  237. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-inline.tsx +0 -0
  238. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-page.tsx +0 -0
  239. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-side-panel-layout.tsx +0 -0
  240. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-surface-actions.tsx +0 -0
  241. /package/{registry → src/extensions}/nocobase-ai/components/tools/builtin-tool-renderers.tsx +0 -0
  242. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-dialog.tsx +0 -0
  243. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-renderer.tsx +0 -0
  244. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-utils.tsx +0 -0
  245. /package/{registry → src/extensions}/nocobase-ai/components/tools/chart-renderer.tsx +0 -0
  246. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-preview.tsx +0 -0
  247. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-advanced.ts +0 -0
  248. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-common.ts +0 -0
  249. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-components.ts +0 -0
  250. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-hierarchy.ts +0 -0
  251. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime.ts +0 -0
  252. /package/{registry → src/extensions}/nocobase-ai/components/tools/sub-agent-renderer.tsx +0 -0
  253. /package/{registry → src/extensions}/nocobase-ai/components/tools/suggestions-renderer.tsx +0 -0
  254. /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-provider.tsx +0 -0
  255. /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-utils.ts +0 -0
  256. /package/{registry → src/extensions}/nocobase-ai/components/tools/workflow-renderer.tsx +0 -0
  257. /package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-employee-shortcut.tsx +0 -0
  258. /package/{registry → src/extensions}/nocobase-ai/demo/interaction-showcase.tsx +0 -0
  259. /package/{registry → src/extensions}/nocobase-ai/demo/page-context-prompt-generator.tsx +0 -0
  260. /package/{registry → src/extensions}/nocobase-ai/demo/page-context.tsx +0 -0
  261. /package/{registry → src/extensions}/nocobase-ai/demo/page-element-showcase.tsx +0 -0
  262. /package/{registry → src/extensions}/nocobase-ai/demo/prompt-card.tsx +0 -0
  263. /package/{registry → src/extensions}/nocobase-ai/demo/shortcut.tsx +0 -0
  264. /package/{registry → src/extensions}/nocobase-ai/index.ts +0 -0
  265. /package/{registry → src/extensions}/nocobase-ai/providers/avatars.ts +0 -0
  266. /package/{registry → src/extensions}/nocobase-ai/providers/chat-controller.ts +0 -0
  267. /package/{registry → src/extensions}/nocobase-ai/providers/chat-message-utils.ts +0 -0
  268. /package/{registry → src/extensions}/nocobase-ai/providers/chat-reducer.ts +0 -0
  269. /package/{registry → src/extensions}/nocobase-ai/providers/chat-task-utils.ts +0 -0
  270. /package/{registry → src/extensions}/nocobase-ai/providers/chat-transport.ts +0 -0
  271. /package/{registry → src/extensions}/nocobase-ai/providers/form-registry.tsx +0 -0
  272. /package/{registry → src/extensions}/nocobase-ai/providers/frontend-tool-registry.tsx +0 -0
  273. /package/{registry → src/extensions}/nocobase-ai/providers/index.ts +0 -0
  274. /package/{registry → src/extensions}/nocobase-ai/providers/model.ts +0 -0
  275. /package/{registry → src/extensions}/nocobase-ai/providers/page-context.tsx +0 -0
  276. /package/{registry → src/extensions}/nocobase-ai/providers/stream-coalescer.ts +0 -0
  277. /package/{registry → src/extensions}/nocobase-ai/providers/stream-event-utils.ts +0 -0
  278. /package/{registry → src/extensions}/nocobase-ai/providers/stream-parser.ts +0 -0
  279. /package/{registry → src/extensions}/nocobase-ai/providers/sub-agent-stream.ts +0 -0
  280. /package/{registry → src/extensions}/nocobase-ai/providers/types.ts +0 -0
  281. /package/{registry → src/extensions}/nocobase-ai/providers/ui-message-stream.ts +0 -0
  282. /package/{registry → src/extensions}/nocobase-ai/providers/use-automatic-tool-approval.ts +0 -0
  283. /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-message-actions.ts +0 -0
  284. /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-runtime.ts +0 -0
  285. /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-catalog.ts +0 -0
  286. /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-history.ts +0 -0
  287. /package/{registry → src/extensions}/nocobase-ai/services/index.ts +0 -0
  288. /package/{registry → src/extensions}/nocobase-ai/services/nocobase-ai-service.ts +0 -0
  289. /package/{registry → src/extensions}/nocobase-ai/services/types.ts +0 -0
  290. /package/{registry → src/extensions}/nocobase-route-surfaces/demo/lazy-route.tsx +0 -0
  291. /package/{registry → src/extensions}/nocobase-route-surfaces/demo/prompt-generator.tsx +0 -0
  292. /package/{registry → src/extensions}/nocobase-route-surfaces/index.ts +0 -0
  293. /package/{registry → src/extensions}/nocobase-route-surfaces/route-dialog.tsx +0 -0
  294. /package/{registry → src/extensions}/nocobase-route-surfaces/route-drawer.tsx +0 -0
  295. /package/{registry → src/extensions}/nocobase-route-surfaces/route-page.tsx +0 -0
  296. /package/{registry → src/extensions}/nocobase-route-surfaces/route-surface-context.ts +0 -0
  297. /package/{registry → src/extensions}/nocobase-route-surfaces/use-refine-unsaved-changes.tsx +0 -0
  298. /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-close.ts +0 -0
  299. /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-state.ts +0 -0
  300. /package/src/{pages/users → extensions/nocobase-users-example}/form-fields.tsx +0 -0
  301. /package/src/{pages/users → extensions/nocobase-users-example}/index.ts +0 -0
  302. /package/src/{pages/users → extensions/nocobase-users-example}/role-badges.tsx +0 -0
  303. /package/src/{pages/users → extensions/nocobase-users-example}/role-utils.ts +0 -0
  304. /package/src/{pages/users → extensions/nocobase-users-example}/types.ts +0 -0
@@ -1,154 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { useLocation } from "react-router";
3
-
4
- import { LoadingState } from "@/components/app-shell/loading-state";
5
- import { clearAcl } from "@/lib/nocobase/acl";
6
- import { nocobaseClient } from "@/lib/nocobase/client";
7
-
8
- import { isDingtalkBrowser } from "./use-dingtalk-sign-in";
9
-
10
- type CheckLoginResponse = {
11
- success?: boolean;
12
- autoLoginType?: "oauth" | "internal";
13
- authUrl?: string;
14
- authenticator?: string;
15
- corpId?: string;
16
- };
17
-
18
- type SignInResponse = {
19
- token?: string;
20
- };
21
-
22
- const publicAuthPaths = new Set([
23
- "/login",
24
- "/signin",
25
- "/register",
26
- "/forgot-password",
27
- ]);
28
-
29
- async function requestDingtalkAuthCode(corpId: string) {
30
- const module = await import("dingtalk-jsapi");
31
- const dd = ((module as { default?: unknown }).default ?? module) as any;
32
-
33
- return new Promise<string>((resolve, reject) => {
34
- const success = (result: { code?: string; authCode?: string }) => {
35
- const code = result?.code ?? result?.authCode;
36
- code
37
- ? resolve(String(code))
38
- : reject(new Error("DingTalk did not return an authorization code."));
39
- };
40
- const fail = (error: { errorMessage?: string; message?: string }) =>
41
- reject(
42
- new Error(
43
- error?.errorMessage ||
44
- error?.message ||
45
- "Unable to request a DingTalk authorization code."
46
- )
47
- );
48
- const run = () => {
49
- const requestAuthCode = dd?.runtime?.permission?.requestAuthCode;
50
- if (typeof requestAuthCode === "function") {
51
- const result = requestAuthCode({ corpId, success, fail });
52
- if (result?.then) result.then(success).catch(fail);
53
- return;
54
- }
55
- if (typeof dd?.getAuthCode === "function") {
56
- dd.getAuthCode({ corpId, success, fail });
57
- return;
58
- }
59
- fail({ message: "DingTalk auth-code API is unavailable." });
60
- };
61
-
62
- try {
63
- typeof dd?.ready === "function" ? dd.ready(run) : run();
64
- } catch (error) {
65
- fail(error as Error);
66
- }
67
- });
68
- }
69
-
70
- export default function DingtalkAutoLoginProvider({
71
- children,
72
- }: React.PropsWithChildren) {
73
- const { pathname, search } = useLocation();
74
- const attemptedRef = useRef(false);
75
- const insideDingtalk = isDingtalkBrowser();
76
- const redirect = `${pathname}${search}`;
77
- const shouldCheck =
78
- insideDingtalk &&
79
- !nocobaseClient.getToken() &&
80
- !publicAuthPaths.has(pathname);
81
- const [isChecking, setIsChecking] = useState(shouldCheck);
82
-
83
- useEffect(() => {
84
- if (!shouldCheck || attemptedRef.current) {
85
- setIsChecking(false);
86
- return;
87
- }
88
- attemptedRef.current = true;
89
- setIsChecking(true);
90
- const controller = new AbortController();
91
-
92
- void (async () => {
93
- try {
94
- const result = await nocobaseClient.action<CheckLoginResponse>(
95
- "dingtalk",
96
- "checkLogin",
97
- {
98
- method: "GET",
99
- query: { isDingTalkBrowser: true, redirect },
100
- signal: controller.signal,
101
- authenticator: null,
102
- includeRole: false,
103
- withAclMeta: false,
104
- }
105
- );
106
-
107
- if (result?.success !== false) return;
108
- if (result.autoLoginType === "oauth" && result.authUrl) {
109
- window.location.replace(nocobaseClient.resolveUrl(result.authUrl));
110
- return;
111
- }
112
- if (
113
- result.autoLoginType !== "internal" ||
114
- !result.authenticator ||
115
- !result.corpId
116
- ) {
117
- return;
118
- }
119
-
120
- const authCode = await requestDingtalkAuthCode(result.corpId);
121
- const signedIn = await nocobaseClient.action<SignInResponse>(
122
- "auth",
123
- "signIn",
124
- {
125
- method: "POST",
126
- authenticator: result.authenticator,
127
- body: { authCode, loginType: "internal" },
128
- }
129
- );
130
- if (!signedIn.token) {
131
- throw new Error("NocoBase did not return an access token.");
132
- }
133
- nocobaseClient.setAuthenticator(result.authenticator);
134
- nocobaseClient.setToken(signedIn.token);
135
- nocobaseClient.setRole(null);
136
- clearAcl();
137
- window.location.replace(redirect);
138
- } catch (error) {
139
- if (!(error instanceof DOMException && error.name === "AbortError")) {
140
- console.warn("Unable to complete DingTalk automatic login", error);
141
- }
142
- } finally {
143
- setIsChecking(false);
144
- }
145
- })();
146
-
147
- return () => controller.abort();
148
- }, [redirect, shouldCheck]);
149
-
150
- if (isChecking) {
151
- return <LoadingState className="min-h-svh" />;
152
- }
153
- return children;
154
- }
@@ -1,23 +0,0 @@
1
- import { AuthMethodDemo } from "@/components/auth/demo";
2
- import DingtalkSignInButton from "./dingtalk-sign-in-button";
3
-
4
- const authenticator = {
5
- name: "company-dingtalk",
6
- authType: "dingtalk",
7
- title: "Sign in via DingTalk",
8
- };
9
-
10
- export function DingtalkAuthDemoPage() {
11
- return (
12
- <AuthMethodDemo
13
- authType="dingtalk"
14
- methodName="DingTalk"
15
- description="Provide DingTalk OAuth login and support internal micro-app automatic login through DingTalk JSAPI."
16
- >
17
- <DingtalkSignInButton
18
- authenticator={authenticator}
19
- onSignIn={() => {}}
20
- />
21
- </AuthMethodDemo>
22
- );
23
- }
@@ -1,45 +0,0 @@
1
- import { MessageSquare } from "lucide-react";
2
-
3
- import type { AuthenticatorComponentProps } from "@/components/auth/types";
4
- import {
5
- Alert,
6
- AlertDescription,
7
- AlertTitle,
8
- } from "@/components/ui/alert";
9
- import { Button } from "@/components/ui/button";
10
- import { resolveTranslatableText } from "@/lib/i18n";
11
-
12
- import { useDingtalkSignIn } from "./use-dingtalk-sign-in";
13
-
14
- export default function DingtalkSignInButton({
15
- authenticator,
16
- onSignIn,
17
- }: AuthenticatorComponentProps & { onSignIn?: () => void }) {
18
- const { signIn, isPending, error } = useDingtalkSignIn(authenticator);
19
- return (
20
- <div className="space-y-3">
21
- {error && (
22
- <Alert variant="destructive">
23
- <AlertTitle>DingTalk sign-in failed</AlertTitle>
24
- <AlertDescription>{error.message}</AlertDescription>
25
- </Alert>
26
- )}
27
- <Button
28
- type="button"
29
- variant="outline"
30
- className="w-full"
31
- disabled={!onSignIn && isPending}
32
- onClick={onSignIn ?? signIn}
33
- >
34
- <MessageSquare />
35
- {!onSignIn && isPending
36
- ? "Redirecting…"
37
- : resolveTranslatableText(
38
- authenticator.title ||
39
- authenticator.authTypeTitle ||
40
- "Sign in via DingTalk"
41
- )}
42
- </Button>
43
- </div>
44
- );
45
- }
@@ -1,55 +0,0 @@
1
- import { lazy } from "react";
2
- import { MessageSquare } from "lucide-react";
3
- import { Route } from "react-router";
4
-
5
- import type { AppExtension } from "@/app/extension";
6
- import { AuthDemoRoute } from "@/components/auth/demo";
7
-
8
- const DingtalkSignInButton = lazy(
9
- () => import("./dingtalk-sign-in-button")
10
- );
11
- const DingtalkAutoLoginProvider = lazy(
12
- () => import("./auto-login-provider")
13
- );
14
- const DingtalkAuthDemoPage = lazy(() =>
15
- import("./demo").then((module) => ({
16
- default: module.DingtalkAuthDemoPage,
17
- }))
18
- );
19
-
20
- const dingtalkAuthExtension: AppExtension = {
21
- id: "nocobase-auth-dingtalk",
22
- AuthRuntimeProvider: DingtalkAutoLoginProvider,
23
- authRuntimePriority: 10,
24
- resources: [
25
- {
26
- name: "auth-dingtalk-demo",
27
- list: "/auth/dingtalk",
28
- meta: {
29
- parent: "auth-components",
30
- label: "DingTalk",
31
- icon: <MessageSquare />,
32
- acl: { type: "authenticated" },
33
- },
34
- },
35
- ],
36
- routes: (
37
- <Route
38
- path="/auth/dingtalk"
39
- element={
40
- <AuthDemoRoute>
41
- <DingtalkAuthDemoPage />
42
- </AuthDemoRoute>
43
- }
44
- />
45
- ),
46
- authAdapters: [
47
- {
48
- authType: "dingtalk",
49
- placement: "button",
50
- Component: DingtalkSignInButton,
51
- },
52
- ],
53
- };
54
-
55
- export default dingtalkAuthExtension;
@@ -1,4 +0,0 @@
1
- export {
2
- isDingtalkBrowser,
3
- useDingtalkSignIn,
4
- } from "./use-dingtalk-sign-in";
@@ -1,64 +0,0 @@
1
- import { useCallback, useMemo, useState } from "react";
2
- import { useSearchParams } from "react-router";
3
-
4
- import type { Authenticator } from "@/components/auth/types";
5
- import { nocobaseClient } from "@/lib/nocobase/client";
6
-
7
- type DingtalkAuthUrlResponse = {
8
- url?: string;
9
- };
10
-
11
- export function isDingtalkBrowser() {
12
- return (
13
- typeof navigator !== "undefined" &&
14
- navigator.userAgent.toLowerCase().includes("dingtalk")
15
- );
16
- }
17
-
18
- export function useDingtalkSignIn(authenticator: Authenticator) {
19
- const [searchParams] = useSearchParams();
20
- const [isPending, setIsPending] = useState(false);
21
- const [error, setError] = useState<Error>();
22
- const callbackError = useMemo(() => {
23
- if (searchParams.get("authenticator") !== authenticator.name) {
24
- return undefined;
25
- }
26
- const message = searchParams.get("error");
27
- return message ? new Error(message) : undefined;
28
- }, [authenticator.name, searchParams]);
29
-
30
- const signIn = useCallback(async () => {
31
- setError(undefined);
32
- setIsPending(true);
33
- try {
34
- const redirect =
35
- searchParams.get("to") || searchParams.get("redirect") || "/";
36
- const result = await nocobaseClient.action<DingtalkAuthUrlResponse>(
37
- "dingtalk",
38
- "getAuthUrl",
39
- {
40
- method: "POST",
41
- authenticator: authenticator.name,
42
- includeRole: false,
43
- withAclMeta: false,
44
- body: { redirect },
45
- }
46
- );
47
- if (!result?.url) {
48
- throw new Error(
49
- "NocoBase did not return a DingTalk authorization URL."
50
- );
51
- }
52
- window.location.replace(nocobaseClient.resolveUrl(result.url));
53
- } catch (cause) {
54
- setError(
55
- cause instanceof Error
56
- ? cause
57
- : new Error("Unable to start DingTalk sign-in.")
58
- );
59
- setIsPending(false);
60
- }
61
- }, [authenticator.name, searchParams]);
62
-
63
- return { signIn, isPending, error: error ?? callbackError };
64
- }
@@ -1,6 +0,0 @@
1
- # NocoBase LDAP authentication
2
-
3
- Adds the LDAP account/password form to the Starter's dynamic sign-in page and
4
- exports `useLdapSignIn` for application-owned login UI.
5
-
6
- Installing the Registry also adds an LDAP component Demo under Authentication.
@@ -1,21 +0,0 @@
1
- import { AuthMethodDemo } from "@/components/auth/demo";
2
- import LdapSignInForm from "./ldap-sign-in-form";
3
-
4
- const authenticator = {
5
- name: "company-ldap",
6
- authType: "LDAP",
7
- title: "Company directory",
8
- options: { autoSignup: true },
9
- };
10
-
11
- export function LdapAuthDemoPage() {
12
- return (
13
- <AuthMethodDemo
14
- authType="LDAP"
15
- methodName="LDAP directory"
16
- description="Use the familiar account and password form while sending credentials through the selected LDAP authenticator."
17
- >
18
- <LdapSignInForm authenticator={authenticator} onSignIn={() => {}} />
19
- </AuthMethodDemo>
20
- );
21
- }
@@ -1,46 +0,0 @@
1
- import { lazy } from "react";
2
- import { ContactRound } from "lucide-react";
3
- import { Route } from "react-router";
4
-
5
- import type { AppExtension } from "@/app/extension";
6
- import { AuthDemoRoute } from "@/components/auth/demo";
7
-
8
- const LdapSignInForm = lazy(() => import("./ldap-sign-in-form"));
9
- const LdapAuthDemoPage = lazy(() =>
10
- import("./demo").then((module) => ({ default: module.LdapAuthDemoPage }))
11
- );
12
-
13
- const ldapAuthExtension: AppExtension = {
14
- id: "nocobase-auth-ldap",
15
- resources: [
16
- {
17
- name: "auth-ldap-demo",
18
- list: "/auth/ldap",
19
- meta: {
20
- parent: "auth-components",
21
- label: "LDAP",
22
- icon: <ContactRound />,
23
- acl: { type: "authenticated" },
24
- },
25
- },
26
- ],
27
- routes: (
28
- <Route
29
- path="/auth/ldap"
30
- element={
31
- <AuthDemoRoute>
32
- <LdapAuthDemoPage />
33
- </AuthDemoRoute>
34
- }
35
- />
36
- ),
37
- authAdapters: [
38
- {
39
- authType: "LDAP",
40
- placement: "form",
41
- Component: LdapSignInForm,
42
- },
43
- ],
44
- };
45
-
46
- export default ldapAuthExtension;
@@ -1 +0,0 @@
1
- export { useLdapSignIn } from "./use-ldap-sign-in";
@@ -1,69 +0,0 @@
1
- import { useState } from "react";
2
-
3
- import { InputPassword } from "@/components/auth/input-password";
4
- import type { AuthenticatorComponentProps } from "@/components/auth/types";
5
- import { Button } from "@/components/ui/button";
6
- import { Input } from "@/components/ui/input";
7
- import { Label } from "@/components/ui/label";
8
-
9
- import { useLdapSignIn } from "./use-ldap-sign-in";
10
-
11
- export default function LdapSignInForm({
12
- authenticator,
13
- onSignIn,
14
- }: AuthenticatorComponentProps & {
15
- onSignIn?: (values: { account: string; password: string }) => void;
16
- }) {
17
- const [account, setAccount] = useState("");
18
- const [password, setPassword] = useState("");
19
- const { signIn, isPending } = useLdapSignIn(authenticator.name);
20
- const autoSignup = authenticator.options?.autoSignup === true;
21
-
22
- return (
23
- <form
24
- className="space-y-5"
25
- onSubmit={(event) => {
26
- event.preventDefault();
27
- if (onSignIn) {
28
- onSignIn({ account, password });
29
- return;
30
- }
31
- void signIn({ account, password });
32
- }}
33
- >
34
- <div className="space-y-2">
35
- <Label htmlFor={`${authenticator.name}-ldap-account`}>Account</Label>
36
- <Input
37
- id={`${authenticator.name}-ldap-account`}
38
- value={account}
39
- onChange={(event) => setAccount(event.target.value)}
40
- autoComplete="username"
41
- required
42
- />
43
- </div>
44
- <div className="space-y-2">
45
- <Label htmlFor={`${authenticator.name}-ldap-password`}>Password</Label>
46
- <InputPassword
47
- id={`${authenticator.name}-ldap-password`}
48
- value={password}
49
- onChange={(event) => setPassword(event.target.value)}
50
- autoComplete="current-password"
51
- required
52
- />
53
- </div>
54
- <Button
55
- type="submit"
56
- className="w-full"
57
- disabled={!onSignIn && isPending}
58
- >
59
- {!onSignIn && isPending ? "Signing in…" : "Sign in"}
60
- </Button>
61
- {autoSignup && (
62
- <p className="text-xs leading-5 text-muted-foreground">
63
- An account will be created automatically after the first successful
64
- LDAP sign-in.
65
- </p>
66
- )}
67
- </form>
68
- );
69
- }
@@ -1,5 +0,0 @@
1
- import { useAuthenticatorSignIn } from "@/components/auth";
2
-
3
- export function useLdapSignIn(authenticator: string) {
4
- return useAuthenticatorSignIn(authenticator);
5
- }
@@ -1,11 +0,0 @@
1
- # NocoBase OIDC authentication
2
-
3
- This Registry adds the default OIDC sign-in button to the Starter's dynamic
4
- authentication page. It also exports `useOidcSignIn` so applications can keep
5
- the NocoBase OIDC protocol while replacing the button UI.
6
-
7
- Installing the Registry also adds an OIDC component Demo under Authentication.
8
-
9
- The authenticator instance must be enabled in the connected NocoBase app. SSO
10
- callbacks currently require the Portal and NocoBase public endpoints to share
11
- an origin or use a compatible reverse proxy.
@@ -1,13 +0,0 @@
1
- import type { PropsWithChildren } from "react";
2
-
3
- import { AuthAutoRedirectProvider } from "@/components/auth";
4
-
5
- export default function OidcAutoRedirectProvider({
6
- children,
7
- }: PropsWithChildren) {
8
- return (
9
- <AuthAutoRedirectProvider resource="oidc" action="checkRedirect">
10
- {children}
11
- </AuthAutoRedirectProvider>
12
- );
13
- }
@@ -1,20 +0,0 @@
1
- import { AuthMethodDemo } from "@/components/auth/demo";
2
- import OidcSignInButton from "./oidc-sign-in-button";
3
-
4
- const authenticator = {
5
- name: "company-oidc",
6
- authType: "OIDC",
7
- title: "Company OIDC",
8
- };
9
-
10
- export function OidcAuthDemoPage() {
11
- return (
12
- <AuthMethodDemo
13
- authType="OIDC"
14
- methodName="OpenID Connect"
15
- description="Redirect users to an OpenID Connect provider while the Starter handles callback tokens and the active authenticator."
16
- >
17
- <OidcSignInButton authenticator={authenticator} onSignIn={() => {}} />
18
- </AuthMethodDemo>
19
- );
20
- }
@@ -1,51 +0,0 @@
1
- import { lazy } from "react";
2
- import { LogIn } from "lucide-react";
3
- import { Route } from "react-router";
4
-
5
- import type { AppExtension } from "@/app/extension";
6
- import { AuthDemoRoute } from "@/components/auth/demo";
7
-
8
- const OidcSignInButton = lazy(() => import("./oidc-sign-in-button"));
9
- const OidcAutoRedirectProvider = lazy(
10
- () => import("./auto-redirect-provider")
11
- );
12
- const OidcAuthDemoPage = lazy(() =>
13
- import("./demo").then((module) => ({ default: module.OidcAuthDemoPage }))
14
- );
15
-
16
- const oidcAuthExtension: AppExtension = {
17
- id: "nocobase-auth-oidc",
18
- AuthRuntimeProvider: OidcAutoRedirectProvider,
19
- authRuntimePriority: 20,
20
- resources: [
21
- {
22
- name: "auth-oidc-demo",
23
- list: "/auth/oidc",
24
- meta: {
25
- parent: "auth-components",
26
- label: "OIDC",
27
- icon: <LogIn />,
28
- acl: { type: "authenticated" },
29
- },
30
- },
31
- ],
32
- routes: (
33
- <Route
34
- path="/auth/oidc"
35
- element={
36
- <AuthDemoRoute>
37
- <OidcAuthDemoPage />
38
- </AuthDemoRoute>
39
- }
40
- />
41
- ),
42
- authAdapters: [
43
- {
44
- authType: "OIDC",
45
- placement: "button",
46
- Component: OidcSignInButton,
47
- },
48
- ],
49
- };
50
-
51
- export default oidcAuthExtension;
@@ -1 +0,0 @@
1
- export { useOidcSignIn } from "./use-oidc-sign-in";
@@ -1,44 +0,0 @@
1
- import { LogIn } from "lucide-react";
2
-
3
- import type { AuthenticatorComponentProps } from "@/components/auth/types";
4
- import {
5
- Alert,
6
- AlertDescription,
7
- AlertTitle,
8
- } from "@/components/ui/alert";
9
- import { Button } from "@/components/ui/button";
10
- import { resolveTranslatableText } from "@/lib/i18n";
11
-
12
- import { useOidcSignIn } from "./use-oidc-sign-in";
13
-
14
- export default function OidcSignInButton({
15
- authenticator,
16
- onSignIn,
17
- }: AuthenticatorComponentProps & { onSignIn?: () => void }) {
18
- const { signIn, isPending, error } = useOidcSignIn(authenticator);
19
-
20
- return (
21
- <div className="space-y-3">
22
- {error && (
23
- <Alert variant="destructive">
24
- <AlertTitle>OIDC sign-in failed</AlertTitle>
25
- <AlertDescription>{error.message}</AlertDescription>
26
- </Alert>
27
- )}
28
- <Button
29
- type="button"
30
- variant="outline"
31
- className="w-full"
32
- disabled={!onSignIn && isPending}
33
- onClick={onSignIn ?? signIn}
34
- >
35
- <LogIn />
36
- {!onSignIn && isPending
37
- ? "Redirecting…"
38
- : resolveTranslatableText(
39
- authenticator.title || authenticator.authTypeTitle || "OIDC"
40
- )}
41
- </Button>
42
- </div>
43
- );
44
- }