@baseplate-dev/plugin-auth 0.6.17 → 0.6.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +12 -0
- package/dist/better-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/index.d.ts +36 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +60 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/index.d.ts +12 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts +6 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts +6 -0
- package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts +6 -0
- package/dist/local-auth/admin/common.js +6 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.d.ts +531 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.js +119 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.d.ts +540 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.js +11 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-paths.js +24 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.d.ts +276 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.js +45 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.d.ts +263 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.js +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.d.ts +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/index.js +2 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.d.ts +21 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.js +69 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.tsx +122 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +12 -0
- package/dist/local-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +6 -0
- package/dist/local-auth/admin/node.js +13 -0
- package/dist/local-auth/admin/schema/invite-user-action.d.ts +12 -0
- package/dist/local-auth/admin/schema/invite-user-action.js +6 -0
- package/dist/local-auth/admin/web.js +8 -0
- package/dist/local-auth/core/common.js +7 -2
- package/dist/local-auth/core/components/local-auth-definition-editor.js +2 -1
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.d.ts +9 -0
- package/dist/local-auth/core/components/local-auth-web-app-settings-form.js +11 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +6 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +66 -6
- package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +188 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.d.ts +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-paths.js +5 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +18 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +66 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +192 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +82 -1
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.d.ts +19 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.js +20 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/otp.constants.ts +22 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.d.ts +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.js +12 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/constants/password.constants.ts +14 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.js +30 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/email-otp.mutations.ts +38 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.js +42 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/invite.mutations.ts +54 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.js +2 -19
- package/dist/local-auth/core/generators/auth-email-password/templates/module/schema/user-password.mutations.ts +1 -22
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.d.ts +37 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.js +225 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-otp.service.ts +333 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.d.ts +39 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.js +138 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.ts +209 -0
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +3 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +3 -2
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.d.ts +3 -1
- package/dist/local-auth/core/generators/auth-email-templates/auth-email-templates.generator.js +18 -3
- package/dist/local-auth/core/generators/auth-email-templates/generated/index.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-paths.js +2 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/template-renderers.js +20 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.d.ts +40 -0
- package/dist/local-auth/core/generators/auth-email-templates/generated/typed-templates.js +24 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.js +18 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/email-otp.email.tsx +57 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.js +14 -0
- package/dist/local-auth/core/generators/auth-email-templates/templates/src/emails/auth/invite.email.tsx +47 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +4 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +5 -1
- package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +20 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +13 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +6 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +17 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +20 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.d.ts +4 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.js +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/auth-verification.service.ts +1 -1
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.d.ts +66 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.js +134 -0
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.ts +184 -0
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts +8 -0
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.js +38 -5
- package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +840 -268
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.d.ts +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-paths.js +3 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +18 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.js +51 -0
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +608 -283
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.js +69 -23
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.js +10 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/-otp-constants.ts +11 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.js +148 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.tsx +264 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.js +184 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.tsx +311 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +2 -9
- package/dist/local-auth/core/generators/react-session/generated/index.d.ts +12 -0
- package/dist/local-auth/core/generators/react-session/generated/template-renderers.d.ts +6 -0
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.d.ts +12 -0
- package/dist/local-auth/core/generators/react-session/react-session.generator.d.ts +6 -0
- package/dist/local-auth/core/node.js +24 -6
- package/dist/local-auth/core/schema/migrations.d.ts +3 -0
- package/dist/local-auth/core/schema/migrations.js +36 -0
- package/dist/local-auth/core/schema/models.js +8 -0
- package/dist/local-auth/core/schema/plugin-definition.d.ts +1 -0
- package/dist/local-auth/core/schema/plugin-definition.js +1 -0
- package/dist/local-auth/core/schema/web-app-schema.d.ts +15 -0
- package/dist/local-auth/core/schema/web-app-schema.js +16 -0
- package/dist/local-auth/core/web.js +8 -1
- package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-ChkXxpXe.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-CKKmnLep.js} +42 -34
- package/dist/web/assets/{dist-DY7ZXvq4.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-Cx7TvZ_H.js} +16717 -373
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-37vlYRxk.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-D3Nvasea.js} +90 -38
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DRSNXPPo.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-C2GDE8Py.js} +1645 -921
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-DfiQqvVC.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-CiccpWjh.js} +212 -57
- package/dist/web/assets/auth-CsHp2bQi.js +1 -0
- package/dist/web/assets/common-BGTuTgx7.js +43 -0
- package/dist/web/assets/common-C8_sC5pp.js +70 -0
- package/dist/web/assets/{common-ByxS61u8.js → common-Co5lW_TK.js} +10 -10
- package/dist/web/assets/{common-iHaemino.js → common-CoLuMS7U.js} +6 -6
- package/dist/web/assets/common-Dueu_1NG.js +36 -0
- package/dist/web/assets/{common-TDf_PrjX.js → common-N3skPbzk.js} +10 -10
- package/dist/web/assets/{dist-CrLSslv6.js → dist-DQd1TAJX.js} +273 -132
- package/dist/web/assets/{get-auth-plugin-definition-kDCtXq_6.js → get-auth-plugin-definition-DyokUVjX.js} +3 -3
- package/dist/web/assets/{hostInit-Cruek6c6.js → hostInit-BCYmw0H5.js} +32 -5
- package/dist/web/assets/{mf-entry-bootstrap-0-dfed0275.js → mf-entry-bootstrap-0-3ede9334.js} +2 -1
- package/dist/web/assets/{mf-entry-bootstrap-1-5275674a.js → mf-entry-bootstrap-1-3da85eea.js} +3 -2
- package/dist/web/assets/{mf-entry-bootstrap-2-39fb9255.js → mf-entry-bootstrap-2-32e24e11.js} +3 -2
- package/dist/web/assets/{mf-entry-bootstrap-3-49e64336.js → mf-entry-bootstrap-3-a3cfea9d.js} +3 -2
- package/dist/web/assets/{models-DSvs_3bA.js → models-BcPOQC5p.js} +4 -5
- package/dist/web/assets/{models-BZmCbizK.js → models-BcUgOGGn.js} +11 -6
- package/dist/web/assets/{plugin-definition-CYj29S3q.js → plugin-definition-D1EImXIf.js} +9 -10
- package/dist/web/assets/plugin-definition-lw-gB4hU.js +10 -0
- package/dist/web/assets/{styles-yjbHBTlw.js → styles-EOyEbGA4.js} +9 -10
- package/dist/web/assets/{virtualExposes-CbPBmicF.js → virtualExposes-DWORnjyA.js} +1 -1
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-t-KnBiUh.js +747 -0
- package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-B6BXIeF1.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-DZfE3QCR.js} +13 -13
- package/dist/web/assets/{web-VqBA3jxZ.js → web-CBVepebK.js} +22 -22
- package/dist/web/assets/{web-D0MSKfyv.js → web-Dgb85jhs.js} +47 -47
- package/dist/web/assets/{web-CXAHKjIY.js → web-EDeSquSP.js} +28 -28
- package/dist/web/assets/{web-1eTcxMhf.js → web-PqAcfBSy.js} +9 -9
- package/dist/web/assets/{web-CDAKPPK9.js → web-RhChfBw_.js} +21 -21
- package/dist/web/assets/web-kaD9AzNS.js +59 -0
- package/dist/web/assets/web-xJ-GnSkC.js +148 -0
- package/dist/web/index.html +5 -5
- package/dist/web/remoteEntry.js +1 -1
- package/package.json +14 -14
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-CO5Pvo0y.js +0 -384
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-BEZ7A-cz.js +0 -13566
- package/dist/web/assets/auth-BxAE0rgh.js +0 -1
- package/dist/web/assets/common-CKl_XlvH.js +0 -37
- package/dist/web/assets/common-UpVCKZeW.js +0 -41
- package/dist/web/assets/common-crSwCD36.js +0 -37
- package/dist/web/assets/model-utils-C0WDb_Ec.js +0 -1599
- package/dist/web/assets/plugin-definition-DOMmPL2Z.js +0 -11
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-XM6iYVxf.js +0 -259
- package/dist/web/assets/virtual_mf-exposes-ssr___mfe_internal__plugin-auth__remoteEntry_js-DGjg7Brm.js +0 -129
- package/dist/web/assets/web-DbeAaDTV.js +0 -118
- package/dist/web/assets/web-miDovYk_.js +0 -46
- package/dist/web/remoteEntry.ssr.js +0 -43
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getApolloErrorCode } from '%apolloErrorImports';
|
|
3
|
+
import { graphql, readFragment } from '%graphqlImports';
|
|
4
|
+
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '%reactComponentsImports';
|
|
5
|
+
import { logAndFormatError } from '%reactErrorImports';
|
|
6
|
+
import { useMutation } from '@apollo/client/react';
|
|
7
|
+
import { toast } from 'sonner';
|
|
8
|
+
export const inviteUserDialogUserFragment = graphql(`
|
|
9
|
+
fragment InviteUserDialog_user on User {
|
|
10
|
+
id
|
|
11
|
+
email
|
|
12
|
+
}
|
|
13
|
+
`);
|
|
14
|
+
const inviteUserMutation = graphql(`
|
|
15
|
+
mutation InviteUserDialogInviteUser($input: InviteUserInput!) {
|
|
16
|
+
inviteUser(input: $input) {
|
|
17
|
+
user {
|
|
18
|
+
...InviteUserDialog_user
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`);
|
|
23
|
+
/**
|
|
24
|
+
* Dialog for sending an invite email so a user can set their password and sign in.
|
|
25
|
+
* Self-contained component that handles its own mutation logic.
|
|
26
|
+
*
|
|
27
|
+
* @param props - The component props
|
|
28
|
+
* @param props.user - The user to invite
|
|
29
|
+
* @param props.open - Whether the dialog is open
|
|
30
|
+
* @param props.onOpenChange - Callback when dialog open state changes
|
|
31
|
+
* @returns The invite user dialog component
|
|
32
|
+
*/
|
|
33
|
+
export function InviteUserDialog({ user, open, onOpenChange, }) {
|
|
34
|
+
// Unmask the fragment data
|
|
35
|
+
const userData = readFragment(inviteUserDialogUserFragment, user);
|
|
36
|
+
const [inviteUser, { loading }] = useMutation(inviteUserMutation);
|
|
37
|
+
const handleConfirm = () => {
|
|
38
|
+
inviteUser({
|
|
39
|
+
variables: { input: { userId: userData.id } },
|
|
40
|
+
})
|
|
41
|
+
.then(() => {
|
|
42
|
+
toast.success('Invite sent!');
|
|
43
|
+
onOpenChange(false);
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
const errorCode = getApolloErrorCode(err, [
|
|
47
|
+
'user-already-has-account',
|
|
48
|
+
'user-has-no-email',
|
|
49
|
+
]);
|
|
50
|
+
switch (errorCode) {
|
|
51
|
+
case 'user-already-has-account': {
|
|
52
|
+
toast.error('This user already has a password set.');
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
case 'user-has-no-email': {
|
|
56
|
+
toast.error('This user has no email address to invite.');
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case null: {
|
|
60
|
+
toast.error(logAndFormatError(err, 'Sorry, we could not send the invite.'));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Send Invite" }), _jsxs(DialogDescription, { children: ["Send an invite email to ", userData.email, "?"] })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
66
|
+
onOpenChange(false);
|
|
67
|
+
}, children: "Cancel" }), _jsx(Button, { onClick: handleConfirm, disabled: loading, children: "Send Invite" })] })] }) }));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=invite-user-dialog.js.map
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import type { FragmentType } from '%graphqlImports';
|
|
4
|
+
import type { ReactElement } from 'react';
|
|
5
|
+
|
|
6
|
+
import { getApolloErrorCode } from '%apolloErrorImports';
|
|
7
|
+
import { graphql, readFragment } from '%graphqlImports';
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
Dialog,
|
|
11
|
+
DialogContent,
|
|
12
|
+
DialogDescription,
|
|
13
|
+
DialogFooter,
|
|
14
|
+
DialogHeader,
|
|
15
|
+
DialogTitle,
|
|
16
|
+
} from '%reactComponentsImports';
|
|
17
|
+
import { logAndFormatError } from '%reactErrorImports';
|
|
18
|
+
import { useMutation } from '@apollo/client/react';
|
|
19
|
+
import { toast } from 'sonner';
|
|
20
|
+
|
|
21
|
+
export const inviteUserDialogUserFragment = graphql(`
|
|
22
|
+
fragment InviteUserDialog_user on User {
|
|
23
|
+
id
|
|
24
|
+
email
|
|
25
|
+
}
|
|
26
|
+
`);
|
|
27
|
+
|
|
28
|
+
const inviteUserMutation = graphql(`
|
|
29
|
+
mutation InviteUserDialogInviteUser($input: InviteUserInput!) {
|
|
30
|
+
inviteUser(input: $input) {
|
|
31
|
+
user {
|
|
32
|
+
...InviteUserDialog_user
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`);
|
|
37
|
+
|
|
38
|
+
interface InviteUserDialogProps {
|
|
39
|
+
user: FragmentType<typeof inviteUserDialogUserFragment>;
|
|
40
|
+
open: boolean;
|
|
41
|
+
onOpenChange: (open: boolean) => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Dialog for sending an invite email so a user can set their password and sign in.
|
|
46
|
+
* Self-contained component that handles its own mutation logic.
|
|
47
|
+
*
|
|
48
|
+
* @param props - The component props
|
|
49
|
+
* @param props.user - The user to invite
|
|
50
|
+
* @param props.open - Whether the dialog is open
|
|
51
|
+
* @param props.onOpenChange - Callback when dialog open state changes
|
|
52
|
+
* @returns The invite user dialog component
|
|
53
|
+
*/
|
|
54
|
+
export function InviteUserDialog({
|
|
55
|
+
user,
|
|
56
|
+
open,
|
|
57
|
+
onOpenChange,
|
|
58
|
+
}: InviteUserDialogProps): ReactElement {
|
|
59
|
+
// Unmask the fragment data
|
|
60
|
+
const userData = readFragment(inviteUserDialogUserFragment, user);
|
|
61
|
+
|
|
62
|
+
const [inviteUser, { loading }] = useMutation(inviteUserMutation);
|
|
63
|
+
|
|
64
|
+
const handleConfirm = (): void => {
|
|
65
|
+
inviteUser({
|
|
66
|
+
variables: { input: { userId: userData.id } },
|
|
67
|
+
})
|
|
68
|
+
.then(() => {
|
|
69
|
+
toast.success('Invite sent!');
|
|
70
|
+
onOpenChange(false);
|
|
71
|
+
})
|
|
72
|
+
.catch((err: unknown) => {
|
|
73
|
+
const errorCode = getApolloErrorCode(err, [
|
|
74
|
+
'user-already-has-account',
|
|
75
|
+
'user-has-no-email',
|
|
76
|
+
] as const);
|
|
77
|
+
switch (errorCode) {
|
|
78
|
+
case 'user-already-has-account': {
|
|
79
|
+
toast.error('This user already has a password set.');
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case 'user-has-no-email': {
|
|
83
|
+
toast.error('This user has no email address to invite.');
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case null: {
|
|
87
|
+
toast.error(
|
|
88
|
+
logAndFormatError(err, 'Sorry, we could not send the invite.'),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
97
|
+
<DialogContent className="sm:max-w-[425px]">
|
|
98
|
+
<DialogHeader>
|
|
99
|
+
<DialogTitle>Send Invite</DialogTitle>
|
|
100
|
+
<DialogDescription>
|
|
101
|
+
Send an invite email to {userData.email}?
|
|
102
|
+
</DialogDescription>
|
|
103
|
+
</DialogHeader>
|
|
104
|
+
|
|
105
|
+
<DialogFooter>
|
|
106
|
+
<Button
|
|
107
|
+
type="button"
|
|
108
|
+
variant="outline"
|
|
109
|
+
onClick={() => {
|
|
110
|
+
onOpenChange(false);
|
|
111
|
+
}}
|
|
112
|
+
>
|
|
113
|
+
Cancel
|
|
114
|
+
</Button>
|
|
115
|
+
<Button onClick={handleConfirm} disabled={loading}>
|
|
116
|
+
Send Invite
|
|
117
|
+
</Button>
|
|
118
|
+
</DialogFooter>
|
|
119
|
+
</DialogContent>
|
|
120
|
+
</Dialog>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
@@ -141,6 +141,12 @@ export declare const adminCrudManageRolesActionGenerator: import("@baseplate-dev
|
|
|
141
141
|
InputGroupInput: {};
|
|
142
142
|
InputGroupText: {};
|
|
143
143
|
InputGroupTextarea: {};
|
|
144
|
+
InputOtp: {};
|
|
145
|
+
InputOtpField: {};
|
|
146
|
+
InputOtpFieldController: {};
|
|
147
|
+
InputOtpGroup: {};
|
|
148
|
+
InputOtpSeparator: {};
|
|
149
|
+
InputOtpSlot: {};
|
|
144
150
|
inputVariants: {};
|
|
145
151
|
Item: {};
|
|
146
152
|
ItemActions: {};
|
|
@@ -379,6 +385,12 @@ export declare const adminCrudManageRolesActionGenerator: import("@baseplate-dev
|
|
|
379
385
|
InputGroupInput: {};
|
|
380
386
|
InputGroupText: {};
|
|
381
387
|
InputGroupTextarea: {};
|
|
388
|
+
InputOtp: {};
|
|
389
|
+
InputOtpField: {};
|
|
390
|
+
InputOtpFieldController: {};
|
|
391
|
+
InputOtpGroup: {};
|
|
392
|
+
InputOtpSeparator: {};
|
|
393
|
+
InputOtpSlot: {};
|
|
382
394
|
inputVariants: {};
|
|
383
395
|
Item: {};
|
|
384
396
|
ItemActions: {};
|
package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts
CHANGED
|
@@ -139,6 +139,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_MANAGE_ROLES_ACTION_GENERATED:
|
|
|
139
139
|
InputGroupInput: {};
|
|
140
140
|
InputGroupText: {};
|
|
141
141
|
InputGroupTextarea: {};
|
|
142
|
+
InputOtp: {};
|
|
143
|
+
InputOtpField: {};
|
|
144
|
+
InputOtpFieldController: {};
|
|
145
|
+
InputOtpGroup: {};
|
|
146
|
+
InputOtpSeparator: {};
|
|
147
|
+
InputOtpSlot: {};
|
|
142
148
|
inputVariants: {};
|
|
143
149
|
Item: {};
|
|
144
150
|
ItemActions: {};
|
|
@@ -388,6 +394,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_MANAGE_ROLES_ACTION_GENERATED:
|
|
|
388
394
|
InputGroupInput: {};
|
|
389
395
|
InputGroupText: {};
|
|
390
396
|
InputGroupTextarea: {};
|
|
397
|
+
InputOtp: {};
|
|
398
|
+
InputOtpField: {};
|
|
399
|
+
InputOtpFieldController: {};
|
|
400
|
+
InputOtpGroup: {};
|
|
401
|
+
InputOtpSeparator: {};
|
|
402
|
+
InputOtpSlot: {};
|
|
391
403
|
inputVariants: {};
|
|
392
404
|
Item: {};
|
|
393
405
|
ItemActions: {};
|
|
@@ -138,6 +138,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_MANAGE_ROLES_ACTION_RENDERERS:
|
|
|
138
138
|
InputGroupInput: {};
|
|
139
139
|
InputGroupText: {};
|
|
140
140
|
InputGroupTextarea: {};
|
|
141
|
+
InputOtp: {};
|
|
142
|
+
InputOtpField: {};
|
|
143
|
+
InputOtpFieldController: {};
|
|
144
|
+
InputOtpGroup: {};
|
|
145
|
+
InputOtpSeparator: {};
|
|
146
|
+
InputOtpSlot: {};
|
|
141
147
|
inputVariants: {};
|
|
142
148
|
Item: {};
|
|
143
149
|
ItemActions: {};
|
|
@@ -128,6 +128,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_MANAGE_ROLES_ACTION_TEMPLATES:
|
|
|
128
128
|
InputGroupInput: {};
|
|
129
129
|
InputGroupText: {};
|
|
130
130
|
InputGroupTextarea: {};
|
|
131
|
+
InputOtp: {};
|
|
132
|
+
InputOtpField: {};
|
|
133
|
+
InputOtpFieldController: {};
|
|
134
|
+
InputOtpGroup: {};
|
|
135
|
+
InputOtpSeparator: {};
|
|
136
|
+
InputOtpSlot: {};
|
|
131
137
|
inputVariants: {};
|
|
132
138
|
Item: {};
|
|
133
139
|
ItemActions: {};
|
|
@@ -140,6 +140,12 @@ export declare const adminCrudResetPasswordActionGenerator: import("@baseplate-d
|
|
|
140
140
|
InputGroupInput: {};
|
|
141
141
|
InputGroupText: {};
|
|
142
142
|
InputGroupTextarea: {};
|
|
143
|
+
InputOtp: {};
|
|
144
|
+
InputOtpField: {};
|
|
145
|
+
InputOtpFieldController: {};
|
|
146
|
+
InputOtpGroup: {};
|
|
147
|
+
InputOtpSeparator: {};
|
|
148
|
+
InputOtpSlot: {};
|
|
143
149
|
inputVariants: {};
|
|
144
150
|
Item: {};
|
|
145
151
|
ItemActions: {};
|
|
@@ -378,6 +384,12 @@ export declare const adminCrudResetPasswordActionGenerator: import("@baseplate-d
|
|
|
378
384
|
InputGroupInput: {};
|
|
379
385
|
InputGroupText: {};
|
|
380
386
|
InputGroupTextarea: {};
|
|
387
|
+
InputOtp: {};
|
|
388
|
+
InputOtpField: {};
|
|
389
|
+
InputOtpFieldController: {};
|
|
390
|
+
InputOtpGroup: {};
|
|
391
|
+
InputOtpSeparator: {};
|
|
392
|
+
InputOtpSlot: {};
|
|
381
393
|
inputVariants: {};
|
|
382
394
|
Item: {};
|
|
383
395
|
ItemActions: {};
|
package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts
CHANGED
|
@@ -139,6 +139,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_RESET_PASSWORD_ACTION_GENERATED
|
|
|
139
139
|
InputGroupInput: {};
|
|
140
140
|
InputGroupText: {};
|
|
141
141
|
InputGroupTextarea: {};
|
|
142
|
+
InputOtp: {};
|
|
143
|
+
InputOtpField: {};
|
|
144
|
+
InputOtpFieldController: {};
|
|
145
|
+
InputOtpGroup: {};
|
|
146
|
+
InputOtpSeparator: {};
|
|
147
|
+
InputOtpSlot: {};
|
|
142
148
|
inputVariants: {};
|
|
143
149
|
Item: {};
|
|
144
150
|
ItemActions: {};
|
|
@@ -387,6 +393,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_RESET_PASSWORD_ACTION_GENERATED
|
|
|
387
393
|
InputGroupInput: {};
|
|
388
394
|
InputGroupText: {};
|
|
389
395
|
InputGroupTextarea: {};
|
|
396
|
+
InputOtp: {};
|
|
397
|
+
InputOtpField: {};
|
|
398
|
+
InputOtpFieldController: {};
|
|
399
|
+
InputOtpGroup: {};
|
|
400
|
+
InputOtpSeparator: {};
|
|
401
|
+
InputOtpSlot: {};
|
|
390
402
|
inputVariants: {};
|
|
391
403
|
Item: {};
|
|
392
404
|
ItemActions: {};
|
|
@@ -138,6 +138,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_RESET_PASSWORD_ACTION_RENDERERS
|
|
|
138
138
|
InputGroupInput: {};
|
|
139
139
|
InputGroupText: {};
|
|
140
140
|
InputGroupTextarea: {};
|
|
141
|
+
InputOtp: {};
|
|
142
|
+
InputOtpField: {};
|
|
143
|
+
InputOtpFieldController: {};
|
|
144
|
+
InputOtpGroup: {};
|
|
145
|
+
InputOtpSeparator: {};
|
|
146
|
+
InputOtpSlot: {};
|
|
141
147
|
inputVariants: {};
|
|
142
148
|
Item: {};
|
|
143
149
|
ItemActions: {};
|
|
@@ -126,6 +126,12 @@ export declare const mainGroup: {
|
|
|
126
126
|
InputGroupInput: {};
|
|
127
127
|
InputGroupText: {};
|
|
128
128
|
InputGroupTextarea: {};
|
|
129
|
+
InputOtp: {};
|
|
130
|
+
InputOtpField: {};
|
|
131
|
+
InputOtpFieldController: {};
|
|
132
|
+
InputOtpGroup: {};
|
|
133
|
+
InputOtpSeparator: {};
|
|
134
|
+
InputOtpSlot: {};
|
|
129
135
|
inputVariants: {};
|
|
130
136
|
Item: {};
|
|
131
137
|
ItemActions: {};
|
|
@@ -373,6 +379,12 @@ export declare const LOCAL_AUTH_ADMIN_ADMIN_CRUD_RESET_PASSWORD_ACTION_TEMPLATES
|
|
|
373
379
|
InputGroupInput: {};
|
|
374
380
|
InputGroupText: {};
|
|
375
381
|
InputGroupTextarea: {};
|
|
382
|
+
InputOtp: {};
|
|
383
|
+
InputOtpField: {};
|
|
384
|
+
InputOtpFieldController: {};
|
|
385
|
+
InputOtpGroup: {};
|
|
386
|
+
InputOtpSeparator: {};
|
|
387
|
+
InputOtpSlot: {};
|
|
376
388
|
inputVariants: {};
|
|
377
389
|
Item: {};
|
|
378
390
|
ItemActions: {};
|
|
@@ -123,6 +123,12 @@ export declare const adminCrudRolesColumnGenerator: import("@baseplate-dev/sync"
|
|
|
123
123
|
InputGroupInput: {};
|
|
124
124
|
InputGroupText: {};
|
|
125
125
|
InputGroupTextarea: {};
|
|
126
|
+
InputOtp: {};
|
|
127
|
+
InputOtpField: {};
|
|
128
|
+
InputOtpFieldController: {};
|
|
129
|
+
InputOtpGroup: {};
|
|
130
|
+
InputOtpSeparator: {};
|
|
131
|
+
InputOtpSlot: {};
|
|
126
132
|
inputVariants: {};
|
|
127
133
|
Item: {};
|
|
128
134
|
ItemActions: {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { adminCrudActionCompilerSpec, adminCrudColumnCompilerSpec, authConfigSpec, createPluginModule, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { adminCrudInviteUserActionGenerator } from './generators/admin-crud-invite-user-action/index.js';
|
|
2
3
|
import { adminCrudManageRolesActionGenerator } from './generators/admin-crud-manage-roles-action/index.js';
|
|
3
4
|
import { adminCrudResetPasswordActionGenerator } from './generators/admin-crud-reset-password-action/index.js';
|
|
4
5
|
import { adminCrudRolesColumnGenerator } from './generators/admin-crud-roles-column/index.js';
|
|
@@ -40,6 +41,17 @@ function buildResetPasswordActionCompiler() {
|
|
|
40
41
|
},
|
|
41
42
|
};
|
|
42
43
|
}
|
|
44
|
+
function buildInviteUserActionCompiler() {
|
|
45
|
+
return {
|
|
46
|
+
name: 'invite-user',
|
|
47
|
+
compileAction(definition, { order }) {
|
|
48
|
+
return adminCrudInviteUserActionGenerator({
|
|
49
|
+
order,
|
|
50
|
+
position: definition.position,
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
43
55
|
export default createPluginModule({
|
|
44
56
|
name: 'node',
|
|
45
57
|
dependencies: {
|
|
@@ -50,6 +62,7 @@ export default createPluginModule({
|
|
|
50
62
|
adminCrudActionCompiler.actions.addMany([
|
|
51
63
|
buildManageRolesActionCompiler(),
|
|
52
64
|
buildResetPasswordActionCompiler(),
|
|
65
|
+
buildInviteUserActionCompiler(),
|
|
53
66
|
]);
|
|
54
67
|
adminCrudColumnCompiler.columns.add(buildRolesColumnCompiler());
|
|
55
68
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { def } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const createAdminCrudInviteUserActionSchema: (context: import("@baseplate-dev/project-builder-lib").DefinitionSchemaParserContext) => z.ZodObject<{
|
|
4
|
+
id: z.ZodDefault<z.ZodString>;
|
|
5
|
+
position: z.ZodDefault<z.ZodEnum<{
|
|
6
|
+
inline: "inline";
|
|
7
|
+
dropdown: "dropdown";
|
|
8
|
+
}>>;
|
|
9
|
+
type: z.ZodLiteral<"invite-user">;
|
|
10
|
+
}, z.core.$loose>;
|
|
11
|
+
export type AdminCrudInviteUserActionDefinition = def.InferOutput<typeof createAdminCrudInviteUserActionSchema>;
|
|
12
|
+
//# sourceMappingURL=invite-user-action.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { baseAdminCrudActionSchema, definitionSchema, } from '@baseplate-dev/project-builder-lib';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const createAdminCrudInviteUserActionSchema = definitionSchema(() => baseAdminCrudActionSchema.extend({
|
|
4
|
+
type: z.literal('invite-user'),
|
|
5
|
+
}));
|
|
6
|
+
//# sourceMappingURL=invite-user-action.js.map
|
|
@@ -25,6 +25,14 @@ export default createPluginModule({
|
|
|
25
25
|
LOCAL_AUTH_MODELS.user,
|
|
26
26
|
getNewAction: () => ({ type: 'reset-password', position: 'dropdown' }),
|
|
27
27
|
},
|
|
28
|
+
{
|
|
29
|
+
pluginKey,
|
|
30
|
+
name: 'invite-user',
|
|
31
|
+
label: 'Send Invite',
|
|
32
|
+
isAvailableForModel: (definition, modelId) => ModelUtils.byIdOrThrow(definition, modelId).name ===
|
|
33
|
+
LOCAL_AUTH_MODELS.user,
|
|
34
|
+
getNewAction: () => ({ type: 'invite-user', position: 'dropdown' }),
|
|
35
|
+
},
|
|
28
36
|
]);
|
|
29
37
|
adminCrudColumnWeb.columns.add({
|
|
30
38
|
pluginKey,
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { authModelsSpec, createPluginModule, definitionIssueCheckerSpec, pluginConfigSpec, } from '@baseplate-dev/project-builder-lib';
|
|
1
|
+
import { authModelsSpec, createPluginModule, definitionIssueCheckerSpec, pluginConfigSpec, webAppSchemaExtensionSpec, } from '@baseplate-dev/project-builder-lib';
|
|
2
2
|
import { LOCAL_AUTH_MODELS } from '#src/local-auth/constants/model-names.js';
|
|
3
|
+
import { LOCAL_AUTH_PLUGIN_CONFIG_MIGRATIONS } from './schema/migrations.js';
|
|
3
4
|
import { createLocalAuthPluginDefinitionSchema } from './schema/plugin-definition.js';
|
|
4
5
|
import { createLocalAuthSchemaChecker } from './schema/schema-issue-checker.js';
|
|
6
|
+
import { createLocalAuthWebAppSchema } from './schema/web-app-schema.js';
|
|
5
7
|
export default createPluginModule({
|
|
6
8
|
name: 'common',
|
|
7
9
|
dependencies: {
|
|
8
10
|
pluginConfig: pluginConfigSpec,
|
|
9
11
|
authModels: authModelsSpec,
|
|
10
12
|
issueCheckers: definitionIssueCheckerSpec,
|
|
13
|
+
webAppSchemaExtension: webAppSchemaExtensionSpec,
|
|
11
14
|
},
|
|
12
|
-
initialize: ({ pluginConfig, authModels, issueCheckers }, { pluginKey }) => {
|
|
15
|
+
initialize: ({ pluginConfig, authModels, issueCheckers, webAppSchemaExtension }, { pluginKey }) => {
|
|
13
16
|
pluginConfig.schemas.set(pluginKey, createLocalAuthPluginDefinitionSchema);
|
|
17
|
+
pluginConfig.migrations.set(pluginKey, LOCAL_AUTH_PLUGIN_CONFIG_MIGRATIONS);
|
|
14
18
|
authModels.getAuthModels.set(() => ({
|
|
15
19
|
user: LOCAL_AUTH_MODELS.user,
|
|
16
20
|
}));
|
|
17
21
|
issueCheckers.checkers.set(pluginKey, createLocalAuthSchemaChecker(pluginKey));
|
|
22
|
+
webAppSchemaExtension.schemas.set(pluginKey, createLocalAuthWebAppSchema);
|
|
18
23
|
},
|
|
19
24
|
});
|
|
20
25
|
//# sourceMappingURL=common.js.map
|
|
@@ -26,6 +26,7 @@ export function LocalAuthDefinitionEditor({ definition: pluginMetadata, metadata
|
|
|
26
26
|
return {
|
|
27
27
|
additionalUserAdminRoles: [],
|
|
28
28
|
requireNameOnRegistration: false,
|
|
29
|
+
emailOtp: false,
|
|
29
30
|
};
|
|
30
31
|
}, [pluginMetadata?.config]);
|
|
31
32
|
const form = useResettableForm({
|
|
@@ -58,6 +59,6 @@ export function LocalAuthDefinitionEditor({ definition: pluginMetadata, metadata
|
|
|
58
59
|
useBlockUnsavedChangesNavigate({ control, reset, onSubmit });
|
|
59
60
|
return (_jsxs("div", { className: "auth:relative auth:flex auth:h-full auth:flex-1 auth:flex-col auth:gap-4 auth:overflow-hidden", children: [_jsx(AuthConfigTabs, {}), _jsx("div", { className: "auth:mb-[--action-bar-height] auth:flex auth:flex-1 auth:overflow-y-auto", style: {
|
|
60
61
|
'--action-bar-height': '52px',
|
|
61
|
-
}, children: _jsxs("form", { onSubmit: onSubmit, className: "auth:max-w-6xl auth:flex-1", children: [_jsx("div", { className: "auth:pb-16", children: _jsxs(SectionList, { children: [_jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Local Auth User Models" }), _jsx(SectionListSectionDescription, { children: "The plugin will automatically configure the models it needs." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(DefinitionDiffAlert, { diff: diff }) })] }), _jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "User Management Permissions" }), _jsx(SectionListSectionDescription, { children: "The \"admin\" role always has user management permissions. Optionally add more roles that can manage users and assign roles in the admin interface." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(MultiComboboxFieldController, { label: "Additional User Admin Roles", name: "additionalUserAdminRoles", control: control, options: roles, description: "Additional roles (beyond admin) that can manage users and assign roles." }) })] }), _jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Registration Settings" }), _jsx(SectionListSectionDescription, { children: "Configure what information is collected during user registration." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(SwitchFieldController, { label: "Require Name on Registration", name: "requireNameOnRegistration", control: control, description: "When enabled, users must provide their name when registering." }) })] })] }) }), _jsx(FormActionBar, { form: form, allowSaveWithoutDirty: !pluginMetadata || diff.hasChanges })] }) })] }));
|
|
62
|
+
}, children: _jsxs("form", { onSubmit: onSubmit, className: "auth:max-w-6xl auth:flex-1", children: [_jsx("div", { className: "auth:pb-16", children: _jsxs(SectionList, { children: [_jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Local Auth User Models" }), _jsx(SectionListSectionDescription, { children: "The plugin will automatically configure the models it needs." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(DefinitionDiffAlert, { diff: diff }) })] }), _jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "User Management Permissions" }), _jsx(SectionListSectionDescription, { children: "The \"admin\" role always has user management permissions. Optionally add more roles that can manage users and assign roles in the admin interface." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(MultiComboboxFieldController, { label: "Additional User Admin Roles", name: "additionalUserAdminRoles", control: control, options: roles, description: "Additional roles (beyond admin) that can manage users and assign roles." }) })] }), _jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Registration Settings" }), _jsx(SectionListSectionDescription, { children: "Configure what information is collected during user registration." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(SwitchFieldController, { label: "Require Name on Registration", name: "requireNameOnRegistration", control: control, description: "When enabled, users must provide their name when registering." }) })] }), _jsxs(SectionListSection, { children: [_jsxs(SectionListSectionHeader, { children: [_jsx(SectionListSectionTitle, { children: "Sign-in Methods" }), _jsx(SectionListSectionDescription, { children: "Choose how users can sign in, in addition to email and password." })] }), _jsx(SectionListSectionContent, { className: "auth:space-y-6", children: _jsx(SwitchFieldController, { label: "Email Sign-in Codes", name: "emailOtp", control: control, description: "When enabled, users can sign in with a single-use code emailed to them instead of a password. Signing in with a code creates an account if the address is new." }) })] })] }) }), _jsx(FormActionBar, { form: form, allowSaveWithoutDirty: !pluginMetadata || diff.hasChanges })] }) })] }));
|
|
62
63
|
}
|
|
63
64
|
//# sourceMappingURL=local-auth-definition-editor.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WebAppSettingsFormProps } from '@baseplate-dev/project-builder-lib/web';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the local-auth per-app settings (disable registration toggle) in
|
|
5
|
+
* the web app settings page. Bound to `pluginData[pluginKey]` on the shared
|
|
6
|
+
* web app form.
|
|
7
|
+
*/
|
|
8
|
+
export declare function LocalAuthWebAppSettingsForm({ formProps, pluginKey, }: WebAppSettingsFormProps): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=local-auth-web-app-settings-form.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SwitchFieldController } from '@baseplate-dev/ui-components';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the local-auth per-app settings (disable registration toggle) in
|
|
5
|
+
* the web app settings page. Bound to `pluginData[pluginKey]` on the shared
|
|
6
|
+
* web app form.
|
|
7
|
+
*/
|
|
8
|
+
export function LocalAuthWebAppSettingsForm({ formProps, pluginKey, }) {
|
|
9
|
+
return (_jsx(SwitchFieldController, { label: "Disable Registration", description: "When enabled, this site's sign-up page and link are hidden so users can only be added via an invite.", control: formProps.control, name: `pluginData.${pluginKey}.disableRegistration` }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=local-auth-web-app-settings-form.js.map
|
package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare const authEmailPasswordGenerator: import("@baseplate-dev/sync").G
|
|
|
5
5
|
adminRoles: string[];
|
|
6
6
|
devWebDomainPort: number;
|
|
7
7
|
requireNameOnRegistration: boolean;
|
|
8
|
+
emailOtp?: boolean | undefined;
|
|
9
|
+
disableRegistration?: boolean | undefined;
|
|
8
10
|
}, {
|
|
9
11
|
paths: import("@baseplate-dev/sync").GeneratorTask<{
|
|
10
12
|
localAuthCoreAuthEmailPasswordPaths: import("@baseplate-dev/sync").ProviderExport<import("./generated/template-paths.js").LocalAuthCoreAuthEmailPasswordPaths>;
|
|
@@ -34,10 +36,13 @@ export declare const authEmailPasswordGenerator: import("@baseplate-dev/sync").G
|
|
|
34
36
|
cleanupAuthVerificationQueue: {};
|
|
35
37
|
cleanupAuthVerificationWorker: {};
|
|
36
38
|
cleanupExpiredAuthVerifications: {};
|
|
39
|
+
consumeCodeVerification: {};
|
|
37
40
|
CookieUserSessionService: {};
|
|
38
41
|
createAuthVerification: {};
|
|
42
|
+
createCodeVerification: {};
|
|
39
43
|
userSessionPayload: {};
|
|
40
44
|
validateAuthVerification: {};
|
|
45
|
+
validateCodeVerification: {};
|
|
41
46
|
}>>;
|
|
42
47
|
configServiceImports: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/core-generators").InferTsImportMapFromSchema<{
|
|
43
48
|
getConfig: {};
|
|
@@ -114,6 +119,7 @@ export declare const authEmailPasswordGenerator: import("@baseplate-dev/sync").G
|
|
|
114
119
|
appModule: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/fastify-generators").AppModuleProvider>;
|
|
115
120
|
}, any>;
|
|
116
121
|
main: import("@baseplate-dev/sync").GeneratorTask<any, {
|
|
122
|
+
paths: import("@baseplate-dev/sync").ProviderType<import("./generated/template-paths.js").LocalAuthCoreAuthEmailPasswordPaths>;
|
|
117
123
|
renderers: import("@baseplate-dev/sync").ProviderType<import("./generated/template-renderers.js").LocalAuthCoreAuthEmailPasswordRenderers>;
|
|
118
124
|
transactionalLibConfig: import("@baseplate-dev/sync").ProviderType<import("@baseplate-dev/plugin-email").TransactionalLibConfigProvider>;
|
|
119
125
|
userObjectType: import("@baseplate-dev/sync").ProviderDependency<import("@baseplate-dev/fastify-generators").PothosTypeOutputProvider>;
|