@dbx-tools/ui 0.9.136 → 0.9.139
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/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Hand edits are overwritten on the next watch; this file is read-only.
|
|
4
4
|
|
|
5
5
|
export const PACKAGE_IDENTIFIER = "@dbx-tools/ui";
|
|
6
|
-
export const PACKAGE_VERSION = "0.9.
|
|
6
|
+
export const PACKAGE_VERSION = "0.9.139";
|
|
7
7
|
export * as authReactAuthClient from "./src/auth/react/auth-client.ts";
|
|
8
8
|
export * as authReactAuthGate from "./src/auth/react/auth-gate.tsx";
|
|
9
9
|
export * as authReactPasskeyManager from "./src/auth/react/passkey-manager.tsx";
|
package/package.json
CHANGED
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@databricks/appkit-ui": "0.81.0",
|
|
33
|
-
"@dbx-tools/shared-auth": "^0.9.
|
|
34
|
-
"@dbx-tools/shared-core": "^0.9.
|
|
35
|
-
"@dbx-tools/shared-email": "^0.9.
|
|
36
|
-
"@dbx-tools/shared-email-template": "^0.9.
|
|
37
|
-
"@dbx-tools/shared-search": "^0.9.
|
|
33
|
+
"@dbx-tools/shared-auth": "^0.9.139",
|
|
34
|
+
"@dbx-tools/shared-core": "^0.9.139",
|
|
35
|
+
"@dbx-tools/shared-email": "^0.9.139",
|
|
36
|
+
"@dbx-tools/shared-email-template": "^0.9.139",
|
|
37
|
+
"@dbx-tools/shared-search": "^0.9.139",
|
|
38
38
|
"lucide-react": "^0.554.0",
|
|
39
39
|
"shiki": "^3.0.0",
|
|
40
40
|
"streamdown": "^2.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"version": "0.9.
|
|
47
|
+
"version": "0.9.139",
|
|
48
48
|
"dbxToolsConfig": {
|
|
49
49
|
"tags": [
|
|
50
50
|
"ui"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
beginPasskeySignIn,
|
|
7
7
|
getAuthStatus,
|
|
8
8
|
passkeyDisplayName,
|
|
9
|
+
passkeysAvailable,
|
|
9
10
|
requestEmailOtp,
|
|
10
11
|
type PasskeyOperation,
|
|
11
12
|
verifyEmailOtp,
|
|
@@ -57,7 +58,7 @@ export function AuthGate({
|
|
|
57
58
|
void getAuthStatus()
|
|
58
59
|
.then((status) => {
|
|
59
60
|
if (cancelled) return;
|
|
60
|
-
setPasskeysEnabled(status.passkeysEnabled === true);
|
|
61
|
+
setPasskeysEnabled(status.passkeysEnabled === true && passkeysAvailable());
|
|
61
62
|
setConfiguredPasskeyNamePrefix(status.passkeyNamePrefix);
|
|
62
63
|
setPhase(status.enabled ? (status.authenticated ? "authed" : "email") : "open");
|
|
63
64
|
})
|
|
@@ -271,7 +272,7 @@ export function AuthGate({
|
|
|
271
272
|
onCheckedChange={(checked) => setCreatePasskey(checked === true)}
|
|
272
273
|
/>
|
|
273
274
|
<Label htmlFor="create-passkey" className="text-sm font-normal">
|
|
274
|
-
Create
|
|
275
|
+
Create passkey
|
|
275
276
|
</Label>
|
|
276
277
|
</div>
|
|
277
278
|
) : null}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getAuthStatus,
|
|
6
6
|
listPasskeys,
|
|
7
7
|
passkeyDisplayName,
|
|
8
|
+
passkeysAvailable,
|
|
8
9
|
type PasskeyOperation,
|
|
9
10
|
type Passkey,
|
|
10
11
|
removePasskey,
|
|
@@ -21,6 +22,7 @@ export interface PasskeyManagerProps {
|
|
|
21
22
|
|
|
22
23
|
/** Authenticated management surface for a user's Better Auth passkeys. */
|
|
23
24
|
export function PasskeyManager({ className, passkeyNamePrefix }: PasskeyManagerProps): ReactNode {
|
|
25
|
+
const [available] = useState(passkeysAvailable);
|
|
24
26
|
const [passkeys, setPasskeys] = useState<Passkey[]>([]);
|
|
25
27
|
const [names, setNames] = useState<Record<string, string>>({});
|
|
26
28
|
const [busy, setBusy] = useState(false);
|
|
@@ -49,8 +51,9 @@ export function PasskeyManager({ className, passkeyNamePrefix }: PasskeyManagerP
|
|
|
49
51
|
}, []);
|
|
50
52
|
|
|
51
53
|
useEffect(() => {
|
|
54
|
+
if (!available) return;
|
|
52
55
|
void refresh().catch(() => setNotice("Unable to load passkeys."));
|
|
53
|
-
}, [refresh]);
|
|
56
|
+
}, [available, refresh]);
|
|
54
57
|
|
|
55
58
|
const add = useCallback(async () => {
|
|
56
59
|
cancelEnrollment();
|
|
@@ -106,6 +109,8 @@ export function PasskeyManager({ className, passkeyNamePrefix }: PasskeyManagerP
|
|
|
106
109
|
[refresh],
|
|
107
110
|
);
|
|
108
111
|
|
|
112
|
+
if (!available) return null;
|
|
113
|
+
|
|
109
114
|
return (
|
|
110
115
|
<section className={className} aria-label="Passkeys">
|
|
111
116
|
<div className="mb-3 flex items-center justify-between gap-3">
|
|
@@ -195,7 +195,7 @@ export function BrandPicker({
|
|
|
195
195
|
<Label htmlFor={`${id}-tagline`}>Tagline</Label>
|
|
196
196
|
<Input
|
|
197
197
|
id={`${id}-tagline`}
|
|
198
|
-
value={draft.tagline}
|
|
198
|
+
value={draft.tagline ?? ""}
|
|
199
199
|
onChange={(event) => updateIdentity("tagline", event.currentTarget.value)}
|
|
200
200
|
/>
|
|
201
201
|
</div>
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
// search-as-you-type state machine. Single-index queries use AppKit's native
|
|
3
3
|
// route and client config; universal queries use the dbx-tools extension route.
|
|
4
4
|
|
|
5
|
+
import { usePluginClientConfig } from "@databricks/appkit-ui/react";
|
|
5
6
|
import { useAiSearchQuery, type AiSearchRequest } from "@databricks/appkit-ui/react/beta";
|
|
6
7
|
import {
|
|
8
|
+
SEARCH_DEFAULT_BASE_PATH,
|
|
9
|
+
SEARCH_PLUGIN_NAME,
|
|
10
|
+
SEARCH_ROUTES,
|
|
7
11
|
searchSchemas,
|
|
8
12
|
type SearchClientConfig,
|
|
9
13
|
type SearchHit,
|
|
@@ -48,13 +52,24 @@ export interface UseSearchState {
|
|
|
48
52
|
clear: () => void;
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
const UNIVERSAL_SEARCH_PATH = "/api/search/universal";
|
|
52
|
-
|
|
53
55
|
/** Validate one universal-search response with the owning shared schema. */
|
|
54
56
|
export function parseUniversalSearchResult(value: unknown): SearchResult {
|
|
55
57
|
return searchSchemas.searchResultSchema.parse(value);
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** Validate the published extension config, treating AppKit's empty sentinel as absent. */
|
|
61
|
+
export function parseSearchClientConfig(value: unknown): SearchClientConfig | undefined {
|
|
62
|
+
if (
|
|
63
|
+
!value ||
|
|
64
|
+
typeof value !== "object" ||
|
|
65
|
+
Array.isArray(value) ||
|
|
66
|
+
Object.keys(value).length === 0
|
|
67
|
+
) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
return searchSchemas.searchClientConfigSchema.parse(value);
|
|
71
|
+
}
|
|
72
|
+
|
|
58
73
|
/** A single configured index is already the complete universal-search set. */
|
|
59
74
|
export function usesUniversalSearchRoute(
|
|
60
75
|
universal: boolean | undefined,
|
|
@@ -82,9 +97,18 @@ function toHits(
|
|
|
82
97
|
*/
|
|
83
98
|
export function useSearch(options: UseSearchOptions = {}): UseSearchState {
|
|
84
99
|
const native = useAiSearchQuery({ ...(options.index ? { alias: options.index } : {}) });
|
|
100
|
+
const publishedConfig = usePluginClientConfig<unknown>(SEARCH_PLUGIN_NAME);
|
|
101
|
+
const config = useMemo(() => parseSearchClientConfig(publishedConfig), [publishedConfig]);
|
|
85
102
|
const debounceMs = options.debounceMs ?? 200;
|
|
86
103
|
const minLength = options.minLength ?? 1;
|
|
87
|
-
const useUniversalRoute = usesUniversalSearchRoute(
|
|
104
|
+
const useUniversalRoute = usesUniversalSearchRoute(
|
|
105
|
+
options.universal,
|
|
106
|
+
config?.indexes.length ?? native.indexes.length,
|
|
107
|
+
);
|
|
108
|
+
const universalSearchPath = searchSchemas.searchRoute(
|
|
109
|
+
config?.basePath ?? SEARCH_DEFAULT_BASE_PATH,
|
|
110
|
+
SEARCH_ROUTES.universal,
|
|
111
|
+
);
|
|
88
112
|
|
|
89
113
|
const [query, setQueryState] = useState("");
|
|
90
114
|
const [hits, setHits] = useState<SearchHit[]>([]);
|
|
@@ -118,7 +142,7 @@ export function useSearch(options: UseSearchOptions = {}): UseSearchState {
|
|
|
118
142
|
setUniversalLoading(true);
|
|
119
143
|
setUniversalError(null);
|
|
120
144
|
try {
|
|
121
|
-
const response = await fetch(
|
|
145
|
+
const response = await fetch(universalSearchPath, {
|
|
122
146
|
method: "POST",
|
|
123
147
|
headers: { "content-type": "application/json" },
|
|
124
148
|
body: JSON.stringify({
|
|
@@ -141,7 +165,15 @@ export function useSearch(options: UseSearchOptions = {}): UseSearchState {
|
|
|
141
165
|
if (abortRef.current === controller) setUniversalLoading(false);
|
|
142
166
|
}
|
|
143
167
|
},
|
|
144
|
-
[
|
|
168
|
+
[
|
|
169
|
+
minLength,
|
|
170
|
+
native.alias,
|
|
171
|
+
native.search,
|
|
172
|
+
options.limit,
|
|
173
|
+
options.mode,
|
|
174
|
+
universalSearchPath,
|
|
175
|
+
useUniversalRoute,
|
|
176
|
+
],
|
|
145
177
|
);
|
|
146
178
|
|
|
147
179
|
const setQuery = useCallback(
|
|
@@ -175,19 +207,6 @@ export function useSearch(options: UseSearchOptions = {}): UseSearchState {
|
|
|
175
207
|
[],
|
|
176
208
|
);
|
|
177
209
|
|
|
178
|
-
const config = useMemo<SearchClientConfig>(
|
|
179
|
-
() => ({
|
|
180
|
-
indexes: native.indexes.map((index) => ({
|
|
181
|
-
name: index.alias,
|
|
182
|
-
alias: index.alias,
|
|
183
|
-
isDefault: index.alias === native.alias,
|
|
184
|
-
})),
|
|
185
|
-
...(native.alias ? { defaultIndex: native.alias } : {}),
|
|
186
|
-
pageSize: options.limit ?? 20,
|
|
187
|
-
basePath: "/api/ai-search",
|
|
188
|
-
}),
|
|
189
|
-
[native.alias, native.indexes, options.limit],
|
|
190
|
-
);
|
|
191
210
|
const loading = useUniversalRoute ? universalLoading : native.loading;
|
|
192
211
|
const error = useUniversalRoute ? universalError : native.error;
|
|
193
212
|
return useMemo(
|