@8wave/ai-elements 0.114.0-beta.25 → 0.114.0-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/ai-elements.es.js +754 -335
  2. package/dist/ai-elements.es.js.map +1 -1
  3. package/dist-vue/PkChatbotAuth.js +1 -1
  4. package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js +421 -0
  5. package/dist-vue/_chunks/PkChatbotAuth-jzoNJkmH.js.map +1 -0
  6. package/dist-vue/apps/web-component/src/components/EmbeddedChatWidget.ce.d.ts +4 -4
  7. package/dist-vue/apps/web-component/src/composables/useChatbotAuth.d.ts +53 -5
  8. package/dist-vue/apps/web-component/src/composables/useChatbotAuthForm.d.ts +14 -0
  9. package/dist-vue/composables.js +297 -16
  10. package/dist-vue/composables.js.map +1 -1
  11. package/dist-vue/index.js +354 -328
  12. package/dist-vue/index.js.map +1 -1
  13. package/dist-vue/locales.js +24 -0
  14. package/dist-vue/packages/auth/src/additional-fields.d.ts +48 -0
  15. package/dist-vue/packages/auth/src/passkey-policy-client-plugin.d.ts +31 -0
  16. package/dist-vue/packages/auth/src/passkey-policy-plugin.d.ts +22 -0
  17. package/dist-vue/packages/auth/src/two-factor-policy-client-plugin.d.ts +60 -0
  18. package/dist-vue/packages/auth/src/two-factor-policy-plugin.d.ts +65 -0
  19. package/dist-vue/packages/components/src/PkQrCode.d.ts +14 -0
  20. package/dist-vue/packages/components/src/chat/PkChatbotAuth.d.ts +19 -0
  21. package/dist-vue/packages/components/src/index.d.ts +2 -1
  22. package/dist-vue/packages/models/src/schema/Member.d.ts +3 -0
  23. package/dist-vue/packages/models/src/schema/Notification.d.ts +2 -0
  24. package/dist-vue/packages/models/src/schema/Organization.d.ts +1 -0
  25. package/dist-vue/packages/models/src/schema/User.d.ts +1 -0
  26. package/dist-vue/style.css +1 -1
  27. package/package.json +1 -1
  28. package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js +0 -349
  29. package/dist-vue/_chunks/PkChatbotAuth-Bi508F1u.js.map +0 -1
@@ -471,6 +471,18 @@ var e = {
471
471
  untitled: "Untitled file",
472
472
  exclude: "Remove file"
473
473
  },
