@nocobase/portal-template-default 1.0.9 → 1.0.11

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 (338) 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/dist/assets/{LineDraw-C0m1GONT.js → LineDraw-iG-ADes-.js} +1 -1
  7. package/dist/assets/{SymbolDraw-CCospe5G.js → SymbolDraw-DXoSw1tM.js} +1 -1
  8. package/dist/assets/VisualMapping-C_ee4Eht.js +1 -0
  9. package/dist/assets/auth-method-demo-DaOCuvsq.js +1 -0
  10. package/dist/assets/auto-login-provider-5Uxza9Ms.js +2 -0
  11. package/dist/assets/auto-login-provider-DyaPGK2D.js +1 -0
  12. package/dist/assets/auto-redirect-provider-CfwRvYOI.js +1 -0
  13. package/dist/assets/auto-redirect-provider-Cr3jmYts.js +1 -0
  14. package/dist/assets/auto-redirect-provider-QkJQRBbG.js +1 -0
  15. package/dist/assets/calendar-DjDRfD5t.js +1 -0
  16. package/dist/assets/card-DuQBOS6A.js +1 -0
  17. package/dist/assets/cas-sign-in-button-CyqG1QME.js +1 -0
  18. package/dist/assets/components-D-ptYjX_.js +20 -0
  19. package/dist/assets/configuration-gate-C08mkkiX.js +1 -0
  20. package/dist/assets/{createClipPathFromCoordSys-uEftn1Mq.js → createClipPathFromCoordSys-wj34-b1B.js} +1 -1
  21. package/dist/assets/createSeriesDataSimply-D0A6SAVQ.js +1 -0
  22. package/dist/assets/customGraphicKeyframeAnimation-DWrhrHL_.js +3 -0
  23. package/dist/assets/demo-BYWHeKUe.js +1 -0
  24. package/dist/assets/demo-CPWoNtx8.js +1 -0
  25. package/dist/assets/demo-CyvJk5zV.js +1 -0
  26. package/dist/assets/demo-D4OiKplc.js +1 -0
  27. package/dist/assets/demo-DBueJg0m.js +1 -0
  28. package/dist/assets/demo-DkIhyiRK.js +1 -0
  29. package/dist/assets/demo-tpTjO0sC.js +1 -0
  30. package/dist/assets/dingtalk-sign-in-button-DSWsSruv.js +1 -0
  31. package/dist/assets/echarts-preview-DxHNfq1C.js +1 -0
  32. package/dist/assets/{echarts-runtime-CEgJbv68.js → echarts-runtime-D8kXn6ME.js} +3 -3
  33. package/dist/assets/{echarts-runtime-advanced-Buhm2BHz.js → echarts-runtime-advanced-QY8v95qK.js} +1 -1
  34. package/dist/assets/{echarts-runtime-common-DLAdBAIa.js → echarts-runtime-common-D-yqAK-r.js} +1 -1
  35. package/dist/assets/{echarts-runtime-components-ypnyLkYx.js → echarts-runtime-components-P4-i8jPU.js} +1 -1
  36. package/dist/assets/{echarts-runtime-hierarchy-ClStquCF.js → echarts-runtime-hierarchy-ByQZ-DbP.js} +1 -1
  37. package/dist/assets/floating-BFVEyPEp.js +15 -0
  38. package/dist/assets/index-BgCbGDMc.js +43 -0
  39. package/dist/assets/index-Btk35Nx-.js +23 -0
  40. package/dist/assets/index-CwNxd66J.js +1 -0
  41. package/dist/assets/index-MB-jfQld.js +686 -0
  42. package/dist/assets/index-NH3aqqQz.css +1 -0
  43. package/dist/assets/index-gFtCXH3o.js +58 -0
  44. package/dist/assets/index-um5hdKdZ.js +23 -0
  45. package/dist/assets/{labelHelper-C137W5gU.js → labelHelper-DQqRy3a_.js} +1 -1
  46. package/dist/assets/ldap-sign-in-form--6Gt3yGq.js +1 -0
  47. package/dist/assets/oidc-sign-in-button-CQdRcR_p.js +1 -0
  48. package/dist/assets/{page-context-Cxx11gzg.js → page-context-CnQ4GYM7.js} +10 -10
  49. package/dist/assets/prompt-card-B2RS4nt2.js +1 -0
  50. package/dist/assets/prompt-output-DZHRM2ft.js +1 -0
  51. package/dist/assets/saml-sign-in-button-BHL5a0JV.js +1 -0
  52. package/dist/assets/{sectorHelper-Fqgz3uEk.js → sectorHelper-DN_Vv6OL.js} +1 -1
  53. package/dist/assets/shortcut-C5x5LQWU.js +47 -0
  54. package/dist/assets/sms-sign-in-form-DTX9GV2I.js +1 -0
  55. package/dist/assets/{static.browser-CfQQzERe.js → static.browser-jI1psK0d.js} +8 -8
  56. package/dist/assets/{switch-DrxImI8F.js → switch-CRL8PmRI.js} +1 -1
  57. package/dist/assets/{tool-cards-BGfsY8JF.js → tool-cards-DFttLAfo.js} +6 -7
  58. package/dist/assets/use-authenticator-sign-in-CRGjzXju.js +1 -0
  59. package/dist/assets/use-dingtalk-sign-in-8WYzJ2jf.js +1 -0
  60. package/dist/assets/use-wecom-sign-in-C9j8wfCD.js +1 -0
  61. package/dist/assets/wecom-sign-in-button-mIS1zGSU.js +1 -0
  62. package/dist/index.html +2 -2
  63. package/dist/index.raw.html +5 -2
  64. package/package.json +3 -5
  65. package/scripts/build-html.mjs +12 -0
  66. package/src/App.css +2 -0
  67. package/src/App.tsx +35 -186
  68. package/src/app/development.tsx +154 -0
  69. package/src/app/extension.ts +5 -0
  70. package/src/app/extensions.tsx +18 -4
  71. package/src/app/routes.tsx +65 -0
  72. package/src/components/access-control/acl-bootstrap.tsx +11 -3
  73. package/src/components/access-control/acl-gate.tsx +7 -6
  74. package/src/components/access-control/can-access.tsx +17 -0
  75. package/src/components/access-control/navigate-to-accessible-resource.tsx +8 -3
  76. package/src/components/app-shell/sidebar.tsx +21 -5
  77. package/src/components/auth/auto-redirect-provider.tsx +2 -1
  78. package/src/extensions/nocobase-acl/README.md +74 -0
  79. package/{registry → src/extensions}/nocobase-acl/components/acl-boundary.tsx +22 -25
  80. package/{registry → src/extensions}/nocobase-acl/components/role-switcher.tsx +26 -23
  81. package/src/extensions/nocobase-acl/demo/acl-preview-provider.tsx +81 -0
  82. package/{registry → src/extensions}/nocobase-acl/demo/boundary-api.tsx +58 -0
  83. package/{registry → src/extensions}/nocobase-acl/demo/index.tsx +243 -105
  84. package/{registry → src/extensions}/nocobase-acl/demo/prompt-generator.tsx +3 -1
  85. package/src/extensions/nocobase-acl/extension.tsx +73 -0
  86. package/{registry → src/extensions}/nocobase-ai/README.md +21 -5
  87. package/{registry → src/extensions}/nocobase-ai/components/chat/chat-composer.tsx +3 -1
  88. package/{registry → src/extensions}/nocobase-ai/components/chat/chat-messages.tsx +38 -3
  89. package/{registry → src/extensions}/nocobase-ai/components/chat/tool-call-card.tsx +1 -9
  90. package/{registry → src/extensions}/nocobase-ai/components/index.ts +5 -0
  91. package/src/extensions/nocobase-ai/components/surfaces/chat-dialog.tsx +17 -0
  92. package/src/extensions/nocobase-ai/components/surfaces/chat-side-panel.tsx +35 -0
  93. package/src/extensions/nocobase-ai/components/surfaces/chat-surface.tsx +108 -0
  94. package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-chat-floating-trigger.tsx +2 -2
  95. package/{registry → src/extensions}/nocobase-ai/demo/configuration-gate.tsx +4 -1
  96. package/{registry → src/extensions}/nocobase-ai/demo/container-showcase.tsx +2 -2
  97. package/{registry → src/extensions}/nocobase-ai/demo/floating.tsx +45 -15
  98. package/{registry → src/extensions}/nocobase-ai/demo/index.tsx +116 -74
  99. package/{registry → src/extensions}/nocobase-ai/demo/prompt-generator.tsx +3 -3
  100. package/{registry → src/extensions}/nocobase-ai/demo/tool-cards.tsx +2 -3
  101. package/src/extensions/nocobase-ai/extension.tsx +160 -0
  102. package/{registry → src/extensions}/nocobase-ai/global-ai-chat.tsx +12 -28
  103. package/{registry → src/extensions}/nocobase-ai/providers/ai-provider.tsx +14 -1
  104. package/{registry → src/extensions}/nocobase-ai/providers/chat-context.tsx +1 -0
  105. package/{registry → src/extensions}/nocobase-ai/providers/chat-provider.tsx +29 -8
  106. package/{registry → src/extensions}/nocobase-ai/providers/use-chat-attachments.ts +6 -1
  107. package/{registry → src/extensions}/nocobase-ai/providers/use-chat-work-context.ts +4 -1
  108. package/{registry → src/extensions}/nocobase-route-surfaces/README.md +2 -1
  109. package/{registry → src/extensions}/nocobase-route-surfaces/demo/index.tsx +33 -7
  110. package/{registry → src/extensions}/nocobase-route-surfaces/demo/scenarios.ts +20 -14
  111. package/{registry → src/extensions}/nocobase-route-surfaces/extension.tsx +55 -52
  112. package/src/{pages/users → extensions/nocobase-users-example}/create.tsx +4 -4
  113. package/src/{pages/users → extensions/nocobase-users-example}/edit.tsx +5 -9
  114. package/src/extensions/nocobase-users-example/extension.tsx +109 -0
  115. package/src/{pages/users → extensions/nocobase-users-example}/form-context.ts +11 -9
  116. package/src/extensions/nocobase-users-example/layout.tsx +16 -0
  117. package/src/{pages/users → extensions/nocobase-users-example}/list.tsx +1 -1
  118. package/src/extensions/nocobase-users-example/locales/en-US.ts +77 -0
  119. package/src/extensions/nocobase-users-example/locales/index.ts +8 -0
  120. package/src/extensions/nocobase-users-example/locales/zh-CN.ts +73 -0
  121. package/src/extensions/nocobase-users-example/optional-ai.ts +67 -0
  122. package/src/{pages/users → extensions/nocobase-users-example}/role-detail.tsx +4 -15
  123. package/src/{pages/users → extensions/nocobase-users-example}/routes.ts +1 -4
  124. package/src/extensions/nocobase-users-example/show.tsx +266 -0
  125. package/src/lib/nocobase/acl/context.ts +32 -0
  126. package/src/lib/nocobase/acl/evaluator.ts +186 -0
  127. package/src/lib/nocobase/acl/hooks.ts +40 -0
  128. package/src/lib/nocobase/acl/index.ts +4 -1
  129. package/src/lib/nocobase/acl/menu.ts +6 -6
  130. package/src/lib/nocobase/acl/record-permissions.ts +37 -7
  131. package/src/lib/nocobase/acl/store-provider.tsx +14 -0
  132. package/src/lib/nocobase/acl/store.ts +92 -86
  133. package/src/lib/nocobase/acl/types.ts +52 -32
  134. package/src/lib/nocobase/auth-session.ts +128 -0
  135. package/src/lib/nocobase/client.ts +48 -50
  136. package/src/locales/en-US.ts +0 -78
  137. package/src/locales/index.ts +2 -7
  138. package/src/locales/zh-CN.ts +0 -74
  139. package/src/providers/access-control.ts +43 -8
  140. package/src/providers/auth-callback.ts +1 -0
  141. package/src/providers/auth.ts +24 -26
  142. package/src/providers/constants.ts +0 -4
  143. package/src/providers/data.ts +14 -26
  144. package/src/providers/runtime-config.ts +40 -0
  145. package/src/vite-env.d.ts +9 -0
  146. package/tests/auth-session-regression.mjs +101 -0
  147. package/tsconfig.json +2 -1
  148. package/vite.config.ts +9 -1
  149. package/dist/assets/VisualMapping-Cbv1v7Cd.js +0 -1
  150. package/dist/assets/ai-employee-shortcut-B253WWow.js +0 -1
  151. package/dist/assets/calendar-B3dXXyIv.js +0 -1
  152. package/dist/assets/chat-inline-xpQ9iq4p.js +0 -1
  153. package/dist/assets/chat-side-panel-layout-BVWsp5rr.js +0 -1
  154. package/dist/assets/components-ChhJaNRc.js +0 -20
  155. package/dist/assets/configuration-gate-Dwdq_lxf.js +0 -1
  156. package/dist/assets/createSeriesDataSimply-CI7l7Ufv.js +0 -1
  157. package/dist/assets/customGraphicKeyframeAnimation-DE3jSfMd.js +0 -3
  158. package/dist/assets/echarts-preview-C-cNUtJF.js +0 -1
  159. package/dist/assets/floating-BarTmn-b.js +0 -13
  160. package/dist/assets/index-BJIcYTdc.js +0 -53
  161. package/dist/assets/index-C6xNKxpg.js +0 -656
  162. package/dist/assets/index-D4JQi1TM.js +0 -54
  163. package/dist/assets/index-YA7-AUO8.css +0 -1
  164. package/dist/assets/index-g8zWVpP9.js +0 -23
  165. package/dist/assets/prompt-card-BsYMW_rq.js +0 -1
  166. package/dist/assets/shortcut-xtghDP63.js +0 -47
  167. package/registry/nocobase-acl/README.md +0 -19
  168. package/registry/nocobase-acl/extension.tsx +0 -71
  169. package/registry/nocobase-acl/tests/acl-regression.mjs +0 -314
  170. package/registry/nocobase-ai/components/surfaces/chat-dialog.tsx +0 -31
  171. package/registry/nocobase-ai/components/surfaces/chat-side-panel.tsx +0 -74
  172. package/registry/nocobase-ai/extension.tsx +0 -158
  173. package/registry/nocobase-ai/tests/business-report-regression.mjs +0 -70
  174. package/registry/nocobase-ai/tests/form-filler-regression.mjs +0 -129
  175. package/registry/nocobase-ai/tests/frontend-tool-regression.mjs +0 -128
  176. package/registry/nocobase-ai/tests/page-context-regression.mjs +0 -48
  177. package/registry/nocobase-ai/tests/stream-regression.mjs +0 -207
  178. package/registry/nocobase-auth-cas/README.md +0 -6
  179. package/registry/nocobase-auth-cas/cas-sign-in-button.tsx +0 -41
  180. package/registry/nocobase-auth-cas/demo.tsx +0 -20
  181. package/registry/nocobase-auth-cas/extension.tsx +0 -46
  182. package/registry/nocobase-auth-cas/index.ts +0 -1
  183. package/registry/nocobase-auth-cas/use-cas-sign-in.ts +0 -29
  184. package/registry/nocobase-auth-dingtalk/README.md +0 -7
  185. package/registry/nocobase-auth-dingtalk/auto-login-provider.tsx +0 -154
  186. package/registry/nocobase-auth-dingtalk/demo.tsx +0 -23
  187. package/registry/nocobase-auth-dingtalk/dingtalk-sign-in-button.tsx +0 -45
  188. package/registry/nocobase-auth-dingtalk/extension.tsx +0 -55
  189. package/registry/nocobase-auth-dingtalk/index.ts +0 -4
  190. package/registry/nocobase-auth-dingtalk/use-dingtalk-sign-in.ts +0 -64
  191. package/registry/nocobase-auth-ldap/README.md +0 -6
  192. package/registry/nocobase-auth-ldap/demo.tsx +0 -21
  193. package/registry/nocobase-auth-ldap/extension.tsx +0 -46
  194. package/registry/nocobase-auth-ldap/index.ts +0 -1
  195. package/registry/nocobase-auth-ldap/ldap-sign-in-form.tsx +0 -69
  196. package/registry/nocobase-auth-ldap/use-ldap-sign-in.ts +0 -5
  197. package/registry/nocobase-auth-oidc/README.md +0 -11
  198. package/registry/nocobase-auth-oidc/auto-redirect-provider.tsx +0 -13
  199. package/registry/nocobase-auth-oidc/demo.tsx +0 -20
  200. package/registry/nocobase-auth-oidc/extension.tsx +0 -51
  201. package/registry/nocobase-auth-oidc/index.ts +0 -1
  202. package/registry/nocobase-auth-oidc/oidc-sign-in-button.tsx +0 -44
  203. package/registry/nocobase-auth-oidc/use-oidc-sign-in.ts +0 -58
  204. package/registry/nocobase-auth-saml/README.md +0 -6
  205. package/registry/nocobase-auth-saml/auto-redirect-provider.tsx +0 -13
  206. package/registry/nocobase-auth-saml/demo.tsx +0 -20
  207. package/registry/nocobase-auth-saml/extension.tsx +0 -51
  208. package/registry/nocobase-auth-saml/index.ts +0 -1
  209. package/registry/nocobase-auth-saml/saml-sign-in-button.tsx +0 -43
  210. package/registry/nocobase-auth-saml/use-saml-sign-in.ts +0 -51
  211. package/registry/nocobase-auth-sms/README.md +0 -7
  212. package/registry/nocobase-auth-sms/demo.tsx +0 -25
  213. package/registry/nocobase-auth-sms/extension.tsx +0 -46
  214. package/registry/nocobase-auth-sms/index.ts +0 -1
  215. package/registry/nocobase-auth-sms/sms-sign-in-form.tsx +0 -107
  216. package/registry/nocobase-auth-sms/use-sms-sign-in.ts +0 -88
  217. package/registry/nocobase-auth-wecom/README.md +0 -6
  218. package/registry/nocobase-auth-wecom/auto-login-provider.tsx +0 -21
  219. package/registry/nocobase-auth-wecom/demo.tsx +0 -23
  220. package/registry/nocobase-auth-wecom/extension.tsx +0 -49
  221. package/registry/nocobase-auth-wecom/index.ts +0 -1
  222. package/registry/nocobase-auth-wecom/use-wecom-sign-in.ts +0 -62
  223. package/registry/nocobase-auth-wecom/wecom-sign-in-button.tsx +0 -70
  224. package/registry/nocobase-i18n/README.md +0 -44
  225. package/registry/nocobase-i18n/components/index.ts +0 -1
  226. package/registry/nocobase-i18n/components/language-switcher.tsx +0 -138
  227. package/registry/nocobase-i18n/demo/index.tsx +0 -209
  228. package/registry/nocobase-i18n/demo/prompt-generator.tsx +0 -132
  229. package/registry/nocobase-i18n/extension.tsx +0 -45
  230. package/registry/nocobase-i18n/index.ts +0 -7
  231. package/registry/nocobase-i18n/locales/en-US.ts +0 -39
  232. package/registry/nocobase-i18n/locales/index.ts +0 -8
  233. package/registry/nocobase-i18n/locales/zh-CN.ts +0 -35
  234. package/registry/nocobase-i18n/provider.tsx +0 -44
  235. package/registry/nocobase-i18n/server-resources.ts +0 -166
  236. package/registry/nocobase-i18n/tests/i18n-regression.mjs +0 -51
  237. package/registry.config.json +0 -302
  238. package/scripts/registry.mjs +0 -164
  239. package/src/components/access-control/resource-access-guard.tsx +0 -21
  240. package/src/components/access-control/use-acl-runtime.ts +0 -28
  241. package/src/lib/nocobase/acl/action.ts +0 -147
  242. package/src/pages/users/layout.tsx +0 -15
  243. package/src/pages/users/show.tsx +0 -278
  244. /package/{registry → src/extensions}/nocobase-acl/components/index.ts +0 -0
  245. /package/{registry → src/extensions}/nocobase-acl/components/role-options.ts +0 -0
  246. /package/{registry → src/extensions}/nocobase-acl/demo/components.tsx +0 -0
  247. /package/{registry → src/extensions}/nocobase-acl/demo/lazy-route.tsx +0 -0
  248. /package/{registry → src/extensions}/nocobase-acl/demo/role-switcher-prompt-generator.tsx +0 -0
  249. /package/{registry → src/extensions}/nocobase-acl/demo/scenario-section.tsx +0 -0
  250. /package/{registry → src/extensions}/nocobase-acl/index.ts +0 -0
  251. /package/{registry → src/extensions}/nocobase-ai/adapters/react-hook-form.ts +0 -0
  252. /package/{registry → src/extensions}/nocobase-ai/assets/nocobase-ai-chat.svg +0 -0
  253. /package/{registry → src/extensions}/nocobase-ai/components/ai-root-provider.tsx +0 -0
  254. /package/{registry → src/extensions}/nocobase-ai/components/chat/ai-employee-avatar.tsx +0 -0
  255. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-attachment.tsx +0 -0
  256. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-compact.tsx +0 -0
  257. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-empty-state.tsx +0 -0
  258. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-header.tsx +0 -0
  259. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-history-dialog.tsx +0 -0
  260. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-message.tsx +0 -0
  261. /package/{registry → src/extensions}/nocobase-ai/components/chat/chat-window.tsx +0 -0
  262. /package/{registry → src/extensions}/nocobase-ai/components/chat/conversation-list.tsx +0 -0
  263. /package/{registry → src/extensions}/nocobase-ai/components/chat/markdown-message.tsx +0 -0
  264. /package/{registry → src/extensions}/nocobase-ai/components/chat/model-select-options.tsx +0 -0
  265. /package/{registry → src/extensions}/nocobase-ai/components/chat/reasoning-panel.tsx +0 -0
  266. /package/{registry → src/extensions}/nocobase-ai/components/chat/sub-agent-conversation.tsx +0 -0
  267. /package/{registry → src/extensions}/nocobase-ai/components/chat/user-prompt-editor.tsx +0 -0
  268. /package/{registry → src/extensions}/nocobase-ai/components/chat/work-context-chip.tsx +0 -0
  269. /package/{registry → src/extensions}/nocobase-ai/components/page-elements/ai-form.tsx +0 -0
  270. /package/{registry → src/extensions}/nocobase-ai/components/page-elements/page-element-provider.tsx +0 -0
  271. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-inline.tsx +0 -0
  272. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-page.tsx +0 -0
  273. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-side-panel-layout.tsx +0 -0
  274. /package/{registry → src/extensions}/nocobase-ai/components/surfaces/chat-surface-actions.tsx +0 -0
  275. /package/{registry → src/extensions}/nocobase-ai/components/tools/builtin-tool-renderers.tsx +0 -0
  276. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-dialog.tsx +0 -0
  277. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-renderer.tsx +0 -0
  278. /package/{registry → src/extensions}/nocobase-ai/components/tools/business-report-utils.tsx +0 -0
  279. /package/{registry → src/extensions}/nocobase-ai/components/tools/chart-renderer.tsx +0 -0
  280. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-preview.tsx +0 -0
  281. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-advanced.ts +0 -0
  282. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-common.ts +0 -0
  283. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-components.ts +0 -0
  284. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime-hierarchy.ts +0 -0
  285. /package/{registry → src/extensions}/nocobase-ai/components/tools/echarts-runtime.ts +0 -0
  286. /package/{registry → src/extensions}/nocobase-ai/components/tools/sub-agent-renderer.tsx +0 -0
  287. /package/{registry → src/extensions}/nocobase-ai/components/tools/suggestions-renderer.tsx +0 -0
  288. /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-provider.tsx +0 -0
  289. /package/{registry → src/extensions}/nocobase-ai/components/tools/tool-renderer-utils.ts +0 -0
  290. /package/{registry → src/extensions}/nocobase-ai/components/tools/workflow-renderer.tsx +0 -0
  291. /package/{registry → src/extensions}/nocobase-ai/components/triggers/ai-employee-shortcut.tsx +0 -0
  292. /package/{registry → src/extensions}/nocobase-ai/demo/interaction-showcase.tsx +0 -0
  293. /package/{registry → src/extensions}/nocobase-ai/demo/page-context-prompt-generator.tsx +0 -0
  294. /package/{registry → src/extensions}/nocobase-ai/demo/page-context.tsx +0 -0
  295. /package/{registry → src/extensions}/nocobase-ai/demo/page-element-showcase.tsx +0 -0
  296. /package/{registry → src/extensions}/nocobase-ai/demo/prompt-card.tsx +0 -0
  297. /package/{registry → src/extensions}/nocobase-ai/demo/shortcut.tsx +0 -0
  298. /package/{registry → src/extensions}/nocobase-ai/index.ts +0 -0
  299. /package/{registry → src/extensions}/nocobase-ai/providers/avatars.ts +0 -0
  300. /package/{registry → src/extensions}/nocobase-ai/providers/chat-controller.ts +0 -0
  301. /package/{registry → src/extensions}/nocobase-ai/providers/chat-message-utils.ts +0 -0
  302. /package/{registry → src/extensions}/nocobase-ai/providers/chat-reducer.ts +0 -0
  303. /package/{registry → src/extensions}/nocobase-ai/providers/chat-task-utils.ts +0 -0
  304. /package/{registry → src/extensions}/nocobase-ai/providers/chat-transport.ts +0 -0
  305. /package/{registry → src/extensions}/nocobase-ai/providers/form-registry.tsx +0 -0
  306. /package/{registry → src/extensions}/nocobase-ai/providers/frontend-tool-registry.tsx +0 -0
  307. /package/{registry → src/extensions}/nocobase-ai/providers/index.ts +0 -0
  308. /package/{registry → src/extensions}/nocobase-ai/providers/model.ts +0 -0
  309. /package/{registry → src/extensions}/nocobase-ai/providers/page-context.tsx +0 -0
  310. /package/{registry → src/extensions}/nocobase-ai/providers/stream-coalescer.ts +0 -0
  311. /package/{registry → src/extensions}/nocobase-ai/providers/stream-event-utils.ts +0 -0
  312. /package/{registry → src/extensions}/nocobase-ai/providers/stream-parser.ts +0 -0
  313. /package/{registry → src/extensions}/nocobase-ai/providers/sub-agent-stream.ts +0 -0
  314. /package/{registry → src/extensions}/nocobase-ai/providers/types.ts +0 -0
  315. /package/{registry → src/extensions}/nocobase-ai/providers/ui-message-stream.ts +0 -0
  316. /package/{registry → src/extensions}/nocobase-ai/providers/use-automatic-tool-approval.ts +0 -0
  317. /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-message-actions.ts +0 -0
  318. /package/{registry → src/extensions}/nocobase-ai/providers/use-chat-runtime.ts +0 -0
  319. /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-catalog.ts +0 -0
  320. /package/{registry → src/extensions}/nocobase-ai/providers/use-conversation-history.ts +0 -0
  321. /package/{registry → src/extensions}/nocobase-ai/services/index.ts +0 -0
  322. /package/{registry → src/extensions}/nocobase-ai/services/nocobase-ai-service.ts +0 -0
  323. /package/{registry → src/extensions}/nocobase-ai/services/types.ts +0 -0
  324. /package/{registry → src/extensions}/nocobase-route-surfaces/demo/lazy-route.tsx +0 -0
  325. /package/{registry → src/extensions}/nocobase-route-surfaces/demo/prompt-generator.tsx +0 -0
  326. /package/{registry → src/extensions}/nocobase-route-surfaces/index.ts +0 -0
  327. /package/{registry → src/extensions}/nocobase-route-surfaces/route-dialog.tsx +0 -0
  328. /package/{registry → src/extensions}/nocobase-route-surfaces/route-drawer.tsx +0 -0
  329. /package/{registry → src/extensions}/nocobase-route-surfaces/route-page.tsx +0 -0
  330. /package/{registry → src/extensions}/nocobase-route-surfaces/route-surface-context.ts +0 -0
  331. /package/{registry → src/extensions}/nocobase-route-surfaces/use-refine-unsaved-changes.tsx +0 -0
  332. /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-close.ts +0 -0
  333. /package/{registry → src/extensions}/nocobase-route-surfaces/use-route-surface-state.ts +0 -0
  334. /package/src/{pages/users → extensions/nocobase-users-example}/form-fields.tsx +0 -0
  335. /package/src/{pages/users → extensions/nocobase-users-example}/index.ts +0 -0
  336. /package/src/{pages/users → extensions/nocobase-users-example}/role-badges.tsx +0 -0
  337. /package/src/{pages/users → extensions/nocobase-users-example}/role-utils.ts +0 -0
  338. /package/src/{pages/users → extensions/nocobase-users-example}/types.ts +0 -0
