@wasp.sh/wasp-cli-darwin-arm64-unknown 0.20.0
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/data/Cli/starters/README.md +22 -0
- package/data/Cli/starters/basic/README.md +35 -0
- package/data/Cli/starters/basic/eslint.config.js +24 -0
- package/data/Cli/starters/basic/main.wasp +100 -0
- package/data/Cli/starters/basic/package.json +29 -0
- package/data/Cli/starters/basic/postcss.config.js +6 -0
- package/data/Cli/starters/basic/schema.prisma +42 -0
- package/data/Cli/starters/basic/src/App.css +13 -0
- package/data/Cli/starters/basic/src/App.tsx +12 -0
- package/data/Cli/starters/basic/src/assets/logo.svg +1 -0
- package/data/Cli/starters/basic/src/auth/AuthLayout.tsx +10 -0
- package/data/Cli/starters/basic/src/auth/email/EmailVerificationPage.tsx +19 -0
- package/data/Cli/starters/basic/src/auth/email/LoginPage.tsx +27 -0
- package/data/Cli/starters/basic/src/auth/email/PasswordResetPage.tsx +19 -0
- package/data/Cli/starters/basic/src/auth/email/RequestPasswordResetPage.tsx +10 -0
- package/data/Cli/starters/basic/src/auth/email/SignupPage.tsx +34 -0
- package/data/Cli/starters/basic/src/auth/email/userSignupFields.ts +13 -0
- package/data/Cli/starters/basic/src/shared/components/Button.tsx +90 -0
- package/data/Cli/starters/basic/src/shared/components/Dialog.tsx +85 -0
- package/data/Cli/starters/basic/src/shared/components/Header.tsx +39 -0
- package/data/Cli/starters/basic/src/shared/components/Input.tsx +36 -0
- package/data/Cli/starters/basic/src/shared/components/Portal.tsx +26 -0
- package/data/Cli/starters/basic/src/tags/actions.ts +23 -0
- package/data/Cli/starters/basic/src/tags/components/ColorRadioButton.tsx +44 -0
- package/data/Cli/starters/basic/src/tags/components/ColorRadioButtons.tsx +59 -0
- package/data/Cli/starters/basic/src/tags/components/CreateTagDialog.tsx +50 -0
- package/data/Cli/starters/basic/src/tags/components/CreateTagForm.tsx +100 -0
- package/data/Cli/starters/basic/src/tags/components/TagLabel.tsx +55 -0
- package/data/Cli/starters/basic/src/tags/components/colors.ts +8 -0
- package/data/Cli/starters/basic/src/tags/queries.ts +14 -0
- package/data/Cli/starters/basic/src/tasks/TasksPage.tsx +19 -0
- package/data/Cli/starters/basic/src/tasks/actions.ts +71 -0
- package/data/Cli/starters/basic/src/tasks/components/CreateTaskForm.tsx +103 -0
- package/data/Cli/starters/basic/src/tasks/components/TaskList.tsx +68 -0
- package/data/Cli/starters/basic/src/tasks/components/TaskListItem.tsx +56 -0
- package/data/Cli/starters/basic/src/tasks/queries.ts +21 -0
- package/data/Cli/starters/basic/tailwind.config.js +30 -0
- package/data/Cli/starters/basic/vite.config.ts +7 -0
- package/data/Cli/starters/minimal/main.wasp +14 -0
- package/data/Cli/starters/minimal/package.json +18 -0
- package/data/Cli/starters/minimal/schema.prisma +10 -0
- package/data/Cli/starters/minimal/src/Main.css +103 -0
- package/data/Cli/starters/minimal/src/MainPage.tsx +37 -0
- package/data/Cli/starters/minimal/src/assets/logo.svg +1 -0
- package/data/Cli/starters/minimal/vite.config.ts +7 -0
- package/data/Cli/starters/skeleton/public/favicon.ico +0 -0
- package/data/Cli/starters/skeleton/src/vite-env.d.ts +7 -0
- package/data/Cli/starters/skeleton/tsconfig.json +28 -0
- package/data/Generator/templates/Dockerfile +78 -0
- package/data/Generator/templates/db/schema.prisma +24 -0
- package/data/Generator/templates/dockerignore +2 -0
- package/data/Generator/templates/react-app/README.md +21 -0
- package/data/Generator/templates/react-app/gitignore +23 -0
- package/data/Generator/templates/react-app/index.html +22 -0
- package/data/Generator/templates/react-app/netlify.toml +8 -0
- package/data/Generator/templates/react-app/npmrc +1 -0
- package/data/Generator/templates/react-app/package.json +31 -0
- package/data/Generator/templates/react-app/public/manifest.json +15 -0
- package/data/Generator/templates/react-app/src/auth/pages/OAuthCallback.tsx +93 -0
- package/data/Generator/templates/react-app/src/auth/pages/createAuthRequiredPage.jsx +40 -0
- package/data/Generator/templates/react-app/src/components/DefaultRootErrorBoundary.tsx +16 -0
- package/data/Generator/templates/react-app/src/components/FullPageWrapper.tsx +21 -0
- package/data/Generator/templates/react-app/src/components/Loader.module.css +37 -0
- package/data/Generator/templates/react-app/src/components/Loader.tsx +12 -0
- package/data/Generator/templates/react-app/src/components/Message.tsx +86 -0
- package/data/Generator/templates/react-app/src/index.tsx +47 -0
- package/data/Generator/templates/react-app/src/logo.png +0 -0
- package/data/Generator/templates/react-app/src/router.tsx +59 -0
- package/data/Generator/templates/react-app/src/test/vitest/setup.ts +8 -0
- package/data/Generator/templates/react-app/src/utils.js +3 -0
- package/data/Generator/templates/react-app/src/vite-env.d.ts +1 -0
- package/data/Generator/templates/react-app/tsconfig.app.json +28 -0
- package/data/Generator/templates/react-app/tsconfig.json +11 -0
- package/data/Generator/templates/react-app/tsconfig.vite.json +16 -0
- package/data/Generator/templates/react-app/vite/detectServerImports.ts +53 -0
- package/data/Generator/templates/react-app/vite/validateEnv.ts +45 -0
- package/data/Generator/templates/react-app/vite.config.ts +74 -0
- package/data/Generator/templates/sdk/wasp/api/events.ts +11 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +136 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +13 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +22 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +20 -0
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +14 -0
- package/data/Generator/templates/sdk/wasp/auth/email/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Auth.module.css +16 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Auth.tsx +94 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/ForgotPassword.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Login.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/ResetPassword.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/Signup.tsx +24 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/VerifyEmail.tsx +18 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.module.css +99 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Form.tsx +74 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.module.css +22 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/Message.tsx +34 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/auth-styles.css +30 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.module.css +55 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/common/LoginSignupForm.tsx +291 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ForgotPasswordForm.tsx +52 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/ResetPasswordForm.tsx +82 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/VerifyEmailForm.tsx +43 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/email/useEmail.ts +33 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.module.css +33 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialButton.tsx +14 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.module.css +4 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/social/SocialIcons.tsx +74 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/usernameAndPassword/useUsernameAndPassword.ts +29 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/internal/util.ts +16 -0
- package/data/Generator/templates/sdk/wasp/auth/forms/types.ts +77 -0
- package/data/Generator/templates/sdk/wasp/auth/helpers/_Provider.tsx +17 -0
- package/data/Generator/templates/sdk/wasp/auth/helpers/user.ts +15 -0
- package/data/Generator/templates/sdk/wasp/auth/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/auth/jwt.ts +22 -0
- package/data/Generator/templates/sdk/wasp/auth/logout.ts +18 -0
- package/data/Generator/templates/sdk/wasp/auth/lucia.ts +53 -0
- package/data/Generator/templates/sdk/wasp/auth/password.ts +36 -0
- package/data/Generator/templates/sdk/wasp/auth/providers/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/auth/providers/types.ts +68 -0
- package/data/Generator/templates/sdk/wasp/auth/session.ts +78 -0
- package/data/Generator/templates/sdk/wasp/auth/types.ts +2 -0
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +37 -0
- package/data/Generator/templates/sdk/wasp/auth/user.ts +63 -0
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +13 -0
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +20 -0
- package/data/Generator/templates/sdk/wasp/auth/username/index.ts +2 -0
- package/data/Generator/templates/sdk/wasp/auth/utils.ts +369 -0
- package/data/Generator/templates/sdk/wasp/auth/validation.ts +83 -0
- package/data/Generator/templates/sdk/wasp/client/auth/discord.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/email.ts +5 -0
- package/data/Generator/templates/sdk/wasp/client/auth/github.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/google.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/index.ts +29 -0
- package/data/Generator/templates/sdk/wasp/client/auth/keycloak.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/slack.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/auth/ui.ts +32 -0
- package/data/Generator/templates/sdk/wasp/client/auth/username.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/config.ts +15 -0
- package/data/Generator/templates/sdk/wasp/client/crud/_crud.ts +89 -0
- package/data/Generator/templates/sdk/wasp/client/crud/index.ts +4 -0
- package/data/Generator/templates/sdk/wasp/client/crud/operationsHelpers.ts +21 -0
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/env.ts +5 -0
- package/data/Generator/templates/sdk/wasp/client/hooks.ts +19 -0
- package/data/Generator/templates/sdk/wasp/client/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/client/operations/actions/core.ts +49 -0
- package/data/Generator/templates/sdk/wasp/client/operations/actions/index.ts +13 -0
- package/data/Generator/templates/sdk/wasp/client/operations/hooks.ts +347 -0
- package/data/Generator/templates/sdk/wasp/client/operations/index.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +22 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/resources.js +83 -0
- package/data/Generator/templates/sdk/wasp/client/operations/internal/updateHandlersMap.js +37 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queries/core.ts +91 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queries/index.ts +16 -0
- package/data/Generator/templates/sdk/wasp/client/operations/queryClient.ts +34 -0
- package/data/Generator/templates/sdk/wasp/client/operations/rpc.ts +96 -0
- package/data/Generator/templates/sdk/wasp/client/router/Link.tsx +21 -0
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +53 -0
- package/data/Generator/templates/sdk/wasp/client/router/linkHelpers.ts +48 -0
- package/data/Generator/templates/sdk/wasp/client/router/types.ts +98 -0
- package/data/Generator/templates/sdk/wasp/client/test/index.ts +1 -0
- package/data/Generator/templates/sdk/wasp/client/test/vitest/helpers.tsx +95 -0
- package/data/Generator/templates/sdk/wasp/client/webSocket/WebSocketProvider.tsx +77 -0
- package/data/Generator/templates/sdk/wasp/client/webSocket/index.ts +39 -0
- package/data/Generator/templates/sdk/wasp/core/auth.ts +40 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/custom-register.ts +21 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/index.ts +56 -0
- package/data/Generator/templates/sdk/wasp/core/serialization/prisma.ts +54 -0
- package/data/Generator/templates/sdk/wasp/core/storage.ts +50 -0
- package/data/Generator/templates/sdk/wasp/dev/index.ts +19 -0
- package/data/Generator/templates/sdk/wasp/entities/index.ts +28 -0
- package/data/Generator/templates/sdk/wasp/env/index.ts +9 -0
- package/data/Generator/templates/sdk/wasp/env/validation.ts +38 -0
- package/data/Generator/templates/sdk/wasp/package.json +152 -0
- package/data/Generator/templates/sdk/wasp/prisma-runtime-library.d.ts +17 -0
- package/data/Generator/templates/sdk/wasp/scripts/copy-assets.js +14 -0
- package/data/Generator/templates/sdk/wasp/server/HttpError.ts +30 -0
- package/data/Generator/templates/sdk/wasp/server/_types/index.ts +105 -0
- package/data/Generator/templates/sdk/wasp/server/_types/taggedEntities.ts +26 -0
- package/data/Generator/templates/sdk/wasp/server/api/index.ts +44 -0
- package/data/Generator/templates/sdk/wasp/server/auth/email/index.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/email/utils.ts +104 -0
- package/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +188 -0
- package/data/Generator/templates/sdk/wasp/server/auth/index.ts +49 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/index.ts +38 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/oneTimeCode.ts +50 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/provider.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/discord.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/github.ts +20 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/google.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/keycloak.ts +23 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/providers/slack.ts +22 -0
- package/data/Generator/templates/sdk/wasp/server/auth/oauth/redirect.ts +43 -0
- package/data/Generator/templates/sdk/wasp/server/auth/user.ts +148 -0
- package/data/Generator/templates/sdk/wasp/server/auth/username.ts +1 -0
- package/data/Generator/templates/sdk/wasp/server/config.ts +47 -0
- package/data/Generator/templates/sdk/wasp/server/crud/_operationTypes.ts +134 -0
- package/data/Generator/templates/sdk/wasp/server/crud/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/server/dbClient.ts +35 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/helpers.ts +40 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/dummy.ts +34 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/mailgun.ts +31 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/sendgrid.ts +44 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/providers/smtp.ts +29 -0
- package/data/Generator/templates/sdk/wasp/server/email/core/types.ts +59 -0
- package/data/Generator/templates/sdk/wasp/server/email/index.ts +39 -0
- package/data/Generator/templates/sdk/wasp/server/env.ts +173 -0
- package/data/Generator/templates/sdk/wasp/server/index.ts +17 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/_job.ts +39 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/job.ts +28 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/index.ts +3 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBoss.ts +76 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/pgBossJob.ts +230 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/core/pgBoss/types.ts +9 -0
- package/data/Generator/templates/sdk/wasp/server/jobs/index.ts +5 -0
- package/data/Generator/templates/sdk/wasp/server/middleware/globalMiddleware.ts +8 -0
- package/data/Generator/templates/sdk/wasp/server/middleware/index.ts +1 -0
- package/data/Generator/templates/sdk/wasp/server/operations/actions/index.ts +41 -0
- package/data/Generator/templates/sdk/wasp/server/operations/actions/types.ts +35 -0
- package/data/Generator/templates/sdk/wasp/server/operations/index.ts +13 -0
- package/data/Generator/templates/sdk/wasp/server/operations/queries/index.ts +42 -0
- package/data/Generator/templates/sdk/wasp/server/operations/queries/types.ts +36 -0
- package/data/Generator/templates/sdk/wasp/server/operations/wrappers.ts +242 -0
- package/data/Generator/templates/sdk/wasp/server/types/index.ts +11 -0
- package/data/Generator/templates/sdk/wasp/server/utils.ts +38 -0
- package/data/Generator/templates/sdk/wasp/server/webSocket/index.ts +57 -0
- package/data/Generator/templates/sdk/wasp/tsconfig.json +102 -0
- package/data/Generator/templates/sdk/wasp/universal/ansiColors.ts +14 -0
- package/data/Generator/templates/sdk/wasp/universal/predicates.ts +3 -0
- package/data/Generator/templates/sdk/wasp/universal/types.ts +74 -0
- package/data/Generator/templates/sdk/wasp/universal/url.ts +9 -0
- package/data/Generator/templates/sdk/wasp/universal/validators.ts +21 -0
- package/data/Generator/templates/sdk/wasp/vite-env.d.ts +1 -0
- package/data/Generator/templates/server/README.md +1 -0
- package/data/Generator/templates/server/gitignore +6 -0
- package/data/Generator/templates/server/nodemon.json +13 -0
- package/data/Generator/templates/server/npmrc +1 -0
- package/data/Generator/templates/server/package.json +27 -0
- package/data/Generator/templates/server/rollup.config.js +44 -0
- package/data/Generator/templates/server/src/actions/_action.ts +18 -0
- package/data/Generator/templates/server/src/app.js +36 -0
- package/data/Generator/templates/server/src/auth/hooks.ts +135 -0
- package/data/Generator/templates/server/src/auth/providers/config/discord.ts +69 -0
- package/data/Generator/templates/server/src/auth/providers/config/email.ts +96 -0
- package/data/Generator/templates/server/src/auth/providers/config/github.ts +78 -0
- package/data/Generator/templates/server/src/auth/providers/config/google.ts +65 -0
- package/data/Generator/templates/server/src/auth/providers/config/keycloak.ts +67 -0
- package/data/Generator/templates/server/src/auth/providers/config/slack.ts +65 -0
- package/data/Generator/templates/server/src/auth/providers/config/username.ts +33 -0
- package/data/Generator/templates/server/src/auth/providers/email/login.ts +66 -0
- package/data/Generator/templates/server/src/auth/providers/email/requestPasswordReset.ts +74 -0
- package/data/Generator/templates/server/src/auth/providers/email/resetPassword.ts +48 -0
- package/data/Generator/templates/server/src/auth/providers/email/signup.ts +165 -0
- package/data/Generator/templates/server/src/auth/providers/email/verifyEmail.ts +42 -0
- package/data/Generator/templates/server/src/auth/providers/index.ts +32 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/config.ts +19 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/cookies.ts +35 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +130 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/oneTimeCode.ts +39 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/state.ts +144 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/types.ts +7 -0
- package/data/Generator/templates/server/src/auth/providers/oauth/user.ts +139 -0
- package/data/Generator/templates/server/src/auth/providers/username/login.ts +64 -0
- package/data/Generator/templates/server/src/auth/providers/username/signup.ts +59 -0
- package/data/Generator/templates/server/src/crud/_operations.ts +184 -0
- package/data/Generator/templates/server/src/dbSeed.ts +37 -0
- package/data/Generator/templates/server/src/jobs/_job.ts +9 -0
- package/data/Generator/templates/server/src/jobs/core/allJobs.ts +8 -0
- package/data/Generator/templates/server/src/middleware/globalMiddleware.ts +45 -0
- package/data/Generator/templates/server/src/middleware/index.ts +1 -0
- package/data/Generator/templates/server/src/middleware/operations.ts +28 -0
- package/data/Generator/templates/server/src/queries/_query.ts +18 -0
- package/data/Generator/templates/server/src/routes/apis/index.ts +67 -0
- package/data/Generator/templates/server/src/routes/auth/index.js +16 -0
- package/data/Generator/templates/server/src/routes/auth/logout.ts +12 -0
- package/data/Generator/templates/server/src/routes/auth/me.ts +10 -0
- package/data/Generator/templates/server/src/routes/crud/_crud.ts +46 -0
- package/data/Generator/templates/server/src/routes/crud/index.ts +12 -0
- package/data/Generator/templates/server/src/routes/index.js +55 -0
- package/data/Generator/templates/server/src/routes/operations/_action.js +5 -0
- package/data/Generator/templates/server/src/routes/operations/_query.js +5 -0
- package/data/Generator/templates/server/src/routes/operations/index.js +18 -0
- package/data/Generator/templates/server/src/server.ts +76 -0
- package/data/Generator/templates/server/src/views/wrong-port.ts +123 -0
- package/data/Generator/templates/server/src/webSocket/initialization.ts +59 -0
- package/data/Generator/templates/server/tsconfig.json +41 -0
- package/data/Lsp/templates/ts/action.fn.ts +12 -0
- package/data/Lsp/templates/ts/operation.fn.js +7 -0
- package/data/Lsp/templates/ts/page.component.jsx +9 -0
- package/data/Lsp/templates/ts/query.fn.ts +12 -0
- package/data/packages/deploy/dist/common/brandedTypes.js +2 -0
- package/data/packages/deploy/dist/common/clientApp.js +26 -0
- package/data/packages/deploy/dist/common/commander.js +8 -0
- package/data/packages/deploy/dist/common/random.js +5 -0
- package/data/packages/deploy/dist/common/terminal.js +24 -0
- package/data/packages/deploy/dist/common/typeUtils.js +2 -0
- package/data/packages/deploy/dist/common/validation.js +14 -0
- package/data/packages/deploy/dist/common/waspBuild.js +21 -0
- package/data/packages/deploy/dist/common/waspProject.js +43 -0
- package/data/packages/deploy/dist/common/zx.js +10 -0
- package/data/packages/deploy/dist/index.js +30 -0
- package/data/packages/deploy/dist/providers/fly/CommonCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/CommonOps.js +36 -0
- package/data/packages/deploy/dist/providers/fly/DeploymentInstructions.js +12 -0
- package/data/packages/deploy/dist/providers/fly/commands/cmd/CmdCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/cmd/cmd.js +29 -0
- package/data/packages/deploy/dist/providers/fly/commands/createDb/CreateDbCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/createDb/createDb.js +55 -0
- package/data/packages/deploy/dist/providers/fly/commands/deploy/DeployCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/deploy/deploy.js +88 -0
- package/data/packages/deploy/dist/providers/fly/commands/launch/LaunchCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/launch/launch.js +17 -0
- package/data/packages/deploy/dist/providers/fly/commands/setup/SetupCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/fly/commands/setup/setup.js +141 -0
- package/data/packages/deploy/dist/providers/fly/flyAppUrl.js +4 -0
- package/data/packages/deploy/dist/providers/fly/flyCli.js +74 -0
- package/data/packages/deploy/dist/providers/fly/index.js +121 -0
- package/data/packages/deploy/dist/providers/fly/jsonOutputSchemas.js +37 -0
- package/data/packages/deploy/dist/providers/fly/tomlFile.js +65 -0
- package/data/packages/deploy/dist/providers/railway/DeploymentInstructions.js +11 -0
- package/data/packages/deploy/dist/providers/railway/brandedTypes.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/DeployCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/client.js +22 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/common.js +40 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/index.js +57 -0
- package/data/packages/deploy/dist/providers/railway/commands/deploy/server.js +17 -0
- package/data/packages/deploy/dist/providers/railway/commands/launch/LaunchCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/launch/launch.js +9 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/SetupCmdOptions.js +2 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +146 -0
- package/data/packages/deploy/dist/providers/railway/index.js +83 -0
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +19 -0
- package/data/packages/deploy/dist/providers/railway/ports.js +6 -0
- package/data/packages/deploy/dist/providers/railway/railwayCli.js +85 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/RailwayProject.js +14 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/cli.js +80 -0
- package/data/packages/deploy/dist/providers/railway/railwayProject/index.js +48 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/nameGenerator.js +24 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/url.js +32 -0
- package/data/packages/deploy/package-lock.json +3536 -0
- package/data/packages/deploy/package.json +29 -0
- package/data/packages/prisma/dist/format.js +35 -0
- package/data/packages/prisma/dist/index.js +33 -0
- package/data/packages/prisma/package-lock.json +5101 -0
- package/data/packages/prisma/package.json +30 -0
- package/data/packages/studio/dist/index.js +48 -0
- package/data/packages/studio/dist/public/assets/Flow-b5112d3d.js +26 -0
- package/data/packages/studio/dist/public/assets/index-17ce6ed4.css +1 -0
- package/data/packages/studio/dist/public/assets/index-62a9d21a.js +120 -0
- package/data/packages/studio/dist/public/index.html +14 -0
- package/data/packages/studio/package-lock.json +1866 -0
- package/data/packages/studio/package.json +33 -0
- package/data/packages/ts-inspect/dist/exports.js +82 -0
- package/data/packages/ts-inspect/dist/index.js +28 -0
- package/data/packages/ts-inspect/package-lock.json +4947 -0
- package/data/packages/ts-inspect/package.json +31 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.js +59 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +65 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.js +126 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.js +743 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts +224 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.js +656 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts +2 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.js +57 -0
- package/data/packages/wasp-config/dist/src/_private.d.ts +2 -0
- package/data/packages/wasp-config/dist/src/_private.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/_private.js +1 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts +16 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/appAnalyzer.js +34 -0
- package/data/packages/wasp-config/dist/src/appSpec.d.ts +223 -0
- package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/appSpec.js +6 -0
- package/data/packages/wasp-config/dist/src/branded.d.ts +7 -0
- package/data/packages/wasp-config/dist/src/branded.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/branded.js +1 -0
- package/data/packages/wasp-config/dist/src/cli.d.ts +6 -0
- package/data/packages/wasp-config/dist/src/cli.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/cli.js +24 -0
- package/data/packages/wasp-config/dist/src/index.d.ts +8 -0
- package/data/packages/wasp-config/dist/src/index.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/index.js +1 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts +38 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.js +294 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts +24 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/publicApi/App.js +75 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts +171 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.js +1 -0
- package/data/packages/wasp-config/dist/src/run.d.ts +3 -0
- package/data/packages/wasp-config/dist/src/run.d.ts.map +1 -0
- package/data/packages/wasp-config/dist/src/run.js +18 -0
- package/data/packages/wasp-config/package-lock.json +3992 -0
- package/data/packages/wasp-config/package.json +39 -0
- package/main.js +9 -0
- package/package.json +1 -0
- package/readme.md +3 -0
- package/wasp-bin +0 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import axios, { type AxiosInstance, type AxiosError } from 'axios'
|
|
2
|
+
|
|
3
|
+
import { config } from 'wasp/client'
|
|
4
|
+
import { storage } from 'wasp/core/storage'
|
|
5
|
+
import { apiEventsEmitter } from './events.js'
|
|
6
|
+
|
|
7
|
+
// PUBLIC API
|
|
8
|
+
export const api: AxiosInstance = axios.create({
|
|
9
|
+
baseURL: config.apiUrl,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const WASP_APP_AUTH_SESSION_ID_NAME = 'sessionId'
|
|
13
|
+
|
|
14
|
+
// PRIVATE API (sdk)
|
|
15
|
+
export function setSessionId(sessionId: string): void {
|
|
16
|
+
storage.set(WASP_APP_AUTH_SESSION_ID_NAME, sessionId)
|
|
17
|
+
apiEventsEmitter.emit('sessionId.set')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// PRIVATE API (sdk)
|
|
21
|
+
export function getSessionId(): string | null {
|
|
22
|
+
const sessionId = storage.get(WASP_APP_AUTH_SESSION_ID_NAME) as
|
|
23
|
+
| string
|
|
24
|
+
| undefined
|
|
25
|
+
return sessionId ?? null
|
|
26
|
+
}
|
|
27
|
+
// PRIVATE API (sdk)
|
|
28
|
+
export function clearSessionId(): void {
|
|
29
|
+
storage.remove(WASP_APP_AUTH_SESSION_ID_NAME)
|
|
30
|
+
apiEventsEmitter.emit('sessionId.clear')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// PRIVATE API (sdk)
|
|
34
|
+
export function removeLocalUserData(): void {
|
|
35
|
+
storage.clear()
|
|
36
|
+
apiEventsEmitter.emit('sessionId.clear')
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Axios interceptors for handling authentication
|
|
41
|
+
*
|
|
42
|
+
* (1) Request Interceptor:
|
|
43
|
+
* If a session ID exists, it is added to the request as an `Authorization`
|
|
44
|
+
* header for the server to use.
|
|
45
|
+
*
|
|
46
|
+
* (2) Response Interceptor:
|
|
47
|
+
* - Catches 401 errors from the server.
|
|
48
|
+
* - Before clearing the session ID from local storage due to a 401 error,
|
|
49
|
+
* it compares the session ID stored in the *failed request's config*
|
|
50
|
+
* with the *current* session ID in local storage.
|
|
51
|
+
* - It only clears the local session ID if the two session IDs match.
|
|
52
|
+
*
|
|
53
|
+
* This prevents a race condition like this:
|
|
54
|
+
* 1. Request A is sent with old session ID X.
|
|
55
|
+
* 2. User logs out and logs back in, obtaining new session ID Y.
|
|
56
|
+
* 3. Request A finally fails with a 401 (because ID X is invalid).
|
|
57
|
+
* Without the check, the interceptor would clear the *current* valid session ID Y.
|
|
58
|
+
* The check ensures we only clear the session if the *request that failed* used
|
|
59
|
+
* the *same session ID that's currently stored*.
|
|
60
|
+
*/
|
|
61
|
+
api.interceptors.request.use((config) => {
|
|
62
|
+
const sessionId = getSessionId()
|
|
63
|
+
if (sessionId !== null) {
|
|
64
|
+
config.headers['Authorization'] = `Bearer ${sessionId}`
|
|
65
|
+
}
|
|
66
|
+
return config
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
api.interceptors.response.use(undefined, (error) => {
|
|
70
|
+
const failingSessionId = getSessionIdFromAuthorizationHeader(error.config.headers['Authorization'])
|
|
71
|
+
const currentSessionId = getSessionId()
|
|
72
|
+
if (error.response?.status === 401 && failingSessionId === currentSessionId) {
|
|
73
|
+
clearSessionId()
|
|
74
|
+
}
|
|
75
|
+
return Promise.reject(error)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
// This handler will run on other tabs (not the active one calling API functions),
|
|
79
|
+
// and will ensure they know about auth session ID changes.
|
|
80
|
+
// Ref: https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
|
|
81
|
+
// "Note: This won't work on the same page that is making the changes — it is really a way
|
|
82
|
+
// for other pages on the domain using the storage to sync any changes that are made."
|
|
83
|
+
window.addEventListener('storage', (event) => {
|
|
84
|
+
if (event.key === storage.getPrefixedKey(WASP_APP_AUTH_SESSION_ID_NAME)) {
|
|
85
|
+
if (!!event.newValue) {
|
|
86
|
+
apiEventsEmitter.emit('sessionId.set')
|
|
87
|
+
} else {
|
|
88
|
+
apiEventsEmitter.emit('sessionId.clear')
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// PRIVATE API (sdk)
|
|
94
|
+
/**
|
|
95
|
+
* Takes an error returned by the app's API (as returned by axios), and transforms into a more
|
|
96
|
+
* standard format to be further used by the client. It is also assumed that given API
|
|
97
|
+
* error has been formatted as implemented by HttpError on the server.
|
|
98
|
+
*/
|
|
99
|
+
export function handleApiError<T extends AxiosError<{ message?: string, data?: unknown }>>(error: T): T | WaspHttpError {
|
|
100
|
+
if (error?.response) {
|
|
101
|
+
// If error came from HTTP response, we capture most informative message
|
|
102
|
+
// and also add .statusCode information to it.
|
|
103
|
+
// If error had JSON response, we assume it is of format { message, data } and
|
|
104
|
+
// add that info to the error.
|
|
105
|
+
// TODO: We might want to use HttpError here instead of just Error, since
|
|
106
|
+
// HttpError is also used on server to throw errors like these.
|
|
107
|
+
// That would require copying HttpError code to web-app also and using it here.
|
|
108
|
+
const responseJson = error.response?.data
|
|
109
|
+
const responseStatusCode = error.response.status
|
|
110
|
+
return new WaspHttpError(responseStatusCode, responseJson?.message ?? error.message, responseJson)
|
|
111
|
+
} else {
|
|
112
|
+
// If any other error, we just propagate it.
|
|
113
|
+
return error
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
class WaspHttpError extends Error {
|
|
118
|
+
statusCode: number
|
|
119
|
+
|
|
120
|
+
data: unknown
|
|
121
|
+
|
|
122
|
+
constructor (statusCode: number, message: string, data: unknown) {
|
|
123
|
+
super(message)
|
|
124
|
+
this.statusCode = statusCode
|
|
125
|
+
this.data = data
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function getSessionIdFromAuthorizationHeader(header: string | undefined): string | null {
|
|
130
|
+
const prefix = 'Bearer '
|
|
131
|
+
if (header && header.startsWith(prefix)) {
|
|
132
|
+
return header.substring(prefix.length)
|
|
133
|
+
} else {
|
|
134
|
+
return null
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import { api, handleApiError } from 'wasp/client/api';
|
|
3
|
+
import { initSession } from '../../helpers/user';
|
|
4
|
+
|
|
5
|
+
// PUBLIC API
|
|
6
|
+
export async function login(data: { email: string; password: string }): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
const response = await api.post('{= loginPath =}', data);
|
|
9
|
+
await initSession(response.data.sessionId);
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw handleApiError(e);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import { api, handleApiError } from 'wasp/client/api';
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export async function requestPasswordReset(data: { email: string; }): Promise<{ success: boolean }> {
|
|
6
|
+
try {
|
|
7
|
+
const response = await api.post('{= requestPasswordResetPath =}', data);
|
|
8
|
+
return response.data;
|
|
9
|
+
} catch (e) {
|
|
10
|
+
throw handleApiError(e);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// PUBLIC API
|
|
15
|
+
export async function resetPassword(data: { token: string; password: string; }): Promise<{ success: boolean }> {
|
|
16
|
+
try {
|
|
17
|
+
const response = await api.post('{= resetPasswordPath =}', data);
|
|
18
|
+
return response.data;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw handleApiError(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import { api, handleApiError } from 'wasp/client/api';
|
|
3
|
+
{=# emailUserSignupFields.isDefined =}
|
|
4
|
+
import { type UserEmailSignupFields } from '../../providers'
|
|
5
|
+
{=/ emailUserSignupFields.isDefined =}
|
|
6
|
+
|
|
7
|
+
type EmailSignupData = {
|
|
8
|
+
email: string
|
|
9
|
+
password: string
|
|
10
|
+
}{=# emailUserSignupFields.isDefined =} & UserEmailSignupFields{=/ emailUserSignupFields.isDefined =}
|
|
11
|
+
|
|
12
|
+
// PUBLIC API
|
|
13
|
+
export async function signup(data: EmailSignupData): Promise<{ success: boolean }> {
|
|
14
|
+
try {
|
|
15
|
+
const response = await api.post('{= signupPath =}', data);
|
|
16
|
+
return response.data;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw handleApiError(e);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import { api, handleApiError } from 'wasp/client/api'
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export async function verifyEmail(data: {
|
|
6
|
+
token: string
|
|
7
|
+
}): Promise<{ success: boolean; reason?: string }> {
|
|
8
|
+
try {
|
|
9
|
+
const response = await api.post('{= verifyEmailPath =}', data)
|
|
10
|
+
return response.data
|
|
11
|
+
} catch (e) {
|
|
12
|
+
throw handleApiError(e)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Using !important with some of the components is a workaround for Tailwind
|
|
3
|
+
CSS's having too much precedence.
|
|
4
|
+
https://github.com/wasp-lang/wasp/issues/1764
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.container {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.headerText {
|
|
13
|
+
font-size: 1.875rem !important;
|
|
14
|
+
font-weight: 700 !important;
|
|
15
|
+
margin-top: 1.5rem !important;
|
|
16
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{{={= =}=}}
|
|
2
|
+
import { useState, createContext, useMemo } from 'react'
|
|
3
|
+
import styles from './Auth.module.css'
|
|
4
|
+
import './internal/auth-styles.css'
|
|
5
|
+
import { tokenObjToCSSVars } from "./internal/util"
|
|
6
|
+
import { CSSProperties } from "react"
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type State,
|
|
10
|
+
type CustomizationOptions,
|
|
11
|
+
type ErrorMessage,
|
|
12
|
+
type AdditionalSignupFields,
|
|
13
|
+
} from './types'
|
|
14
|
+
import { LoginSignupForm } from './internal/common/LoginSignupForm'
|
|
15
|
+
import { MessageError, MessageSuccess } from './internal/Message'
|
|
16
|
+
{=# isEmailAuthEnabled =}
|
|
17
|
+
import { ForgotPasswordForm } from './internal/email/ForgotPasswordForm'
|
|
18
|
+
import { ResetPasswordForm } from './internal/email/ResetPasswordForm'
|
|
19
|
+
import { VerifyEmailForm } from './internal/email/VerifyEmailForm'
|
|
20
|
+
{=/ isEmailAuthEnabled =}
|
|
21
|
+
|
|
22
|
+
const logoStyle = {
|
|
23
|
+
height: '3rem'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// PRIVATE API
|
|
28
|
+
export const AuthContext = createContext({
|
|
29
|
+
isLoading: false,
|
|
30
|
+
setIsLoading: (isLoading: boolean) => {},
|
|
31
|
+
setErrorMessage: (errorMessage: ErrorMessage | null) => {},
|
|
32
|
+
setSuccessMessage: (successMessage: string | null) => {},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
function Auth ({ state, appearance, logo, socialLayout = 'horizontal', additionalSignupFields }: {
|
|
36
|
+
state: State;
|
|
37
|
+
} & CustomizationOptions & {
|
|
38
|
+
additionalSignupFields?: AdditionalSignupFields;
|
|
39
|
+
}) {
|
|
40
|
+
const [errorMessage, setErrorMessage] = useState<ErrorMessage | null>(null);
|
|
41
|
+
const [successMessage, setSuccessMessage] = useState<string | null>(null);
|
|
42
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
43
|
+
|
|
44
|
+
const customStyle = useMemo(() => ({
|
|
45
|
+
...tokenObjToCSSVars('color', appearance?.colors ?? {}),
|
|
46
|
+
...tokenObjToCSSVars('font-size', appearance?.fontSizes ?? {}),
|
|
47
|
+
}), [appearance])
|
|
48
|
+
|
|
49
|
+
const titles: Record<State, string> = {
|
|
50
|
+
login: 'Log in to your account',
|
|
51
|
+
signup: 'Create a new account',
|
|
52
|
+
{=# isEmailAuthEnabled =}
|
|
53
|
+
"forgot-password": "Forgot your password?",
|
|
54
|
+
"reset-password": "Reset your password",
|
|
55
|
+
"verify-email": "Email verification",
|
|
56
|
+
{=/ isEmailAuthEnabled =}
|
|
57
|
+
}
|
|
58
|
+
const title = titles[state]
|
|
59
|
+
|
|
60
|
+
const socialButtonsDirection = socialLayout === 'vertical' ? 'vertical' : 'horizontal'
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className={styles.container} style={customStyle}>
|
|
64
|
+
<div>
|
|
65
|
+
{logo && (<img style={logoStyle} src={logo} alt='Your Company' />)}
|
|
66
|
+
<h2 className={styles.headerText}>{title}</h2>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{errorMessage && (
|
|
70
|
+
<MessageError>
|
|
71
|
+
{errorMessage.title}{errorMessage.description && ': '}{errorMessage.description}
|
|
72
|
+
</MessageError>
|
|
73
|
+
)}
|
|
74
|
+
{successMessage && <MessageSuccess>{successMessage}</MessageSuccess>}
|
|
75
|
+
<AuthContext.Provider value={{ isLoading, setIsLoading, setErrorMessage, setSuccessMessage }}>
|
|
76
|
+
{(state === 'login' || state === 'signup') && (
|
|
77
|
+
<LoginSignupForm
|
|
78
|
+
state={state}
|
|
79
|
+
socialButtonsDirection={socialButtonsDirection}
|
|
80
|
+
additionalSignupFields={additionalSignupFields}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{=# isEmailAuthEnabled =}
|
|
84
|
+
{state === 'forgot-password' && (<ForgotPasswordForm />)}
|
|
85
|
+
{state === 'reset-password' && (<ResetPasswordForm />)}
|
|
86
|
+
{state === 'verify-email' && (<VerifyEmailForm />)}
|
|
87
|
+
{=/ isEmailAuthEnabled =}
|
|
88
|
+
</AuthContext.Provider>
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// PRIVATE API
|
|
94
|
+
export default Auth;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Auth from './Auth'
|
|
2
|
+
import { type CustomizationOptions, State } from './types'
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export function ForgotPasswordForm({
|
|
6
|
+
appearance,
|
|
7
|
+
logo,
|
|
8
|
+
socialLayout,
|
|
9
|
+
}: CustomizationOptions): React.JSX.Element {
|
|
10
|
+
return (
|
|
11
|
+
<Auth
|
|
12
|
+
appearance={appearance}
|
|
13
|
+
logo={logo}
|
|
14
|
+
socialLayout={socialLayout}
|
|
15
|
+
state={State.ForgotPassword}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Auth from './Auth'
|
|
2
|
+
import { type CustomizationOptions, State } from './types'
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export function LoginForm({
|
|
6
|
+
appearance,
|
|
7
|
+
logo,
|
|
8
|
+
socialLayout,
|
|
9
|
+
}: CustomizationOptions): React.JSX.Element {
|
|
10
|
+
return (
|
|
11
|
+
<Auth
|
|
12
|
+
appearance={appearance}
|
|
13
|
+
logo={logo}
|
|
14
|
+
socialLayout={socialLayout}
|
|
15
|
+
state={State.Login}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Auth from './Auth'
|
|
2
|
+
import { type CustomizationOptions, State } from './types'
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export function ResetPasswordForm({
|
|
6
|
+
appearance,
|
|
7
|
+
logo,
|
|
8
|
+
socialLayout,
|
|
9
|
+
}: CustomizationOptions): React.JSX.Element {
|
|
10
|
+
return (
|
|
11
|
+
<Auth
|
|
12
|
+
appearance={appearance}
|
|
13
|
+
logo={logo}
|
|
14
|
+
socialLayout={socialLayout}
|
|
15
|
+
state={State.ResetPassword}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Auth from './Auth'
|
|
2
|
+
import {
|
|
3
|
+
type CustomizationOptions,
|
|
4
|
+
type AdditionalSignupFields,
|
|
5
|
+
State,
|
|
6
|
+
} from './types'
|
|
7
|
+
|
|
8
|
+
// PUBLIC API
|
|
9
|
+
export function SignupForm({
|
|
10
|
+
appearance,
|
|
11
|
+
logo,
|
|
12
|
+
socialLayout,
|
|
13
|
+
additionalFields,
|
|
14
|
+
}: CustomizationOptions & { additionalFields?: AdditionalSignupFields; }): React.JSX.Element {
|
|
15
|
+
return (
|
|
16
|
+
<Auth
|
|
17
|
+
appearance={appearance}
|
|
18
|
+
logo={logo}
|
|
19
|
+
socialLayout={socialLayout}
|
|
20
|
+
state={State.Signup}
|
|
21
|
+
additionalSignupFields={additionalFields}
|
|
22
|
+
/>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Auth from './Auth'
|
|
2
|
+
import { type CustomizationOptions, State } from './types'
|
|
3
|
+
|
|
4
|
+
// PUBLIC API
|
|
5
|
+
export function VerifyEmailForm({
|
|
6
|
+
appearance,
|
|
7
|
+
logo,
|
|
8
|
+
socialLayout,
|
|
9
|
+
}: CustomizationOptions): React.JSX.Element {
|
|
10
|
+
return (
|
|
11
|
+
<Auth
|
|
12
|
+
appearance={appearance}
|
|
13
|
+
logo={logo}
|
|
14
|
+
socialLayout={socialLayout}
|
|
15
|
+
state={State.VerifyEmail}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Using !important with some of the components is a workaround for Tailwind
|
|
3
|
+
CSS's having too much precedence.
|
|
4
|
+
https://github.com/wasp-lang/wasp/issues/1764
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.form {
|
|
8
|
+
margin-top: 1.5rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.formItemGroup {
|
|
12
|
+
/* Empty class to use as marker */
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.formItemGroup + .formItemGroup {
|
|
16
|
+
margin-top: 1.5rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.formLabel {
|
|
20
|
+
display: block !important;
|
|
21
|
+
font-size: var(--font-size-sm) !important;
|
|
22
|
+
font-weight: 500 !important;
|
|
23
|
+
margin-bottom: 0.5rem !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.formInput,
|
|
27
|
+
.formTextarea {
|
|
28
|
+
display: block !important;
|
|
29
|
+
line-height: 1.5rem !important;
|
|
30
|
+
font-size: var(--font-size-sm) !important;
|
|
31
|
+
border-width: 1px !important;
|
|
32
|
+
border-color: var(--color-gray600) !important;
|
|
33
|
+
background-color: #f8f4ff !important;
|
|
34
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
|
|
35
|
+
border-radius: 0.375rem !important;
|
|
36
|
+
width: 100% !important;
|
|
37
|
+
padding-top: 0.375rem !important;
|
|
38
|
+
padding-bottom: 0.375rem !important;
|
|
39
|
+
padding-left: 0.75rem !important;
|
|
40
|
+
padding-right: 0.75rem !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.formInput:focus,
|
|
45
|
+
.formTextarea:focus {
|
|
46
|
+
border-width: 1px !important;
|
|
47
|
+
border-color: var(--color-gray700) !important;
|
|
48
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
|
|
49
|
+
outline: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.formInput:disabled,
|
|
53
|
+
.formTextarea:disabled {
|
|
54
|
+
opacity: 0.5 !important;
|
|
55
|
+
cursor: not-allowed !important;
|
|
56
|
+
background-color: var(--color-gray400) !important;
|
|
57
|
+
border-color: var(--color-gray400) !important;
|
|
58
|
+
color: var(--color-gray500) !important;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.formError {
|
|
62
|
+
display: block;
|
|
63
|
+
font-size: var(--font-size-sm);
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
color: var(--color-formErrorText);
|
|
66
|
+
margin-top: 0.5rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.submitButton {
|
|
70
|
+
display: flex !important;
|
|
71
|
+
justify-content: center !important;
|
|
72
|
+
width: 100% !important;
|
|
73
|
+
border-width: 1px !important;
|
|
74
|
+
border-color: var(--color-brand) !important;
|
|
75
|
+
background-color: var(--color-brand) !important;
|
|
76
|
+
color: var(--color-submitButtonText) !important;
|
|
77
|
+
padding: 0.5rem 0.75rem !important;
|
|
78
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
|
|
79
|
+
font-weight: 600 !important;
|
|
80
|
+
font-size: var(--font-size-sm) !important;
|
|
81
|
+
line-height: 1.25rem !important;
|
|
82
|
+
border-radius: 0.375rem !important;
|
|
83
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1) !important;
|
|
84
|
+
transition-duration: 100ms !important;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.submitButton:hover {
|
|
89
|
+
background-color: var(--color-brandAccent) !important;
|
|
90
|
+
border-color: var(--color-brandAccent) !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.submitButton:disabled {
|
|
94
|
+
opacity: 0.5 !important;
|
|
95
|
+
cursor: not-allowed !important;
|
|
96
|
+
background-color: var(--color-gray400) !important;
|
|
97
|
+
border-color: var(--color-gray400) !important;
|
|
98
|
+
color: var(--color-gray500) !important;
|
|
99
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
2
|
+
import styles from "./Form.module.css";
|
|
3
|
+
import "./auth-styles.css";
|
|
4
|
+
import { clsx } from "./util";
|
|
5
|
+
|
|
6
|
+
// PRIVATE API
|
|
7
|
+
export const Form = forwardRef<
|
|
8
|
+
ComponentRef<"form">,
|
|
9
|
+
ComponentPropsWithoutRef<"form">
|
|
10
|
+
>(({ children, className, ...props }, ref) => (
|
|
11
|
+
<form className={clsx(styles.form, className)} {...props} ref={ref}>
|
|
12
|
+
{children}
|
|
13
|
+
</form>
|
|
14
|
+
));
|
|
15
|
+
|
|
16
|
+
// PUBLIC API
|
|
17
|
+
export const FormItemGroup = forwardRef<
|
|
18
|
+
ComponentRef<"div">,
|
|
19
|
+
ComponentPropsWithoutRef<"div">
|
|
20
|
+
>(({ children, className, ...props }, ref) => (
|
|
21
|
+
<div className={clsx(styles.formItemGroup, className)} {...props} ref={ref}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
));
|
|
25
|
+
|
|
26
|
+
// PUBLIC API
|
|
27
|
+
export const FormLabel = forwardRef<
|
|
28
|
+
ComponentRef<"label">,
|
|
29
|
+
ComponentPropsWithoutRef<"label">
|
|
30
|
+
>(({ children, className, ...props }, ref) => (
|
|
31
|
+
<label className={clsx(styles.formLabel, className)} {...props} ref={ref}>
|
|
32
|
+
{children}
|
|
33
|
+
</label>
|
|
34
|
+
));
|
|
35
|
+
|
|
36
|
+
// PUBLIC API
|
|
37
|
+
export const FormInput = forwardRef<
|
|
38
|
+
ComponentRef<"input">,
|
|
39
|
+
ComponentPropsWithoutRef<"input">
|
|
40
|
+
>(({ className, ...props }, ref) => (
|
|
41
|
+
<input className={clsx(styles.formInput, className)} {...props} ref={ref} />
|
|
42
|
+
));
|
|
43
|
+
|
|
44
|
+
// PUBLIC API)
|
|
45
|
+
export const FormTextarea = forwardRef<
|
|
46
|
+
ComponentRef<"textarea">,
|
|
47
|
+
ComponentPropsWithoutRef<"textarea">
|
|
48
|
+
>(({ className, ...props }, ref) => (
|
|
49
|
+
<textarea
|
|
50
|
+
className={clsx(styles.formTextarea, className)}
|
|
51
|
+
{...props}
|
|
52
|
+
ref={ref}
|
|
53
|
+
/>
|
|
54
|
+
));
|
|
55
|
+
|
|
56
|
+
// PUBLIC API)
|
|
57
|
+
export const FormError = forwardRef<
|
|
58
|
+
ComponentRef<"div">,
|
|
59
|
+
ComponentPropsWithoutRef<"div">
|
|
60
|
+
>(({ children, className, ...props }, ref) => (
|
|
61
|
+
<div className={clsx(styles.formError, className)} {...props} ref={ref}>
|
|
62
|
+
{children}
|
|
63
|
+
</div>
|
|
64
|
+
));
|
|
65
|
+
|
|
66
|
+
// PRIVATE API
|
|
67
|
+
export const SubmitButton = forwardRef<
|
|
68
|
+
ComponentRef<"button">,
|
|
69
|
+
ComponentPropsWithoutRef<"button">
|
|
70
|
+
>(({ children, className, ...props }, ref) => (
|
|
71
|
+
<button className={clsx(styles.submitButton, className)} {...props} ref={ref}>
|
|
72
|
+
{children}
|
|
73
|
+
</button>
|
|
74
|
+
));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.message {
|
|
2
|
+
padding: 0.5rem 0.75rem;
|
|
3
|
+
border-radius: 0.375rem;
|
|
4
|
+
margin-top: 1rem;
|
|
5
|
+
background: var(--color-gray400);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.messageError {
|
|
9
|
+
padding: 0.5rem 0.75rem;
|
|
10
|
+
border-radius: 0.375rem;
|
|
11
|
+
margin-top: 1rem;
|
|
12
|
+
background: var(--color-errorBackground);
|
|
13
|
+
color: var(--color-errorText);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.messageSuccess {
|
|
17
|
+
padding: 0.5rem 0.75rem;
|
|
18
|
+
border-radius: 0.375rem;
|
|
19
|
+
margin-top: 1rem;
|
|
20
|
+
background: var(--color-successBackground);
|
|
21
|
+
color: var(--color-successText);
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ComponentRef, forwardRef } from "react";
|
|
2
|
+
import styles from "./Message.module.css";
|
|
3
|
+
import "./auth-styles.css";
|
|
4
|
+
import { clsx } from "./util";
|
|
5
|
+
|
|
6
|
+
// PRIVATE API
|
|
7
|
+
export const Message = forwardRef<
|
|
8
|
+
ComponentRef<"div">,
|
|
9
|
+
ComponentPropsWithoutRef<"div">
|
|
10
|
+
>(({ children, className, ...props }, ref) => (
|
|
11
|
+
<div className={clsx(styles.message, className)} {...props} ref={ref}>
|
|
12
|
+
{children}
|
|
13
|
+
</div>
|
|
14
|
+
));
|
|
15
|
+
|
|
16
|
+
// PRIVATE API
|
|
17
|
+
export const MessageError = forwardRef<
|
|
18
|
+
ComponentRef<"div">,
|
|
19
|
+
ComponentPropsWithoutRef<"div">
|
|
20
|
+
>(({ children, className, ...props }, ref) => (
|
|
21
|
+
<div className={clsx(styles.messageError, className)} {...props} ref={ref}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
));
|
|
25
|
+
|
|
26
|
+
// PRIVATE API
|
|
27
|
+
export const MessageSuccess = forwardRef<
|
|
28
|
+
ComponentRef<"div">,
|
|
29
|
+
ComponentPropsWithoutRef<"div">
|
|
30
|
+
>(({ children, className, ...props }, ref) => (
|
|
31
|
+
<div className={clsx(styles.messageSuccess, className)} {...props} ref={ref}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
));
|