474
+ twoFactor: {
475
+ challengeBackup: "Enter one of the backup codes you saved.",
476
+ challengeEmailSent: "We sent a 6-digit code to your email. It expires in 5 minutes.",
477
+ challengeApp: "Enter the 6-digit code from your authenticator app.",
478
+ challengeTitle: "Two-step verification",
479
+ backupCode: "Backup code",
480
+ code: "6-digit code",
481
+ verify: "Verify",
482
+ useBackupCode: "Use a backup code",
483
+ useApp: "Use the authenticator app",
484
+ sendAgain: "Send a new code"
485
+ },
474
486
  auth: {
475
487
  signInTitle: "Sign in to your account",
476
488
  signUpTitle: "Create your account",
@@ -1049,6 +1061,18 @@ var e = {
1049
1061
  untitled: "File senza nome",
1050
1062
  exclude: "Rimuovi file"
1051
1063
  },
1064
+ twoFactor: {
1065
+ challengeBackup: "Scrivi uno dei codici di recupero che hai salvato.",
1066
+ challengeEmailSent: "Ti abbiamo inviato un codice a 6 cifre via email. Scade fra 5 minuti.",
1067
+ challengeApp: "Scrivi il codice a 6 cifre della tua app di autenticazione.",
1068
+ challengeTitle: "Verifica in due passaggi",
1069
+ backupCode: "Codice di recupero",
1070
+ code: "Codice a 6 cifre",
1071
+ verify: "Verifica",
1072
+ useBackupCode: "Usa un codice di recupero",
1073
+ useApp: "Usa l'app di autenticazione",
1074
+ sendAgain: "Invia un nuovo codice"
1075
+ },
1052
1076
  auth: {
1053
1077
  signInTitle: "Accedi al tuo account",
1054
1078
  signUpTitle: "Crea il tuo account",
@@ -0,0 +1,48 @@
1
+ /** The columns the config adds to better-auth's session. */
2
+ export declare const sessionAdditionalFields: {
3
+ activeOrganizationId: {
4
+ type: "string";
5
+ };
6
+ impersonatedBy: {
7
+ type: "string";
8
+ };
9
+ organizationRole: {
10
+ type: "string";
11
+ };
12
+ hardExpiresAt: {
13
+ type: "date";
14
+ required: false;
15
+ input: false;
16
+ };
17
+ signedInWithPasskey: {
18
+ type: "boolean";
19
+ required: false;
20
+ input: false;
21
+ defaultValue: false;
22
+ };
23
+ };
24
+ /** The columns the config adds to better-auth's user. */
25
+ export declare const userAdditionalFields: {
26
+ media: {
27
+ type: "json";
28
+ required: false;
29
+ };
30
+ phoneNumber: {
31
+ type: "string";
32
+ required: false;
33
+ };
34
+ };
35
+ /**
36
+ * What `inferAdditionalFields` reads of the server options, for a client that
37
+ * must not load the config itself. The widget's type declarations are built
38
+ * from its imports, and the inferred type of the config, with the two-step
39
+ * verification and passkey plugins, is too long to serialize (TS7056).
40
+ */
41
+ export type AdditionalFieldsOptions = {
42
+ session: {
43
+ additionalFields: typeof sessionAdditionalFields;
44
+ };
45
+ user: {
46
+ additionalFields: typeof userAdditionalFields;
47
+ };
48
+ };
@@ -0,0 +1,31 @@
1
+ import { BetterFetch } from 'better-auth/client';
2
+ /**
3
+ * Client counterpart of the server `passkeyPolicy()` plugin, see
4
+ * docs/specs/two-factor-authentication.md, D10.
5
+ */
6
+ export declare function passkeyPolicyClient(): {
7
+ id: "passkey-policy";
8
+ getActions: ($fetch: BetterFetch) => {
9
+ passkeyPolicy: {
10
+ /** Lets the session add a passkey for the next five minutes. */
11
+ confirmPassword: (data: {
12
+ password: string;
13
+ }) => Promise<{
14
+ data: null;
15
+ error: {
16
+ message?: string | undefined;
17
+ status: number;
18
+ statusText: string;
19
+ };
20
+ } | {
21
+ data: {
22
+ status: boolean;
23
+ };
24
+ error: null;
25
+ }>;
26
+ };
27
+ };
28
+ pathMethods: {
29
+ '/passkey-policy/confirm-password': "POST";
30
+ };
31
+ };
@@ -0,0 +1,22 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ /** Whether a session created on this route is opened with a passkey. */
3
+ export declare function isPasskeySessionPath(path: string | undefined): boolean;
4
+ /**
5
+ * Refuses a passkey that did not check who holds it (a PIN, a fingerprint, a
6
+ * face). With that check a passkey is two factors on its own, which is what
7
+ * lets it stand in for the password and the code; without it, it is a key
8
+ * anyone holding the device can use. better-auth leaves the check off.
9
+ */
10
+ export declare function requirePasskeyUserVerification(userVerified: boolean | undefined): void;
11
+ /**
12
+ * The confirmation that guards adding a passkey, the announcements of D7 for
13
+ * passkeys and the rate limit of the confirmation.
14
+ *
15
+ * A passkey signs in without the password and without the code, so adding
16
+ * one is as strong as setting the password: the session alone is not enough,
17
+ * since a stolen one would leave a way in that outlives it (there is no
18
+ * freshness window, see `freshAge` in packages/auth/src/index.ts). The
19
+ * password is asked again, or, for an account without one, a sign-in in the
20
+ * last ten minutes.
21
+ */
22
+ export declare function passkeyPolicy(): BetterAuthPlugin;
@@ -0,0 +1,60 @@
1
+ import { BetterFetch } from 'better-auth/client';
2
+ /** What `GET /two-factor-policy/status` answers. */
3
+ export interface TwoFactorStatus {
4
+ enabled: boolean;
5
+ /** `totp` for an authenticator app, `otp` for the code sent by email. */
6
+ method: 'totp' | 'otp' | null;
7
+ /** The second factor protects a password: without one it is not offered. */
8
+ hasPassword: boolean;
9
+ /** An organization of the user requires it and it is not set up yet. */
10
+ required: boolean;
11
+ /** The user's organizations that require it. */
12
+ requiredBy: {
13
+ id: string;
14
+ name: string;
15
+ }[];
16
+ /** Backup codes left, with an authenticator app; null otherwise. */
17
+ backupCodesRemaining: number | null;
18
+ /** Passkeys of the user: a session opened with one meets the policy. */
19
+ passkeys: number;
20
+ }
21
+ /**
22
+ * Client counterpart of the server `twoFactorPolicy()` plugin, see
23
+ * docs/specs/two-factor-authentication.md.
24
+ */
25
+ export declare function twoFactorPolicyClient(): {
26
+ id: "two-factor-policy";
27
+ getActions: ($fetch: BetterFetch) => {
28
+ twoFactorPolicy: {
29
+ status: () => Promise<{
30
+ data: null;
31
+ error: {
32
+ message?: string | undefined;
33
+ status: number;
34
+ statusText: string;
35
+ };
36
+ } | {
37
+ data: TwoFactorStatus;
38
+ error: null;
39
+ }>;
40
+ reset: (data: {
41
+ userId: string;
42
+ }) => Promise<{
43
+ data: null;
44
+ error: {
45
+ message?: string | undefined;
46
+ status: number;
47
+ statusText: string;
48
+ };
49
+ } | {
50
+ data: {
51
+ status: boolean;
52
+ };
53
+ error: null;
54
+ }>;
55
+ };
56
+ };
57
+ pathMethods: {
58
+ '/two-factor-policy/reset': "POST";
59
+ };
60
+ };
@@ -0,0 +1,65 @@
1
+ import { BetterAuthPlugin } from 'better-auth';
2
+ import { createAuthMiddleware } from 'better-auth/api';
3
+ import { TwoFactorChange } from 'email';
4
+ /**
5
+ * Carries the challenge for a client that cannot hold the cookie: the widget,
6
+ * cross-origin and on bearer tokens (D4). The value is the signed cookie as
7
+ * the sign-in set it.
8
+ */
9
+ export declare const TWO_FACTOR_TOKEN_HEADER = "x-two-factor-token";
10
+ /** Time the code sent by email stays valid, in minutes. */
11
+ export declare const TWO_FACTOR_OTP_PERIOD_MINUTES = 5;
12
+ type ChangedUser = {
13
+ id: string;
14
+ email: string;
15
+ name: string;
16
+ };
17
+ export type MiddlewareContext = Parameters<Parameters<typeof createAuthMiddleware>[0]>[0];
18
+ /**
19
+ * Tells the user that their second factor or their passkeys changed (D7, D10),
20
+ * by email and in the notification panel. Never throws: the change is already
21
+ * written.
22
+ */
23
+ export declare function announceTwoFactorChange(user: ChangedUser, change: TwoFactorChange): Promise<void>;
24
+ type PolicyOrganization = {
25
+ requireTwoFactor?: boolean | null;
26
+ deleted?: boolean | null;
27
+ };
28
+ /**
29
+ * Whether the request has to stop for the organization policy (D6): the
30
+ * session of a member of an organization that requires a second factor, who
31
+ * signs in with a password and has none. `organizations` is what the caller
32
+ * already listed for the request, so the common case costs no query, or a
33
+ * loader that runs only once the cheap exemptions are past; the password
34
+ * check is cached, since most users have no second factor. Impersonation and
35
+ * anonymous sessions are exempt, and so is a deleted organization, which the
36
+ * status endpoint does not list either: counted here alone, it would bounce
37
+ * the user between the setup page and the app.
38
+ *
39
+ * A session opened with a passkey meets the policy (D10), and so does a user
40
+ * with a passkey where no session tells how they signed in: a Platform MCP
41
+ * token, whose authorization ran in a session the policy let through.
42
+ */
43
+ export declare function isTwoFactorSetupRequiredForSession(input: {
44
+ user: {
45
+ id: string;
46
+ twoFactorEnabled?: boolean | null;
47
+ isAnonymous?: boolean | null;
48
+ hasPasskey?: boolean;
49
+ };
50
+ session: {
51
+ impersonatedBy?: string | null;
52
+ signedInWithPasskey?: boolean | null;
53
+ };
54
+ organizations: readonly PolicyOrganization[] | (() => Promise<readonly PolicyOrganization[]>);
55
+ }): Promise<boolean>;
56
+ /**
57
+ * The status endpoint, the administrator reset, the widget bridge and the
58
+ * announcements of docs/specs/two-factor-authentication.md.
59
+ *
60
+ * The endpoints live under `/two-factor-policy/` and not `/two-factor/` on
61
+ * purpose: the `twoFactor` plugin rate limits its prefix to three requests
62
+ * every ten seconds, which a profile page reading the status would hit.
63
+ */
64
+ export declare function twoFactorPolicy(): BetterAuthPlugin;
65
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
2
+ /**
3
+ * A QR code drawn as inline SVG, with `qrcode` loaded on first use. The
4
+ * code stays dark on a white ground whatever the theme: a scanner reads
5
+ * the contrast, and not every one reads it inverted.
6
+ */
7
+ type __VLS_Props = {
8
+ value: string;
9
+ /** What the code holds, for a screen reader. */
10
+ label: string;
11
+ };
12
+ declare const __VLS_export: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
@@ -4,6 +4,12 @@ type __VLS_Props = {
4
4
  branding?: AgentBranding;
5
5
  authMethods?: AuthMethods;
6
6
  loading?: boolean;
7
+ /**
8
+ * Set while an email sign-in waits for its second factor: the
9
+ * methods the account has (`totp`, `otp`). The code step replaces
10
+ * the forms until it is answered or cancelled.
11
+ */
12
+ twoFactorMethods?: string[];
7
13
  };
8
14
  type __VLS_ModelProps = {
9
15
  'errorMessage'?: string | undefined;
@@ -43,6 +49,12 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
43
49
  email: string;
44
50
  }) => any;
45
51
  social: (provider: "google" | "microsoft") => any;
52
+ "verify-two-factor": (payload: {
53
+ kind: "totp" | "otp" | "backup";
54
+ code: string;
55
+ }) => any;
56
+ "send-two-factor-code": () => any;
57
+ "cancel-two-factor": () => any;
46
58
  }, string, PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