@@ -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
- }
@@ -1,58 +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
- export function useOidcSignIn(authenticator: Authenticator) {
8
- const [searchParams] = useSearchParams();
9
- const [isPending, setIsPending] = useState(false);
10
- const [error, setError] = useState<Error>();
11
- const callbackError = useMemo(() => {
12
- if (searchParams.get("authenticator") !== authenticator.name) {
13
- return undefined;
14
- }
15
- const message = searchParams.get("error");
16
- return message ? new Error(message) : undefined;
17
- }, [authenticator.name, searchParams]);
18
-
19
- const signIn = useCallback(async () => {
20
- setError(undefined);
21
- setIsPending(true);
22
-
23
- try {
24
- const redirect =
25
- searchParams.get("to") || searchParams.get("redirect") || "/";
26
- const authUrl = await nocobaseClient.action<string>(
27
- "oidc",
28
- "getAuthUrl",
29
- {
30
- method: "POST",
31
- authenticator: authenticator.name,
32
- includeRole: false,
33
- withAclMeta: false,
34
- body: { redirect },
35
- }
36
- );
37
-
38
- if (!authUrl) {
39
- throw new Error("NocoBase did not return an OIDC authorization URL.");
40
- }
41
-
42
- window.location.replace(nocobaseClient.resolveUrl(authUrl));
43
- } catch (cause) {
44
- setError(
45
- cause instanceof Error
46
- ? cause
47
- : new Error("Unable to start OIDC sign-in.")
48
- );
49
- setIsPending(false);
50
- }
51
- }, [authenticator.name, searchParams]);
52
-
53
- return {
54
- signIn,
55
- isPending,
56
- error: error ?? callbackError,
57
- };
58
- }
@@ -1,6 +0,0 @@
1
- # NocoBase SAML authentication
2
-
3
- Adds dynamic SAML sign-in, callback error handling, automatic redirect support,
4
- and the `useSamlSignIn` hook for custom login UI.
5
-
6
- Installing the Registry also adds a SAML component Demo under Authentication.
@@ -1,13 +0,0 @@
1
- import type { PropsWithChildren } from "react";
2
-
3
- import { AuthAutoRedirectProvider } from "@/components/auth";
4
-
5
- export default function SamlAutoRedirectProvider({
6
- children,
7
- }: PropsWithChildren) {
8
- return (
9
- <AuthAutoRedirectProvider resource="saml" action="checkRedirect">
10
- {children}
11
- </AuthAutoRedirectProvider>
12
- );
13
- }
@@ -1,20 +0,0 @@
1
- import { AuthMethodDemo } from "@/components/auth/demo";
2
- import SamlSignInButton from "./saml-sign-in-button";
3
-
4
- const authenticator = {
5
- name: "company-saml",
6
- authType: "SAML",
7
- title: "Company SAML",
8
- };
9
-
10
- export function SamlAuthDemoPage() {
11
- return (
12
- <AuthMethodDemo
13
- authType="SAML"
14
- methodName="SAML"
15
- description="Start an identity-provider redirect and return through the Starter's shared authentication callback."
16
- >
17
- <SamlSignInButton authenticator={authenticator} onSignIn={() => {}} />
18
- </AuthMethodDemo>
19
- );
20
- }
@@ -1,51 +0,0 @@
1
- import { lazy } from "react";
2
- import { BadgeCheck } 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 SamlSignInButton = lazy(() => import("./saml-sign-in-button"));
9
- const SamlAutoRedirectProvider = lazy(
10
- () => import("./auto-redirect-provider")
11
- );
12
- const SamlAuthDemoPage = lazy(() =>
13
- import("./demo").then((module) => ({ default: module.SamlAuthDemoPage }))
14
- );
15
-
16
- const samlAuthExtension: AppExtension = {
17
- id: "nocobase-auth-saml",
18
- AuthRuntimeProvider: SamlAutoRedirectProvider,
19
- authRuntimePriority: 20,
20
- resources: [
21
- {
22
- name: "auth-saml-demo",
23
- list: "/auth/saml",
24
- meta: {
25
- parent: "auth-components",
26
- label: "SAML",
27
- icon: <BadgeCheck />,
28
- acl: { type: "authenticated" },
29
- },
30
- },
31
- ],
32
- routes: (
33
- <Route
34
- path="/auth/saml"
35
- element={
36
- <AuthDemoRoute>
37
- <SamlAuthDemoPage />
38
- </AuthDemoRoute>
39
- }
40
- />
41
- ),
42
- authAdapters: [
43
- {
44
- authType: "SAML",
45
- placement: "button",
46
- Component: SamlSignInButton,
47
- },
48
- ],
49
- };
50
-
51
- export default samlAuthExtension;
@@ -1 +0,0 @@
1
- export { useSamlSignIn } from "./use-saml-sign-in";
@@ -1,43 +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 { useSamlSignIn } from "./use-saml-sign-in";
13
-
14
- export default function SamlSignInButton({
15
- authenticator,
16
- onSignIn,
17
- }: AuthenticatorComponentProps & { onSignIn?: () => void }) {
18
- const { signIn, isPending, error } = useSamlSignIn(authenticator);
19
- return (
20
- <div className="space-y-3">
21
- {error && (
22
- <Alert variant="destructive">
23
- <AlertTitle>SAML 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
- <LogIn />
35
- {!onSignIn && isPending
36
- ? "Redirecting…"
37
- : resolveTranslatableText(
38
- authenticator.title || authenticator.authTypeTitle || "SAML"
39
- )}
40
- </Button>
41
- </div>
42
- );
43
- }
@@ -1,51 +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
- export function useSamlSignIn(authenticator: Authenticator) {
8
- const [searchParams] = useSearchParams();
9
- const [isPending, setIsPending] = useState(false);
10
- const [error, setError] = useState<Error>();
11
- const callbackError = useMemo(() => {
12
- if (searchParams.get("authenticator") !== authenticator.name) {
13
- return undefined;
14
- }
15
- const message = searchParams.get("error");
16
- return message ? new Error(message) : undefined;
17
- }, [authenticator.name, searchParams]);
18
-
19
- const signIn = useCallback(async () => {
20
- setError(undefined);
21
- setIsPending(true);
22
- try {
23
- const redirect =
24
- searchParams.get("to") || searchParams.get("redirect") || "/";
25
- const authUrl = await nocobaseClient.action<string>(
26
- "saml",
27
- "getAuthUrl",
28
- {
29
- method: "POST",
30
- authenticator: authenticator.name,
31
- includeRole: false,
32
- withAclMeta: false,
33
- body: { redirect },
34
- }
35
- );
36
- if (!authUrl) {
37
- throw new Error("NocoBase did not return a SAML authorization URL.");
38
- }
39
- window.location.replace(nocobaseClient.resolveUrl(authUrl));
40
- } catch (cause) {
41
- setError(
42
- cause instanceof Error
43
- ? cause
44
- : new Error("Unable to start SAML sign-in.")
45
- );
46
- setIsPending(false);
47
- }
48
- }, [authenticator.name, searchParams]);
49
-
50
- return { signIn, isPending, error: error ?? callbackError };
51
- }
@@ -1,7 +0,0 @@
1
- # NocoBase SMS authentication
2
-
3
- Adds phone and verification-code sign-in to the dynamic login page. The
4
- `useSmsSignIn` hook exposes code delivery, countdown state, and sign-in for
5
- custom UI.
6
-
7
- Installing the Registry also adds an SMS component Demo under Authentication.
@@ -1,25 +0,0 @@
1
- import { AuthMethodDemo } from "@/components/auth/demo";
2
- import SmsSignInForm from "./sms-sign-in-form";
3
-
4
- const authenticator = {
5
- name: "company-sms",
6
- authType: "SMS",
7
- title: "SMS verification code",
8
- options: { autoSignup: true, verifier: "login-sms" },
9
- };
10
-
11
- export function SmsAuthDemoPage() {
12
- return (
13
- <AuthMethodDemo
14
- authType="SMS"
15
- methodName="SMS verification code"
16
- description="Collect a phone number and one-time code while keeping delivery and sign-in bound to the configured verifier."
17
- >
18
- <SmsSignInForm
19
- authenticator={authenticator}
20
- onSendCode={() => {}}
21
- onSignIn={() => {}}
22
- />
23
- </AuthMethodDemo>
24
- );
25
- }