@contember/create 2.1.0-alpha.3 → 2.1.0-alpha.35

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 (314) hide show
  1. package/dist/development/run.cjs +6 -4
  2. package/dist/development/run.cjs.map +1 -1
  3. package/dist/development/run.js +6 -4
  4. package/dist/development/run.js.map +1 -1
  5. package/dist/development/src/commands/WorkspaceCreateCommand.cjs +37 -23
  6. package/dist/development/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  7. package/dist/development/src/commands/WorkspaceCreateCommand.js +37 -23
  8. package/dist/development/src/commands/WorkspaceCreateCommand.js.map +1 -1
  9. package/dist/development/src/lib/FileSystem.cjs +1 -0
  10. package/dist/development/src/lib/FileSystem.cjs.map +1 -1
  11. package/dist/development/src/lib/FileSystem.js +1 -0
  12. package/dist/development/src/lib/FileSystem.js.map +1 -1
  13. package/dist/development/src/lib/TemplateInstaller.cjs +28 -12
  14. package/dist/development/src/lib/TemplateInstaller.cjs.map +1 -1
  15. package/dist/development/src/lib/TemplateInstaller.js +28 -12
  16. package/dist/development/src/lib/TemplateInstaller.js.map +1 -1
  17. package/dist/development/src/lib/packageManagerDetector.cjs +22 -0
  18. package/dist/development/src/lib/packageManagerDetector.cjs.map +1 -0
  19. package/dist/development/src/lib/packageManagerDetector.js +22 -0
  20. package/dist/development/src/lib/packageManagerDetector.js.map +1 -0
  21. package/dist/development/src/lib/version.cjs.map +1 -1
  22. package/dist/development/src/lib/version.js.map +1 -1
  23. package/dist/development/src/paths.cjs.map +1 -1
  24. package/dist/development/src/paths.js.map +1 -1
  25. package/dist/production/run.cjs +6 -4
  26. package/dist/production/run.cjs.map +1 -1
  27. package/dist/production/run.js +6 -4
  28. package/dist/production/run.js.map +1 -1
  29. package/dist/production/src/commands/WorkspaceCreateCommand.cjs +37 -23
  30. package/dist/production/src/commands/WorkspaceCreateCommand.cjs.map +1 -1
  31. package/dist/production/src/commands/WorkspaceCreateCommand.js +37 -23
  32. package/dist/production/src/commands/WorkspaceCreateCommand.js.map +1 -1
  33. package/dist/production/src/lib/FileSystem.cjs +1 -0
  34. package/dist/production/src/lib/FileSystem.cjs.map +1 -1
  35. package/dist/production/src/lib/FileSystem.js +1 -0
  36. package/dist/production/src/lib/FileSystem.js.map +1 -1
  37. package/dist/production/src/lib/TemplateInstaller.cjs +28 -12
  38. package/dist/production/src/lib/TemplateInstaller.cjs.map +1 -1
  39. package/dist/production/src/lib/TemplateInstaller.js +28 -12
  40. package/dist/production/src/lib/TemplateInstaller.js.map +1 -1
  41. package/dist/production/src/lib/packageManagerDetector.cjs +22 -0
  42. package/dist/production/src/lib/packageManagerDetector.cjs.map +1 -0
  43. package/dist/production/src/lib/packageManagerDetector.js +22 -0
  44. package/dist/production/src/lib/packageManagerDetector.js.map +1 -0
  45. package/dist/production/src/lib/version.cjs.map +1 -1
  46. package/dist/production/src/lib/version.js.map +1 -1
  47. package/dist/production/src/paths.cjs.map +1 -1
  48. package/dist/production/src/paths.js.map +1 -1
  49. package/dist/types/commands/WorkspaceCreateCommand.d.ts +4 -2
  50. package/dist/types/commands/WorkspaceCreateCommand.d.ts.map +1 -1
  51. package/dist/types/lib/FileSystem.d.ts +1 -0
  52. package/dist/types/lib/FileSystem.d.ts.map +1 -1
  53. package/dist/types/lib/TemplateInstaller.d.ts.map +1 -1
  54. package/dist/types/lib/packageManagerDetector.d.ts +3 -0
  55. package/dist/types/lib/packageManagerDetector.d.ts.map +1 -0
  56. package/package.json +15 -6
  57. package/resources/templates/{template-workspace → default}/.github/workflows/deploy.yaml +1 -1
  58. package/resources/templates/default/.gitignore.dist +154 -0
  59. package/resources/templates/default/README.md +98 -0
  60. package/resources/templates/{template-workspace → default}/admin/.env.development +1 -0
  61. package/resources/templates/default/admin/.env.production +6 -0
  62. package/resources/templates/{template-workspace → default}/admin/app/components/layout.tsx +7 -3
  63. package/resources/templates/default/admin/app/components/navigation.tsx +85 -0
  64. package/resources/templates/{template-workspace → default}/admin/app/index.tsx +4 -4
  65. package/resources/templates/default/admin/app/pages/tenant.tsx +160 -0
  66. package/resources/templates/default/admin/entrypoint/components/layout.tsx +14 -0
  67. package/resources/templates/default/admin/entrypoint/components/logged-in.tsx +47 -0
  68. package/resources/templates/default/admin/entrypoint/components/login.tsx +103 -0
  69. package/resources/templates/default/admin/entrypoint/config.ts +35 -0
  70. package/resources/templates/default/admin/entrypoint/contexts/login.tsx +18 -0
  71. package/resources/templates/default/admin/entrypoint/index.tsx +12 -0
  72. package/resources/templates/default/admin/entrypoint/login-entrypoint.tsx +24 -0
  73. package/resources/templates/default/admin/entrypoint/pages/index.tsx +48 -0
  74. package/resources/templates/default/admin/entrypoint/pages/magicLink.tsx +56 -0
  75. package/resources/templates/default/admin/entrypoint/pages/magicLinkSent.tsx +63 -0
  76. package/resources/templates/default/admin/entrypoint/pages/passwordReset.tsx +44 -0
  77. package/resources/templates/default/admin/entrypoint/pages/resetRequest.tsx +35 -0
  78. package/resources/templates/default/admin/entrypoint/pages/resetRequestSuccess.tsx +34 -0
  79. package/resources/templates/default/admin/index.css +94 -0
  80. package/resources/templates/{template-workspace → default}/admin/index.html +1 -1
  81. package/resources/templates/{template-workspace → default}/admin/lib/binding/binding.tsx +0 -2
  82. package/resources/templates/{template-workspace → default}/admin/lib/binding/hooks.tsx +14 -8
  83. package/resources/templates/default/admin/lib/binding/identity.tsx +51 -0
  84. package/resources/templates/{template-workspace → default}/admin/lib/binding/navigation-guard-dialog.tsx +12 -8
  85. package/resources/templates/{template-workspace → default}/admin/lib/binding/persist.tsx +7 -5
  86. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/block-repeater.tsx +14 -16
  87. package/resources/templates/{template-workspace → default}/admin/lib/board/board.tsx +61 -47
  88. package/resources/templates/{template-workspace → default}/admin/lib/buttons/back-button.tsx +1 -1
  89. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/cells.tsx +49 -35
  90. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-header.tsx +47 -38
  91. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/columns.tsx +128 -105
  92. package/resources/templates/default/admin/lib/datagrid/elements.tsx +63 -0
  93. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/empty.tsx +1 -1
  94. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/boolean.tsx +1 -4
  95. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/common.tsx +14 -14
  96. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/date.tsx +35 -21
  97. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/defined.tsx +0 -1
  98. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/enum.tsx +24 -30
  99. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/mobile.tsx +2 -3
  100. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/number.tsx +0 -3
  101. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/relation.tsx +36 -30
  102. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/labels.tsx +0 -1
  103. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/loader.tsx +2 -7
  104. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/pagination.tsx +33 -38
  105. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/table.tsx +8 -6
  106. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/tiles.tsx +10 -5
  107. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/toolbar.tsx +10 -7
  108. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/ui.tsx +12 -15
  109. package/resources/templates/{template-workspace → default}/admin/lib/dev/login-panel.tsx +23 -16
  110. package/resources/templates/{template-workspace → default}/admin/lib/dict.ts +17 -5
  111. package/resources/templates/default/admin/lib/dimensions/dimensions.tsx +159 -0
  112. package/resources/templates/{template-workspace → default}/admin/lib/editor/block-editor.tsx +22 -10
  113. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/baseEditorPlugins.tsx +0 -2
  114. package/resources/templates/default/admin/lib/editor/common/buttons.tsx +205 -0
  115. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-block-toolbar.tsx +3 -1
  116. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-canvas.tsx +6 -4
  117. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-editable-canvas.tsx +0 -1
  118. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/editor-inline-toolbar.tsx +5 -2
  119. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/AnchorRenderer.tsx +18 -16
  120. package/resources/templates/default/admin/lib/editor/common/elements/BlockElement.tsx +60 -0
  121. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HeadingRenderer.tsx +1 -1
  122. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableCellElementRenderer.tsx +1 -1
  123. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableElementRenderer.tsx +2 -7
  124. package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/TableRowElementRenderer.tsx +1 -5
  125. package/resources/templates/{template-workspace → default}/admin/lib/editor/editor-block.tsx +17 -10
  126. package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text-view.tsx +11 -6
  127. package/resources/templates/{template-workspace → default}/admin/lib/editor/rich-text.tsx +6 -7
  128. package/resources/templates/default/admin/lib/editor/sortable-block.tsx +57 -0
  129. package/resources/templates/default/admin/lib/form/container.tsx +72 -0
  130. package/resources/templates/{template-workspace → default}/admin/lib/form/inputs.tsx +14 -12
  131. package/resources/templates/{template-workspace → default}/admin/lib/form/select.tsx +93 -51
  132. package/resources/templates/{template-workspace → default}/admin/lib/form/ui.tsx +1 -1
  133. package/resources/templates/default/admin/lib/form/upload-repeaters.tsx +221 -0
  134. package/resources/templates/{template-workspace → default}/admin/lib/form/upload.tsx +61 -62
  135. package/resources/templates/{template-workspace → default}/admin/lib/labels/enum-labels.ts +6 -3
  136. package/resources/templates/{template-workspace → default}/admin/lib/labels/field-labels.ts +4 -2
  137. package/resources/templates/{template-workspace → default}/admin/lib/layout/layout-boxed.tsx +39 -29
  138. package/resources/templates/{template-workspace → default}/admin/lib/layout/slots.tsx +1 -4
  139. package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/outdated-application-dialog.tsx +10 -4
  140. package/resources/templates/{template-workspace → default}/admin/lib/repeater/repeater.tsx +24 -15
  141. package/resources/templates/{template-workspace → default}/admin/lib/select/create-new.tsx +0 -3
  142. package/resources/templates/{template-workspace → default}/admin/lib/select/filter.tsx +0 -1
  143. package/resources/templates/{template-workspace → default}/admin/lib/select/list.tsx +33 -28
  144. package/resources/templates/default/admin/lib/select/multi-select.tsx +92 -0
  145. package/resources/templates/default/admin/lib/select/select.tsx +109 -0
  146. package/resources/templates/default/admin/lib/select/sortable-select.tsx +138 -0
  147. package/resources/templates/{template-workspace → default}/admin/lib/select/ui.tsx +13 -11
  148. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/change-my-password.tsx +21 -8
  149. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/common.tsx +21 -12
  150. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/create-api-key.tsx +9 -5
  151. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/invite.tsx +12 -7
  152. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/login.tsx +26 -7
  153. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/memberships-control.tsx +32 -20
  154. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset-request.tsx +9 -5
  155. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/password-reset.tsx +21 -8
  156. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin-init.tsx +9 -5
  157. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/passwordless-signin.tsx +25 -12
  158. package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/update-project-member.tsx +3 -4
  159. package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInviteUser.tsx +2 -3
  160. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/api-key-list.tsx +5 -3
  161. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-delete-dialog.tsx +13 -2
  162. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/member-list.tsx +17 -11
  163. package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/person-list.tsx +6 -4
  164. package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/otp-setup.tsx +86 -59
  165. package/resources/templates/default/admin/lib/toast/toast.tsx +113 -0
  166. package/resources/templates/{template-workspace → default}/admin/lib/toast/toaster.tsx +0 -1
  167. package/resources/templates/{template-workspace → default}/admin/lib/ui/alert-dialog.tsx +4 -3
  168. package/resources/templates/default/admin/lib/ui/button.tsx +30 -0
  169. package/resources/templates/{template-workspace → default}/admin/lib/ui/card.tsx +1 -1
  170. package/resources/templates/{template-workspace → default}/admin/lib/ui/dialog.tsx +12 -8
  171. package/resources/templates/default/admin/lib/ui/dimension.tsx +9 -0
  172. package/resources/templates/{template-workspace → default}/admin/lib/ui/dropdown.tsx +18 -15
  173. package/resources/templates/default/admin/lib/ui/input.tsx +68 -0
  174. package/resources/templates/{template-workspace → default}/admin/lib/ui/loader.tsx +1 -1
  175. package/resources/templates/{template-workspace → default}/admin/lib/ui/menu.tsx +3 -11
  176. package/resources/templates/{template-workspace → default}/admin/lib/ui/overlay.tsx +11 -9
  177. package/resources/templates/{template-workspace → default}/admin/lib/ui/popover.tsx +2 -2
  178. package/resources/templates/{template-workspace → default}/admin/lib/ui/property-list.tsx +5 -5
  179. package/resources/templates/{template-workspace → default}/admin/lib/ui/scroll-area.tsx +11 -11
  180. package/resources/templates/{template-workspace → default}/admin/lib/ui/select.tsx +4 -5
  181. package/resources/templates/{template-workspace → default}/admin/lib/ui/sheet.tsx +9 -8
  182. package/resources/templates/{template-workspace → default}/admin/lib/ui/sidebar.tsx +53 -42
  183. package/resources/templates/{template-workspace → default}/admin/lib/ui/sortable.tsx +1 -1
  184. package/resources/templates/default/admin/lib/ui/switch.tsx +11 -0
  185. package/resources/templates/{template-workspace → default}/admin/lib/ui/table.tsx +3 -3
  186. package/resources/templates/{template-workspace → default}/admin/lib/ui/textarea.tsx +10 -7
  187. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle-group.tsx +9 -5
  188. package/resources/templates/{template-workspace → default}/admin/lib/ui/toggle.tsx +3 -5
  189. package/resources/templates/{template-workspace → default}/admin/lib/ui/tooltip.tsx +4 -3
  190. package/resources/templates/{template-workspace → default}/admin/lib/upload/dropzone.tsx +14 -10
  191. package/resources/templates/{template-workspace → default}/admin/lib/upload/repeater.tsx +0 -1
  192. package/resources/templates/{template-workspace → default}/admin/lib/upload/ui.tsx +4 -8
  193. package/resources/templates/{template-workspace → default}/admin/lib/upload/upload-progress.tsx +28 -12
  194. package/resources/templates/{template-workspace → default}/admin/lib/upload/view.tsx +130 -68
  195. package/resources/templates/{template-workspace → default}/admin/lib/utils/createComponentOpenHooks.tsx +10 -6
  196. package/resources/templates/{template-workspace → default}/admin/lib/utils/uic.tsx +24 -14
  197. package/resources/templates/{template-workspace → default}/admin/lib/utils/use-mobile.ts +1 -3
  198. package/resources/templates/{template-workspace → default}/admin/package.json +6 -4
  199. package/resources/templates/default/admin/sentry.ts +26 -0
  200. package/resources/templates/{template-workspace → default}/admin/tsconfig.json +1 -9
  201. package/resources/templates/default/admin/vite-env.d.ts +12 -0
  202. package/resources/templates/default/admin/vite.config.ts +11 -0
  203. package/resources/templates/default/api/README.md +87 -0
  204. package/resources/templates/{template-workspace → default}/biome.json +1 -1
  205. package/resources/templates/default/client/README.md +285 -0
  206. package/resources/templates/{template-workspace → default}/contember.template.yaml +5 -0
  207. package/resources/templates/{template-workspace → default}/package.json +1 -1
  208. package/resources/templates/default/scripts/generate-client.sh +7 -0
  209. package/resources/templates/default/scripts/update-ui-lib.sh +344 -0
  210. package/src/commands/WorkspaceCreateCommand.ts +41 -25
  211. package/src/lib/FileSystem.ts +1 -0
  212. package/src/lib/TemplateInstaller.ts +32 -12
  213. package/src/lib/packageManagerDetector.ts +24 -0
  214. package/src/run.ts +8 -7
  215. package/dist/types/tsconfig.tsbuildinfo +0 -1
  216. package/resources/templates/template-workspace/.gitignore.dist +0 -3
  217. package/resources/templates/template-workspace/admin/app/components/navigation.tsx +0 -1
  218. package/resources/templates/template-workspace/admin/index.css +0 -53
  219. package/resources/templates/template-workspace/admin/index.tsx +0 -268
  220. package/resources/templates/template-workspace/admin/lib/binding/identity.tsx +0 -50
  221. package/resources/templates/template-workspace/admin/lib/datagrid/elements.tsx +0 -48
  222. package/resources/templates/template-workspace/admin/lib/dimensions/dimensions.tsx +0 -135
  223. package/resources/templates/template-workspace/admin/lib/editor/common/buttons.tsx +0 -83
  224. package/resources/templates/template-workspace/admin/lib/editor/common/elements/BlockElement.tsx +0 -48
  225. package/resources/templates/template-workspace/admin/lib/editor/sortable-block.tsx +0 -51
  226. package/resources/templates/template-workspace/admin/lib/form/container.tsx +0 -59
  227. package/resources/templates/template-workspace/admin/lib/form/upload-repeaters.tsx +0 -188
  228. package/resources/templates/template-workspace/admin/lib/select/multi-select.tsx +0 -96
  229. package/resources/templates/template-workspace/admin/lib/select/select.tsx +0 -104
  230. package/resources/templates/template-workspace/admin/lib/select/sortable-select.tsx +0 -136
  231. package/resources/templates/template-workspace/admin/lib/toast/toast.tsx +0 -112
  232. package/resources/templates/template-workspace/admin/lib/ui/button.tsx +0 -29
  233. package/resources/templates/template-workspace/admin/lib/ui/input.tsx +0 -69
  234. package/resources/templates/template-workspace/admin/lib/ui/switch.tsx +0 -9
  235. package/resources/templates/template-workspace/admin/postcss.config.js +0 -6
  236. package/resources/templates/template-workspace/admin/tailwind.config.js +0 -73
  237. package/resources/templates/template-workspace/admin/vite-env.d.ts +0 -7
  238. package/resources/templates/template-workspace/scripts/generate-client.sh +0 -8
  239. package/resources/templates/{template-workspace → default}/.github/scripts/setup-actions-variables.sh +0 -0
  240. package/resources/templates/{template-workspace → default}/admin/app/components/logo.tsx +0 -0
  241. package/resources/templates/{template-workspace → default}/admin/app/config.ts +0 -0
  242. package/resources/templates/{template-workspace → default}/admin/app/index.html +0 -0
  243. package/resources/templates/{template-workspace → default}/admin/app/pages/index.tsx +0 -0
  244. package/resources/templates/{template-workspace → default}/admin/lib/binding/delete.tsx +0 -0
  245. package/resources/templates/{template-workspace → default}/admin/lib/binding/index.ts +0 -0
  246. package/resources/templates/{template-workspace → default}/admin/lib/block-repeater/index.ts +0 -0
  247. package/resources/templates/{template-workspace → default}/admin/lib/board/index.ts +0 -0
  248. package/resources/templates/{template-workspace → default}/admin/lib/buttons/index.ts +0 -0
  249. package/resources/templates/{template-workspace → default}/admin/lib/buttons/link-back-button.tsx +0 -0
  250. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/column-leaf.tsx +0 -0
  251. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/export.tsx +0 -0
  252. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/index.ts +0 -0
  253. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/filters/text.tsx +0 -0
  254. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/grid.tsx +0 -0
  255. package/resources/templates/{template-workspace → default}/admin/lib/datagrid/index.ts +21 -21
  256. /package/resources/templates/{template-workspace → default}/admin/lib/datagrid/layout-switcher.tsx +0 -0
  257. /package/resources/templates/{template-workspace → default}/admin/lib/dev/index.ts +0 -0
  258. /package/resources/templates/{template-workspace → default}/admin/lib/dev/todo.tsx +0 -0
  259. /package/resources/templates/{template-workspace → default}/admin/lib/dimensions/index.ts +0 -0
  260. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/HorizontalRuleRenderer.tsx +0 -0
  261. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ListItemRenderer.tsx +0 -0
  262. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/OrderedListRenderer.tsx +0 -0
  263. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ParagraphRenderer.tsx +0 -0
  264. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/ScrollTargetRenderer.tsx +0 -0
  265. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/elements/UnorderedListRenderer.tsx +0 -0
  266. /package/resources/templates/{template-workspace → default}/admin/lib/editor/common/index.ts +0 -0
  267. /package/resources/templates/{template-workspace → default}/admin/lib/editor/index.ts +0 -0
  268. /package/resources/templates/{template-workspace → default}/admin/lib/editor/plugins.tsx +0 -0
  269. /package/resources/templates/{template-workspace → default}/admin/lib/errors/error-boundary.tsx +0 -0
  270. /package/resources/templates/{template-workspace → default}/admin/lib/errors/index.ts +0 -0
  271. /package/resources/templates/{template-workspace → default}/admin/lib/errors/use-error-formatter.ts +0 -0
  272. /package/resources/templates/{template-workspace → default}/admin/lib/field/formatted-field.tsx +0 -0
  273. /package/resources/templates/{template-workspace → default}/admin/lib/field/index.ts +0 -0
  274. /package/resources/templates/{template-workspace → default}/admin/lib/form/index.ts +0 -0
  275. /package/resources/templates/{template-workspace → default}/admin/lib/form/labels.tsx +0 -0
  276. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/formatting.ts +0 -0
  277. /package/resources/templates/{template-workspace → default}/admin/lib/formatting/index.ts +0 -0
  278. /package/resources/templates/{template-workspace → default}/admin/lib/images/formatImageResizeUrl.ts +0 -0
  279. /package/resources/templates/{template-workspace → default}/admin/lib/images/index.ts +0 -0
  280. /package/resources/templates/{template-workspace → default}/admin/lib/labels/index.ts +0 -0
  281. /package/resources/templates/{template-workspace → default}/admin/lib/layout/index.ts +0 -0
  282. /package/resources/templates/{template-workspace → default}/admin/lib/layout/layout.tsx +0 -0
  283. /package/resources/templates/{template-workspace → default}/admin/lib/outdated-application-dialog/index.ts +0 -0
  284. /package/resources/templates/{template-workspace → default}/admin/lib/repeater/index.ts +0 -0
  285. /package/resources/templates/{template-workspace → default}/admin/lib/select/highlight.tsx +0 -0
  286. /package/resources/templates/{template-workspace → default}/admin/lib/select/index.ts +0 -0
  287. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/forms/index.ts +0 -0
  288. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/hooks/useInvite.ts +0 -0
  289. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/index.ts +0 -0
  290. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/listing/index.ts +0 -0
  291. /package/resources/templates/{template-workspace → default}/admin/lib/tenant/otp/index.ts +0 -0
  292. /package/resources/templates/{template-workspace → default}/admin/lib/toast/index.ts +0 -0
  293. /package/resources/templates/{template-workspace → default}/admin/lib/ui/avatar.tsx +0 -0
  294. /package/resources/templates/{template-workspace → default}/admin/lib/ui/collapsible.tsx +0 -0
  295. /package/resources/templates/{template-workspace → default}/admin/lib/ui/divider.tsx +0 -0
  296. /package/resources/templates/{template-workspace → default}/admin/lib/ui/label.tsx +0 -0
  297. /package/resources/templates/{template-workspace → default}/admin/lib/ui/progress.tsx +0 -0
  298. /package/resources/templates/{template-workspace → default}/admin/lib/ui/separator.tsx +0 -0
  299. /package/resources/templates/{template-workspace → default}/admin/lib/ui/skeleton.tsx +0 -0
  300. /package/resources/templates/{template-workspace → default}/admin/lib/upload/index.ts +0 -0
  301. /package/resources/templates/{template-workspace → default}/admin/lib/utils/cn.ts +0 -0
  302. /package/resources/templates/{template-workspace → default}/admin/lib/utils/index.ts +0 -0
  303. /package/resources/templates/{template-workspace → default}/admin/public/favicon.png +0 -0
  304. /package/resources/templates/{template-workspace → default}/api/index.ts +0 -0
  305. /package/resources/templates/{template-workspace → default}/api/migrations/.gitkeep +0 -0
  306. /package/resources/templates/{template-workspace → default}/api/model/index.ts +0 -0
  307. /package/resources/templates/{template-workspace → default}/api/package.json +0 -0
  308. /package/resources/templates/{template-workspace → default}/api/tsconfig.json +0 -0
  309. /package/resources/templates/{template-workspace → default}/client/package.json +0 -0
  310. /package/resources/templates/{template-workspace → default}/client/src/index.ts +0 -0
  311. /package/resources/templates/{template-workspace → default}/client/tsconfig.json +0 -0
  312. /package/resources/templates/{template-workspace → default}/docker-compose.yaml +0 -0
  313. /package/resources/templates/{template-workspace → default}/tsconfig.json +0 -0
  314. /package/resources/templates/{template-workspace → default}/tsconfig.settings.json +0 -0