59
  "onUpdate:errorMessage"?: ((message?: string | undefined) => any) | undefined;
48
60
  "onUpdate:success"?: ((value?: {
@@ -63,10 +75,17 @@ declare const __VLS_export: DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, C
63
75
  email: string;
64
76
  }) => any) | undefined;
65
77
  onSocial?: ((provider: "google" | "microsoft") => any) | undefined;
78
+ "onVerify-two-factor"?: ((payload: {
79
+ kind: "totp" | "otp" | "backup";
80
+ code: string;
81
+ }) => any) | undefined;
82
+ "onSend-two-factor-code"?: (() => any) | undefined;
83
+ "onCancel-two-factor"?: (() => any) | undefined;
66
84
  }>, {
67
85
  branding: AgentBranding;
68
86
  authMethods: AuthMethods;
69
87
  loading: boolean;
88
+ twoFactorMethods: string[];
70
89
  }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
71
90
  declare const _default: typeof __VLS_export;
72
91
  export default _default;
@@ -22,6 +22,7 @@ import { default as PkLoader } from './PkLoader';
22
22
  import { default as PkMedia } from './PkMedia';
23
23
  import { default as PkOfflineScreen } from './PkOfflineScreen';
24
24
  import { default as PkPwaNotices } from './PkPwaNotices';
