@budibase/frontend-core 3.27.5 → 3.28.1
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/package.json +2 -2
- package/src/api/index.ts +2 -0
- package/src/api/types.ts +2 -0
- package/src/api/user.ts +4 -4
- package/src/api/workspaceHome.ts +25 -0
- package/src/components/Chatbox/index.svelte +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/frontend-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.28.1",
|
|
4
4
|
"description": "Budibase frontend core libraries used in builder and client",
|
|
5
5
|
"author": "Budibase",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vitest": "^3.2.4"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "e034f570c9fbb13b51fa2178e74764b1c3182761"
|
|
28
28
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -54,6 +54,7 @@ import { buildWorkspaceAppEndpoints } from "./workspaceApps"
|
|
|
54
54
|
import { buildResourceEndpoints } from "./resource"
|
|
55
55
|
import { buildDeploymentEndpoints } from "./deploy"
|
|
56
56
|
import { buildWorkspaceFavouriteEndpoints } from "./workspaceFavourites"
|
|
57
|
+
import { buildWorkspaceHomeEndpoints } from "./workspaceHome"
|
|
57
58
|
import { buildRecaptchaEndpoints } from "./recaptcha"
|
|
58
59
|
import { buildAIConfigEndpoints } from "./aiConfig"
|
|
59
60
|
import { buildVectorDbEndpoints } from "./vectorDbs"
|
|
@@ -324,6 +325,7 @@ export const createAPIClient = (config: APIClientConfig = {}): APIClient => {
|
|
|
324
325
|
navigation: buildNavigationEndpoints(API),
|
|
325
326
|
workspaceApp: buildWorkspaceAppEndpoints(API),
|
|
326
327
|
workspace: buildWorkspaceFavouriteEndpoints(API),
|
|
328
|
+
workspaceHome: buildWorkspaceHomeEndpoints(API),
|
|
327
329
|
resource: buildResourceEndpoints(API),
|
|
328
330
|
recaptcha: buildRecaptchaEndpoints(API),
|
|
329
331
|
aiConfig: buildAIConfigEndpoints(API),
|
package/src/api/types.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { WorkspaceAppEndpoints } from "./workspaceApps"
|
|
|
41
41
|
import { ResourceEndpoints } from "./resource"
|
|
42
42
|
import { DeploymentEndpoints } from "./deploy"
|
|
43
43
|
import { WorkspaceFavouriteEndpoints } from "./workspaceFavourites"
|
|
44
|
+
import { WorkspaceHomeEndpoints } from "./workspaceHome"
|
|
44
45
|
import { RecaptchaEndpoints } from "./recaptcha"
|
|
45
46
|
import { AIConfigEndpoints } from "./aiConfig"
|
|
46
47
|
import { VectorDbEndpoints } from "./vectorDbs"
|
|
@@ -155,6 +156,7 @@ export type APIClient = BaseAPIClient &
|
|
|
155
156
|
navigation: NavigationEndpoints
|
|
156
157
|
workspaceApp: WorkspaceAppEndpoints
|
|
157
158
|
workspace: WorkspaceFavouriteEndpoints
|
|
159
|
+
workspaceHome: WorkspaceHomeEndpoints
|
|
158
160
|
deployment: DeploymentEndpoints
|
|
159
161
|
recaptcha: RecaptchaEndpoints
|
|
160
162
|
aiConfig: AIConfigEndpoints
|
package/src/api/user.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface UserEndpoints {
|
|
|
55
55
|
acceptInvite: (
|
|
56
56
|
data: AcceptUserInviteRequest
|
|
57
57
|
) => Promise<AcceptUserInviteResponse>
|
|
58
|
-
|
|
58
|
+
getUserCountByWorkspace: (workspaceId: string) => Promise<number>
|
|
59
59
|
getAccountHolder: () => Promise<LookupAccountHolderResponse>
|
|
60
60
|
searchUsers: (data: SearchUsersRequest) => Promise<SearchUsersResponse>
|
|
61
61
|
createUsers: (
|
|
@@ -274,11 +274,11 @@ export const buildUserEndpoints = (API: BaseAPIClient): UserEndpoints => ({
|
|
|
274
274
|
},
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
|
-
* Counts the number of users in
|
|
277
|
+
* Counts the number of users in a workspace
|
|
278
278
|
*/
|
|
279
|
-
|
|
279
|
+
getUserCountByWorkspace: async workspaceId => {
|
|
280
280
|
const res = await API.get<CountUserResponse>({
|
|
281
|
-
url: `/api/global/users/count/${
|
|
281
|
+
url: `/api/global/users/count/${workspaceId}`,
|
|
282
282
|
})
|
|
283
283
|
return res.userCount
|
|
284
284
|
},
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetGitHubStarsResponse,
|
|
3
|
+
GetWorkspaceHomeMetricsResponse,
|
|
4
|
+
} from "@budibase/types"
|
|
5
|
+
import { BaseAPIClient } from "./types"
|
|
6
|
+
|
|
7
|
+
export interface WorkspaceHomeEndpoints {
|
|
8
|
+
getMetrics: () => Promise<GetWorkspaceHomeMetricsResponse>
|
|
9
|
+
getGitHubStars: () => Promise<GetGitHubStarsResponse>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const buildWorkspaceHomeEndpoints = (
|
|
13
|
+
API: BaseAPIClient
|
|
14
|
+
): WorkspaceHomeEndpoints => ({
|
|
15
|
+
getMetrics: async () => {
|
|
16
|
+
return await API.get({
|
|
17
|
+
url: "/api/workspace/home/metrics",
|
|
18
|
+
})
|
|
19
|
+
},
|
|
20
|
+
getGitHubStars: async () => {
|
|
21
|
+
return await API.get({
|
|
22
|
+
url: "/api/global/github/stars",
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
})
|
|
@@ -136,6 +136,8 @@
|
|
|
136
136
|
return () => clearInterval(interval)
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
+
const PREVIEW_CHAT_APP_ID = "agent-preview"
|
|
140
|
+
|
|
139
141
|
let resolvedChatAppId = $state<string | undefined>()
|
|
140
142
|
let resolvedConversationId = $state<string | undefined>()
|
|
141
143
|
|
|
@@ -262,6 +264,15 @@
|
|
|
262
264
|
resolvedChatAppId = chat.chatAppId
|
|
263
265
|
return chat.chatAppId
|
|
264
266
|
}
|
|
267
|
+
|
|
268
|
+
if (isAgentPreviewChat) {
|
|
269
|
+
resolvedChatAppId = PREVIEW_CHAT_APP_ID
|
|
270
|
+
if (chat) {
|
|
271
|
+
chat = { ...chat, chatAppId: PREVIEW_CHAT_APP_ID }
|
|
272
|
+
}
|
|
273
|
+
return PREVIEW_CHAT_APP_ID
|
|
274
|
+
}
|
|
275
|
+
|
|
265
276
|
try {
|
|
266
277
|
const chatApp = await API.fetchChatApp(workspaceId)
|
|
267
278
|
if (chatApp?._id) {
|
|
@@ -327,7 +338,9 @@
|
|
|
327
338
|
|
|
328
339
|
resolvedChatAppId = chatAppId
|
|
329
340
|
|
|
330
|
-
if (
|
|
341
|
+
if (isAgentPreviewChat) {
|
|
342
|
+
resolvedConversationId = chat._id
|
|
343
|
+
} else if (
|
|
331
344
|
persistConversation &&
|
|
332
345
|
!chat._id &&
|
|
333
346
|
(!chat.messages || chat.messages.length === 0)
|