@@ -0,0 +1,160 @@
1
+ import { useProjectSlug } from '@contember/react-client'
2
+ import { ChangeMyPasswordForm, CreateApiKeyForm, InviteForm } from '@contember/react-identity'
3
+ import { KeyRoundIcon, LockKeyholeIcon, UsersIcon } from 'lucide-react'
4
+ import { ReactNode, useRef } from 'react'
5
+ import { Slots } from '~/lib/layout'
6
+ import {
7
+ ApiKeyList,
8
+ ChangeMyPasswordFormFields,
9
+ CreateApiKeyFormFields,
10
+ InviteFormFields,
11
+ MemberListController,
12
+ OtpSetup,
13
+ PersonList,
14
+ } from '~/lib/tenant'
15
+ import { ToastContent, useShowToast } from '~/lib/toast'
16
+ import { Card, CardContent, CardHeader, CardTitle } from '~/lib/ui/card'
17
+ import { Input } from '~/lib/ui/input'
18
+
19
+ const Title = ({ icon, children }: { icon?: ReactNode; children: ReactNode }) => {
20
+ return (
21
+ <div className="flex items-center">
22
+ {icon && <div className="mr-2">{icon}</div>}
23
+ <h1>{children}</h1>
24
+ </div>
25
+ )
26
+ }
27
+
28
+ export const Security = () => {
29
+ const showToast = useShowToast()
30
+
31
+ return (
32
+ <>
33
+ <Slots.Title>
34
+ <Title icon={<LockKeyholeIcon />}>Security</Title>
35
+ </Slots.Title>
36
+
37
+ <div className="flex flex-col gap-4">
38
+ <Card className="w-[40rem] max-w-full">
39
+ <CardHeader>
40
+ <CardTitle className="text-2xl">Change Password</CardTitle>
41
+ </CardHeader>
42
+ <CardContent>
43
+ <ChangeMyPasswordForm onSuccess={() => showToast(
44
+ <ToastContent>Password changed</ToastContent>, { type: 'success' })}>
45
+ <form className="grid gap-4">
46
+ <ChangeMyPasswordFormFields />
47
+ </form>
48
+ </ChangeMyPasswordForm>
49
+ </CardContent>
50
+ </Card>
51
+ <Card className="w-[40rem] max-w-full">
52
+ <CardHeader>
53
+ <CardTitle className="text-2xl">Two-factor setup</CardTitle>
54
+ </CardHeader>
55
+ <CardContent>
56
+ <OtpSetup />
57
+ </CardContent>
58
+ </Card>
59
+ </div>
60
+ </>
61
+ )
62
+ }
63
+
64
+ export const Members = () => {
65
+ const projectSlug = useProjectSlug()!
66
+ const showToast = useShowToast()
67
+ const memberListController = useRef<MemberListController>(undefined)
68
+
69
+ return (
70
+ <>
71
+ <Slots.Title>
72
+ <Title icon={<UsersIcon />}>Members</Title>
73
+ </Slots.Title>
74
+
75
+ <div className="flex flex-col gap-4">
76
+ <Card className="w-[40rem] max-w-full">
77
+ <CardHeader>
78
+ <CardTitle className="text-2xl">Invite</CardTitle>
79
+ </CardHeader>
80
+ <CardContent>
81
+ <InviteForm
82
+ projectSlug={projectSlug}
83
+ initialMemberships={[{ role: 'admin', variables: [] }]}
84
+ onSuccess={args => {
85
+ showToast(
86
+ <ToastContent>Invitation sent to {args.result.person?.email}</ToastContent>, { type: 'success' })
87
+ memberListController.current?.refresh()
88
+ }}
89
+ >
90
+ <form>
91
+ <InviteFormFields projectSlug={projectSlug} />
92
+ </form>
93
+ </InviteForm>
94
+ </CardContent>
95
+ </Card>
96
+ <Card className="w-[40rem] max-w-full">
97
+ <CardHeader>
98
+ <CardTitle className="text-2xl">Members</CardTitle>
99
+ </CardHeader>
100
+ <CardContent>
101
+ <PersonList controller={memberListController} />
102
+ </CardContent>
103
+ </Card>
104
+
105
+ </div>
106
+ </>
107
+ )
108
+ }
109
+
110
+ export const ApiKeys = () => {
111
+ const projectSlug = useProjectSlug()!
112
+ const showToast = useShowToast()
113
+ const memberListController = useRef<MemberListController>(undefined)
114
+
115
+ return (
116
+ <>
117
+ <Slots.Title>
118
+ <Title icon={<KeyRoundIcon />}>API keys</Title>
119
+ </Slots.Title>
120
+
121
+ <div className="flex flex-col gap-4">
122
+ <div>
123
+ <Card className="w-[40rem] max-w-full">
124
+ <CardHeader>
125
+ <CardTitle className="text-2xl">Create API key</CardTitle>
126
+ </CardHeader>
127
+ <CardContent>
128
+ <CreateApiKeyForm
129
+ projectSlug={projectSlug}
130
+ initialMemberships={[{ role: 'admin', variables: [] }]}
131
+ onSuccess={args => {
132
+ showToast((
133
+ <ToastContent title="API key created">
134
+ <Input value={args.result.apiKey.token} type="text" />
135
+ </ToastContent>
136
+ ), { type: 'success' })
137
+ memberListController.current?.refresh()
138
+ }}
139
+ >
140
+ <form className="grid gap-4">
141
+ <CreateApiKeyFormFields projectSlug={projectSlug} />
142
+ </form>
143
+ </CreateApiKeyForm>
144
+ </CardContent>
145
+ </Card>
146
+ </div>
147
+ <div>
148
+ <Card className="w-[40rem] max-w-full">
149
+ <CardHeader>
150
+ <CardTitle className="text-2xl">API keys</CardTitle>
151
+ </CardHeader>
152
+ <CardContent>
153
+ <ApiKeyList controller={memberListController} />
154
+ </CardContent>
155
+ </Card>
156
+ </div>
157
+ </div>
158
+ </>
159
+ )
160
+ }
@@ -0,0 +1,14 @@
1
+ export const Layout = ({ children }: { children?: React.ReactNode }) => (
2
+ <div className="grid md:grid-cols-2 min-h-screen ">
3
+ <div className="bg-gray-100 p-4 flex items-center justify-center">
4
+ {children}
5
+ </div>
6
+ <div className="bg-gray-700 text-white p-4 flex items-center justify-center">
7
+ <div className="w-full max-w-md">
8
+ <div className="text-center text-2xl">Welcome to your app</div>
9
+ <p className="mt-8 text-center text-gray-300">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor, sem
10
+ eget ultricies ultricies, sapien urna tristique eros, ac tincidunt felis lacus nec nunc.</p>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ )
@@ -0,0 +1,47 @@
1
+ import { useIdentity } from '@contember/react-identity'
2
+ import { useEffect } from 'react'
3
+ import { Card, CardDescription, CardHeader, CardTitle } from '~/lib/ui/card'
4
+ import { Loader } from '~/lib/ui/loader'
5
+
6
+ /**
7
+ * Props for {@link LoggedIn} component
8
+ */
9
+ export type LoggedInProps = {
10
+ /**
11
+ * The URL to redirect to after successful login.
12
+ */
13
+ appUrl: string
14
+ }
15
+
16
+ /**
17
+ * Props {@link LoggedInProps}
18
+ *
19
+ * `LoggedIn` displays a confirmation UI upon successful login and redirects the user to the specified app URL.
20
+ * Must be used in a context where `useIdentity` is available (e.g., inside a Contember admin interface).
21
+ *
22
+ * #### Example: login redirect screen
23
+ * ```tsx
24
+ * <LoggedIn appUrl="https://admin.example.com/dashboard" />
25
+ * ```
26
+ */
27
+ export const LoggedIn = ({ appUrl }: LoggedInProps) => {
28
+ const identity = useIdentity()
29
+
30
+ useEffect(() => {
31
+ setTimeout(() => {
32
+ window.location.href = appUrl
33
+ }, 500)
34
+ }, [appUrl])
35
+
36
+ return (
37
+ <Card className="w-96 relative">
38
+ <CardHeader>
39
+ <CardTitle className="text-2xl">Logged in</CardTitle>
40
+ <CardDescription>
41
+ as {identity?.person?.email ?? 'unknown'}
42
+ </CardDescription>
43
+ </CardHeader>
44
+ <Loader position="static" />
45
+ </Card>
46
+ )
47
+ }
@@ -0,0 +1,103 @@
1
+ import { ToastContent, useShowToast } from '~/lib/toast'
2
+ import { dict } from '~/lib/dict'
3
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '~/lib/ui/card'
4
+ import { AnchorButton, Button } from '~/lib/ui/button'
5
+ import { LoginFormFields } from '~/lib/tenant'
6
+ import { PasswordlessSignInInitFormFields } from '~/lib/tenant/forms/passwordless-signin-init'
7
+ import { Loader } from '~/lib/ui/loader'
8
+ import { useRedirect } from '@contember/react-routing'
9
+ import { IDP, IDPInitTrigger, IDPState, LoginForm, PasswordlessSignInInitForm } from '@contember/react-identity'
10
+
11
+ /**
12
+ * Props for {@link Login} component
13
+ */
14
+ export type LoginProps = {
15
+ /**
16
+ * IDPs to be displayed in the login form
17
+ */
18
+ idps: Record<string, string>
19
+ /**
20
+ * Whether the login form should display a token from environment
21
+ */
22
+ hasTokenFromEnv: boolean
23
+ /**
24
+ * The URL of the application
25
+ */
26
+ appUrl: string
27
+ /**
28
+ * Whether the login form should display a magic link
29
+ */
30
+ magicLink: boolean
31
+ }
32
+
33
+ /**
34
+ * Props {@link LoginProps}
35
+ *
36
+ * `Login` renders a flexible authentication UI supporting multiple identity providers (IDPs), magic link login, and fallback login options.
37
+ * Must be used within a Contember environment where `useShowToast` and `useRedirect` are available.
38
+ *
39
+ * - Supports IDP login (OAuth, SAML, etc.) with customizable labels
40
+ * - Displays errors via toast notifications
41
+ * - Supports magic link (passwordless) login
42
+ * - Optional login as a default user using token from environment
43
+ *
44
+ * #### Example: full-featured login page
45
+ * ```tsx
46
+ * <Login
47
+ * idps={{ github: 'GitHub', google: 'Google' }}
48
+ * hasTokenFromEnv={true}
49
+ * appUrl="https://admin.example.com/dashboard"
50
+ * magicLink={true}
51
+ * />
52
+ * ```
53
+ */
54
+ export const Login = ({ idps, hasTokenFromEnv, appUrl, magicLink }: LoginProps) => {
55
+ const showToast = useShowToast()
56
+ const redirect = useRedirect()
57
+
58
+ return (
59
+ <IDP
60
+ onInitError={error => showToast(<ToastContent>{dict.tenant.login.idpInitError} {error}</ToastContent>, { type: 'error' })}
61
+ onResponseError={error => showToast(
62
+ <ToastContent>{dict.tenant.login.idpResponseError} {error}</ToastContent>, { type: 'error' })}
63
+ >
64
+ <Card className="w-96 relative">
65
+ <CardHeader>
66
+ <CardTitle className="text-2xl">{dict.tenant.login.title}</CardTitle>
67
+ <CardDescription>
68
+ {dict.tenant.login.description}
69
+ </CardDescription>
70
+ </CardHeader>
71
+ <CardContent>
72
+ {hasTokenFromEnv && <AnchorButton href={appUrl} size="lg" className="w-full" variant="destructive">
73
+ Continue as default user
74
+ </AnchorButton>}
75
+ <LoginForm>
76
+ <form className="grid gap-4">
77
+ <LoginFormFields />
78
+ </form>
79
+ </LoginForm>
80
+
81
+ {Object.entries(idps).map(([idp, label]) => (
82
+ <IDPInitTrigger key={idp} identityProvider={idp}>
83
+ <Button variant="outline" className="w-full">
84
+ {label}
85
+ </Button>
86
+ </IDPInitTrigger>
87
+ ))}
88
+
89
+ {magicLink && <PasswordlessSignInInitForm onSuccess={({ result }) => {
90
+ redirect('magicLinkSent(request_id: $requestId)', { requestId: result.requestId })
91
+ }}>
92
+ <form>
93
+ <PasswordlessSignInInitFormFields />
94
+ </form>
95
+ </PasswordlessSignInInitForm>}
96
+ </CardContent>
97
+ <IDPState state={['processing_init', 'processing_response', 'success']}>
98
+ <Loader />
99
+ </IDPState>
100
+ </Card>
101
+ </IDP>
102
+ )
103
+ }
@@ -0,0 +1,35 @@
1
+ import { ContemberClientProps } from '@contember/react-client'
2
+
3
+ /**
4
+ * Configuration for the login entrypoint.
5
+ * Loads environment variables and prepares configuration for the Contember client.
6
+ */
7
+ export const loginEntrypointConfig = (() => {
8
+ const apiBaseUrl = import.meta.env.VITE_CONTEMBER_ADMIN_API_BASE_URL
9
+ const loginToken = import.meta.env.VITE_CONTEMBER_ADMIN_LOGIN_TOKEN
10
+
11
+ if (!apiBaseUrl) {
12
+ throw new Error('VITE_CONTEMBER_ADMIN_API_BASE_URL is not set')
13
+ }
14
+ if (!loginToken) {
15
+ throw new Error('VITE_CONTEMBER_ADMIN_LOGIN_TOKEN is not set')
16
+ }
17
+
18
+ const clientConfig = {
19
+ apiBaseUrl,
20
+ loginToken,
21
+ } satisfies ContemberClientProps
22
+
23
+ // You can add more IDPs here
24
+ const identityProviders = {
25
+ // google: 'Login with Google',
26
+ } satisfies Record<string, string>
27
+
28
+ return {
29
+ ...clientConfig,
30
+ idps: identityProviders,
31
+ appUrl: '/app',
32
+ hasTokenFromEnv: import.meta.env.VITE_CONTEMBER_ADMIN_SESSION_TOKEN !== '__SESSION_TOKEN__',
33
+ magicLink: true,
34
+ }
35
+ })()
@@ -0,0 +1,18 @@
1
+ import { createRequiredContext } from '@contember/react-utils'
2
+ import { PropsWithChildren } from 'react'
3
+
4
+ export type LoginConfig = {
5
+ appUrl: string
6
+ hasTokenFromEnv: boolean
7
+ idps: Record<string, string>
8
+ magicLink: boolean
9
+ }
10
+
11
+ const [LoginConfigContext, useLoginConfig] = createRequiredContext<LoginConfig>('LoginConfigContext')
12
+ export { LoginConfigContext, useLoginConfig }
13
+
14
+ export const LoginConfigProvider = ({ children, ...config }: PropsWithChildren<LoginConfig>) => (
15
+ <LoginConfigContext.Provider value={config}>
16
+ {children}
17
+ </LoginConfigContext.Provider>
18
+ )
@@ -0,0 +1,12 @@
1
+ import { createErrorHandler } from '@contember/react-devbar'
2
+ import { LoginEntrypoint } from './login-entrypoint'
3
+ import { createRoot } from 'react-dom/client'
4
+ import '../index.css'
5
+ import '../sentry'
6
+ import { loginEntrypointConfig } from './config'
7
+
8
+ const errorHandler = createErrorHandler((dom, react, onRecoverableError) => createRoot(dom, { onRecoverableError }).render(react))
9
+
10
+ const rootEl = document.body.appendChild(document.createElement('div'))
11
+
12
+ errorHandler(onRecoverableError => createRoot(rootEl, { onRecoverableError }).render(<LoginEntrypoint {...loginEntrypointConfig} />))
@@ -0,0 +1,24 @@
1
+ import { ContemberClient, ContemberClientProps } from '@contember/react-client'
2
+ import { type PageModule, Pages, RoutingProvider } from '@contember/react-routing'
3
+ import { Toaster } from '~/lib/toast/toast'
4
+ import { Layout } from './components/layout'
5
+ import { type LoginConfig, LoginConfigProvider } from './contexts/login'
6
+
7
+ export type LoginEntrypointProps = ContemberClientProps & LoginConfig
8
+
9
+ export const LoginEntrypoint = ({ appUrl, hasTokenFromEnv, idps, magicLink, apiBaseUrl, sessionToken, loginToken, project, stage }: LoginEntrypointProps) => (
10
+ <ContemberClient apiBaseUrl={apiBaseUrl} sessionToken={sessionToken} loginToken={loginToken} project={project} stage={stage}>
11
+ <LoginConfigProvider appUrl={appUrl} hasTokenFromEnv={hasTokenFromEnv} idps={idps} magicLink={magicLink}>
12
+ <RoutingProvider pageInQuery>
13
+ <Toaster>
14
+ <Pages
15
+ layout={Layout}
16
+ children={import.meta.glob<PageModule>(
17
+ './pages/**/*.tsx',
18
+ { eager: true }
19
+ )} />
20
+ </Toaster>
21
+ </RoutingProvider>
22
+ </LoginConfigProvider>
23
+ </ContemberClient>
24
+ )
@@ -0,0 +1,48 @@
1
+ import { CircleAlert } from 'lucide-react'
2
+ import { dict } from '~/lib/dict'
3
+ import { Button } from '~/lib/ui/button'
4
+ import { Card, CardContent } from '~/lib/ui/card'
5
+ import { Loader } from '~/lib/ui/loader'
6
+ import { Overlay } from '~/lib/ui/overlay'
7
+ import { Login } from '../components/login'
8
+ import { LoggedIn } from '../components/logged-in'
9
+ import { useLoginConfig } from '../contexts/login'
10
+ import { IdentityProvider, IdentityState, LogoutTrigger } from '@contember/react-identity'
11
+
12
+ export default () => {
13
+ const entrypointConfig = useLoginConfig()
14
+
15
+ return (
16
+ <IdentityProvider>
17
+ <IdentityState state={['none', 'cleared']}>
18
+ <Login
19
+ appUrl={entrypointConfig.appUrl}
20
+ hasTokenFromEnv={entrypointConfig.hasTokenFromEnv}
21
+ idps={entrypointConfig.idps}
22
+ magicLink={entrypointConfig.magicLink}
23
+ />
24
+ </IdentityState>
25
+ <IdentityState state="success">
26
+ <LoggedIn appUrl={entrypointConfig.appUrl} />
27
+ </IdentityState>
28
+ <IdentityState state="loading">
29
+ <Loader />
30
+ </IdentityState>
31
+ <IdentityState state="failed">
32
+ <Overlay>
33
+ <Card className="w-72">
34
+ <CardContent className="flex flex-col items-center gap-2">
35
+ <CircleAlert className="h-12 w-12 text-destructive" />
36
+ <p className="text-center text-lg text-gray-600">
37
+ {dict.identityLoader.fail}
38
+ </p>
39
+ <LogoutTrigger>
40
+ <Button>Login again</Button>
41
+ </LogoutTrigger>
42
+ </CardContent>
43
+ </Card>
44
+ </Overlay>
45
+ </IdentityState>
46
+ </IdentityProvider>
47
+ )
48
+ }
@@ -0,0 +1,56 @@
1
+ import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
2
+ import { dict } from '~/lib/dict'
3
+ import { Loader } from '~/lib/ui/loader'
4
+ import { PasswordlessSignInFormFields } from '~/lib/tenant/forms/passwordless-signin'
5
+ import { AnchorButton } from '~/lib/ui/button'
6
+ import { Link, useCurrentRequest, useRedirect } from '@contember/react-routing'
7
+ import { PasswordlessSignInForm, usePasswordlessOtpActivator } from '@contember/react-identity'
8
+
9
+ export default () => {
10
+ const request = useCurrentRequest()
11
+ const redirect = useRedirect()
12
+ const requestId = request?.parameters.request_id as string | undefined
13
+ const token = request?.parameters.token as string | undefined
14
+ const otpActivation = usePasswordlessOtpActivator()
15
+
16
+ if (!requestId || !token || otpActivation.type === 'empty') {
17
+ return <p>Invalid request</p>
18
+ }
19
+
20
+ return (
21
+ <Card className="w-96">
22
+ <CardHeader>
23
+ <CardTitle className="text-2xl">{dict.tenant.passwordlessSignIn.title}</CardTitle>
24
+ </CardHeader>
25
+ <CardContent>
26
+ {otpActivation.type === 'otp_activating' && <Loader />}
27
+ {otpActivation.type === 'otp_activation_failed' && <div className="text-red-500 text-center">
28
+ {dict.tenant.otpActivation.errorMessages[otpActivation.error]}
29
+ </div>}
30
+ {otpActivation.type === 'otp_activated' && <div className="flex flex-col items-center gap-4">
31
+ <p className="text-lg text-center">
32
+ Enter the following code where you initiated signing in:
33
+ </p>
34
+ <div className="text-4xl font-bold border p-2 rounded font-mono">
35
+ {otpActivation.otp}
36
+ </div>
37
+
38
+ </div>}
39
+ {otpActivation.type === 'can_proceed_to_login' && <PasswordlessSignInForm onSuccess={() => {
40
+ redirect('index')
41
+ }} requestId={requestId} token={token?.toString()} validationType="token">
42
+ <form>
43
+ <PasswordlessSignInFormFields type="token" />
44
+ </form>
45
+ </PasswordlessSignInForm>}
46
+ </CardContent>
47
+ <CardFooter>
48
+ <Link to="index">
49
+ <AnchorButton variant="link" className="ml-auto">
50
+ {dict.tenant.login.backToLogin}
51
+ </AnchorButton>
52
+ </Link>
53
+ </CardFooter>
54
+ </Card>
55
+ )
56
+ }
@@ -0,0 +1,63 @@
1
+ import { useEffect, useState } from 'react'
2
+ import { Card, CardContent, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
3
+ import { dict } from '~/lib/dict'
4
+ import { PasswordlessSignInFormFields } from '~/lib/tenant/forms/passwordless-signin'
5
+ import { MailIcon } from 'lucide-react'
6
+ import { AnchorButton } from '~/lib/ui/button'
7
+ import { PasswordlessSignInForm } from '@contember/react-identity'
8
+ import { Link, useCurrentRequest, useRedirect } from '@contember/react-routing'
9
+
10
+ export default () => {
11
+ const request = useCurrentRequest()
12
+ const redirect = useRedirect()
13
+ const requestId = request?.parameters.request_id as string | undefined
14
+ const [showOtp, setShowOtp] = useState(false)
15
+
16
+ useEffect(() => {
17
+ setTimeout(() => {
18
+ setShowOtp(true)
19
+ }, 5000)
20
+ }, [])
21
+
22
+ if (!requestId) {
23
+ return <p>Invalid request</p>
24
+ }
25
+
26
+ return (
27
+ <Card className="w-96">
28
+ <CardHeader>
29
+ <CardTitle className="text-2xl">{dict.tenant.passwordlessSignIn.title}</CardTitle>
30
+ </CardHeader>
31
+ <CardContent>
32
+ {showOtp ? (<>
33
+ <p className="text-gray-600">Have a verification code? Enter it here:</p>
34
+ <PasswordlessSignInForm onSuccess={() => {
35
+ redirect('index')
36
+ }} requestId={requestId} validationType="otp">
37
+ <form>
38
+ <PasswordlessSignInFormFields type="otp" />
39
+ </form>
40
+ </PasswordlessSignInForm>
41
+ </>) : <div className="flex flex-col items-center justify-center gap-4">
42
+ <MailIcon className="text-gray-300 w-16 h-16" />
43
+ <div className="text-center">
44
+ An email with password reset instructions has been sent to your email address.
45
+ </div>
46
+ <div className="text-xs text-gray-600">
47
+ Do you have a verification code?{' '}
48
+ <span onClick={() => setShowOtp(true)} className="underline cursor-pointer">
49
+ Enter manually
50
+ </span>
51
+ </div>
52
+ </div>}
53
+ </CardContent>
54
+ <CardFooter>
55
+ <Link to="index">
56
+ <AnchorButton variant="link" className="ml-auto">
57
+ {dict.tenant.login.backToLogin}
58
+ </AnchorButton>
59
+ </Link>
60
+ </CardFooter>
61
+ </Card>
62
+ )
63
+ }
@@ -0,0 +1,44 @@
1
+ import { ToastContent, useShowToast } from '~/lib/toast'
2
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
3
+ import { dict } from '~/lib/dict'
4
+ import { PasswordResetFormFields } from '~/lib/tenant'
5
+ import { AnchorButton } from '~/lib/ui/button'
6
+ import { Link, useCurrentRequest, useRedirect } from '@contember/react-routing'
7
+ import { PasswordResetForm } from '@contember/react-identity'
8
+
9
+ export default () => {
10
+ const request = useCurrentRequest()
11
+ const redirect = useRedirect()
12
+ const showToast = useShowToast()
13
+ const token = request?.parameters.token as string | undefined
14
+
15
+ return (
16
+ <Card className="w-96">
17
+ <CardHeader>
18
+ <CardTitle className="text-2xl">{dict.tenant.passwordReset.title}</CardTitle>
19
+ <CardDescription>
20
+ {dict.tenant.passwordReset.description}
21
+ </CardDescription>
22
+ </CardHeader>
23
+ <CardContent>
24
+ <PasswordResetForm onSuccess={() => {
25
+ showToast(<ToastContent>
26
+ Password has been reset
27
+ </ToastContent>, { type: 'success' })
28
+ redirect('index')
29
+ }} token={token}>
30
+ <form>
31
+ <PasswordResetFormFields hasToken={!!token} />
32
+ </form>
33
+ </PasswordResetForm>
34
+ </CardContent>
35
+ <CardFooter>
36
+ <Link to="index">
37
+ <AnchorButton variant="link" className="ml-auto">
38
+ {dict.tenant.login.backToLogin}
39
+ </AnchorButton>
40
+ </Link>
41
+ </CardFooter>
42
+ </Card>
43
+ )
44
+ }
@@ -0,0 +1,35 @@
1
+ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/lib/ui/card'
2
+ import { dict } from '~/lib/dict'
3
+ import { PasswordResetRequestFormFields } from '~/lib/tenant'
4
+ import { AnchorButton } from '~/lib/ui/button'
5
+ import { Link, useRedirect } from '@contember/react-routing'
6
+ import { PasswordResetRequestForm } from '@contember/react-identity'
7
+
8
+ export default () => {
9
+ const redirect = useRedirect()
10
+
11
+ return (
12
+ <Card className="w-96">
13
+ <CardHeader>
14
+ <CardTitle className="text-2xl">{dict.tenant.passwordResetRequest.title}</CardTitle>
15
+ <CardDescription>
16
+ {dict.tenant.passwordResetRequest.description}
17
+ </CardDescription>
18
+ </CardHeader>
19
+ <CardContent>
20
+ <PasswordResetRequestForm onSuccess={() => redirect('resetRequestSuccess')}>
21
+ <form>
22
+ <PasswordResetRequestFormFields />
23
+ </form>
24
+ </PasswordResetRequestForm>
25
+ </CardContent>
26
+ <CardFooter>
27
+ <Link to="index">
28
+ <AnchorButton variant="link" className="ml-auto">
29
+ {dict.tenant.login.backToLogin}
30
+ </AnchorButton>
31
+ </Link>
32
+ </CardFooter>
33
+ </Card>
34
+ )
35
+ }