25
+ import { default as PkQrCode } from './PkQrCode';
25
26
  import { default as PkRelativeTime } from './PkRelativeTime';
26
27
  import { default as PkSkeleton } from './PkSkeleton';
27
28
  import { default as PkSvgViewer } from './PkSvgViewer';
@@ -32,4 +33,4 @@ export * from './chat';
32
33
  export * from './input';
33
34
  export * from './table';
34
35
  export * from './types';
35
- export { PkBadge, PkEditorAgentType, PkEditorDocumentType, PkEditorNotificationType, PkEditorCode, PkEditorJsonSchema, PkEditorMarkdown, PkEditorMedia, PkEditorPrompt, PkEditorRadioButtons, PkEditorCheckboxButtons, PkEditorRepeater, PkEditorWyswyg, PkCheckboxField, PkFieldset, PkInfobox, PkSchemaField, PkIntegrationProvider, PkLazyImg, PkLightbox, PkLoader, PkMedia, PkOfflineScreen, PkPwaNotices, PkRelativeTime, PkSkeleton, PkSvgViewer, PkUrl, };
36
+ export { PkBadge, PkEditorAgentType, PkEditorDocumentType, PkEditorNotificationType, PkEditorCode, PkEditorJsonSchema, PkEditorMarkdown, PkEditorMedia, PkEditorPrompt, PkEditorRadioButtons, PkEditorCheckboxButtons, PkEditorRepeater, PkEditorWyswyg, PkCheckboxField, PkFieldset, PkInfobox, PkSchemaField, PkIntegrationProvider, PkLazyImg, PkLightbox, PkLoader, PkMedia, PkOfflineScreen, PkPwaNotices, PkQrCode, PkRelativeTime, PkSkeleton, PkSvgViewer, PkUrl, };
@@ -119,6 +119,9 @@ export declare const MemberSchema: z.ZodObject<{
119
119
  user: "user";
120
120
  admin: "admin";
121
121
  }>;
