@burdenoff/microfe-proserviceworld 2026.706.3 → 2026.709.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/dist/dev/main.d.ts +2 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/generated/global-operations.d.ts +2 -0
- package/dist/generated/global-operations.d.ts.map +1 -0
- package/dist/generated/global-types.d.ts +18199 -0
- package/dist/generated/global-types.d.ts.map +1 -0
- package/dist/generated/wspace-operations.d.ts +2 -0
- package/dist/generated/wspace-operations.d.ts.map +1 -0
- package/dist/generated/wspace-types.d.ts +43046 -0
- package/dist/generated/wspace-types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -1
- package/dist/proserviceworld/ProServiceWorldRoot.d.ts +5 -0
- package/dist/proserviceworld/ProServiceWorldRoot.d.ts.map +1 -0
- package/dist/proserviceworld/ProServiceWorldRoutes.d.ts +2 -0
- package/dist/proserviceworld/ProServiceWorldRoutes.d.ts.map +1 -0
- package/dist/proserviceworld/components/DiscussionThread.d.ts +12 -0
- package/dist/proserviceworld/components/DiscussionThread.d.ts.map +1 -0
- package/dist/proserviceworld/components/ui.d.ts +82 -0
- package/dist/proserviceworld/components/ui.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useAnalytics.d.ts +18 -0
- package/dist/proserviceworld/hooks/useAnalytics.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useAnalytics.js +21 -0
- package/dist/proserviceworld/hooks/useAnalytics.js.map +1 -0
- package/dist/proserviceworld/hooks/useEntityComments.d.ts +27 -0
- package/dist/proserviceworld/hooks/useEntityComments.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useFiles.d.ts +23 -0
- package/dist/proserviceworld/hooks/useFiles.d.ts.map +1 -0
- package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts +351 -0
- package/dist/proserviceworld/hooks/useProServiceWorldApi.d.ts.map +1 -0
- package/dist/proserviceworld/index.d.ts +5 -0
- package/dist/proserviceworld/index.d.ts.map +1 -0
- package/dist/proserviceworld/index.js +1 -0
- package/dist/proserviceworld/pages/AnalyticsPage.d.ts +4 -0
- package/dist/proserviceworld/pages/AnalyticsPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/ClientDetailPage.d.ts +4 -0
- package/dist/proserviceworld/pages/ClientDetailPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/ClientsPage.d.ts +9 -0
- package/dist/proserviceworld/pages/ClientsPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/ClientsPage.js +157 -146
- package/dist/proserviceworld/pages/ClientsPage.js.map +1 -1
- package/dist/proserviceworld/pages/CompliancePage.d.ts +4 -0
- package/dist/proserviceworld/pages/CompliancePage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/ConflictsPage.d.ts +4 -0
- package/dist/proserviceworld/pages/ConflictsPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/DashboardPage.d.ts +4 -0
- package/dist/proserviceworld/pages/DashboardPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/DocumentsPage.d.ts +4 -0
- package/dist/proserviceworld/pages/DocumentsPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/EngagementDetailPage.d.ts +4 -0
- package/dist/proserviceworld/pages/EngagementDetailPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/EngagementDetailPage.js +162 -156
- package/dist/proserviceworld/pages/EngagementDetailPage.js.map +1 -1
- package/dist/proserviceworld/pages/EngagementsPage.d.ts +4 -0
- package/dist/proserviceworld/pages/EngagementsPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/EngagementsPage.js +141 -128
- package/dist/proserviceworld/pages/EngagementsPage.js.map +1 -1
- package/dist/proserviceworld/pages/InvoicesPage.d.ts +4 -0
- package/dist/proserviceworld/pages/InvoicesPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/MattersPage.d.ts +4 -0
- package/dist/proserviceworld/pages/MattersPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/MattersPage.js +165 -150
- package/dist/proserviceworld/pages/MattersPage.js.map +1 -1
- package/dist/proserviceworld/pages/PracticeAreasPage.d.ts +4 -0
- package/dist/proserviceworld/pages/PracticeAreasPage.d.ts.map +1 -0
- package/dist/proserviceworld/pages/TimePage.d.ts +4 -0
- package/dist/proserviceworld/pages/TimePage.d.ts.map +1 -0
- package/dist/proserviceworld/providers/ProServiceWorldProvider.d.ts +6 -0
- package/dist/proserviceworld/providers/ProServiceWorldProvider.d.ts.map +1 -0
- package/dist/proserviceworld/services/assistantApi.d.ts +74 -0
- package/dist/proserviceworld/services/assistantApi.d.ts.map +1 -0
- package/dist/proserviceworld/services/assistantApi.js +203 -0
- package/dist/proserviceworld/services/assistantApi.js.map +1 -0
- package/dist/proserviceworld/services/createSandboxAssistantTransport.d.ts +28 -0
- package/dist/proserviceworld/services/createSandboxAssistantTransport.d.ts.map +1 -0
- package/dist/proserviceworld/services/createSandboxAssistantTransport.js +120 -0
- package/dist/proserviceworld/services/createSandboxAssistantTransport.js.map +1 -0
- package/dist/proserviceworld/types/index.d.ts +57 -0
- package/dist/proserviceworld/types/index.d.ts.map +1 -0
- package/dist/proserviceworld/utils/cn.d.ts +4 -0
- package/dist/proserviceworld/utils/cn.d.ts.map +1 -0
- package/dist/proserviceworld/utils/nav.d.ts +6 -0
- package/dist/proserviceworld/utils/nav.d.ts.map +1 -0
- package/dist/proserviceworld/utils/navigation.d.ts +2 -0
- package/dist/proserviceworld/utils/navigation.d.ts.map +1 -0
- package/dist/proserviceworld/utils/pageContext.d.ts +12 -0
- package/dist/proserviceworld/utils/pageContext.d.ts.map +1 -0
- package/dist/proserviceworld/utils/pageContext.js +74 -0
- package/dist/proserviceworld/utils/pageContext.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/proserviceworld/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * ProServiceWorld adapter for the shared fe-libs AssistantWidget.\n *\n * The floating widget (Layer 1) is backend-agnostic — it calls an injected\n * `AssistantTransport`. This hook builds a transport that reuses the sandbox\n * `api-calls` agent: it provisions/reuses a sandbox, opens a session, dispatches\n * the prompt async, then polls for the streamed answer. The agent introspects\n * the GraphQL schema and performs API calls on the user's behalf using their\n * workspace token, contextual to the current screen (via `gatherPageContext`).\n */\n\nimport { useCallback, useMemo, useRef } from 'react';\nimport { useAuthToken } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { useProServiceWorld } from '../providers/ProServiceWorldProvider';\nimport {\n createAssistantSandbox,\n createAssistantSession,\n extendAssistantSandboxTTL,\n findExistingSandbox,\n getAssistantMessages,\n sendAssistantPromptAsync,\n waitForAssistantServiceReady,\n waitForSandboxReady,\n type AssistantRawMessage,\n type AssistantSandboxAuthContext,\n} from './assistantApi';\nimport { gatherPageContext } from '../utils/pageContext';\nimport type { AssistantMode } from '../types';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n}\n\nconst MODE: AssistantMode = 'assistant';\nconst STREAM_BUDGET_MS = 180_000;\nconst POLL_INTERVAL_MS = 1500;\nconst TTL_EXTEND_INTERVAL_MS = 30_000;\n\nfunction getProfileContextValue(key: 'workspaceId' | 'organizationId'): string {\n try {\n const activeContextKey =\n key === 'workspaceId'\n ? 'burdenoff-active-context-workspace'\n : 'burdenoff-active-context-organization';\n const activeContextValue = localStorage.getItem(activeContextKey);\n if (activeContextValue) return activeContextValue;\n\n const activeProfileId = sessionStorage.getItem('bf-active-profile');\n if (!activeProfileId) return '';\n const raw = localStorage.getItem(`bf-p-${activeProfileId}-context`);\n if (!raw) return '';\n const context = JSON.parse(raw) as { workspaceId?: string; organizationId?: string };\n return context[key] ?? '';\n } catch {\n return '';\n }\n}\n\nfunction getWorkspaceId(): string {\n const params = new URLSearchParams(window.location.search);\n return params.get('workspace') ?? getProfileContextValue('workspaceId');\n}\n\nfunction getOrganizationId(): string {\n const params = new URLSearchParams(window.location.search);\n return params.get('org') ?? getProfileContextValue('organizationId');\n}\n\nfunction getRawMessageCreatedAt(message: AssistantRawMessage): number {\n return message.info?.time?.created ?? 0;\n}\n\nfunction getAssistantText(parts: AssistantRawMessage['parts']): string {\n return (parts ?? [])\n .filter((part) => part.type === 'text' && typeof part.text === 'string')\n .map((part) => part.text?.trim() ?? '')\n .filter(Boolean)\n .join('\\n');\n}\n\nfunction getToolProgress(parts: AssistantRawMessage['parts']): string[] {\n return (parts ?? [])\n .filter((part) => part.type === 'tool' && part.tool)\n .map((part) => {\n const status = part.state?.status ?? 'running';\n const tool = part.tool ?? 'tool';\n if (status === 'completed') return `Completed: ${tool}`;\n if (status === 'failed') return `Failed: ${tool}`;\n return `Running: ${tool}`;\n });\n}\n\nfunction buildProgress(\n messages: AssistantRawMessage[],\n sinceMs: number\n): { content: string; done: boolean } {\n const relevant = messages\n .filter(\n (message) => message.info?.role === 'assistant' && getRawMessageCreatedAt(message) >= sinceMs\n )\n .sort((left, right) => getRawMessageCreatedAt(left) - getRawMessageCreatedAt(right));\n\n if (relevant.length === 0) return { content: 'Thinking…', done: false };\n\n const latest = relevant[relevant.length - 1]!;\n const text = getAssistantText(latest.parts);\n const toolProgress = getToolProgress(latest.parts);\n const content = [text, ...toolProgress].filter(Boolean).join('\\n\\n') || 'Thinking…';\n\n return {\n content,\n done: Boolean(latest.info?.time?.completed) && (Boolean(text) || toolProgress.length > 0),\n };\n}\n\nfunction sanitize(response: string): string {\n return response\n .replace(/(Authorization\\s*:\\s*Bearer\\s+)[^\\s\\n]+/gi, '$1[REDACTED]')\n .replace(/(X-Workspace-Authorization\\s*:\\s*Bearer\\s+)[^\\s\\n]+/gi, '$1[REDACTED]')\n .replace(/\\beyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9._-]+\\.[A-Za-z0-9._-]+\\b/g, '[REDACTED_JWT]')\n .replace(/\\bsk-ant-[A-Za-z0-9-]+\\b/g, '[REDACTED_API_KEY]');\n}\n\nfunction isRecoverable(error: unknown): boolean {\n const message =\n error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();\n if (\n message.includes('rate limit exceeded') ||\n message.includes('unauthorized') ||\n message.includes('k8s api error 401')\n ) {\n return false;\n }\n return [\n 'sandbox not found',\n 'sandbox is not running',\n 'sandbox service not available yet',\n 'sandbox failed',\n 'sandbox startup timed out',\n 'assistant service did not become healthy',\n 'proxy error: 404',\n 'proxy error: 502',\n 'proxy error: 503',\n ].some((fragment) => message.includes(fragment));\n}\n\n/**\n * Returns a memoized `AssistantTransport` wired to the ProServiceWorld sandbox\n * `api-calls` agent. The sandbox + session are cached in refs so follow-up\n * turns reuse the warm environment for the lifetime of the host shell.\n */\nexport function useSandboxAssistantTransport(): AssistantTransport {\n const { apiGatewayUrl } = useProServiceWorld();\n const { getAccessToken, getWorkspaceToken, userId } = useAuthToken();\n\n const sandboxIdRef = useRef<string | null>(null);\n const sessionIdRef = useRef<string | null>(null);\n\n const ensureRuntime = useCallback(\n async (\n workspaceId: string,\n authContext: AssistantSandboxAuthContext\n ): Promise<{ sandboxId: string; sessionId: string }> => {\n let sandboxId = sandboxIdRef.current;\n if (!sandboxId) {\n sandboxId = await findExistingSandbox(apiGatewayUrl, workspaceId, MODE, authContext);\n if (!sandboxId) {\n if (!getAccessToken()) {\n throw new Error(\n 'API Calls mode requires an authenticated session. Please sign in again.'\n );\n }\n sandboxId = await createAssistantSandbox(apiGatewayUrl, MODE, workspaceId, authContext);\n }\n await waitForSandboxReady(apiGatewayUrl, sandboxId, workspaceId, authContext);\n await waitForAssistantServiceReady(apiGatewayUrl, sandboxId, workspaceId, authContext);\n sandboxIdRef.current = sandboxId;\n }\n\n let sessionId = sessionIdRef.current;\n if (!sessionId) {\n const result = await createAssistantSession(\n apiGatewayUrl,\n sandboxId,\n workspaceId,\n MODE,\n authContext\n );\n sessionId = result.sessionId;\n sessionIdRef.current = sessionId;\n }\n\n return { sandboxId, sessionId };\n },\n [apiGatewayUrl, getAccessToken]\n );\n\n const sendPrompt = useCallback(\n async ({ prompt, onProgress, signal }: AssistantSendArgs): Promise<{ text: string }> => {\n const workspaceId = getWorkspaceId();\n if (!workspaceId) {\n throw new Error('The assistant needs an active workspace. Open a workspace and try again.');\n }\n const authContext: AssistantSandboxAuthContext = {\n accessToken: getAccessToken(),\n workspaceToken: getWorkspaceToken(),\n userId,\n organizationId: getOrganizationId(),\n };\n\n const run = async (attempt: 1 | 2): Promise<{ text: string }> => {\n try {\n const { sandboxId, sessionId } = await ensureRuntime(workspaceId, authContext);\n\n const startedAt = Date.now();\n await sendAssistantPromptAsync(\n apiGatewayUrl,\n sandboxId,\n workspaceId,\n sessionId,\n prompt,\n MODE,\n gatherPageContext(),\n authContext\n );\n\n const timeoutAt = Date.now() + STREAM_BUDGET_MS;\n let lastTtlExtensionAt = Date.now();\n let progress = buildProgress([], startedAt);\n\n while (Date.now() < timeoutAt) {\n if (signal.aborted) throw new Error('Cancelled');\n\n const messages = await getAssistantMessages(\n apiGatewayUrl,\n sandboxId,\n workspaceId,\n sessionId,\n authContext,\n 50\n );\n progress = buildProgress(messages, startedAt);\n onProgress(sanitize(progress.content));\n if (progress.done) break;\n\n if (Date.now() - lastTtlExtensionAt > TTL_EXTEND_INTERVAL_MS) {\n await extendAssistantSandboxTTL(\n apiGatewayUrl,\n sandboxId,\n workspaceId,\n 600,\n authContext\n ).catch(() => undefined);\n lastTtlExtensionAt = Date.now();\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));\n }\n\n if (!progress.done) {\n throw new Error('The assistant timed out while responding. Please try again.');\n }\n\n return { text: sanitize(progress.content) };\n } catch (error) {\n if (attempt === 1 && isRecoverable(error)) {\n sandboxIdRef.current = null;\n sessionIdRef.current = null;\n return run(2);\n }\n throw error;\n }\n };\n\n return run(1);\n },\n [ap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CAAC,YAAY,KAAA,EAAU,EACxB,IAAqB,KAAK,KAAK,GAGjC,MAAM,IAAI,SAAS,MAAY,WAAW,GAAS,EAAiB,CAAC;;AAGvE,QAAI,CAAC,EAAS,KACZ,OAAU,MAAM,8DAA8D;AAGhF,WAAO,EAAE,MAAM,EAAS,EAAS,QAAQ,EAAE;YACpC,GAAO;AACd,QAAI,MAAY,KAAK,EAAc,EAAM,CAGvC,QAFA,EAAa,UAAU,MACvB,EAAa,UAAU,MAChB,EAAI,EAAE;AAEf,UAAM;;;AAIV,SAAO,EAAI,EAAE;IAEf;EAAC;EAAe;EAAe;EAAgB;EAAmB;EAAO,CAC1E;AAED,QAAO,SAAmC,EAAE,eAAY,GAAG,CAAC,EAAW,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type AssistantMode = 'general' | 'api-calls' | 'vibe-plugins' | 'assistant';
|
|
4
|
+
export interface AssistantArtifact {
|
|
5
|
+
name: string;
|
|
6
|
+
path: string;
|
|
7
|
+
mimeType?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface PageContext {
|
|
11
|
+
currentUrl: string;
|
|
12
|
+
currentPage: string;
|
|
13
|
+
entityType?: string;
|
|
14
|
+
entityId?: string;
|
|
15
|
+
platform: string;
|
|
16
|
+
version: string;
|
|
17
|
+
viewportSize: string;
|
|
18
|
+
userAgent: string;
|
|
19
|
+
timestamp: string;
|
|
20
|
+
}
|
|
21
|
+
export interface NavItem {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
path: string;
|
|
25
|
+
icon?: React.ReactNode;
|
|
26
|
+
order?: number;
|
|
27
|
+
group?: string;
|
|
28
|
+
children?: NavItem[];
|
|
29
|
+
}
|
|
30
|
+
export interface FooterItem {
|
|
31
|
+
id: string;
|
|
32
|
+
label: string;
|
|
33
|
+
type: 'status' | 'action';
|
|
34
|
+
order?: number;
|
|
35
|
+
section: 'left' | 'center' | 'right';
|
|
36
|
+
}
|
|
37
|
+
export interface ProServiceWorldRootProps {
|
|
38
|
+
basePath?: string;
|
|
39
|
+
workspaceId?: string;
|
|
40
|
+
tenantId?: string;
|
|
41
|
+
apiGatewayUrl?: string;
|
|
42
|
+
authToken?: string;
|
|
43
|
+
navigate?: (path: string) => void;
|
|
44
|
+
currentUser?: {
|
|
45
|
+
id: string;
|
|
46
|
+
email: string;
|
|
47
|
+
firstName?: string;
|
|
48
|
+
lastName?: string;
|
|
49
|
+
avatar?: string;
|
|
50
|
+
username?: string;
|
|
51
|
+
name?: string;
|
|
52
|
+
role?: string;
|
|
53
|
+
} | null;
|
|
54
|
+
registerNavItems?: (items: NavItem | NavItem[]) => () => void;
|
|
55
|
+
registerFooterItems?: (items: FooterItem | FooterItem[]) => () => void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,CAAC;AAEnF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MA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C;IAC9D,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,KAAK,MAAM,IAAI,CAAC;CACxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/utils/nav.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,MAAM,IAAI,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAInD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/utils/navigation.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAIvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PageContext } from '../types';
|
|
2
|
+
|
|
3
|
+
interface ConversationContextShape {
|
|
4
|
+
entityType?: string;
|
|
5
|
+
entityId?: string;
|
|
6
|
+
activeTab?: string;
|
|
7
|
+
metadata?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function gatherPageContext(): PageContext;
|
|
10
|
+
export declare function resolveProServiceWorldConversationContext(pathname: string, search: string): ConversationContextShape;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=pageContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageContext.d.ts","sourceRoot":"","sources":["../../../src/proserviceworld/utils/pageContext.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,UAAU,wBAAwB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAID,wBAAgB,iBAAiB,IAAI,WAAW,CAoB/C;AAMD,wBAAgB,yCAAyC,CACvD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,wBAAwB,CA+D1B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/proserviceworld/utils/pageContext.ts
|
|
2
|
+
var e = "proserviceworld";
|
|
3
|
+
function t() {
|
|
4
|
+
let t = window.location.href, n = window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home", i = r(window.location.pathname, window.location.search);
|
|
5
|
+
return {
|
|
6
|
+
currentUrl: t,
|
|
7
|
+
currentPage: n,
|
|
8
|
+
entityType: i.entityType,
|
|
9
|
+
entityId: i.entityId,
|
|
10
|
+
platform: e,
|
|
11
|
+
version: "2026.709.1",
|
|
12
|
+
viewportSize: `${window.innerWidth}x${window.innerHeight}`,
|
|
13
|
+
userAgent: navigator.userAgent,
|
|
14
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function n(e, t) {
|
|
18
|
+
return t.match(e);
|
|
19
|
+
}
|
|
20
|
+
function r(e, t) {
|
|
21
|
+
let r = new URLSearchParams(t);
|
|
22
|
+
for (let [t, r] of [
|
|
23
|
+
[/^\/proserviceworld\/clients\/([^/]+)$/, "PROSERVICEWORLD_CLIENT"],
|
|
24
|
+
[/^\/proserviceworld\/engagements\/([^/]+)$/, "PROSERVICEWORLD_ENGAGEMENT"],
|
|
25
|
+
[/^\/proserviceworld\/matters\/([^/]+)$/, "PROSERVICEWORLD_MATTER"],
|
|
26
|
+
[/^\/proserviceworld\/invoices\/([^/]+)$/, "PROSERVICEWORLD_INVOICE"],
|
|
27
|
+
[/^\/proserviceworld\/compliance\/([^/]+)$/, "PROSERVICEWORLD_COMPLIANCE"],
|
|
28
|
+
[/^\/proserviceworld\/conflicts\/([^/]+)$/, "PROSERVICEWORLD_CONFLICT"],
|
|
29
|
+
[/^\/proserviceworld\/documents\/([^/]+)$/, "PROSERVICEWORLD_DOCUMENT"],
|
|
30
|
+
[/^\/proserviceworld\/practice-areas\/([^/]+)$/, "PROSERVICEWORLD_PRACTICE_AREA"]
|
|
31
|
+
]) {
|
|
32
|
+
let i = n(t, e);
|
|
33
|
+
if (i) return {
|
|
34
|
+
entityType: r,
|
|
35
|
+
entityId: i[1],
|
|
36
|
+
metadata: { routePattern: t.source }
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
let i = {
|
|
40
|
+
clients: "PROSERVICEWORLD_CLIENT_LIST",
|
|
41
|
+
engagements: "PROSERVICEWORLD_ENGAGEMENT_LIST",
|
|
42
|
+
matters: "PROSERVICEWORLD_MATTER_LIST",
|
|
43
|
+
time: "PROSERVICEWORLD_TIME",
|
|
44
|
+
invoices: "PROSERVICEWORLD_INVOICE_LIST",
|
|
45
|
+
compliance: "PROSERVICEWORLD_COMPLIANCE_LIST",
|
|
46
|
+
conflicts: "PROSERVICEWORLD_CONFLICT_LIST",
|
|
47
|
+
documents: "PROSERVICEWORLD_DOCUMENT_LIST",
|
|
48
|
+
"practice-areas": "PROSERVICEWORLD_PRACTICE_AREA_LIST",
|
|
49
|
+
analytics: "PROSERVICEWORLD_ANALYTICS"
|
|
50
|
+
}, a = e.match(/^\/proserviceworld\/([^/]+)$/);
|
|
51
|
+
if (a) {
|
|
52
|
+
let e = i[a[1] ?? ""];
|
|
53
|
+
if (e) return {
|
|
54
|
+
entityType: e,
|
|
55
|
+
metadata: { routePattern: a[0] }
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
let o = r.get("tab") ?? (() => {
|
|
59
|
+
let t = e.split("/").filter(Boolean);
|
|
60
|
+
return t.length > 2 ? t[t.length - 1] : void 0;
|
|
61
|
+
})();
|
|
62
|
+
return {
|
|
63
|
+
activeTab: o ?? void 0,
|
|
64
|
+
metadata: {
|
|
65
|
+
...o ? { activeTab: o } : {},
|
|
66
|
+
...r.get("selectedTargetId") ? { selectedTargetId: r.get("selectedTargetId") } : {},
|
|
67
|
+
...r.get("actionId") ? { actionId: r.get("actionId") } : {}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { t as gatherPageContext };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=pageContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageContext.js","names":[],"sources":["../../../src/proserviceworld/utils/pageContext.ts"],"sourcesContent":["/**\n * Page context gathering for ProServiceWorld.\n *\n * Captures the user's current browser context to be sent alongside every\n * assistant prompt. The exported shape matches the agent's allow-list contract\n * (`currentUrl`, `currentPage`, `entityType`, `entityId`, `platform`, `version`,\n * `viewportSize`).\n */\n\nimport type { PageContext } from '../types';\n\ninterface ConversationContextShape {\n entityType?: string;\n entityId?: string;\n activeTab?: string;\n metadata?: Record<string, unknown>;\n}\n\nconst PRODUCT_ID = 'proserviceworld';\n\nexport function gatherPageContext(): PageContext {\n const url = window.location.href;\n const pathSegments = window.location.pathname.split('/').filter(Boolean);\n const currentPage = pathSegments.slice(0, 3).join('/') || 'home';\n const entity = resolveProServiceWorldConversationContext(\n window.location.pathname,\n window.location.search\n );\n\n return {\n currentUrl: url,\n currentPage,\n entityType: entity.entityType,\n entityId: entity.entityId,\n platform: PRODUCT_ID,\n version: import.meta.env.VITE_APP_VERSION ?? '2026.709.1',\n viewportSize: `${window.innerWidth}x${window.innerHeight}`,\n userAgent: navigator.userAgent,\n timestamp: new Date().toISOString(),\n };\n}\n\nfunction matchPath(pattern: RegExp, pathname: string): RegExpMatchArray | null {\n return pathname.match(pattern);\n}\n\nexport function resolveProServiceWorldConversationContext(\n pathname: string,\n search: string\n): ConversationContextShape {\n const params = new URLSearchParams(search);\n\n const directMatches: Array<[RegExp, string]> = [\n [/^\\/proserviceworld\\/clients\\/([^/]+)$/, 'PROSERVICEWORLD_CLIENT'],\n [/^\\/proserviceworld\\/engagements\\/([^/]+)$/, 'PROSERVICEWORLD_ENGAGEMENT'],\n [/^\\/proserviceworld\\/matters\\/([^/]+)$/, 'PROSERVICEWORLD_MATTER'],\n [/^\\/proserviceworld\\/invoices\\/([^/]+)$/, 'PROSERVICEWORLD_INVOICE'],\n [/^\\/proserviceworld\\/compliance\\/([^/]+)$/, 'PROSERVICEWORLD_COMPLIANCE'],\n [/^\\/proserviceworld\\/conflicts\\/([^/]+)$/, 'PROSERVICEWORLD_CONFLICT'],\n [/^\\/proserviceworld\\/documents\\/([^/]+)$/, 'PROSERVICEWORLD_DOCUMENT'],\n [/^\\/proserviceworld\\/practice-areas\\/([^/]+)$/, 'PROSERVICEWORLD_PRACTICE_AREA'],\n ];\n\n for (const [pattern, entityType] of directMatches) {\n const match = matchPath(pattern, pathname);\n if (match) {\n return {\n entityType,\n entityId: match[1],\n metadata: { routePattern: pattern.source },\n };\n }\n }\n\n const listEntityMap: Record<string, string> = {\n clients: 'PROSERVICEWORLD_CLIENT_LIST',\n engagements: 'PROSERVICEWORLD_ENGAGEMENT_LIST',\n matters: 'PROSERVICEWORLD_MATTER_LIST',\n time: 'PROSERVICEWORLD_TIME',\n invoices: 'PROSERVICEWORLD_INVOICE_LIST',\n compliance: 'PROSERVICEWORLD_COMPLIANCE_LIST',\n conflicts: 'PROSERVICEWORLD_CONFLICT_LIST',\n documents: 'PROSERVICEWORLD_DOCUMENT_LIST',\n 'practice-areas': 'PROSERVICEWORLD_PRACTICE_AREA_LIST',\n analytics: 'PROSERVICEWORLD_ANALYTICS',\n };\n\n const listMatch = pathname.match(/^\\/proserviceworld\\/([^/]+)$/);\n if (listMatch) {\n const entityType = listEntityMap[listMatch[1] ?? ''];\n if (entityType) {\n return { entityType, metadata: { routePattern: listMatch[0] } };\n }\n }\n\n const activeTab =\n params.get('tab') ??\n (() => {\n const segments = pathname.split('/').filter(Boolean);\n return segments.length > 2 ? segments[segments.length - 1] : undefined;\n })();\n\n return {\n activeTab: activeTab ?? undefined,\n metadata: {\n ...(activeTab ? { activeTab } : {}),\n ...(params.get('selectedTargetId')\n ? { selectedTargetId: params.get('selectedTargetId') }\n : {}),\n ...(params.get('actionId') ? { actionId: params.get('actionId') } : {}),\n },\n };\n}\n"],"mappings":";AAkBA,IAAM,IAAa;AAEnB,SAAgB,IAAiC;CAC/C,IAAM,IAAM,OAAO,SAAS,MAEtB,IADe,OAAO,SAAS,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ,CACvC,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,IAAI,QACpD,IAAS,EACb,OAAO,SAAS,UAChB,OAAO,SAAS,OACjB;AAED,QAAO;EACL,YAAY;EACZ;EACA,YAAY,EAAO;EACnB,UAAU,EAAO;EACjB,UAAU;EACV,SAA6C;EAC7C,cAAc,GAAG,OAAO,WAAW,GAAG,OAAO;EAC7C,WAAW,UAAU;EACrB,4BAAW,IAAI,MAAM,EAAC,aAAa;EACpC;;AAGH,SAAS,EAAU,GAAiB,GAA2C;AAC7E,QAAO,EAAS,MAAM,EAAQ;;AAGhC,SAAgB,EACd,GACA,GAC0B;CAC1B,IAAM,IAAS,IAAI,gBAAgB,EAAO;AAa1C,MAAK,IAAM,CAAC,GAAS,MAX0B;EAC7C,CAAC,yCAAyC,yBAAyB;EACnE,CAAC,6CAA6C,6BAA6B;EAC3E,CAAC,yCAAyC,yBAAyB;EACnE,CAAC,0CAA0C,0BAA0B;EACrE,CAAC,4CAA4C,6BAA6B;EAC1E,CAAC,2CAA2C,2BAA2B;EACvE,CAAC,2CAA2C,2BAA2B;EACvE,CAAC,gDAAgD,gCA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