@memberjunction/ng-explorer-core 6.2.0-edge.4 → 6.2.0-edge.6
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 +7 -2
- package/dist/app-routing.module.d.ts.map +1 -1
- package/dist/app-routing.module.js +20 -10
- package/dist/app-routing.module.js.map +1 -1
- package/dist/generated/lazy-feature-config.d.ts +1 -1
- package/dist/generated/lazy-feature-config.d.ts.map +1 -1
- package/dist/generated/lazy-feature-config.js +6 -3
- package/dist/generated/lazy-feature-config.js.map +1 -1
- package/dist/lib/oauth/oauth-callback.component.d.ts +2 -0
- package/dist/lib/oauth/oauth-callback.component.d.ts.map +1 -1
- package/dist/lib/oauth/oauth-callback.component.js +10 -10
- package/dist/lib/oauth/oauth-callback.component.js.map +1 -1
- package/dist/lib/resource-wrappers/chat-conversations-resource.component.d.ts +17 -3
- package/dist/lib/resource-wrappers/chat-conversations-resource.component.d.ts.map +1 -1
- package/dist/lib/resource-wrappers/chat-conversations-resource.component.js +211 -13
- package/dist/lib/resource-wrappers/chat-conversations-resource.component.js.map +1 -1
- package/dist/lib/resource-wrappers/chat-tasks-resource.component.d.ts +12 -3
- package/dist/lib/resource-wrappers/chat-tasks-resource.component.d.ts.map +1 -1
- package/dist/lib/resource-wrappers/chat-tasks-resource.component.js +18 -3
- package/dist/lib/resource-wrappers/chat-tasks-resource.component.js.map +1 -1
- package/dist/lib/resource-wrappers/record-form-mode.d.ts +44 -0
- package/dist/lib/resource-wrappers/record-form-mode.d.ts.map +1 -0
- package/dist/lib/resource-wrappers/record-form-mode.js +47 -0
- package/dist/lib/resource-wrappers/record-form-mode.js.map +1 -0
- package/dist/lib/resource-wrappers/record-resource.component.d.ts +56 -1
- package/dist/lib/resource-wrappers/record-resource.component.d.ts.map +1 -1
- package/dist/lib/resource-wrappers/record-resource.component.js +124 -9
- package/dist/lib/resource-wrappers/record-resource.component.js.map +1 -1
- package/dist/lib/resource-wrappers/search-results-resource.component.d.ts +3 -3
- package/dist/lib/resource-wrappers/search-results-resource.component.d.ts.map +1 -1
- package/dist/lib/resource-wrappers/search-results-resource.component.js +5 -10
- package/dist/lib/resource-wrappers/search-results-resource.component.js.map +1 -1
- package/dist/lib/resource-wrappers/standard-form-create.d.ts +4 -0
- package/dist/lib/resource-wrappers/standard-form-create.d.ts.map +1 -0
- package/dist/lib/resource-wrappers/standard-form-create.js +6 -0
- package/dist/lib/resource-wrappers/standard-form-create.js.map +1 -0
- package/dist/lib/resource-wrappers/view-resource.component.d.ts +18 -1
- package/dist/lib/resource-wrappers/view-resource.component.d.ts.map +1 -1
- package/dist/lib/resource-wrappers/view-resource.component.js +105 -39
- package/dist/lib/resource-wrappers/view-resource.component.js.map +1 -1
- package/dist/lib/server-connectivity/server-connectivity-banner.component.d.ts +16 -3
- package/dist/lib/server-connectivity/server-connectivity-banner.component.d.ts.map +1 -1
- package/dist/lib/server-connectivity/server-connectivity-banner.component.js +17 -3
- package/dist/lib/server-connectivity/server-connectivity-banner.component.js.map +1 -1
- package/dist/lib/shell/components/record-open/record-origin-crumb.component.d.ts.map +1 -1
- package/dist/lib/shell/components/record-open/record-origin-crumb.component.js +12 -8
- package/dist/lib/shell/components/record-open/record-origin-crumb.component.js.map +1 -1
- package/dist/lib/shell/components/tabs/component-cache-manager.d.ts +6 -0
- package/dist/lib/shell/components/tabs/component-cache-manager.d.ts.map +1 -1
- package/dist/lib/shell/components/tabs/component-cache-manager.js +18 -3
- package/dist/lib/shell/components/tabs/component-cache-manager.js.map +1 -1
- package/dist/lib/shell/components/tabs/tab-container.component.d.ts +36 -0
- package/dist/lib/shell/components/tabs/tab-container.component.d.ts.map +1 -1
- package/dist/lib/shell/components/tabs/tab-container.component.js +188 -47
- package/dist/lib/shell/components/tabs/tab-container.component.js.map +1 -1
- package/dist/lib/shell/deep-link-workspace.d.ts +25 -0
- package/dist/lib/shell/deep-link-workspace.d.ts.map +1 -0
- package/dist/lib/shell/deep-link-workspace.js +49 -0
- package/dist/lib/shell/deep-link-workspace.js.map +1 -0
- package/dist/lib/shell/shell-chrome-policy.d.ts +6 -0
- package/dist/lib/shell/shell-chrome-policy.d.ts.map +1 -1
- package/dist/lib/shell/shell-chrome-policy.js +1 -0
- package/dist/lib/shell/shell-chrome-policy.js.map +1 -1
- package/dist/lib/shell/shell.component.d.ts +35 -0
- package/dist/lib/shell/shell.component.d.ts.map +1 -1
- package/dist/lib/shell/shell.component.js +348 -78
- package/dist/lib/shell/shell.component.js.map +1 -1
- package/dist/lib/single-record/single-record.component.d.ts +39 -2
- package/dist/lib/single-record/single-record.component.d.ts.map +1 -1
- package/dist/lib/single-record/single-record.component.js +99 -12
- package/dist/lib/single-record/single-record.component.js.map +1 -1
- package/dist/lib/user-notifications/user-notifications.component.d.ts +10 -2
- package/dist/lib/user-notifications/user-notifications.component.d.ts.map +1 -1
- package/dist/lib/user-notifications/user-notifications.component.js +77 -22
- package/dist/lib/user-notifications/user-notifications.component.js.map +1 -1
- package/package.json +57 -57
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-callback.component.d.ts","sourceRoot":"","sources":["../../../src/lib/oauth/oauth-callback.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAa,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;AAiBrE;;;;;;;;;GASG;AACH,qBAMa,sBAAuB,SAAQ,oBAAqB,YAAW,MAAM,EAAE,SAAS;IA0BrF,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,GAAG;IA3Bf,oDAAoD;IAC7C,SAAS,UAAQ;IAExB,kBAAkB;IACX,QAAQ,UAAS;IAExB,+BAA+B;IACxB,YAAY,SAAM;IAEzB,iDAAiD;I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,CAAC,YAAY,CAAS;gBAGjB,KAAK,EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,iBAAiB;IAI5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAK/B,WAAW,IAAI,IAAI;IAQnB;;;OAGG;YACW,yBAAyB;IAiDvC;;OAEG;IACH,OAAO,CAAC,eAAe;IAgBvB;;OAEG;YACW,mBAAmB;IAcjC;;OAEG;YACW,oBAAoB;IAgDlC,yGAAyG;IACzG,OAAO,CAAC,iBAAiB;IAOzB;;OAEG;YACW,YAAY;IA+B1B;;OAEG;IACH,OAAO,CAAC,aAAa;IA+BrB;;OAEG;IACH,OAAO,CAAC,cAAc;IA+BtB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAO7B;;OAEG;IACH,OAAO,CAAC,SAAS;IASjB;;OAEG;IACI,OAAO,IAAI,IAAI;IAOtB,uCAAuC;IAChC,OAAO,IAAI,IAAI;IAItB;;OAEG;IACI,OAAO,IAAI,IAAI;IAKtB,uCAAuC;IAChC,OAAO,IAAI,IAAI;yCArVb,sBAAsB;2CAAtB,sBAAsB;CAwVlC"}
|
|
@@ -253,6 +253,13 @@ export class OAuthCallbackComponent extends BaseAngularComponent {
|
|
|
253
253
|
this.showError('network_error', message, true);
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
+
/** Pre-#5674 exchange URL for hosts that have not configured MJAPI_URI: derived from the GraphQL URL. */
|
|
257
|
+
legacyExchangeUrl(graphqlUrl) {
|
|
258
|
+
if (graphqlUrl.includes('/graphql')) {
|
|
259
|
+
return graphqlUrl.replace('/graphql', '/oauth/exchange');
|
|
260
|
+
}
|
|
261
|
+
return graphqlUrl.replace(/\/$/, '') + '/oauth/exchange';
|
|
262
|
+
}
|
|
256
263
|
/**
|
|
257
264
|
* Call the backend to exchange the authorization code for tokens
|
|
258
265
|
*/
|
|
@@ -260,16 +267,9 @@ export class OAuthCallbackComponent extends BaseAngularComponent {
|
|
|
260
267
|
// Get the GraphQL provider - we know it's ready at this point
|
|
261
268
|
const gqlProvider = this.ProviderToUse;
|
|
262
269
|
const configData = gqlProvider.ConfigData;
|
|
263
|
-
//
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
if (apiUrl.includes('/graphql')) {
|
|
267
|
-
apiUrl = apiUrl.replace('/graphql', '/oauth/exchange');
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
// URL doesn't have /graphql, append /oauth/exchange
|
|
271
|
-
apiUrl = apiUrl.replace(/\/$/, '') + '/oauth/exchange';
|
|
272
|
-
}
|
|
270
|
+
// The exchange endpoint hangs off the configured MJAPI URL (MJAPI_URI, MJ #5674). Without one,
|
|
271
|
+
// keep the pre-#5674 derivation from the GraphQL URL.
|
|
272
|
+
const apiUrl = configData.MJAPIURL ? `${configData.MJAPIURL}/oauth/exchange` : this.legacyExchangeUrl(configData.URL);
|
|
273
273
|
try {
|
|
274
274
|
const response = await fetch(apiUrl, {
|
|
275
275
|
method: 'POST',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-callback.component.js","sourceRoot":"","sources":["../../../src/lib/oauth/oauth-callback.component.ts","../../../src/lib/oauth/oauth-callback.component.html"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAwC,MAAM,eAAe,CAAC;AAKhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;;;;;ICdzD,8BAAkC;IAC9B,gCAAoD;IACxD,iBAAM;;;IADU,cAA0B;IAA1B,sBAAA,sCAA0B,CAAA;;;IAYlC,8BAAwB;IAAA,YAAe;IAAA,iBAAM;;;IAArB,cAAe;IAAf,sCAAe;;;;IAKnC,kCAAyD;IAApB,yMAAS,gBAAS,KAAC;IACpD,wBAAwC;IACxC,2BACJ;IAAA,iBAAS;;;;IAbjB,AADJ,8BAAgC,aACW;IACnC,uBAA8C;IAClD,iBAAM;IACN,0BAAI;IAAA,oCAAoB;IAAA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wFAA+B;YAUvC,AADI,iBAAM,EACJ;;YA3CE,eAIC;YAJD,wCAIC;YAGD,cAuBC;YAvBD,uCAuBC;YAGD,cAQC;YARD,0DAQC;;;iFDOI,sBAAsB;cANlC,SAAS;6BACI,KAAK,YACL,mBAAmB;;kFAIpB,sBAAsB","sourcesContent":["/**\n * @fileoverview OAuth Callback Component\n *\n * Handles OAuth provider redirects in the frontend. When an OAuth provider\n * redirects back to the application after user authorization, this component:\n * 1. Waits for the user's session to be restored (authentication)\n * 2. Extracts the code and state from URL query parameters\n * 3. Calls the backend /oauth/exchange endpoint to complete the token exchange\n * 4. Redirects to the original page with success/error notification\n *\n * @module OAuth Callback\n */\n\nimport { Component, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { Metadata } from '@memberjunction/core';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n/**\n * Response from the OAuth exchange endpoint\n */\ninterface OAuthExchangeResponse {\n success: boolean;\n connectionId?: string;\n errorCode?: string;\n errorMessage?: string;\n isRetryable?: boolean;\n}\n\n/** Maximum time to wait for provider initialization (30 seconds) */\nconst MAX_WAIT_TIME_MS = 30000;\n/** Polling interval for checking provider readiness (500ms) */\nconst POLL_INTERVAL_MS = 500;\n\n/**\n * OAuth Callback Component\n *\n * Handles the redirect from OAuth providers after user authorization.\n * This component is loaded at /oauth/callback and processes the\n * authorization code to complete the OAuth flow.\n *\n * The component waits for authentication to complete before attempting\n * the code exchange, since the user's session needs to be restored first.\n */\n@Component({\n standalone: false,\n selector: 'mj-oauth-callback',\n templateUrl: './oauth-callback.component.html',\n styleUrls: ['./oauth-callback.component.css']\n})\nexport class OAuthCallbackComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n /** Loading state while processing OAuth callback */\n public IsLoading = true;\n\n /** Error state */\n public HasError = false;\n\n /** Error message to display */\n public ErrorMessage = '';\n\n /** Error code from OAuth provider or exchange */\n public ErrorCode = '';\n\n /** Whether the error is retryable */\n public IsRetryable = false;\n\n /** Status message shown during processing */\n public StatusMessage = 'Restoring session...';\n\n /** Timer for polling provider readiness */\n private pollTimer: ReturnType<typeof setInterval> | null = null;\n\n /** Flag to prevent double processing */\n private isProcessing = false;\n\n constructor(\n private route: ActivatedRoute,\n private router: Router,\n private cdr: ChangeDetectorRef\n ) {\n super();}\n\n async ngOnInit(): Promise<void> {\n // Wait for the GraphQL provider to be ready, then process the callback\n await this.waitForProviderAndProcess();\n }\n\n ngOnDestroy(): void {\n // Clean up the polling timer\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n\n /**\n * Waits for the GraphQL provider to be initialized (indicating auth is complete)\n * then processes the OAuth callback.\n */\n private async waitForProviderAndProcess(): Promise<void> {\n const startTime = Date.now();\n\n // Check if provider is already ready\n if (this.isProviderReady()) {\n await this.safeProcessCallback();\n return;\n }\n\n // Poll for provider readiness\n this.StatusMessage = 'Waiting for authentication...';\n this.cdr.detectChanges();\n\n return new Promise<void>((resolve) => {\n this.pollTimer = setInterval(async () => {\n const elapsed = Date.now() - startTime;\n\n if (this.isProviderReady()) {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n await this.safeProcessCallback();\n resolve();\n return;\n }\n\n if (elapsed >= MAX_WAIT_TIME_MS) {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n this.showError(\n 'timeout',\n 'Timed out waiting for authentication. Please try logging in again.',\n true\n );\n resolve();\n return;\n }\n\n // Update status message with progress\n const secondsRemaining = Math.ceil((MAX_WAIT_TIME_MS - elapsed) / 1000);\n this.StatusMessage = `Waiting for authentication... (${secondsRemaining}s)`;\n this.cdr.detectChanges();\n }, POLL_INTERVAL_MS);\n });\n }\n\n /**\n * Checks if the GraphQL provider is initialized and has a valid token\n */\n private isProviderReady(): boolean {\n try {\n const provider = this.ProviderToUse as GraphQLDataProvider;\n if (!provider) {\n return false;\n }\n const configData = provider.ConfigData;\n if (!configData || !configData.Token || !configData.URL) {\n return false;\n }\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Safely processes the callback, preventing double execution\n */\n private async safeProcessCallback(): Promise<void> {\n if (this.isProcessing) {\n return;\n }\n this.isProcessing = true;\n\n try {\n await this.processOAuthCallback();\n } catch (error) {\n console.error('[OAuth Callback] Error in processOAuthCallback:', error);\n this.showError('component_error', error instanceof Error ? error.message : String(error), true);\n }\n }\n\n /**\n * Process the OAuth callback by extracting params and exchanging the code\n */\n private async processOAuthCallback(): Promise<void> {\n const params = this.route.snapshot.queryParams;\n\n // Check for error from OAuth provider\n if (params['error']) {\n this.showError(\n params['error'] as string,\n params['error_description'] as string || 'Authorization was denied or failed'\n );\n return;\n }\n\n const code = params['code'] as string;\n const state = params['state'] as string;\n\n // Validate required parameters\n if (!code) {\n this.showError('missing_code', 'No authorization code received from the OAuth provider');\n return;\n }\n\n if (!state) {\n this.showError('missing_state', 'No state parameter received from the OAuth provider');\n return;\n }\n\n // Exchange the code for tokens\n this.StatusMessage = 'Exchanging authorization code...';\n this.cdr.detectChanges();\n\n try {\n const result = await this.exchangeCode(code, state);\n\n if (result.success) {\n this.handleSuccess(result.connectionId);\n } else {\n this.showError(\n result.errorCode || 'exchange_failed',\n result.errorMessage || 'Failed to complete authorization',\n result.isRetryable\n );\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'An unexpected error occurred';\n this.showError('network_error', message, true);\n }\n }\n\n /**\n * Call the backend to exchange the authorization code for tokens\n */\n private async exchangeCode(code: string, state: string): Promise<OAuthExchangeResponse> {\n // Get the GraphQL provider - we know it's ready at this point\n const gqlProvider = this.ProviderToUse as GraphQLDataProvider;\n const configData = gqlProvider.ConfigData;\n\n // Build the exchange endpoint URL from the GraphQL URL\n // Handle both cases: URL with /graphql suffix and URL without\n let apiUrl = configData.URL;\n if (apiUrl.includes('/graphql')) {\n apiUrl = apiUrl.replace('/graphql', '/oauth/exchange');\n } else {\n // URL doesn't have /graphql, append /oauth/exchange\n apiUrl = apiUrl.replace(/\\/$/, '') + '/oauth/exchange';\n }\n\n try {\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${configData.Token}`\n },\n body: JSON.stringify({ code, state })\n });\n\n // Parse response regardless of status code\n const data = await response.json();\n return data as OAuthExchangeResponse;\n } catch (fetchError) {\n return {\n success: false,\n errorCode: 'fetch_error',\n errorMessage: fetchError instanceof Error ? fetchError.message : 'Network error during token exchange'\n };\n }\n }\n\n /**\n * Handle successful OAuth completion\n */\n private handleSuccess(connectionId?: string): void {\n this.IsLoading = false;\n this.StatusMessage = 'Authorization successful! Redirecting...';\n this.cdr.detectChanges();\n\n // Get the stored return URL - try both localStorage and sessionStorage\n const storedUrl = localStorage.getItem('oauth_return_url');\n const storedPath = localStorage.getItem('oauth_return_path');\n const sessionUrl = sessionStorage.getItem('oauth_return_url');\n const sessionPath = sessionStorage.getItem('oauth_return_path');\n\n let returnUrl = storedUrl || sessionUrl || storedPath || sessionPath;\n\n // Clean up all possible storage locations\n this.clearStoredReturnUrls();\n\n // Default to MCP dashboard if no return URL found\n const defaultPath = '/app/admin/MCP';\n if (!returnUrl || returnUrl.trim() === '' || returnUrl === '/') {\n returnUrl = defaultPath;\n }\n\n // Build the final navigation path\n const finalPath = this.buildFinalPath(returnUrl, connectionId, defaultPath);\n\n // Use window.location for reliable navigation after OAuth\n setTimeout(() => {\n window.location.href = finalPath;\n }, 500);\n }\n\n /**\n * Builds the final navigation path with success query params\n */\n private buildFinalPath(returnUrl: string, connectionId: string | undefined, defaultPath: string): string {\n try {\n let finalPath: string;\n\n // If it's a full URL, extract just the path and search\n if (returnUrl.startsWith('http://') || returnUrl.startsWith('https://')) {\n const url = new URL(returnUrl);\n finalPath = url.pathname + url.search;\n } else {\n finalPath = returnUrl;\n }\n\n // Ensure we have a valid path (not empty or just \"/\")\n if (!finalPath || finalPath.trim() === '' || finalPath === '/') {\n finalPath = defaultPath;\n }\n\n // Add success query params\n const separator = finalPath.includes('?') ? '&' : '?';\n finalPath = `${finalPath}${separator}oauth=success`;\n if (connectionId) {\n finalPath += `&connectionId=${connectionId}`;\n }\n\n return finalPath;\n } catch (e) {\n console.error('[OAuth Callback] Error parsing return URL:', e);\n return `${defaultPath}?oauth=success${connectionId ? `&connectionId=${connectionId}` : ''}`;\n }\n }\n\n /**\n * Clears all stored return URLs from storage\n */\n private clearStoredReturnUrls(): void {\n localStorage.removeItem('oauth_return_url');\n localStorage.removeItem('oauth_return_path');\n sessionStorage.removeItem('oauth_return_url');\n sessionStorage.removeItem('oauth_return_path');\n }\n\n /**\n * Show error state\n */\n private showError(errorCode: string, message: string, isRetryable = false): void {\n this.IsLoading = false;\n this.HasError = true;\n this.ErrorCode = errorCode;\n this.ErrorMessage = message;\n this.IsRetryable = isRetryable;\n this.cdr.detectChanges();\n }\n\n /**\n * Handle retry button click\n */\n public OnRetry(): void {\n // Get the stored return URL and redirect there to start fresh\n const returnUrl = localStorage.getItem('oauth_return_url') || '/app/admin/MCP';\n this.clearStoredReturnUrls();\n this.router.navigateByUrl(returnUrl);\n }\n\n /** @deprecated Use {@link OnRetry}. */\n public onRetry(): void {\n return this.OnRetry();\n }\n\n /**\n * Handle close button click (return to MCP dashboard)\n */\n public OnClose(): void {\n this.clearStoredReturnUrls();\n this.router.navigate(['/app/admin/MCP']);\n }\n\n /** @deprecated Use {@link OnClose}. */\n public onClose(): void {\n return this.OnClose();\n }\n}\n","<div class=\"oauth-callback-container\">\n <div class=\"oauth-callback-card\">\n <!-- Loading State -->\n @if (IsLoading) {\n <div class=\"oauth-status loading\">\n <mj-loading text=\"{{ StatusMessage }}\"></mj-loading>\n </div>\n }\n\n <!-- Error State -->\n @if (HasError) {\n <div class=\"oauth-status error\">\n <div class=\"icon-container error-icon\">\n <i class=\"fa-solid fa-circle-exclamation\"></i>\n </div>\n <h2>Authorization Failed</h2>\n @if (ErrorCode) {\n <div class=\"error-code\">{{ ErrorCode }}</div>\n }\n <p class=\"error-message\">{{ ErrorMessage }}</p>\n <div class=\"button-group\">\n @if (IsRetryable) {\n <button mjButton variant=\"secondary\" (click)=\"onRetry()\">\n <i class=\"fa-solid fa-rotate-right\"></i>\n Try Again\n </button>\n }\n <button mjButton [variant]=\"IsRetryable ? 'outline' : 'secondary'\" (click)=\"onClose()\">\n <i class=\"fa-solid fa-arrow-left\"></i>\n Return to Dashboard\n </button>\n </div>\n </div>\n }\n\n <!-- Success State (brief - redirects quickly) -->\n @if (!IsLoading && !HasError) {\n <div class=\"oauth-status success\">\n <div class=\"icon-container success-icon\">\n <i class=\"fa-solid fa-circle-check\"></i>\n </div>\n <h2>Authorization Successful</h2>\n <p>{{ StatusMessage }}</p>\n </div>\n }\n </div>\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"oauth-callback.component.js","sourceRoot":"","sources":["../../../src/lib/oauth/oauth-callback.component.ts","../../../src/lib/oauth/oauth-callback.component.html"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAwC,MAAM,eAAe,CAAC;AAKhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;;;;;;ICdzD,8BAAkC;IAC9B,gCAAoD;IACxD,iBAAM;;;IADU,cAA0B;IAA1B,sBAAA,sCAA0B,CAAA;;;IAYlC,8BAAwB;IAAA,YAAe;IAAA,iBAAM;;;IAArB,cAAe;IAAf,sCAAe;;;;IAKnC,kCAAyD;IAApB,yMAAS,gBAAS,KAAC;IACpD,wBAAwC;IACxC,2BACJ;IAAA,iBAAS;;;;IAbjB,AADJ,8BAAgC,aACW;IACnC,uBAA8C;IAClD,iBAAM;IACN,0BAAI;IAAA,oCAAoB;IAAA,iBAAK;IAC7B,sGAAiB;IAGjB,4BAAyB;IAAA,YAAkB;IAAA,iBAAI;IAC/C,+BAA0B;IACtB,0GAAmB;IAMnB,mCAAuF;IA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;YA0BhB,wFAA+B;YAUvC,AADI,iBAAM,EACJ;;YA3CE,eAIC;YAJD,wCAIC;YAGD,cAuBC;YAvBD,uCAuBC;YAGD,cAQC;YARD,0DAQC;;;iFDOI,sBAAsB;cANlC,SAAS;6BACI,KAAK,YACL,mBAAmB;;kFAIpB,sBAAsB","sourcesContent":["/**\n * @fileoverview OAuth Callback Component\n *\n * Handles OAuth provider redirects in the frontend. When an OAuth provider\n * redirects back to the application after user authorization, this component:\n * 1. Waits for the user's session to be restored (authentication)\n * 2. Extracts the code and state from URL query parameters\n * 3. Calls the backend /oauth/exchange endpoint to complete the token exchange\n * 4. Redirects to the original page with success/error notification\n *\n * @module OAuth Callback\n */\n\nimport { Component, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { Metadata } from '@memberjunction/core';\nimport { GraphQLDataProvider } from '@memberjunction/graphql-dataprovider';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\n/**\n * Response from the OAuth exchange endpoint\n */\ninterface OAuthExchangeResponse {\n success: boolean;\n connectionId?: string;\n errorCode?: string;\n errorMessage?: string;\n isRetryable?: boolean;\n}\n\n/** Maximum time to wait for provider initialization (30 seconds) */\nconst MAX_WAIT_TIME_MS = 30000;\n/** Polling interval for checking provider readiness (500ms) */\nconst POLL_INTERVAL_MS = 500;\n\n/**\n * OAuth Callback Component\n *\n * Handles the redirect from OAuth providers after user authorization.\n * This component is loaded at /oauth/callback and processes the\n * authorization code to complete the OAuth flow.\n *\n * The component waits for authentication to complete before attempting\n * the code exchange, since the user's session needs to be restored first.\n */\n@Component({\n standalone: false,\n selector: 'mj-oauth-callback',\n templateUrl: './oauth-callback.component.html',\n styleUrls: ['./oauth-callback.component.css']\n})\nexport class OAuthCallbackComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n /** Loading state while processing OAuth callback */\n public IsLoading = true;\n\n /** Error state */\n public HasError = false;\n\n /** Error message to display */\n public ErrorMessage = '';\n\n /** Error code from OAuth provider or exchange */\n public ErrorCode = '';\n\n /** Whether the error is retryable */\n public IsRetryable = false;\n\n /** Status message shown during processing */\n public StatusMessage = 'Restoring session...';\n\n /** Timer for polling provider readiness */\n private pollTimer: ReturnType<typeof setInterval> | null = null;\n\n /** Flag to prevent double processing */\n private isProcessing = false;\n\n constructor(\n private route: ActivatedRoute,\n private router: Router,\n private cdr: ChangeDetectorRef\n ) {\n super();}\n\n async ngOnInit(): Promise<void> {\n // Wait for the GraphQL provider to be ready, then process the callback\n await this.waitForProviderAndProcess();\n }\n\n ngOnDestroy(): void {\n // Clean up the polling timer\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n }\n\n /**\n * Waits for the GraphQL provider to be initialized (indicating auth is complete)\n * then processes the OAuth callback.\n */\n private async waitForProviderAndProcess(): Promise<void> {\n const startTime = Date.now();\n\n // Check if provider is already ready\n if (this.isProviderReady()) {\n await this.safeProcessCallback();\n return;\n }\n\n // Poll for provider readiness\n this.StatusMessage = 'Waiting for authentication...';\n this.cdr.detectChanges();\n\n return new Promise<void>((resolve) => {\n this.pollTimer = setInterval(async () => {\n const elapsed = Date.now() - startTime;\n\n if (this.isProviderReady()) {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n await this.safeProcessCallback();\n resolve();\n return;\n }\n\n if (elapsed >= MAX_WAIT_TIME_MS) {\n if (this.pollTimer) {\n clearInterval(this.pollTimer);\n this.pollTimer = null;\n }\n this.showError(\n 'timeout',\n 'Timed out waiting for authentication. Please try logging in again.',\n true\n );\n resolve();\n return;\n }\n\n // Update status message with progress\n const secondsRemaining = Math.ceil((MAX_WAIT_TIME_MS - elapsed) / 1000);\n this.StatusMessage = `Waiting for authentication... (${secondsRemaining}s)`;\n this.cdr.detectChanges();\n }, POLL_INTERVAL_MS);\n });\n }\n\n /**\n * Checks if the GraphQL provider is initialized and has a valid token\n */\n private isProviderReady(): boolean {\n try {\n const provider = this.ProviderToUse as GraphQLDataProvider;\n if (!provider) {\n return false;\n }\n const configData = provider.ConfigData;\n if (!configData || !configData.Token || !configData.URL) {\n return false;\n }\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Safely processes the callback, preventing double execution\n */\n private async safeProcessCallback(): Promise<void> {\n if (this.isProcessing) {\n return;\n }\n this.isProcessing = true;\n\n try {\n await this.processOAuthCallback();\n } catch (error) {\n console.error('[OAuth Callback] Error in processOAuthCallback:', error);\n this.showError('component_error', error instanceof Error ? error.message : String(error), true);\n }\n }\n\n /**\n * Process the OAuth callback by extracting params and exchanging the code\n */\n private async processOAuthCallback(): Promise<void> {\n const params = this.route.snapshot.queryParams;\n\n // Check for error from OAuth provider\n if (params['error']) {\n this.showError(\n params['error'] as string,\n params['error_description'] as string || 'Authorization was denied or failed'\n );\n return;\n }\n\n const code = params['code'] as string;\n const state = params['state'] as string;\n\n // Validate required parameters\n if (!code) {\n this.showError('missing_code', 'No authorization code received from the OAuth provider');\n return;\n }\n\n if (!state) {\n this.showError('missing_state', 'No state parameter received from the OAuth provider');\n return;\n }\n\n // Exchange the code for tokens\n this.StatusMessage = 'Exchanging authorization code...';\n this.cdr.detectChanges();\n\n try {\n const result = await this.exchangeCode(code, state);\n\n if (result.success) {\n this.handleSuccess(result.connectionId);\n } else {\n this.showError(\n result.errorCode || 'exchange_failed',\n result.errorMessage || 'Failed to complete authorization',\n result.isRetryable\n );\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : 'An unexpected error occurred';\n this.showError('network_error', message, true);\n }\n }\n\n /** Pre-#5674 exchange URL for hosts that have not configured MJAPI_URI: derived from the GraphQL URL. */\n private legacyExchangeUrl(graphqlUrl: string): string {\n if (graphqlUrl.includes('/graphql')) {\n return graphqlUrl.replace('/graphql', '/oauth/exchange');\n }\n return graphqlUrl.replace(/\\/$/, '') + '/oauth/exchange';\n }\n\n /**\n * Call the backend to exchange the authorization code for tokens\n */\n private async exchangeCode(code: string, state: string): Promise<OAuthExchangeResponse> {\n // Get the GraphQL provider - we know it's ready at this point\n const gqlProvider = this.ProviderToUse as GraphQLDataProvider;\n const configData = gqlProvider.ConfigData;\n\n // The exchange endpoint hangs off the configured MJAPI URL (MJAPI_URI, MJ #5674). Without one,\n // keep the pre-#5674 derivation from the GraphQL URL.\n const apiUrl = configData.MJAPIURL ? `${configData.MJAPIURL}/oauth/exchange` : this.legacyExchangeUrl(configData.URL);\n\n try {\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${configData.Token}`\n },\n body: JSON.stringify({ code, state })\n });\n\n // Parse response regardless of status code\n const data = await response.json();\n return data as OAuthExchangeResponse;\n } catch (fetchError) {\n return {\n success: false,\n errorCode: 'fetch_error',\n errorMessage: fetchError instanceof Error ? fetchError.message : 'Network error during token exchange'\n };\n }\n }\n\n /**\n * Handle successful OAuth completion\n */\n private handleSuccess(connectionId?: string): void {\n this.IsLoading = false;\n this.StatusMessage = 'Authorization successful! Redirecting...';\n this.cdr.detectChanges();\n\n // Get the stored return URL - try both localStorage and sessionStorage\n const storedUrl = localStorage.getItem('oauth_return_url');\n const storedPath = localStorage.getItem('oauth_return_path');\n const sessionUrl = sessionStorage.getItem('oauth_return_url');\n const sessionPath = sessionStorage.getItem('oauth_return_path');\n\n let returnUrl = storedUrl || sessionUrl || storedPath || sessionPath;\n\n // Clean up all possible storage locations\n this.clearStoredReturnUrls();\n\n // Default to MCP dashboard if no return URL found\n const defaultPath = '/app/admin/MCP';\n if (!returnUrl || returnUrl.trim() === '' || returnUrl === '/') {\n returnUrl = defaultPath;\n }\n\n // Build the final navigation path\n const finalPath = this.buildFinalPath(returnUrl, connectionId, defaultPath);\n\n // Use window.location for reliable navigation after OAuth\n setTimeout(() => {\n window.location.href = finalPath;\n }, 500);\n }\n\n /**\n * Builds the final navigation path with success query params\n */\n private buildFinalPath(returnUrl: string, connectionId: string | undefined, defaultPath: string): string {\n try {\n let finalPath: string;\n\n // If it's a full URL, extract just the path and search\n if (returnUrl.startsWith('http://') || returnUrl.startsWith('https://')) {\n const url = new URL(returnUrl);\n finalPath = url.pathname + url.search;\n } else {\n finalPath = returnUrl;\n }\n\n // Ensure we have a valid path (not empty or just \"/\")\n if (!finalPath || finalPath.trim() === '' || finalPath === '/') {\n finalPath = defaultPath;\n }\n\n // Add success query params\n const separator = finalPath.includes('?') ? '&' : '?';\n finalPath = `${finalPath}${separator}oauth=success`;\n if (connectionId) {\n finalPath += `&connectionId=${connectionId}`;\n }\n\n return finalPath;\n } catch (e) {\n console.error('[OAuth Callback] Error parsing return URL:', e);\n return `${defaultPath}?oauth=success${connectionId ? `&connectionId=${connectionId}` : ''}`;\n }\n }\n\n /**\n * Clears all stored return URLs from storage\n */\n private clearStoredReturnUrls(): void {\n localStorage.removeItem('oauth_return_url');\n localStorage.removeItem('oauth_return_path');\n sessionStorage.removeItem('oauth_return_url');\n sessionStorage.removeItem('oauth_return_path');\n }\n\n /**\n * Show error state\n */\n private showError(errorCode: string, message: string, isRetryable = false): void {\n this.IsLoading = false;\n this.HasError = true;\n this.ErrorCode = errorCode;\n this.ErrorMessage = message;\n this.IsRetryable = isRetryable;\n this.cdr.detectChanges();\n }\n\n /**\n * Handle retry button click\n */\n public OnRetry(): void {\n // Get the stored return URL and redirect there to start fresh\n const returnUrl = localStorage.getItem('oauth_return_url') || '/app/admin/MCP';\n this.clearStoredReturnUrls();\n this.router.navigateByUrl(returnUrl);\n }\n\n /** @deprecated Use {@link OnRetry}. */\n public onRetry(): void {\n return this.OnRetry();\n }\n\n /**\n * Handle close button click (return to MCP dashboard)\n */\n public OnClose(): void {\n this.clearStoredReturnUrls();\n this.router.navigate(['/app/admin/MCP']);\n }\n\n /** @deprecated Use {@link OnClose}. */\n public onClose(): void {\n return this.OnClose();\n }\n}\n","<div class=\"oauth-callback-container\">\n <div class=\"oauth-callback-card\">\n <!-- Loading State -->\n @if (IsLoading) {\n <div class=\"oauth-status loading\">\n <mj-loading text=\"{{ StatusMessage }}\"></mj-loading>\n </div>\n }\n\n <!-- Error State -->\n @if (HasError) {\n <div class=\"oauth-status error\">\n <div class=\"icon-container error-icon\">\n <i class=\"fa-solid fa-circle-exclamation\"></i>\n </div>\n <h2>Authorization Failed</h2>\n @if (ErrorCode) {\n <div class=\"error-code\">{{ ErrorCode }}</div>\n }\n <p class=\"error-message\">{{ ErrorMessage }}</p>\n <div class=\"button-group\">\n @if (IsRetryable) {\n <button mjButton variant=\"secondary\" (click)=\"onRetry()\">\n <i class=\"fa-solid fa-rotate-right\"></i>\n Try Again\n </button>\n }\n <button mjButton [variant]=\"IsRetryable ? 'outline' : 'secondary'\" (click)=\"onClose()\">\n <i class=\"fa-solid fa-arrow-left\"></i>\n Return to Dashboard\n </button>\n </div>\n </div>\n }\n\n <!-- Success State (brief - redirects quickly) -->\n @if (!IsLoading && !HasError) {\n <div class=\"oauth-status success\">\n <div class=\"icon-container success-icon\">\n <i class=\"fa-solid fa-circle-check\"></i>\n </div>\n <h2>Authorization Successful</h2>\n <p>{{ StatusMessage }}</p>\n </div>\n }\n </div>\n</div>\n"]}
|
|
@@ -143,6 +143,7 @@ export declare class ChatConversationsResource extends BaseResourceComponent imp
|
|
|
143
143
|
private mentionAutocompleteService;
|
|
144
144
|
constructor(cdr: ChangeDetectorRef, streamingService: ConversationStreamingService, activeTasksService: ActiveTasksService, uiCommandHandler: UICommandHandlerService, bridge: ConversationBridgeService);
|
|
145
145
|
ngOnInit(): Promise<void>;
|
|
146
|
+
private renameAnimationTimeout;
|
|
146
147
|
ngOnDestroy(): void;
|
|
147
148
|
/**
|
|
148
149
|
* Initialize AI Engine, conversations, and services BEFORE child components render.
|
|
@@ -417,16 +418,29 @@ export declare class ChatConversationsResource extends BaseResourceComponent imp
|
|
|
417
418
|
compositeKey: CompositeKey;
|
|
418
419
|
}): void;
|
|
419
420
|
/**
|
|
420
|
-
* Handle navigation request from artifact viewer plugins.
|
|
421
|
-
* Opens the target nav item (switching apps if needed) then applies query params to the URL.
|
|
421
|
+
* Handle navigation request from artifact viewer plugins or actionable commands.
|
|
422
|
+
* Opens the target nav item or application (switching apps if needed) then applies query params to the URL.
|
|
422
423
|
*/
|
|
423
424
|
OnNavigationRequest(event: NavigationRequest): Promise<void>;
|
|
424
425
|
/** @deprecated Use {@link OnNavigationRequest}. */
|
|
425
426
|
onNavigationRequest(event: NavigationRequest): Promise<void>;
|
|
427
|
+
private normalizeNavToken;
|
|
428
|
+
private stripActionVerbPrefix;
|
|
426
429
|
/**
|
|
427
|
-
* Resolve an application name to its ID.
|
|
430
|
+
* Resolve an application name, URL slug/path, or UUID to its ID.
|
|
428
431
|
*/
|
|
429
432
|
private resolveAppId;
|
|
433
|
+
/**
|
|
434
|
+
* Resolves a nav item label inside a specific application's DefaultNavItems by case/slug-insensitive match.
|
|
435
|
+
*/
|
|
436
|
+
private resolveNavItemLabelInApp;
|
|
437
|
+
private toQueryParamsRecord;
|
|
438
|
+
/**
|
|
439
|
+
* Navigates to an Application or NavItem referenced by an `open:resource` command,
|
|
440
|
+
* matching by ID, Name, URL Path slug (e.g. `"data-explorer"` -> `"Data Explorer"`),
|
|
441
|
+
* or NavItem label across applications.
|
|
442
|
+
*/
|
|
443
|
+
private handleAppOrNavItemCommand;
|
|
430
444
|
/**
|
|
431
445
|
* Handle actionable commands that require app-specific navigation (open:resource, and the
|
|
432
446
|
* compose:email over-length fallback). open:url commands are already handled directly by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-conversations-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/chat-conversations-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,SAAS,EAAa,iBAAiB,EAAgB,MAAM,eAAe,CAAC;AACpH,OAAO,EAAY,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,YAAY,EAA+B,oBAAoB,EAA2D,MAAM,+BAA+B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W,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAE3D;IACM,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAQ;IAElD,oDAAoD;IACpD,IAAW,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAE/C;IACD,oDAAoD;IACpD,IAAW,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAEnD;IACM,wBAAwB,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAQ;IAEnE,wDAAwD;IACxD,IAAW,wBAAwB,IAAI,iBAAiB,EAAE,GAAG,IAAI,CAEhE;IACD,wDAAwD;IACxD,IAAW,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAI,EAEpE;IAGD,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAgC;IACzE,OAAO,CAAC,mBAAmB,CAA8C;IAEzE,OAAO,CAAC,MAAM,CAA+B;IAG7C,OAAO,CAAC,0BAA0B,CAAuC;gBAG/D,GAAG,EAAE,iBAAiB,EACtB,gBAAgB,EAAE,4BAA4B,EAC9C,kBAAkB,EAAE,kBAAkB,EACtC,gBAAgB,EAAE,uBAAuB,EACzC,MAAM,EAAE,yBAAyB;IAKrC,QAAQ;IAoEd,WAAW;
|
|
1
|
+
{"version":3,"file":"chat-conversations-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/chat-conversations-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,SAAS,EAAa,iBAAiB,EAAgB,MAAM,eAAe,CAAC;AACpH,OAAO,EAAY,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,YAAY,EAA+B,oBAAoB,EAA2D,MAAM,+BAA+B,CAAC;AAIzK,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,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G;IACG,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBlE,mDAAmD;IAC7C,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlE,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;IACH,OAAO,CAAC,YAAY;IAmBpB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAsBhC,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;YACW,yBAAyB;IAuDvC;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IA2F/B;;;;;;;;OAQG;IACH,OAAO,CAAC,qBAAqB;IAU7B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;yCA38CnB,yBAAyB;2CAAzB,yBAAyB;CAs+CrC"}
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { Component, ViewEncapsulation, ViewChild, HostListener } from '@angular/core';
|
|
8
|
-
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
8
|
+
import { RegisterClass, UUIDsEqual, IsValidUUID } from '@memberjunction/global';
|
|
9
9
|
import { BaseResourceComponent } from '@memberjunction/ng-shared';
|
|
10
10
|
import { MJEnvironmentEntityExtended, UserInfoEngine, ConversationEngine } from '@memberjunction/core-entities';
|
|
11
11
|
import { ResolveDeepLinkParam } from './chat-deeplink-params.js';
|
|
@@ -384,6 +384,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
384
384
|
this.NotifyLoadComplete();
|
|
385
385
|
}, 100);
|
|
386
386
|
}
|
|
387
|
+
renameAnimationTimeout = null;
|
|
387
388
|
ngOnDestroy() {
|
|
388
389
|
super.ngOnDestroy();
|
|
389
390
|
this.bridge.NotifyWorkspaceActive(false);
|
|
@@ -391,6 +392,10 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
391
392
|
if (this.saveSettingsTimeout) {
|
|
392
393
|
clearTimeout(this.saveSettingsTimeout);
|
|
393
394
|
}
|
|
395
|
+
if (this.renameAnimationTimeout) {
|
|
396
|
+
clearTimeout(this.renameAnimationTimeout);
|
|
397
|
+
this.renameAnimationTimeout = null;
|
|
398
|
+
}
|
|
394
399
|
// Clean up resize event listeners
|
|
395
400
|
document.removeEventListener('mousemove', this.onSidebarResizeMove);
|
|
396
401
|
document.removeEventListener('mouseup', this.onSidebarResizeEnd);
|
|
@@ -433,6 +438,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
433
438
|
if (conversation) {
|
|
434
439
|
this.SelectedConversation = conversation;
|
|
435
440
|
this.updateTabTitle();
|
|
441
|
+
this.cdr.detectChanges();
|
|
436
442
|
}
|
|
437
443
|
// If not in cache, the chat area component will handle loading it
|
|
438
444
|
}
|
|
@@ -964,6 +970,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
964
970
|
if (this.IsMobileView || !this.IsSidebarPinned) {
|
|
965
971
|
this.CollapseSidebar();
|
|
966
972
|
}
|
|
973
|
+
this.cdr.detectChanges();
|
|
967
974
|
}
|
|
968
975
|
/** @deprecated Use {@link OnNewConversationRequested}. */
|
|
969
976
|
onNewConversationRequested() {
|
|
@@ -983,6 +990,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
983
990
|
this.bridge.SetActiveFromWorkspace(event.conversation.ID);
|
|
984
991
|
this.updateUrl();
|
|
985
992
|
this.updateTabTitle();
|
|
993
|
+
this.cdr.detectChanges();
|
|
986
994
|
}
|
|
987
995
|
/** @deprecated Use {@link OnConversationCreated}. */
|
|
988
996
|
async onConversationCreated(event) {
|
|
@@ -998,9 +1006,15 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
998
1006
|
if (event.name) {
|
|
999
1007
|
this.NotifyDisplayNameChanged(event.name);
|
|
1000
1008
|
}
|
|
1009
|
+
this.cdr.detectChanges();
|
|
1010
|
+
if (this.renameAnimationTimeout) {
|
|
1011
|
+
clearTimeout(this.renameAnimationTimeout);
|
|
1012
|
+
}
|
|
1001
1013
|
// Clear the animation trigger after it completes
|
|
1002
|
-
setTimeout(() => {
|
|
1014
|
+
this.renameAnimationTimeout = setTimeout(() => {
|
|
1015
|
+
this.renameAnimationTimeout = null;
|
|
1003
1016
|
this.RenamedConversationId = null;
|
|
1017
|
+
this.cdr.detectChanges();
|
|
1004
1018
|
}, 1500);
|
|
1005
1019
|
}
|
|
1006
1020
|
/** @deprecated Use {@link OnConversationRenamed}. */
|
|
@@ -1016,6 +1030,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
1016
1030
|
this.PendingArtifactVersionNumber = null;
|
|
1017
1031
|
// Update URL to remove artifact params
|
|
1018
1032
|
this.updateUrl();
|
|
1033
|
+
this.cdr.detectChanges();
|
|
1019
1034
|
}
|
|
1020
1035
|
/** @deprecated Use {@link OnPendingArtifactConsumed}. */
|
|
1021
1036
|
onPendingArtifactConsumed() {
|
|
@@ -1027,6 +1042,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
1027
1042
|
OnPendingMessageConsumed() {
|
|
1028
1043
|
this.PendingMessageToSend = null;
|
|
1029
1044
|
this.PendingAttachmentsToSend = null;
|
|
1045
|
+
this.cdr.detectChanges();
|
|
1030
1046
|
}
|
|
1031
1047
|
/** @deprecated Use {@link OnPendingMessageConsumed}. */
|
|
1032
1048
|
onPendingMessageConsumed() {
|
|
@@ -1136,28 +1152,139 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
1136
1152
|
return this.OnOpenEntityRecord(event);
|
|
1137
1153
|
}
|
|
1138
1154
|
/**
|
|
1139
|
-
* Handle navigation request from artifact viewer plugins.
|
|
1140
|
-
* Opens the target nav item (switching apps if needed) then applies query params to the URL.
|
|
1155
|
+
* Handle navigation request from artifact viewer plugins or actionable commands.
|
|
1156
|
+
* Opens the target nav item or application (switching apps if needed) then applies query params to the URL.
|
|
1141
1157
|
*/
|
|
1142
1158
|
async OnNavigationRequest(event) {
|
|
1143
1159
|
const appId = event.appName ? this.resolveAppId(event.appName) : undefined;
|
|
1144
|
-
|
|
1160
|
+
if (appId && (!event.navItemName || this.normalizeNavToken(event.navItemName) === this.normalizeNavToken(event.appName))) {
|
|
1161
|
+
await this.navigationService.SwitchToApp(appId, undefined, event.queryParams);
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
const resolvedNavName = appId && event.navItemName
|
|
1165
|
+
? (this.resolveNavItemLabelInApp(appId, event.navItemName) ?? event.navItemName)
|
|
1166
|
+
: event.navItemName;
|
|
1167
|
+
const tabId = await this.navigationService.OpenNavItemByName(resolvedNavName, undefined, appId, {
|
|
1145
1168
|
queryParams: event.queryParams
|
|
1146
1169
|
});
|
|
1170
|
+
if (!tabId && appId) {
|
|
1171
|
+
await this.navigationService.SwitchToApp(appId, resolvedNavName || undefined, event.queryParams);
|
|
1172
|
+
}
|
|
1147
1173
|
}
|
|
1148
1174
|
/** @deprecated Use {@link OnNavigationRequest}. */
|
|
1149
1175
|
async onNavigationRequest(event) {
|
|
1150
1176
|
return this.OnNavigationRequest(event);
|
|
1151
1177
|
}
|
|
1178
|
+
normalizeNavToken(value) {
|
|
1179
|
+
return String(value ?? '')
|
|
1180
|
+
.toLowerCase()
|
|
1181
|
+
.replace(/[-_]+/g, ' ')
|
|
1182
|
+
.replace(/\s+/g, ' ')
|
|
1183
|
+
.trim();
|
|
1184
|
+
}
|
|
1185
|
+
stripActionVerbPrefix(label) {
|
|
1186
|
+
return String(label ?? '')
|
|
1187
|
+
.replace(/^(open|view|go\s+to|launch|show|explore)\s+/i, '')
|
|
1188
|
+
.trim();
|
|
1189
|
+
}
|
|
1152
1190
|
/**
|
|
1153
|
-
* Resolve an application name to its ID.
|
|
1191
|
+
* Resolve an application name, URL slug/path, or UUID to its ID.
|
|
1154
1192
|
*/
|
|
1155
|
-
resolveAppId(
|
|
1193
|
+
resolveAppId(appNameOrId) {
|
|
1194
|
+
const raw = String(appNameOrId ?? '').trim();
|
|
1195
|
+
if (!raw) {
|
|
1196
|
+
return undefined;
|
|
1197
|
+
}
|
|
1156
1198
|
const md = this.ProviderToUse;
|
|
1157
|
-
const apps = md.Applications;
|
|
1158
|
-
const
|
|
1199
|
+
const apps = md.Applications || [];
|
|
1200
|
+
const lower = raw.toLowerCase();
|
|
1201
|
+
const normalized = this.normalizeNavToken(raw);
|
|
1202
|
+
const app = apps.find(a => UUIDsEqual(a.ID, raw) ||
|
|
1203
|
+
a.Name?.toLowerCase() === lower ||
|
|
1204
|
+
a.Path?.toLowerCase() === lower ||
|
|
1205
|
+
this.normalizeNavToken(a.Name) === normalized ||
|
|
1206
|
+
this.normalizeNavToken(a.Path) === normalized);
|
|
1159
1207
|
return app?.ID;
|
|
1160
1208
|
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Resolves a nav item label inside a specific application's DefaultNavItems by case/slug-insensitive match.
|
|
1211
|
+
*/
|
|
1212
|
+
resolveNavItemLabelInApp(appId, navItemTarget) {
|
|
1213
|
+
const raw = String(navItemTarget ?? '').trim();
|
|
1214
|
+
if (!raw) {
|
|
1215
|
+
return undefined;
|
|
1216
|
+
}
|
|
1217
|
+
const app = (this.ProviderToUse.Applications || []).find(a => UUIDsEqual(a.ID, appId));
|
|
1218
|
+
if (!app?.DefaultNavItems) {
|
|
1219
|
+
return undefined;
|
|
1220
|
+
}
|
|
1221
|
+
try {
|
|
1222
|
+
const items = JSON.parse(app.DefaultNavItems);
|
|
1223
|
+
const normalized = this.normalizeNavToken(raw);
|
|
1224
|
+
const matched = items.find(item => this.normalizeNavToken(item.Label) === normalized ||
|
|
1225
|
+
this.normalizeNavToken(item.Route) === normalized);
|
|
1226
|
+
return matched?.Label;
|
|
1227
|
+
}
|
|
1228
|
+
catch {
|
|
1229
|
+
return undefined;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
toQueryParamsRecord(params) {
|
|
1233
|
+
if (!params || Object.keys(params).length === 0) {
|
|
1234
|
+
return undefined;
|
|
1235
|
+
}
|
|
1236
|
+
const result = {};
|
|
1237
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1238
|
+
if (v != null) {
|
|
1239
|
+
result[k] = String(v);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Navigates to an Application or NavItem referenced by an `open:resource` command,
|
|
1246
|
+
* matching by ID, Name, URL Path slug (e.g. `"data-explorer"` -> `"Data Explorer"`),
|
|
1247
|
+
* or NavItem label across applications.
|
|
1248
|
+
*/
|
|
1249
|
+
async handleAppOrNavItemCommand(command) {
|
|
1250
|
+
const queryParams = this.toQueryParamsRecord(command.parameters);
|
|
1251
|
+
const rt = (command.resourceType ?? '').trim().toLowerCase();
|
|
1252
|
+
const strippedLabel = this.stripActionVerbPrefix(command.label);
|
|
1253
|
+
// 1. Try resolving as an Application directly
|
|
1254
|
+
const appCandidates = rt === 'navitem'
|
|
1255
|
+
? [command.entityName, command.resourceId, strippedLabel]
|
|
1256
|
+
: [command.resourceId, command.entityName, strippedLabel];
|
|
1257
|
+
for (const candidate of appCandidates) {
|
|
1258
|
+
if (!candidate)
|
|
1259
|
+
continue;
|
|
1260
|
+
const appId = this.resolveAppId(candidate);
|
|
1261
|
+
if (appId) {
|
|
1262
|
+
const navHint = rt === 'navitem' ? command.resourceId : command.entityName;
|
|
1263
|
+
const resolvedNavLabel = navHint ? this.resolveNavItemLabelInApp(appId, navHint) : undefined;
|
|
1264
|
+
await this.navigationService.SwitchToApp(appId, resolvedNavLabel, queryParams);
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
// 2. Search across all applications' DefaultNavItems for a matching NavItem label or route slug
|
|
1269
|
+
const navCandidates = [command.resourceId, command.entityName, strippedLabel].filter((c) => !!c && c.trim().length > 0);
|
|
1270
|
+
for (const candidate of navCandidates) {
|
|
1271
|
+
for (const app of this.ProviderToUse.Applications || []) {
|
|
1272
|
+
const matchedLabel = this.resolveNavItemLabelInApp(app.ID, candidate);
|
|
1273
|
+
if (matchedLabel) {
|
|
1274
|
+
await this.navigationService.SwitchToApp(app.ID, matchedLabel, queryParams);
|
|
1275
|
+
return;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
// 3. Fallback to OpenNavItemByName in the active app
|
|
1280
|
+
for (const candidate of navCandidates) {
|
|
1281
|
+
const tabId = await this.navigationService.OpenNavItemByName(candidate, command.parameters, undefined, queryParams ? { queryParams } : undefined);
|
|
1282
|
+
if (tabId) {
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
MJNotificationService.Instance?.CreateSimpleNotification(`Unable to open "${command.label || command.resourceId}": destination was not found.`, 'info', 4000);
|
|
1287
|
+
}
|
|
1161
1288
|
/**
|
|
1162
1289
|
* Handle actionable commands that require app-specific navigation (open:resource, and the
|
|
1163
1290
|
* compose:email over-length fallback). open:url commands are already handled directly by
|
|
@@ -1167,16 +1294,86 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
1167
1294
|
const command = request.command;
|
|
1168
1295
|
if (command.type === 'open:resource') {
|
|
1169
1296
|
const resourceCommand = command;
|
|
1170
|
-
|
|
1297
|
+
const rt = (resourceCommand.resourceType ?? '').trim().toLowerCase();
|
|
1298
|
+
if (rt === 'record') {
|
|
1171
1299
|
// Record opens are emitted as openEntityRecord from mj-conversation-chat-area
|
|
1172
1300
|
// (composite-key aware). Handling them here too would open the record twice.
|
|
1173
1301
|
return;
|
|
1174
1302
|
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1303
|
+
const resourceId = resourceCommand.resourceId;
|
|
1304
|
+
if (rt === 'artifact' || rt === 'file') {
|
|
1305
|
+
if (this.ChatArea?.OpenConversationArtifactForCommand(resourceCommand)) {
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
if (resourceId && IsValidUUID(resourceId)) {
|
|
1309
|
+
this.navigationService.OpenArtifact(resourceId, resourceCommand.label);
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
this.openMostRecentArtifact();
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
if (rt === 'report' || rt === 'dashboard') {
|
|
1316
|
+
if (this.ChatArea?.OpenConversationArtifactForCommand(resourceCommand)) {
|
|
1317
|
+
return;
|
|
1318
|
+
}
|
|
1319
|
+
if (rt === 'dashboard' && resourceId && IsValidUUID(resourceId)) {
|
|
1320
|
+
this.navigationService.OpenDashboard(resourceId, resourceCommand.label || 'Dashboard');
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1178
1323
|
this.openMostRecentArtifact();
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
if (rt === 'app' || rt === 'navitem') {
|
|
1327
|
+
void this.handleAppOrNavItemCommand(resourceCommand);
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
if (rt === 'view') {
|
|
1331
|
+
if (resourceId && IsValidUUID(resourceId)) {
|
|
1332
|
+
this.navigationService.OpenView(resourceId, resourceCommand.label || 'View');
|
|
1333
|
+
}
|
|
1334
|
+
else if (resourceCommand.entityName) {
|
|
1335
|
+
const extraFilter = typeof resourceCommand.parameters?.['ExtraFilter'] === 'string'
|
|
1336
|
+
? resourceCommand.parameters['ExtraFilter']
|
|
1337
|
+
: undefined;
|
|
1338
|
+
this.navigationService.OpenDynamicView(resourceCommand.entityName, extraFilter);
|
|
1339
|
+
}
|
|
1340
|
+
else {
|
|
1341
|
+
void this.handleAppOrNavItemCommand(resourceCommand);
|
|
1342
|
+
}
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (rt === 'query') {
|
|
1346
|
+
if (resourceId && IsValidUUID(resourceId)) {
|
|
1347
|
+
this.navigationService.OpenQuery(resourceId, resourceCommand.label || 'Query');
|
|
1348
|
+
}
|
|
1349
|
+
else {
|
|
1350
|
+
void this.handleAppOrNavItemCommand(resourceCommand);
|
|
1351
|
+
}
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
if (rt === 'search') {
|
|
1355
|
+
const query = String(resourceCommand.resourceId ||
|
|
1356
|
+
resourceCommand.parameters?.['query'] ||
|
|
1357
|
+
this.stripActionVerbPrefix(resourceCommand.label) ||
|
|
1358
|
+
'').trim();
|
|
1359
|
+
if (query) {
|
|
1360
|
+
this.navigationService.OpenSearch(query);
|
|
1361
|
+
}
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
if (rt === 'form') {
|
|
1365
|
+
if (resourceCommand.entityName) {
|
|
1366
|
+
this.navigationService.OpenNewEntityRecord(resourceCommand.entityName, {
|
|
1367
|
+
newRecordValues: resourceCommand.parameters
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
void this.handleAppOrNavItemCommand(resourceCommand);
|
|
1372
|
+
}
|
|
1373
|
+
return;
|
|
1179
1374
|
}
|
|
1375
|
+
// Fallback for any unrecognized open:resource type
|
|
1376
|
+
void this.handleAppOrNavItemCommand(resourceCommand);
|
|
1180
1377
|
}
|
|
1181
1378
|
else if (command.type === 'compose:email') {
|
|
1182
1379
|
// The service handles compose:email directly whenever the draft fits in a mailto: URL, so
|
|
@@ -1229,6 +1426,7 @@ let ChatConversationsResource = class ChatConversationsResource extends BaseReso
|
|
|
1229
1426
|
}
|
|
1230
1427
|
else {
|
|
1231
1428
|
console.warn('No artifacts found in conversation to open for Report/Dashboard command');
|
|
1429
|
+
MJNotificationService.Instance?.CreateSimpleNotification('No artifact found in this conversation to open.', 'info', 3500);
|
|
1232
1430
|
}
|
|
1233
1431
|
}
|
|
1234
1432
|
static ɵfac = function ChatConversationsResource_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || ChatConversationsResource)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1.ConversationStreamingService), i0.ɵɵdirectiveInject(i1.ActiveTasksService), i0.ɵɵdirectiveInject(i1.UICommandHandlerService), i0.ɵɵdirectiveInject(i1.ConversationBridgeService)); };
|