122
+ twoFactorEnabled: z.ZodOptional<z.ZodBoolean>;
123
+ hasPassword: z.ZodOptional<z.ZodBoolean>;
124
+ hasPasskey: z.ZodOptional<z.ZodBoolean>;
122
125
  }, z.core.$strip>;
123
126
  }, z.core.$strip>;
124
127
  export type Member = z.infer<typeof MemberSchema>;
@@ -4,6 +4,8 @@ export declare const NotificationType: {
4
4
  readonly ApiKeyExpiring: "api_key_expiring";
5
5
  readonly Organization: "organization";
6
6
  readonly PasswordResetRequested: "password_reset_requested";
7
+ /** Two-step verification turned on, off, or reset by an administrator. */
8
+ readonly TwoFactor: "two_factor";
7
9
  /** A sync took documents out because the remote no longer has them. */
8
10
  readonly DocumentSyncRemoved: "document_sync_removed";
9
11
  readonly ChatWarning: "chat_warning";
@@ -106,6 +106,7 @@ export declare const OrganizationSchema: z.ZodObject<{
106
106
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
107
107
  deletedBy: z.ZodNullable<z.ZodString>;
108
108
  metadata: z.ZodNullable<z.ZodString>;
109
+ requireTwoFactor: z.ZodOptional<z.ZodBoolean>;
109
110
  }, z.core.$strip>;
110
111
  export type Organization = z.infer<typeof OrganizationSchema>;
111
112
  export declare const OrganizationDtoSchema: z.ZodObject<{
@@ -118,6 +118,7 @@ export declare const UserSchema: z.ZodObject<{
118
118
  user: "user";
119
119
  admin: "admin";
120
120
  }>;
121
+ twoFactorEnabled: z.ZodOptional<z.ZodBoolean>;
121
122
  }, z.core.$strip>;
122
123
  export type User = z.infer<typeof UserSchema>;
123
124
  /**