payload-auth 1.0.1 → 1.1.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/dist/authjs/index.d.ts +1 -0
- package/dist/authjs/index.d.ts.map +1 -0
- package/dist/authjs/index.js +1 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js +1 -1
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.js +1 -1
- package/dist/better-auth/adapter/generate-schema/index.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/index.js +3 -3
- package/dist/better-auth/adapter/generate-schema/utils.d.ts +1 -0
- package/dist/better-auth/adapter/generate-schema/utils.d.ts.map +1 -0
- package/dist/better-auth/adapter/generate-schema/utils.js +1 -1
- package/dist/better-auth/adapter/index.d.ts +3 -2
- package/dist/better-auth/adapter/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/index.js +115 -69
- package/dist/better-auth/adapter/transform/index.d.ts +19 -6
- package/dist/better-auth/adapter/transform/index.d.ts.map +1 -0
- package/dist/better-auth/adapter/transform/index.js +387 -96
- package/dist/better-auth/adapter/types.d.ts +3 -1
- package/dist/better-auth/adapter/types.d.ts.map +1 -0
- package/dist/better-auth/adapter/types.js +1 -1
- package/dist/better-auth/index.d.ts +1 -0
- package/dist/better-auth/index.d.ts.map +1 -0
- package/dist/better-auth/index.js +1 -1
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/check-passkey-plugin.js +5 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/check-username-plugin.js +5 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts +1 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.js +8 -8
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts +8 -0
- package/dist/better-auth/plugin/helpers/get-admin-access.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-admin-access.js +22 -0
- package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts +14 -0
- package/dist/better-auth/plugin/helpers/get-admin-routes.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-admin-routes.js +6 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts +6 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-all-roles.js +20 -0
- package/dist/better-auth/plugin/helpers/get-ip.d.ts +2 -1
- package/dist/better-auth/plugin/helpers/get-ip.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-ip.js +14 -14
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts +3 -0
- package/dist/better-auth/plugin/helpers/get-requst-collection.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/get-requst-collection.js +14 -0
- package/dist/better-auth/plugin/helpers/index.d.ts +2 -1
- package/dist/better-auth/plugin/helpers/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/index.js +2 -2
- package/dist/better-auth/plugin/{lib → helpers}/prepare-session-data.d.ts +3 -2
- package/dist/better-auth/plugin/helpers/prepare-session-data.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/prepare-session-data.js +42 -0
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts +3 -2
- package/dist/better-auth/plugin/helpers/serialize-cookie.d.ts.map +1 -0
- package/dist/better-auth/plugin/helpers/serialize-cookie.js +34 -34
- package/dist/better-auth/plugin/index.d.ts +8 -7
- package/dist/better-auth/plugin/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/index.js +145 -37
- package/dist/better-auth/plugin/{collections → lib/build-collections}/accounts/hooks/sync-password-to-user.d.ts +2 -1
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/hooks/sync-password-to-user.js +47 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/accounts/index.js +159 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-after-read.js +11 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/hooks/get-url-before-change.js +8 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/admin-invitations/index.js +107 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/api-keys.js +196 -0
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts +12 -0
- package/dist/better-auth/plugin/lib/build-collections/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/index.js +96 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/invitations.js +91 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/jwks.js +43 -0
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/members.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/members.js +71 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-access-tokens.js +98 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-applications.js +113 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/oauth-consents.js +67 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/organizations.js +59 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/passkeys.js +108 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/sessions.js +123 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/sso-providers.js +83 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/teams.js +45 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts +6 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/two-factors.js +56 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/better-auth-strategy.js +52 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/forgot-password.js +96 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts +13 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/generate-invite-url.js +67 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/login.js +115 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/refresh-token.js +110 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/reset-password.js +62 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/send-invite-url.js +42 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/set-admin-role.js +79 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts +4 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/endpoints/signup.js +153 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-login.d.ts +2 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-login.js +75 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/after-logout.d.ts +2 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/after-logout.js +74 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-delete.js +45 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/before-login.d.ts +2 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/before-login.js +18 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts +3 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/on-verified-change.js +14 -0
- package/dist/better-auth/plugin/{collections → lib/build-collections}/users/hooks/sync-account.d.ts +2 -1
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/hooks/sync-account.js +82 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/users/index.js +345 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts +8 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/get-timestamp-fields.js +31 -0
- package/dist/better-auth/plugin/lib/{payload-access.d.ts → build-collections/utils/payload-access.d.ts} +2 -1
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/utils/payload-access.js +64 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts +7 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/build-collections/verifications.js +63 -0
- package/dist/better-auth/plugin/lib/{config.d.ts → constants.d.ts} +14 -0
- package/dist/better-auth/plugin/lib/constants.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/constants.js +56 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts +3 -2
- package/dist/better-auth/plugin/lib/get-payload-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/get-payload-auth.js +2 -2
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts +5 -4
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.js +26 -43
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts +5 -3
- package/dist/better-auth/plugin/lib/init-better-auth.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/init-better-auth.js +6 -6
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts +3 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/admin-plugin.js +8 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts +2 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/api-key-plugin.js +17 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts +10 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/index.js +118 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts +2 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/oidc-plugin.js +58 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts +2 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/organizations-plugin.js +86 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts +2 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/passkey-plugin.js +17 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts +2 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/sso-plugin.js +17 -0
- package/dist/better-auth/plugin/lib/{ensure-password-set-before-create.d.ts → sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts} +2 -1
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/ensure-password-set-before-create.js +23 -0
- package/dist/better-auth/plugin/lib/{password.d.ts → sanitize-better-auth-options/utils/password.d.ts} +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/password.js +62 -0
- package/dist/better-auth/plugin/lib/{respect-save-to-jwt-fields-middleware.d.ts → sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts} +6 -5
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.d.ts.map +1 -0
- package/dist/better-auth/plugin/lib/sanitize-better-auth-options/utils/save-to-jwt-middleware.js +30 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts +8 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.js +115 -0
- package/dist/better-auth/plugin/payload/components/admin-buttons/index.scss +31 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.js +196 -0
- package/dist/better-auth/plugin/payload/components/admin-invite-button/index.scss +131 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts +14 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.js +111 -0
- package/dist/better-auth/plugin/payload/components/admin-social-provider-buttons/index.scss +51 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.js +23 -0
- package/dist/better-auth/plugin/payload/components/form-header/index.scss +8 -0
- package/dist/better-auth/plugin/payload/components/icons.d.ts +9 -0
- package/dist/better-auth/plugin/payload/components/icons.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/icons.js +437 -0
- package/dist/better-auth/plugin/payload/components/logo.d.ts +4 -1
- package/dist/better-auth/plugin/payload/components/logo.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/logo.js +22 -34
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts +6 -0
- package/dist/better-auth/plugin/payload/components/logout-button.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/logout-button.js +27 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts +7 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/rsc-redirect.js +8 -0
- package/dist/better-auth/plugin/payload/components/styles.css +2 -2
- package/dist/better-auth/plugin/payload/components/token-field.d.ts +5 -0
- package/dist/better-auth/plugin/payload/components/token-field.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/components/token-field.js +30 -0
- package/dist/better-auth/plugin/payload/exports/client.d.ts +7 -3
- package/dist/better-auth/plugin/payload/exports/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/client.js +7 -4
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts +10 -5
- package/dist/better-auth/plugin/payload/exports/rsc.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/exports/rsc.js +10 -6
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts +3 -0
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/generate-admin-invite-url.js +8 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts +15 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/generate-metadata.js +74 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts +2 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/utils/get-safe-redirect.js +23 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts +12 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/client.js +92 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts +11 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.js +84 -0
- package/dist/better-auth/plugin/payload/views/admin-invite/index.scss +25 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts +14 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/client.js +95 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts +11 -3
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.js +124 -92
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.scss +29 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts +8 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/client.js +119 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.js +69 -0
- package/dist/better-auth/plugin/payload/views/forgot-password/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts +5 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/inactivity/index.js +12 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts +9 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/login-field.js +54 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.js +121 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/index.scss +31 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts +56 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/fields/password/types.js +3 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts +17 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.js +137 -0
- package/dist/better-auth/plugin/payload/views/login/form/index.scss +23 -0
- package/dist/better-auth/plugin/payload/views/login/index.d.ts +11 -4
- package/dist/better-auth/plugin/payload/views/login/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/login/index.js +81 -61
- package/dist/better-auth/plugin/payload/views/login/index.scss +10 -0
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts +8 -0
- package/dist/better-auth/plugin/payload/views/logout/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/logout/client.js +76 -0
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts +8 -0
- package/dist/better-auth/plugin/payload/views/logout/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/logout/index.js +14 -0
- package/dist/better-auth/plugin/payload/views/logout/index.scss +0 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts +7 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/client.js +72 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts +5 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.js +81 -0
- package/dist/better-auth/plugin/payload/views/reset-password/index.scss +9 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts +3 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.d.ts.map +1 -0
- package/dist/better-auth/plugin/payload/views/reset-password/metadata.js +11 -0
- package/dist/better-auth/plugin/types.d.ts +171 -33
- package/dist/better-auth/plugin/types.d.ts.map +1 -0
- package/dist/better-auth/plugin/types.js +1 -1
- package/dist/better-auth/types.d.ts +1 -0
- package/dist/better-auth/types.d.ts.map +1 -0
- package/dist/better-auth/types.js +1 -1
- package/dist/clerk/admin-ui.d.ts +4 -0
- package/dist/clerk/admin-ui.d.ts.map +1 -0
- package/dist/clerk/admin-ui.js +5 -0
- package/dist/clerk/index.d.ts +7 -1
- package/dist/clerk/index.d.ts.map +1 -0
- package/dist/clerk/index.js +7 -2
- package/dist/clerk/plugin/auth-strategy.d.ts +11 -0
- package/dist/clerk/plugin/auth-strategy.d.ts.map +1 -0
- package/dist/clerk/plugin/auth-strategy.js +45 -0
- package/dist/clerk/plugin/collections/users/access.d.ts +14 -0
- package/dist/clerk/plugin/collections/users/access.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/access.js +36 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts +14 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/sync-from-clerk.js +108 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts +4 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/index.js +5 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts +13 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userCreated.js +33 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts +11 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userDeleted.js +27 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts +13 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/handlers/userUpdated.js +35 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts +12 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/endpoints/webhook/index.js +86 -0
- package/dist/clerk/plugin/collections/users/fields.d.ts +6 -0
- package/dist/clerk/plugin/collections/users/fields.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/fields.js +81 -0
- package/dist/clerk/plugin/collections/users/index.d.ts +10 -0
- package/dist/clerk/plugin/collections/users/index.d.ts.map +1 -0
- package/dist/clerk/plugin/collections/users/index.js +95 -0
- package/dist/clerk/plugin/components/after-login-form.d.ts +4 -0
- package/dist/clerk/plugin/components/after-login-form.d.ts.map +1 -0
- package/dist/clerk/plugin/components/after-login-form.js +65 -0
- package/dist/clerk/plugin/components/logout-button.d.ts +2 -0
- package/dist/clerk/plugin/components/logout-button.d.ts.map +1 -0
- package/dist/clerk/plugin/components/logout-button.js +49 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts +6 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.d.ts.map +1 -0
- package/dist/clerk/plugin/components/sync-clerk-users-button.js +75 -0
- package/dist/clerk/plugin.d.ts +6 -0
- package/dist/clerk/plugin.d.ts.map +1 -0
- package/dist/clerk/plugin.js +63 -0
- package/dist/clerk/types.d.ts +63 -0
- package/dist/clerk/types.d.ts.map +1 -0
- package/dist/clerk/types.js +3 -0
- package/dist/clerk/utils/clerk-user.d.ts +21 -0
- package/dist/clerk/utils/clerk-user.d.ts.map +1 -0
- package/dist/clerk/utils/clerk-user.js +45 -0
- package/dist/clerk/utils/index.d.ts +4 -0
- package/dist/clerk/utils/index.d.ts.map +1 -0
- package/dist/clerk/utils/index.js +5 -0
- package/dist/clerk/utils/load-clerk-instance.d.ts +8 -0
- package/dist/clerk/utils/load-clerk-instance.d.ts.map +1 -0
- package/dist/clerk/utils/load-clerk-instance.js +11 -0
- package/dist/clerk/utils/svix.d.ts +9 -0
- package/dist/clerk/utils/svix.d.ts.map +1 -0
- package/dist/clerk/utils/svix.js +40 -0
- package/dist/clerk/utils/user.d.ts +17 -0
- package/dist/clerk/utils/user.d.ts.map +1 -0
- package/dist/clerk/utils/user.js +46 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/kinde/index.d.ts +1 -0
- package/dist/kinde/index.d.ts.map +1 -0
- package/dist/kinde/index.js +1 -1
- package/package.json +44 -18
- package/LICENSE.md +0 -17
- package/dist/authjs/index.js.map +0 -1
- package/dist/better-auth/adapter/dev/bin/run.d.ts +0 -1
- package/dist/better-auth/adapter/dev/bin/run.js +0 -64
- package/dist/better-auth/adapter/dev/bin/run.js.map +0 -1
- package/dist/better-auth/adapter/dev/bin/schema.d.ts +0 -22
- package/dist/better-auth/adapter/dev/bin/schema.js +0 -160
- package/dist/better-auth/adapter/dev/bin/schema.js.map +0 -1
- package/dist/better-auth/adapter/dev/collections.d.ts +0 -3
- package/dist/better-auth/adapter/dev/collections.js +0 -212
- package/dist/better-auth/adapter/dev/collections.js.map +0 -1
- package/dist/better-auth/adapter/dev/index.d.ts +0 -3
- package/dist/better-auth/adapter/dev/index.js +0 -168
- package/dist/better-auth/adapter/dev/index.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/generate-schema-builder.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/get-payload-schema.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/index.js.map +0 -1
- package/dist/better-auth/adapter/generate-schema/utils.js.map +0 -1
- package/dist/better-auth/adapter/index.js.map +0 -1
- package/dist/better-auth/adapter/test/adapter.test.d.ts +0 -1
- package/dist/better-auth/adapter/test/adapter.test.js +0 -181
- package/dist/better-auth/adapter/test/adapter.test.js.map +0 -1
- package/dist/better-auth/adapter/test/better-auth-adapter-test.d.ts +0 -7
- package/dist/better-auth/adapter/test/better-auth-adapter-test.js +0 -425
- package/dist/better-auth/adapter/test/better-auth-adapter-test.js.map +0 -1
- package/dist/better-auth/adapter/test/schema.test.d.ts +0 -1
- package/dist/better-auth/adapter/test/schema.test.js +0 -796
- package/dist/better-auth/adapter/test/schema.test.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload1/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload1/schema.js +0 -177
- package/dist/better-auth/adapter/test/test_payload1/schema.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload2/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload2/schema.js +0 -167
- package/dist/better-auth/adapter/test/test_payload2/schema.js.map +0 -1
- package/dist/better-auth/adapter/test/test_payload3/schema.d.ts +0 -23
- package/dist/better-auth/adapter/test/test_payload3/schema.js +0 -198
- package/dist/better-auth/adapter/test/test_payload3/schema.js.map +0 -1
- package/dist/better-auth/adapter/transform/index.js.map +0 -1
- package/dist/better-auth/adapter/types.js.map +0 -1
- package/dist/better-auth/index.js.map +0 -1
- package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js +0 -47
- package/dist/better-auth/plugin/collections/accounts/hooks/sync-password-to-user.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.d.ts +0 -6
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js +0 -106
- package/dist/better-auth/plugin/collections/users/endpoints/refresh-token.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/after-login.js +0 -71
- package/dist/better-auth/plugin/collections/users/hooks/after-login.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/after-logout.js +0 -49
- package/dist/better-auth/plugin/collections/users/hooks/after-logout.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/before-login.js +0 -18
- package/dist/better-auth/plugin/collections/users/hooks/before-login.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.d.ts +0 -5
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js +0 -33
- package/dist/better-auth/plugin/collections/users/hooks/clean-up-user-after-delete.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.d.ts +0 -2
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js +0 -14
- package/dist/better-auth/plugin/collections/users/hooks/on-verified-change.js.map +0 -1
- package/dist/better-auth/plugin/collections/users/hooks/sync-account.js +0 -82
- package/dist/better-auth/plugin/collections/users/hooks/sync-account.js.map +0 -1
- package/dist/better-auth/plugin/helpers/generate-verify-email-url.js.map +0 -1
- package/dist/better-auth/plugin/helpers/get-ip.js.map +0 -1
- package/dist/better-auth/plugin/helpers/index.js.map +0 -1
- package/dist/better-auth/plugin/helpers/serialize-cookie.js.map +0 -1
- package/dist/better-auth/plugin/index.js.map +0 -1
- package/dist/better-auth/plugin/lib/auth-strategy.d.ts +0 -8
- package/dist/better-auth/plugin/lib/auth-strategy.js +0 -48
- package/dist/better-auth/plugin/lib/auth-strategy.js.map +0 -1
- package/dist/better-auth/plugin/lib/build-collection-configs.d.ts +0 -11
- package/dist/better-auth/plugin/lib/build-collection-configs.js +0 -1558
- package/dist/better-auth/plugin/lib/build-collection-configs.js.map +0 -1
- package/dist/better-auth/plugin/lib/config.js +0 -43
- package/dist/better-auth/plugin/lib/config.js.map +0 -1
- package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js +0 -24
- package/dist/better-auth/plugin/lib/ensure-password-set-before-create.js.map +0 -1
- package/dist/better-auth/plugin/lib/get-payload-auth.js.map +0 -1
- package/dist/better-auth/plugin/lib/get-required-collection-slugs.js.map +0 -1
- package/dist/better-auth/plugin/lib/init-better-auth.js.map +0 -1
- package/dist/better-auth/plugin/lib/password.js +0 -63
- package/dist/better-auth/plugin/lib/password.js.map +0 -1
- package/dist/better-auth/plugin/lib/payload-access.js +0 -64
- package/dist/better-auth/plugin/lib/payload-access.js.map +0 -1
- package/dist/better-auth/plugin/lib/prepare-session-data.js +0 -42
- package/dist/better-auth/plugin/lib/prepare-session-data.js.map +0 -1
- package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js +0 -30
- package/dist/better-auth/plugin/lib/respect-save-to-jwt-fields-middleware.js.map +0 -1
- package/dist/better-auth/plugin/lib/sanitize-auth-options.d.ts +0 -5
- package/dist/better-auth/plugin/lib/sanitize-auth-options.js +0 -298
- package/dist/better-auth/plugin/lib/sanitize-auth-options.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/admin-buttons.d.ts +0 -5
- package/dist/better-auth/plugin/payload/components/admin-buttons.js +0 -222
- package/dist/better-auth/plugin/payload/components/admin-buttons.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/login-redirect.d.ts +0 -1
- package/dist/better-auth/plugin/payload/components/login-redirect.js +0 -6
- package/dist/better-auth/plugin/payload/components/login-redirect.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/logo.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/logout.d.ts +0 -1
- package/dist/better-auth/plugin/payload/components/logout.js +0 -61
- package/dist/better-auth/plugin/payload/components/logout.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/sign-in.d.ts +0 -3
- package/dist/better-auth/plugin/payload/components/sign-in.js +0 -384
- package/dist/better-auth/plugin/payload/components/sign-in.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/sign-up.d.ts +0 -6
- package/dist/better-auth/plugin/payload/components/sign-up.js +0 -502
- package/dist/better-auth/plugin/payload/components/sign-up.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/button.d.ts +0 -10
- package/dist/better-auth/plugin/payload/components/ui/button.js +0 -42
- package/dist/better-auth/plugin/payload/components/ui/button.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/card.d.ts +0 -9
- package/dist/better-auth/plugin/payload/components/ui/card.js +0 -55
- package/dist/better-auth/plugin/payload/components/ui/card.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/checkbox.d.ts +0 -4
- package/dist/better-auth/plugin/payload/components/ui/checkbox.js +0 -23
- package/dist/better-auth/plugin/payload/components/ui/checkbox.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/cn.d.ts +0 -2
- package/dist/better-auth/plugin/payload/components/ui/cn.js +0 -7
- package/dist/better-auth/plugin/payload/components/ui/cn.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/input.d.ts +0 -3
- package/dist/better-auth/plugin/payload/components/ui/input.js +0 -14
- package/dist/better-auth/plugin/payload/components/ui/input.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/label.d.ts +0 -4
- package/dist/better-auth/plugin/payload/components/ui/label.js +0 -15
- package/dist/better-auth/plugin/payload/components/ui/label.js.map +0 -1
- package/dist/better-auth/plugin/payload/components/ui/password-input.d.ts +0 -2
- package/dist/better-auth/plugin/payload/components/ui/password-input.js +0 -55
- package/dist/better-auth/plugin/payload/components/ui/password-input.js.map +0 -1
- package/dist/better-auth/plugin/payload/exports/client.js.map +0 -1
- package/dist/better-auth/plugin/payload/exports/rsc.js.map +0 -1
- package/dist/better-auth/plugin/payload/views/create-first-admin/index.js.map +0 -1
- package/dist/better-auth/plugin/payload/views/login/index.js.map +0 -1
- package/dist/better-auth/plugin/types.js.map +0 -1
- package/dist/better-auth/types.js.map +0 -1
- package/dist/clerk/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/kinde/index.js.map +0 -1
|
@@ -1,502 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button } from './ui/button';
|
|
4
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './ui/card';
|
|
5
|
-
import { Input } from './ui/input';
|
|
6
|
-
import { Label } from './ui/label';
|
|
7
|
-
import { PasswordInput } from './ui/password-input';
|
|
8
|
-
import { DiscordLogoIcon, GitHubLogoIcon } from '@radix-ui/react-icons';
|
|
9
|
-
import { useState } from 'react';
|
|
10
|
-
import Image from 'next/image';
|
|
11
|
-
import { Loader2, X } from 'lucide-react';
|
|
12
|
-
import { toast } from 'sonner';
|
|
13
|
-
import { useRouter } from 'next/navigation';
|
|
14
|
-
import Link from 'next/link';
|
|
15
|
-
import { createAuthClient } from 'better-auth/react';
|
|
16
|
-
import { inferAdditionalFields } from 'better-auth/client/plugins';
|
|
17
|
-
export function SignUp({ admin = false, apiRoute, userSlug, defaultAdminRole }) {
|
|
18
|
-
const [firstName, setFirstName] = useState('');
|
|
19
|
-
const [lastName, setLastName] = useState('');
|
|
20
|
-
const [email, setEmail] = useState('');
|
|
21
|
-
const [password, setPassword] = useState('');
|
|
22
|
-
const [passwordConfirmation, setPasswordConfirmation] = useState('');
|
|
23
|
-
const [image, setImage] = useState(null);
|
|
24
|
-
const [imagePreview, setImagePreview] = useState(null);
|
|
25
|
-
const router = useRouter();
|
|
26
|
-
const authClient = createAuthClient({
|
|
27
|
-
plugins: [
|
|
28
|
-
inferAdditionalFields({
|
|
29
|
-
user: {
|
|
30
|
-
role: {
|
|
31
|
-
type: 'string'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
]
|
|
36
|
-
});
|
|
37
|
-
const handleImageChange = (e)=>{
|
|
38
|
-
const file = e.target.files?.[0];
|
|
39
|
-
if (file) {
|
|
40
|
-
setImage(file);
|
|
41
|
-
const reader = new FileReader();
|
|
42
|
-
reader.onloadend = ()=>{
|
|
43
|
-
setImagePreview(reader.result);
|
|
44
|
-
};
|
|
45
|
-
reader.readAsDataURL(file);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const addAdminRole = async (userId)=>{
|
|
49
|
-
try {
|
|
50
|
-
const req = await fetch(`${process.env.NEXT_PUBLIC_SERVER_URL}${apiRoute}/${userSlug}/${userId}`, {
|
|
51
|
-
method: 'PATCH',
|
|
52
|
-
credentials: 'include',
|
|
53
|
-
headers: {
|
|
54
|
-
'Content-Type': 'application/json'
|
|
55
|
-
},
|
|
56
|
-
body: JSON.stringify({
|
|
57
|
-
role: defaultAdminRole ?? 'admin'
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.log(err);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const [loading, setLoading] = useState(false);
|
|
65
|
-
return /*#__PURE__*/ _jsxs(Card, {
|
|
66
|
-
className: "z-50 rounded-md rounded-t-none w-full max-w-md shadow-lg",
|
|
67
|
-
children: [
|
|
68
|
-
/*#__PURE__*/ _jsxs(CardHeader, {
|
|
69
|
-
className: "space-y-1",
|
|
70
|
-
children: [
|
|
71
|
-
/*#__PURE__*/ _jsx(CardTitle, {
|
|
72
|
-
className: "text-xl md:text-2xl font-bold",
|
|
73
|
-
children: "Sign Up"
|
|
74
|
-
}),
|
|
75
|
-
/*#__PURE__*/ _jsx(CardDescription, {
|
|
76
|
-
className: "text-sm text-muted-foreground",
|
|
77
|
-
children: "Enter your information to create an account"
|
|
78
|
-
})
|
|
79
|
-
]
|
|
80
|
-
}),
|
|
81
|
-
/*#__PURE__*/ _jsx(CardContent, {
|
|
82
|
-
className: "space-y-4",
|
|
83
|
-
children: /*#__PURE__*/ _jsxs("div", {
|
|
84
|
-
className: "space-y-4",
|
|
85
|
-
children: [
|
|
86
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
87
|
-
className: "grid grid-cols-2 gap-4",
|
|
88
|
-
children: [
|
|
89
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
90
|
-
className: "space-y-2",
|
|
91
|
-
children: [
|
|
92
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
93
|
-
htmlFor: "first-name",
|
|
94
|
-
className: "text-sm font-medium",
|
|
95
|
-
children: "First name"
|
|
96
|
-
}),
|
|
97
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
98
|
-
id: "first-name",
|
|
99
|
-
placeholder: "Max",
|
|
100
|
-
required: true,
|
|
101
|
-
onChange: (e)=>{
|
|
102
|
-
setFirstName(e.target.value);
|
|
103
|
-
},
|
|
104
|
-
value: firstName,
|
|
105
|
-
className: "w-full"
|
|
106
|
-
})
|
|
107
|
-
]
|
|
108
|
-
}),
|
|
109
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
110
|
-
className: "space-y-2",
|
|
111
|
-
children: [
|
|
112
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
113
|
-
htmlFor: "last-name",
|
|
114
|
-
className: "text-sm font-medium",
|
|
115
|
-
children: "Last name"
|
|
116
|
-
}),
|
|
117
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
118
|
-
id: "last-name",
|
|
119
|
-
placeholder: "Robinson",
|
|
120
|
-
required: true,
|
|
121
|
-
onChange: (e)=>{
|
|
122
|
-
setLastName(e.target.value);
|
|
123
|
-
},
|
|
124
|
-
value: lastName,
|
|
125
|
-
className: "w-full"
|
|
126
|
-
})
|
|
127
|
-
]
|
|
128
|
-
})
|
|
129
|
-
]
|
|
130
|
-
}),
|
|
131
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
132
|
-
className: "space-y-2",
|
|
133
|
-
children: [
|
|
134
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
135
|
-
htmlFor: "email",
|
|
136
|
-
className: "text-sm font-medium",
|
|
137
|
-
children: "Email"
|
|
138
|
-
}),
|
|
139
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
140
|
-
id: "email",
|
|
141
|
-
type: "email",
|
|
142
|
-
placeholder: "m@example.com",
|
|
143
|
-
required: true,
|
|
144
|
-
onChange: (e)=>{
|
|
145
|
-
setEmail(e.target.value);
|
|
146
|
-
},
|
|
147
|
-
value: email,
|
|
148
|
-
className: "w-full"
|
|
149
|
-
})
|
|
150
|
-
]
|
|
151
|
-
}),
|
|
152
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
153
|
-
className: "space-y-2",
|
|
154
|
-
children: [
|
|
155
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
156
|
-
htmlFor: "password",
|
|
157
|
-
className: "text-sm font-medium",
|
|
158
|
-
children: "Password"
|
|
159
|
-
}),
|
|
160
|
-
/*#__PURE__*/ _jsx(PasswordInput, {
|
|
161
|
-
id: "password",
|
|
162
|
-
value: password,
|
|
163
|
-
onChange: (e)=>setPassword(e.target.value),
|
|
164
|
-
autoComplete: "new-password",
|
|
165
|
-
placeholder: "Password",
|
|
166
|
-
className: "w-full"
|
|
167
|
-
})
|
|
168
|
-
]
|
|
169
|
-
}),
|
|
170
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
171
|
-
className: "space-y-2",
|
|
172
|
-
children: [
|
|
173
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
174
|
-
htmlFor: "password_confirmation",
|
|
175
|
-
className: "text-sm font-medium",
|
|
176
|
-
children: "Confirm Password"
|
|
177
|
-
}),
|
|
178
|
-
/*#__PURE__*/ _jsx(PasswordInput, {
|
|
179
|
-
id: "password_confirmation",
|
|
180
|
-
value: passwordConfirmation,
|
|
181
|
-
onChange: (e)=>setPasswordConfirmation(e.target.value),
|
|
182
|
-
autoComplete: "new-password",
|
|
183
|
-
placeholder: "Confirm Password",
|
|
184
|
-
className: "w-full"
|
|
185
|
-
})
|
|
186
|
-
]
|
|
187
|
-
}),
|
|
188
|
-
!admin && /*#__PURE__*/ _jsxs("div", {
|
|
189
|
-
className: "space-y-2",
|
|
190
|
-
children: [
|
|
191
|
-
/*#__PURE__*/ _jsx(Label, {
|
|
192
|
-
htmlFor: "image",
|
|
193
|
-
className: "text-sm font-medium",
|
|
194
|
-
children: "Profile Image (optional)"
|
|
195
|
-
}),
|
|
196
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
197
|
-
className: "flex items-center gap-3",
|
|
198
|
-
children: [
|
|
199
|
-
imagePreview && /*#__PURE__*/ _jsx("div", {
|
|
200
|
-
className: "relative w-12 h-12 rounded-full overflow-hidden flex-shrink-0",
|
|
201
|
-
children: /*#__PURE__*/ _jsx(Image, {
|
|
202
|
-
src: imagePreview,
|
|
203
|
-
alt: "Profile preview",
|
|
204
|
-
fill: true,
|
|
205
|
-
className: "object-cover"
|
|
206
|
-
})
|
|
207
|
-
}),
|
|
208
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
209
|
-
className: "flex-1 flex items-center gap-2",
|
|
210
|
-
children: [
|
|
211
|
-
/*#__PURE__*/ _jsx(Input, {
|
|
212
|
-
id: "image",
|
|
213
|
-
type: "file",
|
|
214
|
-
accept: "image/*",
|
|
215
|
-
onChange: handleImageChange,
|
|
216
|
-
className: "w-full text-sm"
|
|
217
|
-
}),
|
|
218
|
-
imagePreview && /*#__PURE__*/ _jsx(Button, {
|
|
219
|
-
variant: "ghost",
|
|
220
|
-
size: "icon",
|
|
221
|
-
className: "h-8 w-8 flex-shrink-0",
|
|
222
|
-
onClick: ()=>{
|
|
223
|
-
setImage(null);
|
|
224
|
-
setImagePreview(null);
|
|
225
|
-
},
|
|
226
|
-
children: /*#__PURE__*/ _jsx(X, {
|
|
227
|
-
className: "h-4 w-4"
|
|
228
|
-
})
|
|
229
|
-
})
|
|
230
|
-
]
|
|
231
|
-
})
|
|
232
|
-
]
|
|
233
|
-
})
|
|
234
|
-
]
|
|
235
|
-
}),
|
|
236
|
-
/*#__PURE__*/ _jsxs(Button, {
|
|
237
|
-
type: "submit",
|
|
238
|
-
className: "w-full",
|
|
239
|
-
disabled: loading,
|
|
240
|
-
onClick: async ()=>{
|
|
241
|
-
if (password !== passwordConfirmation) {
|
|
242
|
-
toast.error('Please ensure your password and confirm password match.');
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const user = await authClient.signUp.email({
|
|
246
|
-
email,
|
|
247
|
-
password,
|
|
248
|
-
role: admin ? 'admin' : 'user',
|
|
249
|
-
name: `${firstName} ${lastName}`,
|
|
250
|
-
callbackURL: admin ? '/admin' : '/dashboard',
|
|
251
|
-
fetchOptions: {
|
|
252
|
-
onResponse: ()=>{
|
|
253
|
-
setLoading(false);
|
|
254
|
-
},
|
|
255
|
-
onRequest: ()=>{
|
|
256
|
-
setLoading(true);
|
|
257
|
-
},
|
|
258
|
-
onError: (ctx)=>{
|
|
259
|
-
toast.error(ctx.error.message);
|
|
260
|
-
},
|
|
261
|
-
onSuccess: async ()=>{
|
|
262
|
-
router.push(admin ? '/admin' : '/dashboard');
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
const userId = user.data?.user.id;
|
|
267
|
-
if (userId && admin) {
|
|
268
|
-
await addAdminRole(userId);
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
children: [
|
|
272
|
-
loading ? /*#__PURE__*/ _jsx(Loader2, {
|
|
273
|
-
size: 16,
|
|
274
|
-
className: "animate-spin mr-2"
|
|
275
|
-
}) : null,
|
|
276
|
-
loading ? 'Creating account...' : 'Create an account'
|
|
277
|
-
]
|
|
278
|
-
}),
|
|
279
|
-
!admin && /*#__PURE__*/ _jsxs("div", {
|
|
280
|
-
children: [
|
|
281
|
-
/*#__PURE__*/ _jsx("div", {
|
|
282
|
-
className: "relative my-4",
|
|
283
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
284
|
-
className: "relative flex justify-center text-xs uppercase border-b border-muted pb-4",
|
|
285
|
-
children: /*#__PURE__*/ _jsx("span", {
|
|
286
|
-
className: "bg-card px-2 text-muted-foreground",
|
|
287
|
-
children: "Or continue with"
|
|
288
|
-
})
|
|
289
|
-
})
|
|
290
|
-
}),
|
|
291
|
-
/*#__PURE__*/ _jsxs("div", {
|
|
292
|
-
className: "grid grid-cols-4 gap-2 sm:grid-cols-7",
|
|
293
|
-
children: [
|
|
294
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
295
|
-
variant: "outline",
|
|
296
|
-
size: "icon",
|
|
297
|
-
className: "h-10 w-10",
|
|
298
|
-
onClick: async ()=>{
|
|
299
|
-
await authClient.signIn.social({
|
|
300
|
-
provider: 'github',
|
|
301
|
-
callbackURL: '/dashboard'
|
|
302
|
-
});
|
|
303
|
-
},
|
|
304
|
-
title: "GitHub",
|
|
305
|
-
children: /*#__PURE__*/ _jsx(GitHubLogoIcon, {
|
|
306
|
-
className: "h-4 w-4"
|
|
307
|
-
})
|
|
308
|
-
}),
|
|
309
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
310
|
-
variant: "outline",
|
|
311
|
-
size: "icon",
|
|
312
|
-
className: "h-10 w-10",
|
|
313
|
-
onClick: async ()=>{
|
|
314
|
-
await authClient.signIn.social({
|
|
315
|
-
provider: 'discord',
|
|
316
|
-
callbackURL: '/dashboard'
|
|
317
|
-
});
|
|
318
|
-
},
|
|
319
|
-
title: "Discord",
|
|
320
|
-
children: /*#__PURE__*/ _jsx(DiscordLogoIcon, {
|
|
321
|
-
className: "h-4 w-4"
|
|
322
|
-
})
|
|
323
|
-
}),
|
|
324
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
325
|
-
variant: "outline",
|
|
326
|
-
size: "icon",
|
|
327
|
-
className: "h-10 w-10",
|
|
328
|
-
onClick: async ()=>{
|
|
329
|
-
await authClient.signIn.social({
|
|
330
|
-
provider: 'google',
|
|
331
|
-
callbackURL: '/dashboard'
|
|
332
|
-
});
|
|
333
|
-
},
|
|
334
|
-
title: "Google",
|
|
335
|
-
children: /*#__PURE__*/ _jsxs("svg", {
|
|
336
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
337
|
-
width: "16",
|
|
338
|
-
height: "16",
|
|
339
|
-
viewBox: "0 0 256 262",
|
|
340
|
-
children: [
|
|
341
|
-
/*#__PURE__*/ _jsx("path", {
|
|
342
|
-
fill: "#4285F4",
|
|
343
|
-
d: "M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"
|
|
344
|
-
}),
|
|
345
|
-
/*#__PURE__*/ _jsx("path", {
|
|
346
|
-
fill: "#34A853",
|
|
347
|
-
d: "M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"
|
|
348
|
-
}),
|
|
349
|
-
/*#__PURE__*/ _jsx("path", {
|
|
350
|
-
fill: "#FBBC05",
|
|
351
|
-
d: "M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"
|
|
352
|
-
}),
|
|
353
|
-
/*#__PURE__*/ _jsx("path", {
|
|
354
|
-
fill: "#EB4335",
|
|
355
|
-
d: "M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"
|
|
356
|
-
})
|
|
357
|
-
]
|
|
358
|
-
})
|
|
359
|
-
}),
|
|
360
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
361
|
-
variant: "outline",
|
|
362
|
-
size: "icon",
|
|
363
|
-
className: "h-10 w-10",
|
|
364
|
-
onClick: async ()=>{
|
|
365
|
-
const { data } = await authClient.signIn.social({
|
|
366
|
-
provider: 'microsoft',
|
|
367
|
-
callbackURL: '/dashboard'
|
|
368
|
-
});
|
|
369
|
-
},
|
|
370
|
-
title: "Microsoft",
|
|
371
|
-
children: /*#__PURE__*/ _jsx("svg", {
|
|
372
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
373
|
-
width: "16",
|
|
374
|
-
height: "16",
|
|
375
|
-
viewBox: "0 0 24 24",
|
|
376
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
377
|
-
fill: "currentColor",
|
|
378
|
-
d: "M2 3h9v9H2zm9 19H2v-9h9zM21 3v9h-9V3zm0 19h-9v-9h9z"
|
|
379
|
-
})
|
|
380
|
-
})
|
|
381
|
-
}),
|
|
382
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
383
|
-
variant: "outline",
|
|
384
|
-
size: "icon",
|
|
385
|
-
className: "h-10 w-10",
|
|
386
|
-
onClick: async ()=>{
|
|
387
|
-
await authClient.signIn.social({
|
|
388
|
-
provider: 'twitch',
|
|
389
|
-
callbackURL: '/dashboard'
|
|
390
|
-
});
|
|
391
|
-
},
|
|
392
|
-
title: "Twitch",
|
|
393
|
-
children: /*#__PURE__*/ _jsx("svg", {
|
|
394
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
395
|
-
width: "16",
|
|
396
|
-
height: "16",
|
|
397
|
-
viewBox: "0 0 24 24",
|
|
398
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
399
|
-
fill: "currentColor",
|
|
400
|
-
d: "M11.64 5.93h1.43v4.28h-1.43m3.93-4.28H17v4.28h-1.43M7 2L3.43 5.57v12.86h4.28V22l3.58-3.57h2.85L20.57 12V2m-1.43 9.29l-2.85 2.85h-2.86l-2.5 2.5v-2.5H7.71V3.43h11.43Z"
|
|
401
|
-
})
|
|
402
|
-
})
|
|
403
|
-
}),
|
|
404
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
405
|
-
variant: "outline",
|
|
406
|
-
size: "icon",
|
|
407
|
-
className: "h-10 w-10",
|
|
408
|
-
onClick: async ()=>{
|
|
409
|
-
await authClient.signIn.social({
|
|
410
|
-
provider: 'facebook',
|
|
411
|
-
callbackURL: '/dashboard'
|
|
412
|
-
});
|
|
413
|
-
},
|
|
414
|
-
title: "Facebook",
|
|
415
|
-
children: /*#__PURE__*/ _jsx("svg", {
|
|
416
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
417
|
-
width: "16",
|
|
418
|
-
height: "16",
|
|
419
|
-
viewBox: "0 0 24 24",
|
|
420
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
421
|
-
fill: "currentColor",
|
|
422
|
-
d: "M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c5.05-.5 9-4.76 9-9.95"
|
|
423
|
-
})
|
|
424
|
-
})
|
|
425
|
-
}),
|
|
426
|
-
/*#__PURE__*/ _jsx(Button, {
|
|
427
|
-
variant: "outline",
|
|
428
|
-
size: "icon",
|
|
429
|
-
className: "h-10 w-10",
|
|
430
|
-
onClick: async ()=>{
|
|
431
|
-
await authClient.signIn.social({
|
|
432
|
-
provider: 'twitter',
|
|
433
|
-
callbackURL: '/dashboard'
|
|
434
|
-
});
|
|
435
|
-
},
|
|
436
|
-
title: "Twitter",
|
|
437
|
-
children: /*#__PURE__*/ _jsx("svg", {
|
|
438
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
439
|
-
width: "16",
|
|
440
|
-
height: "16",
|
|
441
|
-
viewBox: "0 0 14 14",
|
|
442
|
-
children: /*#__PURE__*/ _jsxs("g", {
|
|
443
|
-
fill: "none",
|
|
444
|
-
children: [
|
|
445
|
-
/*#__PURE__*/ _jsx("g", {
|
|
446
|
-
clipPath: "url(#primeTwitter0)",
|
|
447
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
448
|
-
fill: "currentColor",
|
|
449
|
-
d: "M11.025.656h2.147L8.482 6.03L14 13.344H9.68L6.294 8.909l-3.87 4.435H.275l5.016-5.75L0 .657h4.43L7.486 4.71zm-.755 11.4h1.19L3.78 1.877H2.504z"
|
|
450
|
-
})
|
|
451
|
-
}),
|
|
452
|
-
/*#__PURE__*/ _jsx("defs", {
|
|
453
|
-
children: /*#__PURE__*/ _jsx("clipPath", {
|
|
454
|
-
id: "primeTwitter0",
|
|
455
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
456
|
-
fill: "#fff",
|
|
457
|
-
d: "M0 0h14v14H0z"
|
|
458
|
-
})
|
|
459
|
-
})
|
|
460
|
-
})
|
|
461
|
-
]
|
|
462
|
-
})
|
|
463
|
-
})
|
|
464
|
-
})
|
|
465
|
-
]
|
|
466
|
-
})
|
|
467
|
-
]
|
|
468
|
-
})
|
|
469
|
-
]
|
|
470
|
-
})
|
|
471
|
-
}),
|
|
472
|
-
/*#__PURE__*/ _jsx(CardFooter, {
|
|
473
|
-
className: "flex flex-col",
|
|
474
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
475
|
-
className: "w-full border-t pt-4",
|
|
476
|
-
children: /*#__PURE__*/ _jsxs("p", {
|
|
477
|
-
className: "text-center text-xs text-muted-foreground",
|
|
478
|
-
children: [
|
|
479
|
-
"Secured by",
|
|
480
|
-
' ',
|
|
481
|
-
/*#__PURE__*/ _jsx(Link, {
|
|
482
|
-
className: "font-medium text-orange-500",
|
|
483
|
-
href: "https://github.com/forrestdevs/payload-better-auth",
|
|
484
|
-
children: "payload-better-auth"
|
|
485
|
-
})
|
|
486
|
-
]
|
|
487
|
-
})
|
|
488
|
-
})
|
|
489
|
-
})
|
|
490
|
-
]
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
async function convertImageToBase64(file) {
|
|
494
|
-
return new Promise((resolve, reject)=>{
|
|
495
|
-
const reader = new FileReader();
|
|
496
|
-
reader.onloadend = ()=>resolve(reader.result);
|
|
497
|
-
reader.onerror = reject;
|
|
498
|
-
reader.readAsDataURL(file);
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
//# sourceMappingURL=sign-up.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/plugin/payload/components/sign-up.tsx"],"sourcesContent":["'use client'\n\nimport { Button } from './ui/button'\nimport { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from './ui/card'\nimport { Input } from './ui/input'\nimport { Label } from './ui/label'\nimport { PasswordInput } from './ui/password-input'\nimport { DiscordLogoIcon, GitHubLogoIcon } from '@radix-ui/react-icons'\nimport { useState } from 'react'\nimport Image from 'next/image'\nimport { Loader2, X } from 'lucide-react'\nimport { toast } from 'sonner'\nimport { useRouter } from 'next/navigation'\nimport Link from 'next/link'\nimport { createAuthClient } from 'better-auth/react'\nimport { inferAdditionalFields } from 'better-auth/client/plugins'\n\nexport function SignUp({\n admin = false,\n apiRoute,\n userSlug,\n defaultAdminRole,\n}: {\n admin?: boolean\n apiRoute: string\n userSlug: string\n defaultAdminRole: string\n}) {\n const [firstName, setFirstName] = useState('')\n const [lastName, setLastName] = useState('')\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [passwordConfirmation, setPasswordConfirmation] = useState('')\n const [image, setImage] = useState<File | null>(null)\n const [imagePreview, setImagePreview] = useState<string | null>(null)\n const router = useRouter()\n\n const authClient = createAuthClient({\n plugins: [\n inferAdditionalFields({\n user: {\n role: {\n type: 'string',\n },\n },\n }),\n ],\n })\n\n const handleImageChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const file = e.target.files?.[0]\n if (file) {\n setImage(file)\n const reader = new FileReader()\n reader.onloadend = () => {\n setImagePreview(reader.result as string)\n }\n reader.readAsDataURL(file)\n }\n }\n\n const addAdminRole = async (userId: string) => {\n try {\n const req = await fetch(\n `${process.env.NEXT_PUBLIC_SERVER_URL}${apiRoute}/${userSlug}/${userId}`,\n {\n method: 'PATCH',\n credentials: 'include',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n role: defaultAdminRole ?? 'admin',\n }),\n },\n )\n } catch (err) {\n console.log(err)\n }\n }\n const [loading, setLoading] = useState(false)\n\n return (\n <Card className=\"z-50 rounded-md rounded-t-none w-full max-w-md shadow-lg\">\n <CardHeader className=\"space-y-1\">\n <CardTitle className=\"text-xl md:text-2xl font-bold\">Sign Up</CardTitle>\n <CardDescription className=\"text-sm text-muted-foreground\">\n Enter your information to create an account\n </CardDescription>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <div className=\"space-y-4\">\n <div className=\"grid grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"first-name\" className=\"text-sm font-medium\">\n First name\n </Label>\n <Input\n id=\"first-name\"\n placeholder=\"Max\"\n required\n onChange={(e) => {\n setFirstName(e.target.value)\n }}\n value={firstName}\n className=\"w-full\"\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"last-name\" className=\"text-sm font-medium\">\n Last name\n </Label>\n <Input\n id=\"last-name\"\n placeholder=\"Robinson\"\n required\n onChange={(e) => {\n setLastName(e.target.value)\n }}\n value={lastName}\n className=\"w-full\"\n />\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"email\" className=\"text-sm font-medium\">\n Email\n </Label>\n <Input\n id=\"email\"\n type=\"email\"\n placeholder=\"m@example.com\"\n required\n onChange={(e) => {\n setEmail(e.target.value)\n }}\n value={email}\n className=\"w-full\"\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"password\" className=\"text-sm font-medium\">\n Password\n </Label>\n <PasswordInput\n id=\"password\"\n value={password}\n onChange={(e: any) => setPassword(e.target.value)}\n autoComplete=\"new-password\"\n placeholder=\"Password\"\n className=\"w-full\"\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"password_confirmation\" className=\"text-sm font-medium\">\n Confirm Password\n </Label>\n <PasswordInput\n id=\"password_confirmation\"\n value={passwordConfirmation}\n onChange={(e: any) => setPasswordConfirmation(e.target.value)}\n autoComplete=\"new-password\"\n placeholder=\"Confirm Password\"\n className=\"w-full\"\n />\n </div>\n\n {!admin && (\n <div className=\"space-y-2\">\n <Label htmlFor=\"image\" className=\"text-sm font-medium\">\n Profile Image (optional)\n </Label>\n <div className=\"flex items-center gap-3\">\n {imagePreview && (\n <div className=\"relative w-12 h-12 rounded-full overflow-hidden flex-shrink-0\">\n <Image src={imagePreview} alt=\"Profile preview\" fill className=\"object-cover\" />\n </div>\n )}\n <div className=\"flex-1 flex items-center gap-2\">\n <Input\n id=\"image\"\n type=\"file\"\n accept=\"image/*\"\n onChange={handleImageChange}\n className=\"w-full text-sm\"\n />\n {imagePreview && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 flex-shrink-0\"\n onClick={() => {\n setImage(null)\n setImagePreview(null)\n }}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </div>\n </div>\n </div>\n )}\n\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={loading}\n onClick={async () => {\n if (password !== passwordConfirmation) {\n toast.error('Please ensure your password and confirm password match.')\n return\n }\n const user = await authClient.signUp.email({\n email,\n password,\n role: admin ? 'admin' : 'user',\n name: `${firstName} ${lastName}`,\n callbackURL: admin ? '/admin' : '/dashboard',\n fetchOptions: {\n onResponse: () => {\n setLoading(false)\n },\n onRequest: () => {\n setLoading(true)\n },\n onError: (ctx) => {\n toast.error(ctx.error.message)\n },\n onSuccess: async () => {\n router.push(admin ? '/admin' : '/dashboard')\n },\n },\n })\n\n const userId = user.data?.user.id\n\n if (userId && admin) {\n await addAdminRole(userId)\n }\n }}\n >\n {loading ? <Loader2 size={16} className=\"animate-spin mr-2\" /> : null}\n {loading ? 'Creating account...' : 'Create an account'}\n </Button>\n\n {!admin && (\n <div>\n <div className=\"relative my-4\">\n <div className=\"relative flex justify-center text-xs uppercase border-b border-muted pb-4\">\n <span className=\"bg-card px-2 text-muted-foreground\">Or continue with</span>\n </div>\n </div>\n <div className=\"grid grid-cols-4 gap-2 sm:grid-cols-7\">\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'github',\n callbackURL: '/dashboard',\n })\n }}\n title=\"GitHub\"\n >\n <GitHubLogoIcon className=\"h-4 w-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'discord',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Discord\"\n >\n <DiscordLogoIcon className=\"h-4 w-4\" />\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'google',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Google\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 256 262\"\n >\n <path\n fill=\"#4285F4\"\n d=\"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027\"\n />\n <path\n fill=\"#34A853\"\n d=\"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z\"\n />\n <path\n fill=\"#EB4335\"\n d=\"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251\"\n />\n </svg>\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n const { data } = await authClient.signIn.social({\n provider: 'microsoft',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Microsoft\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n >\n <path\n fill=\"currentColor\"\n d=\"M2 3h9v9H2zm9 19H2v-9h9zM21 3v9h-9V3zm0 19h-9v-9h9z\"\n ></path>\n </svg>\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'twitch',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Twitch\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n >\n <path\n fill=\"currentColor\"\n d=\"M11.64 5.93h1.43v4.28h-1.43m3.93-4.28H17v4.28h-1.43M7 2L3.43 5.57v12.86h4.28V22l3.58-3.57h2.85L20.57 12V2m-1.43 9.29l-2.85 2.85h-2.86l-2.5 2.5v-2.5H7.71V3.43h11.43Z\"\n ></path>\n </svg>\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'facebook',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Facebook\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n >\n <path\n fill=\"currentColor\"\n d=\"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12c0 4.84 3.44 8.87 8 9.8V15H8v-3h2V9.5C10 7.57 11.57 6 13.5 6H16v3h-2c-.55 0-1 .45-1 1v2h3v3h-3v6.95c5.05-.5 9-4.76 9-9.95\"\n ></path>\n </svg>\n </Button>\n <Button\n variant=\"outline\"\n size=\"icon\"\n className=\"h-10 w-10\"\n onClick={async () => {\n await authClient.signIn.social({\n provider: 'twitter',\n callbackURL: '/dashboard',\n })\n }}\n title=\"Twitter\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 14 14\"\n >\n <g fill=\"none\">\n <g clipPath=\"url(#primeTwitter0)\">\n <path\n fill=\"currentColor\"\n d=\"M11.025.656h2.147L8.482 6.03L14 13.344H9.68L6.294 8.909l-3.87 4.435H.275l5.016-5.75L0 .657h4.43L7.486 4.71zm-.755 11.4h1.19L3.78 1.877H2.504z\"\n ></path>\n </g>\n <defs>\n <clipPath id=\"primeTwitter0\">\n <path fill=\"#fff\" d=\"M0 0h14v14H0z\"></path>\n </clipPath>\n </defs>\n </g>\n </svg>\n </Button>\n </div>\n </div>\n )}\n </div>\n </CardContent>\n <CardFooter className=\"flex flex-col\">\n <div className=\"w-full border-t pt-4\">\n <p className=\"text-center text-xs text-muted-foreground\">\n Secured by{' '}\n <Link\n className=\"font-medium text-orange-500\"\n href=\"https://github.com/forrestdevs/payload-better-auth\"\n >\n payload-better-auth\n </Link>\n </p>\n </div>\n </CardFooter>\n </Card>\n )\n}\n\nasync function convertImageToBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onloadend = () => resolve(reader.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n"],"names":["Button","Card","CardContent","CardDescription","CardFooter","CardHeader","CardTitle","Input","Label","PasswordInput","DiscordLogoIcon","GitHubLogoIcon","useState","Image","Loader2","X","toast","useRouter","Link","createAuthClient","inferAdditionalFields","SignUp","admin","apiRoute","userSlug","defaultAdminRole","firstName","setFirstName","lastName","setLastName","email","setEmail","password","setPassword","passwordConfirmation","setPasswordConfirmation","image","setImage","imagePreview","setImagePreview","router","authClient","plugins","user","role","type","handleImageChange","e","file","target","files","reader","FileReader","onloadend","result","readAsDataURL","addAdminRole","userId","req","fetch","process","env","NEXT_PUBLIC_SERVER_URL","method","credentials","headers","body","JSON","stringify","err","console","log","loading","setLoading","className","div","htmlFor","id","placeholder","required","onChange","value","autoComplete","src","alt","fill","accept","variant","size","onClick","disabled","error","signUp","name","callbackURL","fetchOptions","onResponse","onRequest","onError","ctx","message","onSuccess","push","data","span","signIn","social","provider","title","svg","xmlns","width","height","viewBox","path","d","g","clipPath","defs","p","href","convertImageToBase64","Promise","resolve","reject","onerror"],"mappings":"AAAA;;AAEA,SAASA,MAAM,QAAQ,cAAa;AACpC,SAASC,IAAI,EAAEC,WAAW,EAAEC,eAAe,EAAEC,UAAU,EAAEC,UAAU,EAAEC,SAAS,QAAQ,YAAW;AACjG,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,KAAK,QAAQ,aAAY;AAClC,SAASC,aAAa,QAAQ,sBAAqB;AACnD,SAASC,eAAe,EAAEC,cAAc,QAAQ,wBAAuB;AACvE,SAASC,QAAQ,QAAQ,QAAO;AAChC,OAAOC,WAAW,aAAY;AAC9B,SAASC,OAAO,EAAEC,CAAC,QAAQ,eAAc;AACzC,SAASC,KAAK,QAAQ,SAAQ;AAC9B,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,OAAOC,UAAU,YAAW;AAC5B,SAASC,gBAAgB,QAAQ,oBAAmB;AACpD,SAASC,qBAAqB,QAAQ,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;gDACNC,OAAM;gDACNC,QAAO;gDACPC,SAAQ;0DAER,cAAA,MAACG;oDAAE/B,MAAK;;sEACN,KAAC+B;4DAAEC,UAAS;sEACV,cAAA,KAACH;gEACC7B,MAAK;gEACL8B,GAAE;;;sEAGN,KAACG;sEACC,cAAA,KAACD;gEAASxC,IAAG;0EACX,cAAA,KAACqC;oEAAK7B,MAAK;oEAAO8B,GAAE;;;;;;;;;;;;;;;0BAWxC,KAAC/G;gBAAWsE,WAAU;0BACpB,cAAA,KAACC;oBAAID,WAAU;8BACb,cAAA,MAAC6C;wBAAE7C,WAAU;;4BAA4C;4BAC5C;0CACX,KAACxD;gCACCwD,WAAU;gCACV8C,MAAK;0CACN;;;;;;;;AAQb;AAEA,eAAeC,qBAAqBzE,IAAU;IAC5C,OAAO,IAAI0E,QAAQ,CAACC,SAASC;QAC3B,MAAMzE,SAAS,IAAIC;QACnBD,OAAOE,SAAS,GAAG,IAAMsE,QAAQxE,OAAOG,MAAM;QAC9CH,OAAO0E,OAAO,GAAGD;QACjBzE,OAAOI,aAAa,CAACP;IACvB;AACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
-
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "default" | "outline" | "secondary" | "destructive" | "ghost" | null | undefined;
|
|
5
|
-
size?: "default" | "icon" | "lg" | "sm" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
|
-
asChild?: boolean;
|
|
9
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export { Button, buttonVariants };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
|
-
import { cva } from 'class-variance-authority';
|
|
5
|
-
import { cn } from './cn';
|
|
6
|
-
const buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
|
|
10
|
-
destructive: 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
11
|
-
outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',
|
|
12
|
-
secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
|
|
13
|
-
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
|
|
14
|
-
link: 'text-primary underline-offset-4 hover:underline'
|
|
15
|
-
},
|
|
16
|
-
size: {
|
|
17
|
-
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
18
|
-
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
19
|
-
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
20
|
-
icon: 'size-9'
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
variant: 'default',
|
|
25
|
-
size: 'default'
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
function Button({ className, variant, size, asChild = false, ...props }) {
|
|
29
|
-
const Comp = asChild ? Slot : 'button';
|
|
30
|
-
return /*#__PURE__*/ _jsx(Comp, {
|
|
31
|
-
"data-slot": "button",
|
|
32
|
-
className: cn(buttonVariants({
|
|
33
|
-
variant,
|
|
34
|
-
size,
|
|
35
|
-
className
|
|
36
|
-
})),
|
|
37
|
-
...props
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export { Button, buttonVariants };
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/plugin/payload/components/ui/button.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nimport { cn } from './cn'\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',\n destructive:\n 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',\n outline:\n 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',\n secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',\n ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n default: 'h-9 px-4 py-2 has-[>svg]:px-3',\n sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',\n lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',\n icon: 'size-9',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'default',\n },\n },\n)\n\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean\n }) {\n const Comp = asChild ? Slot : 'button'\n\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n )\n}\n\nexport { Button, buttonVariants }\n"],"names":["React","Slot","cva","cn","buttonVariants","variants","variant","default","destructive","outline","secondary","ghost","link","size","sm","lg","icon","defaultVariants","Button","className","asChild","props","Comp","data-slot"],"mappings":";AAAA,YAAYA,WAAW,QAAO;AAC9B,SAASC,IAAI,QAAQ,uBAAsB;AAC3C,SAASC,GAAG,QAA2B,2BAA0B;AAEjE,SAASC,EAAE,QAAQ,OAAM;AAEzB,MAAMC,iBAAiBF,IACrB,+bACA;IACEG,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,aACE;YACFC,SACE;YACFC,WAAW;YACXC,OAAO;YACPC,MAAM;QACR;QACAC,MAAM;YACJN,SAAS;YACTO,IAAI;YACJC,IAAI;YACJC,MAAM;QACR;IACF;IACAC,iBAAiB;QACfX,SAAS;QACTO,MAAM;IACR;AACF;AAGF,SAASK,OAAO,EACdC,SAAS,EACTb,OAAO,EACPO,IAAI,EACJO,UAAU,KAAK,EACf,GAAGC,OAIF;IACD,MAAMC,OAAOF,UAAUnB,OAAO;IAE9B,qBACE,KAACqB;QACCC,aAAU;QACVJ,WAAWhB,GAAGC,eAAe;YAAEE;YAASO;YAAMM;QAAU;QACvD,GAAGE,KAAK;;AAGf;AAEA,SAASH,MAAM,EAAEd,cAAc,GAAE"}
|