better-auth-ui-svelte 0.3.6 → 0.3.7
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/README.md +12 -9
- package/dist/auth-client.d.ts +27 -3
- package/dist/auth-client.js +6 -0
- package/dist/components/account/index.d.ts +3 -1
- package/dist/components/account/index.js +1 -0
- package/dist/components/settings/account/index.d.ts +11 -5
- package/dist/components/settings/account/index.js +5 -0
- package/dist/components/settings/account/update-field-card.svelte +3 -5
- package/dist/components/settings/api-key/index.d.ts +5 -2
- package/dist/components/settings/api-key/index.js +2 -0
- package/dist/components/settings/index.d.ts +3 -1
- package/dist/components/settings/index.js +1 -0
- package/dist/components/settings/passkey/index.d.ts +5 -2
- package/dist/components/settings/passkey/index.js +2 -0
- package/dist/components/settings/providers/index.d.ts +3 -1
- package/dist/components/settings/providers/index.js +1 -0
- package/dist/components/settings/security/index.d.ts +9 -4
- package/dist/components/settings/security/index.js +4 -0
- package/dist/components/settings/shared/index.d.ts +6 -2
- package/dist/components/settings/shared/index.js +2 -0
- package/dist/components/ui/alert/index.js +2 -0
- package/dist/components/ui/button/index.d.ts +3 -2
- package/dist/components/ui/button/index.js +5 -2
- package/dist/context/auth-ui-config.svelte.d.ts +2 -1
- package/dist/hooks/use-current-organization.svelte.js +26 -9
- package/dist/index.d.ts +43 -21
- package/dist/index.js +21 -0
- package/dist/localization/auth-localization.d.ts +3 -1
- package/dist/localization/stripe-localization.d.ts +1 -1
- package/dist/localization/stripe-localization.js +1 -1
- package/dist/types/auth-hooks.d.ts +3 -3
- package/dist/types/generic-oauth-options.d.ts +1 -2
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -480,16 +480,19 @@ Then use it everywhere:
|
|
|
480
480
|
```svelte
|
|
481
481
|
<!-- src/routes/+layout.svelte -->
|
|
482
482
|
<script lang="ts">
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
// Provider will use your custom paths
|
|
487
|
-
<AuthUIProvider
|
|
488
|
-
{authClient}
|
|
489
|
-
basePath={authPathConfig.basePath}
|
|
490
|
-
viewPaths={authPathConfig.viewPaths}
|
|
491
|
-
/>
|
|
483
|
+
import { AuthUIProvider } from 'better-auth-ui-svelte';
|
|
484
|
+
import { authClient } from '$lib/auth-client';
|
|
485
|
+
import { authPathConfig } from '$lib/config/auth-config';
|
|
492
486
|
</script>
|
|
487
|
+
|
|
488
|
+
<!-- Provider will use your custom paths -->
|
|
489
|
+
<AuthUIProvider
|
|
490
|
+
{authClient}
|
|
491
|
+
basePath={authPathConfig.basePath}
|
|
492
|
+
viewPaths={authPathConfig.viewPaths}
|
|
493
|
+
>
|
|
494
|
+
<slot />
|
|
495
|
+
</AuthUIProvider>
|
|
493
496
|
```
|
|
494
497
|
|
|
495
498
|
```typescript
|
package/dist/auth-client.d.ts
CHANGED
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import { createAuthClient
|
|
2
|
-
import type { Atom } from 'nanostores';
|
|
1
|
+
import { createAuthClient } from 'better-auth/svelte';
|
|
3
2
|
/**
|
|
4
3
|
* Better Auth Svelte client
|
|
5
4
|
* This provides reactive stores for authentication state
|
|
6
5
|
*/
|
|
7
6
|
export declare const authClient: ReturnType<typeof createAuthClient>;
|
|
8
|
-
export declare const useSession: () => Atom<
|
|
7
|
+
export declare const useSession: () => import("nanostores").Atom<{
|
|
8
|
+
data: {
|
|
9
|
+
user: {
|
|
10
|
+
id: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
email: string;
|
|
14
|
+
emailVerified: boolean;
|
|
15
|
+
name: string;
|
|
16
|
+
image?: string | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
session: {
|
|
19
|
+
id: string;
|
|
20
|
+
createdAt: Date;
|
|
21
|
+
updatedAt: Date;
|
|
22
|
+
userId: string;
|
|
23
|
+
expiresAt: Date;
|
|
24
|
+
token: string;
|
|
25
|
+
ipAddress?: string | null | undefined;
|
|
26
|
+
userAgent?: string | null | undefined;
|
|
27
|
+
};
|
|
28
|
+
} | null;
|
|
29
|
+
error: import("better-auth/svelte").BetterFetchError | null;
|
|
30
|
+
isPending: boolean;
|
|
31
|
+
isRefetching: boolean;
|
|
32
|
+
}>;
|
package/dist/auth-client.js
CHANGED
|
@@ -10,6 +10,9 @@ export const authClient = createAuthClient({
|
|
|
10
10
|
apiKeyClient(),
|
|
11
11
|
multiSessionClient(),
|
|
12
12
|
passkeyClient(),
|
|
13
|
+
// @ts-expect-error - BetterAuthClientPlugin type incompatibility between better-auth versions.
|
|
14
|
+
// The oneTapClient plugin has a slightly different type signature that doesn't match the expected
|
|
15
|
+
// BetterAuthClientPlugin interface, but it works correctly at runtime.
|
|
13
16
|
oneTapClient({
|
|
14
17
|
clientId: ''
|
|
15
18
|
}),
|
|
@@ -19,6 +22,9 @@ export const authClient = createAuthClient({
|
|
|
19
22
|
magicLinkClient(),
|
|
20
23
|
emailOTPClient(),
|
|
21
24
|
twoFactorClient(),
|
|
25
|
+
// @ts-expect-error - BetterAuthClientPlugin type incompatibility between better-auth versions.
|
|
26
|
+
// The organizationClient plugin has a slightly different type signature that doesn't match the expected
|
|
27
|
+
// BetterAuthClientPlugin interface, but it works correctly at runtime.
|
|
22
28
|
organizationClient(),
|
|
23
29
|
lastLoginMethodClient()
|
|
24
30
|
]
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import AccountViewComponent from './account-view.svelte';
|
|
1
3
|
export { default as AccountView } from './account-view.svelte';
|
|
2
|
-
export type
|
|
4
|
+
export type AccountViewProps = ComponentProps<typeof AccountViewComponent>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import AccountSettingsCardsComponent from './account-settings-cards.svelte';
|
|
3
|
+
import AccountsCardComponent from './accounts-card.svelte';
|
|
4
|
+
import DeleteAccountCardComponent from './delete-account-card.svelte';
|
|
5
|
+
import UpdateAvatarCardComponent from './update-avatar-card.svelte';
|
|
6
|
+
import UpdateFieldCardComponent from './update-field-card.svelte';
|
|
1
7
|
export { default as AccountSettingsCards } from './account-settings-cards.svelte';
|
|
2
8
|
export { default as AccountsCard } from './accounts-card.svelte';
|
|
3
9
|
export { default as AccountCell } from './account-cell.svelte';
|
|
@@ -7,8 +13,8 @@ export { default as UpdateAvatarCard } from './update-avatar-card.svelte';
|
|
|
7
13
|
export { default as UpdateFieldCard } from './update-field-card.svelte';
|
|
8
14
|
export { default as UpdateNameCard } from './update-name-card.svelte';
|
|
9
15
|
export { default as UpdateUsernameCard } from './update-username-card.svelte';
|
|
10
|
-
export type
|
|
11
|
-
export type
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
16
|
+
export type AccountSettingsCardsProps = ComponentProps<typeof AccountSettingsCardsComponent>;
|
|
17
|
+
export type AccountsCardProps = ComponentProps<typeof AccountsCardComponent>;
|
|
18
|
+
export type DeleteAccountCardProps = ComponentProps<typeof DeleteAccountCardComponent>;
|
|
19
|
+
export type UpdateAvatarCardProps = ComponentProps<typeof UpdateAvatarCardComponent>;
|
|
20
|
+
export type UpdateFieldCardProps = ComponentProps<typeof UpdateFieldCardComponent>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import AccountSettingsCardsComponent from './account-settings-cards.svelte';
|
|
2
|
+
import AccountsCardComponent from './accounts-card.svelte';
|
|
3
|
+
import DeleteAccountCardComponent from './delete-account-card.svelte';
|
|
4
|
+
import UpdateAvatarCardComponent from './update-avatar-card.svelte';
|
|
5
|
+
import UpdateFieldCardComponent from './update-field-card.svelte';
|
|
1
6
|
export { default as AccountSettingsCards } from './account-settings-cards.svelte';
|
|
2
7
|
export { default as AccountsCard } from './accounts-card.svelte';
|
|
3
8
|
export { default as AccountCell } from './account-cell.svelte';
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
hooks: { useSession },
|
|
53
53
|
mutators: { updateUser },
|
|
54
54
|
localization: contextLocalization,
|
|
55
|
-
optimistic,
|
|
56
55
|
toast,
|
|
57
56
|
onSessionChange
|
|
58
57
|
} = getAuthUIConfig();
|
|
@@ -63,7 +62,7 @@
|
|
|
63
62
|
const isPending = $derived('isPending' in $sessionStore ? $sessionStore.isPending : true);
|
|
64
63
|
|
|
65
64
|
// Create the appropriate schema based on type (used for validation logic)
|
|
66
|
-
$derived.by(() => {
|
|
65
|
+
const fieldSchema = $derived.by(() => {
|
|
67
66
|
let schema: z.ZodType<unknown> = z.unknown();
|
|
68
67
|
|
|
69
68
|
if (type === 'number') {
|
|
@@ -158,11 +157,10 @@
|
|
|
158
157
|
{isPending}
|
|
159
158
|
title={label}
|
|
160
159
|
actionLabel={mergedLocalization.SAVE}
|
|
161
|
-
{optimistic}
|
|
162
160
|
>
|
|
163
161
|
<CardContent class={classNames?.content}>
|
|
164
162
|
{#if type === 'boolean'}
|
|
165
|
-
<form.Field {name}>
|
|
163
|
+
<form.Field {name} validators={{ onChange: fieldSchema.shape[name] }}>
|
|
166
164
|
{#snippet children({ state, handleChange })}
|
|
167
165
|
<div class="flex items-center gap-2">
|
|
168
166
|
<Checkbox
|
|
@@ -191,7 +189,7 @@
|
|
|
191
189
|
{:else if isPending}
|
|
192
190
|
<Skeleton class={cn('h-9 w-full', classNames?.skeleton)} />
|
|
193
191
|
{:else}
|
|
194
|
-
<form.Field {name}>
|
|
192
|
+
<form.Field {name} validators={{ onChange: fieldSchema.shape[name] }}>
|
|
195
193
|
{#snippet children({ state, handleBlur, handleChange })}
|
|
196
194
|
<div class="grid w-full items-center gap-1.5">
|
|
197
195
|
{#if type === 'number'}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import ApiKeysCardComponent from './api-keys-card.svelte';
|
|
3
|
+
import ApiKeyCellComponent from './api-key-cell.svelte';
|
|
1
4
|
export { default as ApiKeysCard } from './api-keys-card.svelte';
|
|
2
5
|
export { default as ApiKeyCell } from './api-key-cell.svelte';
|
|
3
6
|
export { default as ApiKeyDisplayDialog } from './api-key-display-dialog.svelte';
|
|
4
7
|
export { default as ApiKeyDeleteDialog } from './api-key-delete-dialog.svelte';
|
|
5
8
|
export { default as CreateApiKeyDialog } from './create-api-key-dialog.svelte';
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
9
|
+
export type ApiKeysCardProps = ComponentProps<typeof ApiKeysCardComponent>;
|
|
10
|
+
export type ApiKeyCellProps = ComponentProps<typeof ApiKeyCellComponent>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import ApiKeysCardComponent from './api-keys-card.svelte';
|
|
2
|
+
import ApiKeyCellComponent from './api-key-cell.svelte';
|
|
1
3
|
export { default as ApiKeysCard } from './api-keys-card.svelte';
|
|
2
4
|
export { default as ApiKeyCell } from './api-key-cell.svelte';
|
|
3
5
|
export { default as ApiKeyDisplayDialog } from './api-key-display-dialog.svelte';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import SecuritySettingsCardsComponent from './security-settings-cards.svelte';
|
|
1
3
|
export * from './shared/index.js';
|
|
2
4
|
export * from './account/index.js';
|
|
3
5
|
export * from './security/index.js';
|
|
@@ -6,4 +8,4 @@ export * from './two-factor/index.js';
|
|
|
6
8
|
export * from './passkey/index.js';
|
|
7
9
|
export * from './api-key/index.js';
|
|
8
10
|
export { default as SecuritySettingsCards } from './security-settings-cards.svelte';
|
|
9
|
-
export type
|
|
11
|
+
export type SecuritySettingsCardsProps = ComponentProps<typeof SecuritySettingsCardsComponent>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import PasskeyCellComponent from './passkey-cell.svelte';
|
|
3
|
+
import PasskeysCardComponent from './passkeys-card.svelte';
|
|
1
4
|
export { default as PasskeyCell } from './passkey-cell.svelte';
|
|
2
5
|
export { default as PasskeysCard } from './passkeys-card.svelte';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
6
|
+
export type PasskeyCellProps = ComponentProps<typeof PasskeyCellComponent>;
|
|
7
|
+
export type PasskeysCardProps = ComponentProps<typeof PasskeysCardComponent>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import ProvidersCardComponent from './providers-card.svelte';
|
|
1
3
|
export { default as ProviderCell } from './provider-cell.svelte';
|
|
2
4
|
export { default as ProvidersCard } from './providers-card.svelte';
|
|
3
|
-
export type
|
|
5
|
+
export type ProvidersCardProps = ComponentProps<typeof ProvidersCardComponent>;
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import ChangeEmailCardComponent from './change-email-card.svelte';
|
|
3
|
+
import ChangePasswordCardComponent from './change-password-card.svelte';
|
|
4
|
+
import SessionCellComponent from './session-cell.svelte';
|
|
5
|
+
import SessionsCardComponent from './sessions-card.svelte';
|
|
1
6
|
export { default as ChangeEmailCard } from './change-email-card.svelte';
|
|
2
7
|
export { default as ChangePasswordCard } from './change-password-card.svelte';
|
|
3
8
|
export { default as SessionCell } from './session-cell.svelte';
|
|
4
9
|
export { default as SessionsCard } from './sessions-card.svelte';
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
8
|
-
export type
|
|
10
|
+
export type ChangeEmailCardProps = ComponentProps<typeof ChangeEmailCardComponent>;
|
|
11
|
+
export type ChangePasswordCardProps = ComponentProps<typeof ChangePasswordCardComponent>;
|
|
12
|
+
export type SessionCellProps = ComponentProps<typeof SessionCellComponent>;
|
|
13
|
+
export type SessionsCardProps = ComponentProps<typeof SessionsCardComponent>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import ChangeEmailCardComponent from './change-email-card.svelte';
|
|
2
|
+
import ChangePasswordCardComponent from './change-password-card.svelte';
|
|
3
|
+
import SessionCellComponent from './session-cell.svelte';
|
|
4
|
+
import SessionsCardComponent from './sessions-card.svelte';
|
|
1
5
|
export { default as ChangeEmailCard } from './change-email-card.svelte';
|
|
2
6
|
export { default as ChangePasswordCard } from './change-password-card.svelte';
|
|
3
7
|
export { default as SessionCell } from './session-cell.svelte';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import SettingsCardComponent from './settings-card.svelte';
|
|
3
|
+
import SessionFreshnessDialogComponent from './session-freshness-dialog.svelte';
|
|
1
4
|
export { default as SettingsCard } from './settings-card.svelte';
|
|
2
5
|
export { default as SettingsCardHeader } from './settings-card-header.svelte';
|
|
3
6
|
export { default as SettingsCardFooter } from './settings-card-footer.svelte';
|
|
4
7
|
export { default as SettingsActionButton } from './settings-action-button.svelte';
|
|
5
8
|
export { default as SessionFreshnessDialog } from './session-freshness-dialog.svelte';
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
9
|
+
export type SettingsCardProps = ComponentProps<typeof SettingsCardComponent>;
|
|
10
|
+
export type SettingsCardClassNames = SettingsCardProps['classNames'];
|
|
11
|
+
export type SessionFreshnessDialogProps = ComponentProps<typeof SessionFreshnessDialogComponent>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import SettingsCardComponent from './settings-card.svelte';
|
|
2
|
+
import SessionFreshnessDialogComponent from './session-freshness-dialog.svelte';
|
|
1
3
|
export { default as SettingsCard } from './settings-card.svelte';
|
|
2
4
|
export { default as SettingsCardHeader } from './settings-card-header.svelte';
|
|
3
5
|
export { default as SettingsCardFooter } from './settings-card-footer.svelte';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Root from './alert.svelte';
|
|
2
2
|
import Description from './alert-description.svelte';
|
|
3
3
|
import Title from './alert-title.svelte';
|
|
4
|
+
// TypeScript doesn't recognize module-level exports from .svelte files, so we suppress the error
|
|
5
|
+
// @ts-expect-error - TS2614: Module has no exported member
|
|
4
6
|
export { alertVariants } from './alert.svelte';
|
|
5
7
|
export { Root, Description, Title,
|
|
6
8
|
//
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import Root
|
|
2
|
-
export {
|
|
1
|
+
import Root from './button.svelte';
|
|
2
|
+
export { buttonVariants, type ButtonProps, type ButtonSize, type ButtonVariant } from './button.svelte';
|
|
3
|
+
export { Root, Root as Button };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import Root
|
|
1
|
+
import Root from './button.svelte';
|
|
2
|
+
// TypeScript doesn't recognize module-level exports from .svelte files, so we suppress the error
|
|
3
|
+
// @ts-expect-error - TS2614: Module has no exported member
|
|
4
|
+
export { buttonVariants } from './button.svelte';
|
|
2
5
|
export { Root,
|
|
3
6
|
//
|
|
4
|
-
Root as Button
|
|
7
|
+
Root as Button };
|
|
@@ -34,7 +34,7 @@ export declare function getLocalization(): {
|
|
|
34
34
|
ALREADY_SUBSCRIBED_PLAN: string;
|
|
35
35
|
UNABLE_TO_CREATE_CUSTOMER: string;
|
|
36
36
|
FAILED_TO_FETCH_PLANS: string;
|
|
37
|
-
|
|
37
|
+
STRIPE_EMAIL_VERIFICATION_REQUIRED: string;
|
|
38
38
|
SUBSCRIPTION_NOT_ACTIVE: string;
|
|
39
39
|
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: string;
|
|
40
40
|
INVALID_PHONE_NUMBER: string;
|
|
@@ -325,6 +325,7 @@ export declare function getLocalization(): {
|
|
|
325
325
|
SIGN_IN_USERNAME_PLACEHOLDER: string;
|
|
326
326
|
VERIFY_YOUR_EMAIL: string;
|
|
327
327
|
VERIFY_YOUR_EMAIL_DESCRIPTION: string;
|
|
328
|
+
EMAIL_VERIFICATION_REQUIRED: string;
|
|
328
329
|
EMAIL_VERIFICATION_SENT_TO: string;
|
|
329
330
|
EMAIL_VERIFICATION_CHECK_INBOX: string;
|
|
330
331
|
EMAIL_VERIFICATION_AFTER_VERIFY: string;
|
|
@@ -36,21 +36,38 @@ export function useCurrentOrganization({ slug: slugProp } = {}) {
|
|
|
36
36
|
if (pathMode === 'slug') {
|
|
37
37
|
const slug = slugProp || contextSlug;
|
|
38
38
|
const orgsResult = organizations.value;
|
|
39
|
-
data
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
if (orgsResult && typeof orgsResult === 'object' && 'data' in orgsResult) {
|
|
40
|
+
const orgsData = orgsResult.data;
|
|
41
|
+
data = Array.isArray(orgsData)
|
|
42
|
+
? (orgsData.find((org) => org.slug === slug) ?? null)
|
|
42
43
|
: null;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
isPending = 'isPending' in orgsResult ? orgsResult.isPending : false;
|
|
45
|
+
isRefetching = 'isRefetching' in orgsResult ? orgsResult.isRefetching : false;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
data = null;
|
|
49
|
+
isPending = false;
|
|
50
|
+
isRefetching = false;
|
|
51
|
+
}
|
|
45
52
|
}
|
|
46
53
|
else {
|
|
47
54
|
const activeResult = activeOrg.value;
|
|
48
55
|
data =
|
|
49
|
-
activeResult && 'data' in activeResult
|
|
50
|
-
|
|
56
|
+
activeResult && typeof activeResult === 'object' && 'data' in activeResult
|
|
57
|
+
? activeResult.data
|
|
58
|
+
: null;
|
|
59
|
+
isPending =
|
|
60
|
+
activeResult && typeof activeResult === 'object' && 'isPending' in activeResult
|
|
61
|
+
? activeResult.isPending
|
|
62
|
+
: false;
|
|
51
63
|
isRefetching =
|
|
52
|
-
activeResult && 'isRefetching' in activeResult
|
|
53
|
-
|
|
64
|
+
activeResult && typeof activeResult === 'object' && 'isRefetching' in activeResult
|
|
65
|
+
? activeResult.isRefetching
|
|
66
|
+
: false;
|
|
67
|
+
refetch =
|
|
68
|
+
activeResult && typeof activeResult === 'object' && 'refetch' in activeResult
|
|
69
|
+
? activeResult.refetch
|
|
70
|
+
: undefined;
|
|
54
71
|
}
|
|
55
72
|
return { data, isPending, isRefetching, refetch };
|
|
56
73
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,9 @@ export { default as SignInForm } from './components/auth/forms/sign-in-form.svel
|
|
|
24
24
|
export { default as SignUpForm } from './components/auth/forms/sign-up-form.svelte';
|
|
25
25
|
export { default as TwoFactorForm } from './components/auth/forms/two-factor-form.svelte';
|
|
26
26
|
export { default as FormError } from './components/form-error.svelte';
|
|
27
|
-
|
|
27
|
+
import type { ComponentProps } from 'svelte';
|
|
28
|
+
import FormErrorComponent from './components/form-error.svelte';
|
|
29
|
+
export type FormErrorProps = ComponentProps<typeof FormErrorComponent>;
|
|
28
30
|
export { default as CreateOrganizationDialog } from './components/organization/create-organization-dialog.svelte';
|
|
29
31
|
export { default as DeleteOrganizationCard } from './components/organization/delete-organization-card.svelte';
|
|
30
32
|
export { default as DeleteOrganizationDialog } from './components/organization/delete-organization-dialog.svelte';
|
|
@@ -57,10 +59,12 @@ export { default as UpdateNameCard } from './components/settings/account/update-
|
|
|
57
59
|
export { default as UpdateUsernameCard } from './components/settings/account/update-username-card.svelte';
|
|
58
60
|
export { default as AccountSettingsCards } from './components/settings/account/account-settings-cards.svelte';
|
|
59
61
|
export { default as ApiKeysCard } from './components/settings/api-key/api-keys-card.svelte';
|
|
60
|
-
|
|
62
|
+
import ApiKeysCardComponent from './components/settings/api-key/api-keys-card.svelte';
|
|
63
|
+
export type ApiKeysCardProps = ComponentProps<typeof ApiKeysCardComponent>;
|
|
61
64
|
export { default as PasskeysCard } from './components/settings/passkey/passkeys-card.svelte';
|
|
62
65
|
export { default as ProvidersCard } from './components/settings/providers/providers-card.svelte';
|
|
63
|
-
|
|
66
|
+
import ProvidersCardComponent from './components/settings/providers/providers-card.svelte';
|
|
67
|
+
export type ProvidersCardProps = ComponentProps<typeof ProvidersCardComponent>;
|
|
64
68
|
export { default as ChangeEmailCard } from './components/settings/security/change-email-card.svelte';
|
|
65
69
|
export { default as ChangePasswordCard } from './components/settings/security/change-password-card.svelte';
|
|
66
70
|
export { default as SessionsCard } from './components/settings/security/sessions-card.svelte';
|
|
@@ -79,23 +83,41 @@ export * from './utils/get-paths.js';
|
|
|
79
83
|
export { getAuthUIConfig, getAuthClient, getLocalization } from './context/auth-ui-config.svelte.js';
|
|
80
84
|
export { authLocalization } from './localization/auth-localization.js';
|
|
81
85
|
export type { AuthUIConfig, User, Session, AuthLocalization } from './types/index.js';
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
import AuthFormComponent from './components/auth/auth-form.svelte';
|
|
87
|
+
import UserButtonComponent from './components/user-button.svelte';
|
|
88
|
+
import UserViewComponent from './components/user-view.svelte';
|
|
89
|
+
import UserAvatarComponent from './components/user-avatar.svelte';
|
|
90
|
+
import OrganizationSwitcherComponent from './components/organization/organization-switcher.svelte';
|
|
91
|
+
import OrganizationCellViewComponent from './components/organization/organization-cell-view.svelte';
|
|
92
|
+
import OrganizationLogoComponent from './components/organization/organization-logo.svelte';
|
|
93
|
+
import OrganizationLogoCardComponent from './components/organization/organization-logo-card.svelte';
|
|
94
|
+
import DeleteOrganizationCardComponent from './components/organization/delete-organization-card.svelte';
|
|
95
|
+
import OrganizationInvitationsCardComponent from './components/organization/organization-invitations-card.svelte';
|
|
96
|
+
import OrganizationMembersCardComponent from './components/organization/organization-members-card.svelte';
|
|
97
|
+
import OrganizationNameCardComponent from './components/organization/organization-name-card.svelte';
|
|
98
|
+
import OrganizationSettingsCardsComponent from './components/organization/organization-settings-cards.svelte';
|
|
99
|
+
import OrganizationSlugCardComponent from './components/organization/organization-slug-card.svelte';
|
|
100
|
+
import OrganizationViewComponent from './components/organization/organization-view.svelte';
|
|
101
|
+
import OrganizationsCardComponent from './components/organization/organizations-card.svelte';
|
|
102
|
+
import UserInvitationsCardComponent from './components/organization/user-invitations-card.svelte';
|
|
103
|
+
import SettingsCardComponent from './components/settings/shared/settings-card.svelte';
|
|
104
|
+
export type AuthFormClassNames = ComponentProps<typeof AuthFormComponent>;
|
|
105
|
+
export type UserButtonClassNames = ComponentProps<typeof UserButtonComponent>;
|
|
106
|
+
export type UserViewClassNames = ComponentProps<typeof UserViewComponent>;
|
|
107
|
+
export type UserAvatarClassNames = ComponentProps<typeof UserAvatarComponent>;
|
|
108
|
+
export type OrganizationSwitcherClassNames = ComponentProps<typeof OrganizationSwitcherComponent>;
|
|
109
|
+
export type OrganizationViewClassNames = ComponentProps<typeof OrganizationCellViewComponent>;
|
|
110
|
+
export type OrganizationLogoClassNames = ComponentProps<typeof OrganizationLogoComponent>;
|
|
111
|
+
export type OrganizationLogoCardProps = ComponentProps<typeof OrganizationLogoCardComponent>;
|
|
112
|
+
export type DeleteOrganizationCardProps = ComponentProps<typeof DeleteOrganizationCardComponent>;
|
|
113
|
+
export type OrganizationInvitationsCardProps = ComponentProps<typeof OrganizationInvitationsCardComponent>;
|
|
114
|
+
export type OrganizationMembersCardProps = ComponentProps<typeof OrganizationMembersCardComponent>;
|
|
115
|
+
export type OrganizationNameCardProps = ComponentProps<typeof OrganizationNameCardComponent>;
|
|
116
|
+
export type OrganizationSettingsCardsProps = ComponentProps<typeof OrganizationSettingsCardsComponent>;
|
|
117
|
+
export type OrganizationSlugCardProps = ComponentProps<typeof OrganizationSlugCardComponent>;
|
|
118
|
+
export type OrganizationViewProps = ComponentProps<typeof OrganizationViewComponent>;
|
|
119
|
+
export type OrganizationsCardProps = ComponentProps<typeof OrganizationsCardComponent>;
|
|
120
|
+
export type UserInvitationsCardProps = ComponentProps<typeof UserInvitationsCardComponent>;
|
|
121
|
+
export type SettingsCardClassNames = ComponentProps<typeof SettingsCardComponent>;
|
|
100
122
|
export * from './types/auth-hooks.js';
|
|
101
123
|
export * from './types/auth-mutators.js';
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export { default as SignUpForm } from './components/auth/forms/sign-up-form.svel
|
|
|
29
29
|
export { default as TwoFactorForm } from './components/auth/forms/two-factor-form.svelte';
|
|
30
30
|
// Form Utilities
|
|
31
31
|
export { default as FormError } from './components/form-error.svelte';
|
|
32
|
+
import FormErrorComponent from './components/form-error.svelte';
|
|
32
33
|
// Organization Components
|
|
33
34
|
// export { default as AcceptInvitationCard } from './components/organization/accept-invitation-card.svelte';
|
|
34
35
|
export { default as CreateOrganizationDialog } from './components/organization/create-organization-dialog.svelte';
|
|
@@ -65,10 +66,12 @@ export { default as UpdateUsernameCard } from './components/settings/account/upd
|
|
|
65
66
|
export { default as AccountSettingsCards } from './components/settings/account/account-settings-cards.svelte';
|
|
66
67
|
// Settings Components - API Key
|
|
67
68
|
export { default as ApiKeysCard } from './components/settings/api-key/api-keys-card.svelte';
|
|
69
|
+
import ApiKeysCardComponent from './components/settings/api-key/api-keys-card.svelte';
|
|
68
70
|
// Settings Components - Passkey
|
|
69
71
|
export { default as PasskeysCard } from './components/settings/passkey/passkeys-card.svelte';
|
|
70
72
|
// Settings Components - Providers
|
|
71
73
|
export { default as ProvidersCard } from './components/settings/providers/providers-card.svelte';
|
|
74
|
+
import ProvidersCardComponent from './components/settings/providers/providers-card.svelte';
|
|
72
75
|
// Settings Components - Security
|
|
73
76
|
export { default as ChangeEmailCard } from './components/settings/security/change-email-card.svelte';
|
|
74
77
|
export { default as ChangePasswordCard } from './components/settings/security/change-password-card.svelte';
|
|
@@ -97,5 +100,23 @@ export * from './utils/get-paths.js';
|
|
|
97
100
|
export { getAuthUIConfig, getAuthClient, getLocalization } from './context/auth-ui-config.svelte.js';
|
|
98
101
|
// Localization
|
|
99
102
|
export { authLocalization } from './localization/auth-localization.js';
|
|
103
|
+
import AuthFormComponent from './components/auth/auth-form.svelte';
|
|
104
|
+
import UserButtonComponent from './components/user-button.svelte';
|
|
105
|
+
import UserViewComponent from './components/user-view.svelte';
|
|
106
|
+
import UserAvatarComponent from './components/user-avatar.svelte';
|
|
107
|
+
import OrganizationSwitcherComponent from './components/organization/organization-switcher.svelte';
|
|
108
|
+
import OrganizationCellViewComponent from './components/organization/organization-cell-view.svelte';
|
|
109
|
+
import OrganizationLogoComponent from './components/organization/organization-logo.svelte';
|
|
110
|
+
import OrganizationLogoCardComponent from './components/organization/organization-logo-card.svelte';
|
|
111
|
+
import DeleteOrganizationCardComponent from './components/organization/delete-organization-card.svelte';
|
|
112
|
+
import OrganizationInvitationsCardComponent from './components/organization/organization-invitations-card.svelte';
|
|
113
|
+
import OrganizationMembersCardComponent from './components/organization/organization-members-card.svelte';
|
|
114
|
+
import OrganizationNameCardComponent from './components/organization/organization-name-card.svelte';
|
|
115
|
+
import OrganizationSettingsCardsComponent from './components/organization/organization-settings-cards.svelte';
|
|
116
|
+
import OrganizationSlugCardComponent from './components/organization/organization-slug-card.svelte';
|
|
117
|
+
import OrganizationViewComponent from './components/organization/organization-view.svelte';
|
|
118
|
+
import OrganizationsCardComponent from './components/organization/organizations-card.svelte';
|
|
119
|
+
import UserInvitationsCardComponent from './components/organization/user-invitations-card.svelte';
|
|
120
|
+
import SettingsCardComponent from './components/settings/shared/settings-card.svelte';
|
|
100
121
|
export * from './types/auth-hooks.js';
|
|
101
122
|
export * from './types/auth-mutators.js';
|
|
@@ -20,7 +20,7 @@ export declare const authLocalization: {
|
|
|
20
20
|
ALREADY_SUBSCRIBED_PLAN: string;
|
|
21
21
|
UNABLE_TO_CREATE_CUSTOMER: string;
|
|
22
22
|
FAILED_TO_FETCH_PLANS: string;
|
|
23
|
-
|
|
23
|
+
STRIPE_EMAIL_VERIFICATION_REQUIRED: string;
|
|
24
24
|
SUBSCRIPTION_NOT_ACTIVE: string;
|
|
25
25
|
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: string;
|
|
26
26
|
INVALID_PHONE_NUMBER: string;
|
|
@@ -484,6 +484,8 @@ export declare const authLocalization: {
|
|
|
484
484
|
VERIFY_YOUR_EMAIL: string;
|
|
485
485
|
/** @default "Please verify your email address. Check your inbox for the verification email. If you haven't received the email, click the button below to resend." */
|
|
486
486
|
VERIFY_YOUR_EMAIL_DESCRIPTION: string;
|
|
487
|
+
/** @default "Email Verification Required" */
|
|
488
|
+
EMAIL_VERIFICATION_REQUIRED: string;
|
|
487
489
|
/** @default "We've sent a verification link to" */
|
|
488
490
|
EMAIL_VERIFICATION_SENT_TO: string;
|
|
489
491
|
/** @default "Please check your email and click the verification link to complete your registration." */
|
|
@@ -4,7 +4,7 @@ export declare const STRIPE_ERROR_CODES: {
|
|
|
4
4
|
ALREADY_SUBSCRIBED_PLAN: string;
|
|
5
5
|
UNABLE_TO_CREATE_CUSTOMER: string;
|
|
6
6
|
FAILED_TO_FETCH_PLANS: string;
|
|
7
|
-
|
|
7
|
+
STRIPE_EMAIL_VERIFICATION_REQUIRED: string;
|
|
8
8
|
SUBSCRIPTION_NOT_ACTIVE: string;
|
|
9
9
|
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: string;
|
|
10
10
|
};
|
|
@@ -4,7 +4,7 @@ export const STRIPE_ERROR_CODES = {
|
|
|
4
4
|
ALREADY_SUBSCRIBED_PLAN: "You're already subscribed to this plan",
|
|
5
5
|
UNABLE_TO_CREATE_CUSTOMER: 'Unable to create customer',
|
|
6
6
|
FAILED_TO_FETCH_PLANS: 'Failed to fetch plans',
|
|
7
|
-
|
|
7
|
+
STRIPE_EMAIL_VERIFICATION_REQUIRED: 'Email verification is required before you can sign up',
|
|
8
8
|
SUBSCRIPTION_NOT_ACTIVE: 'Subscription is not active',
|
|
9
9
|
SUBSCRIPTION_NOT_SCHEDULED_FOR_CANCELLATION: 'Subscription is not scheduled for cancellation'
|
|
10
10
|
};
|
|
@@ -22,10 +22,10 @@ export type AuthHooks = {
|
|
|
22
22
|
}>;
|
|
23
23
|
useListDeviceSessions: () => AuthHook<AnyAuthClient['$Infer']['Session'][]>;
|
|
24
24
|
useListSessions: () => AuthHook<AnyAuthSession['session'][]>;
|
|
25
|
-
useListPasskeys: () =>
|
|
25
|
+
useListPasskeys: () => any;
|
|
26
26
|
useListApiKeys: () => AuthHook<ApiKey[]>;
|
|
27
|
-
useActiveOrganization: () =>
|
|
28
|
-
useListOrganizations: () =>
|
|
27
|
+
useActiveOrganization: () => any;
|
|
28
|
+
useListOrganizations: () => any;
|
|
29
29
|
useHasPermission: (params: {
|
|
30
30
|
permission: string;
|
|
31
31
|
}) => AuthHook<{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AnyAuthClient } from './any-auth-client.js';
|
|
2
1
|
export type Provider = {
|
|
3
2
|
provider: string;
|
|
4
3
|
name: string;
|
|
@@ -13,5 +12,5 @@ export type GenericOAuthOptions = {
|
|
|
13
12
|
/**
|
|
14
13
|
* Custom generic OAuth sign in function
|
|
15
14
|
*/
|
|
16
|
-
signIn?: (params:
|
|
15
|
+
signIn?: (params: any) => Promise<unknown>;
|
|
17
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth-ui-svelte",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Pre-built authentication UI components for Better Auth in Svelte 5",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@better-auth/passkey": "^1.4.9",
|
|
25
25
|
"@lucide/svelte": "^0.554.0",
|
|
26
|
+
"@sveltejs/kit": "^2.0.0",
|
|
26
27
|
"better-auth": "^1.3.0",
|
|
27
28
|
"bits-ui": "^2.14.4",
|
|
28
29
|
"svelte": "^5.0.0",
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
"license": "MIT",
|
|
93
94
|
"repository": {
|
|
94
95
|
"type": "git",
|
|
95
|
-
"url": "https://github.com/multiplehats/better-auth-ui-svelte"
|
|
96
|
+
"url": "git+https://github.com/multiplehats/better-auth-ui-svelte.git"
|
|
96
97
|
},
|
|
97
98
|
"bugs": {
|
|
98
99
|
"url": "https://github.com/multiplehats/better-auth-ui-svelte/issues"
|