Skip to content

Advance analytics#10434

Open
bhagyasakalanka wants to merge 12 commits into
wso2:masterfrom
bhagyasakalanka:advance-analytics
Open

Advance analytics#10434
bhagyasakalanka wants to merge 12 commits into
wso2:masterfrom
bhagyasakalanka:advance-analytics

Conversation

@bhagyasakalanka

@bhagyasakalanka bhagyasakalanka commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Purpose

Provide capability to enable advanced moesif analytics

Screenshot 2026-06-22 at 22 45 45 Screenshot 2026-06-22 at 22 45 54

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@bhagyasakalanka, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 37 minutes and 28 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 5bb32def-4a01-4c4d-9a26-9dc38f0d5529

📥 Commits

Reviewing files that changed from the base of the PR and between a0f79b2 and dd721b0.

📒 Files selected for processing (3)
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx
  • modules/i18n/src/models/namespaces/insights-ns.ts
  • modules/i18n/src/translations/en-US/portals/insights.ts
📝 Walkthrough

Walkthrough

Adds an "Enable Advanced Analytics" upgrade flow to the Insights feature. Introduces a tenantMoesifAnalytics endpoint, an advancedAnalyticsUpgradeEnabled deployment config flag, an enableAdvancedAnalytics API helper, and an AdvancedAnalyticsUpgradeCard confirmation dialog. Wires these into OrgInsightsPage and InsightsPage with updated redirect logic and i18n strings.

Changes

Advanced Analytics Upgrade

Layer / File(s) Summary
Deployment config, endpoints, and schema contracts
features/admin.tenants.v1/models/endpoints.ts, features/admin.tenants.v1/configs/endpoints.ts, apps/console/src/public/deployment.config.json, apps/console/java/.../deployment.config.json.j2, features/admin.core.v1/store/reducers/config.ts, .changeset/huge-berries-thank.md
Adds tenantMoesifAnalytics to TenantResourceEndpointsInterface and implements it in getTenantResourceEndpoints. Adds advancedAnalyticsUpgradeEnabled: false to both the static JSON config and the Jinja2 template. Initializes tenantMoesifAnalytics in the Redux config reducer. Changeset declares patch bumps for five packages.
Moesif model update and InsightsPage flag derivation
features/admin.analytics.v1/models/moesif-analytics.ts, features/admin.analytics.v1/pages/insights-page.tsx
Adds optional enableAllPublishers to MoesifPublisherInterface. Extends InsightsFlagsInterface with advancedAnalyticsUpgradeEnabled and insightsEnabled, removes dashboardEnabled, and adds isAdvancedAnalyticsEnabled helper. Updates useInsightsFlags to derive both new boolean flags.
enableAdvancedAnalytics API helper
features/admin.org-insights.v1/api/enable-advanced-analytics.ts
New exported function reads tenantDomain and tenantMoesifAnalytics endpoint from Redux store, sends an authenticated POST with domain as a query parameter, and throws IdentityAppsApiException when HTTP status is not 200.
AdvancedAnalyticsUpgradeCard component and i18n
features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx, modules/i18n/src/models/namespaces/insights-ns.ts, modules/i18n/src/translations/en-US/portals/insights.ts
New MUI-styled component with dialog open/close and agreement checkbox state. Dialog renders privacy, data-retention, and irreversibility points with optional terms-of-service URLs, a warning Alert, and a confirm button gated on agreement and isEnabling. Adds advancedAnalytics to the insightsNS interface and its English translations.
OrgInsightsPage upgrade flow wiring
features/admin.org-insights.v1/pages/org-insights.tsx
Adds OrgInsightsPagePropsInterface with optional showUpgradeCard, termsOfServiceUrl, and moesifTermsOfServiceUrl. Introduces isEnablingAdvanced state and handleEnableAdvancedAnalytics callback that calls the API, dispatches success/error alerts, and resets state in finally. Conditionally renders AdvancedAnalyticsUpgradeCard when showUpgradeCard is true.
InsightsPage redirect logic and OrgInsightsPage prop pass-through
features/admin.analytics.v1/pages/insights-page.tsx
Refactors InsightsPage to compute isMoesifDashboardAvailable via isAdvancedAnalyticsEnabled gated by embeddingDomain, adds a ContentLoader while publisher data loads, updates shouldRedirectToSettings to depend on insightsEnabled, and passes showUpgradeCard/terms-of-service URL props to OrgInsightsPage.

Possibly related PRs

  • wso2/identity-apps#10353: Modifies the same features/admin.analytics.v1/pages/insights-page.tsx to set up the dashboard/settings-driven insights routing flow that this PR refactors.

Suggested reviewers

  • savindi7
  • DonOmalVindula
  • JayaShakthi97
  • NipuniBhagya
🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides purpose and screenshots but is missing most required checklist items, related issues/PRs documentation, and security checks. Complete the template by adding related issues, filling all checklist items, providing security verification details, and confirming completion of the developer checklist from the product-is issue.
Title check ❓ Inconclusive The PR title 'Advance analytics' is vague and generic, lacking specificity about the actual change being implemented. Consider using a more descriptive title such as 'Add support to enable advanced Moesif analytics' or 'Implement advanced analytics upgrade feature' to better convey the purpose of the changeset.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Changeset Required ✅ Passed Changeset file .changeset/huge-berries-thank.md is present with patch updates for required packages including @wso2is/console and feature packages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ create changeset

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
features/admin.org-insights.v1/pages/org-insights.tsx (1)

52-72: ⚡ Quick win

Extract server error description in error alert.

The error alert uses a hardcoded fallback message. As per coding guidelines, error alerts should extract the server's error description when available: dispatch(addAlert({ description: error?.response?.data?.description || fallback, level: AlertLevels.ERROR, message })).

♻️ Proposed refactor to extract server error
-        } catch (_error: unknown) {
+        } catch (error: unknown) {
             dispatch(addAlert({
-                description: "Failed to enable advanced analytics. Please try again.",
+                description: (error as any)?.response?.data?.description || 
+                    "Failed to enable advanced analytics. Please try again.",
                 level: AlertLevels.ERROR,
                 message: "Operation Failed"
             }));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@features/admin.org-insights.v1/pages/org-insights.tsx` around lines 52 - 72,
The catch block in the handleEnableAdvancedAnalytics function uses a hardcoded
error message instead of extracting the actual server error description. Modify
the catch block to capture the error (change the parameter from _error to
error), extract the server error description using the pattern
error?.response?.data?.description, and provide a fallback message if the server
error is unavailable. Update the dispatch call for addAlert to use this
extracted error description in the description field so users see the actual
server error when available.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/huge-berries-thank.md:
- Line 7: The changeset description contains a grammatical error where "advance
analytics" should be "advanced analytics". Update the text in the changeset file
to use the correct spelling "advanced" instead of "advance" to maintain proper
English grammar.

In `@features/admin.org-insights.v1/api/enable-advanced-analytics.ts`:
- Around line 37-64: In the enableAdvancedAnalytics function, validate that
dashboardInfoEndpoint contains the '/dashboard-info' path segment before
attempting the string replacement to derive enableAnalyticsEndpoint. If the
expected path segment is not present, throw an IdentityApicsApiException with a
descriptive error message rather than allowing the replacement to silently
return an unmodified endpoint, which would result in an incorrect endpoint being
used.

In
`@features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx`:
- Around line 119-124: The Chip component contains hardcoded styling values in
the sx prop that violate coding guidelines. Replace the hardcoded fontSize value
of "0.65rem" and height value of 18 with appropriate theme spacing and
typography values from the Material-UI theme object. Access these values through
the theme parameter in the sx prop callback function or use theme.spacing() and
theme.typography utilities to ensure styling remains consistent with the design
system.
- Around line 36-37: Move the hardcoded URL constants ASGARDEO_TOS_URL and
MOESIF_TOS_URL from the advanced-analytics-upgrade-card.tsx component to the
OrgInsightsConstants file, following the established pattern used in
SIWEConstants. Remove the constant declarations from the component level and
import them from OrgInsightsConstants instead. Additionally, verify the
accessibility of the Asgardeo ToS URL
(https://wso2.com/asgardeo/terms-of-service/) which is currently returning HTTP
403 Forbidden status and determine whether this is due to geolocation
restrictions or an actual accessibility issue that needs to be resolved.

---

Nitpick comments:
In `@features/admin.org-insights.v1/pages/org-insights.tsx`:
- Around line 52-72: The catch block in the handleEnableAdvancedAnalytics
function uses a hardcoded error message instead of extracting the actual server
error description. Modify the catch block to capture the error (change the
parameter from _error to error), extract the server error description using the
pattern error?.response?.data?.description, and provide a fallback message if
the server error is unavailable. Update the dispatch call for addAlert to use
this extracted error description in the description field so users see the
actual server error when available.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 7f7a7ad4-b516-4e02-9532-22038042fdc2

📥 Commits

Reviewing files that changed from the base of the PR and between c7dac49 and c79e405.

📒 Files selected for processing (7)
  • .changeset/huge-berries-thank.md
  • apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2
  • apps/console/src/public/deployment.config.json
  • features/admin.analytics.v1/pages/insights-page.tsx
  • features/admin.org-insights.v1/api/enable-advanced-analytics.ts
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx
  • features/admin.org-insights.v1/pages/org-insights.tsx

Comment thread .changeset/huge-berries-thank.md Outdated
Comment thread features/admin.org-insights.v1/api/enable-advanced-analytics.ts
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.72%. Comparing base (bc7a9e4) to head (6160f62).
⚠️ Report is 231 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10434      +/-   ##
==========================================
+ Coverage   72.70%   72.72%   +0.02%     
==========================================
  Files         469      469              
  Lines       70831    70886      +55     
  Branches      484      240     -244     
==========================================
+ Hits        51498    51553      +55     
- Misses      19219    19222       +3     
+ Partials      114      111       -3     
Files with missing lines Coverage Δ
...es/i18n/src/translations/en-US/portals/insights.ts 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.


<DialogContent>
<Typography variant="body2" color="text.secondary" sx={ { mb: 2 } }>
Before you proceed, please read the following carefully.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add texts to i18n

@savindi7

savindi7 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Topic of the box - "Enable advanced analytics with Moesif" and button should be "Enable"

Is there a way we can inform users of what actually happens when they enable or do we expect them to come here with that idea? The UX is a bit unclear

@savindi7 savindi7 closed this Jun 19, 2026
@savindi7 savindi7 reopened this Jun 19, 2026
@savindi7

Copy link
Copy Markdown
Contributor

Let's take the URLs from the deployment configs

@wso2 wso2 deleted a comment from coderabbitai Bot Jun 19, 2026
/**
* Upgrade prompt shown in the legacy Insights page.
*
* Renders a simple card with an "Enable Advanced Analytics" button. Clicking the button

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these comments necessary?

- Fix changeset typo (advance -> advanced).
- Move advanced analytics upgrade card/dialog texts to the insights i18n namespace.
- Read the terms of service URL from deployment config instead of hardcoding it.
- Use theme values for the upgrade card badge instead of hardcoded sizing.
- Surface the server-provided error description in the enable-analytics alert.
- Trim verbose component documentation.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
features/admin.org-insights.v1/api/enable-advanced-analytics.ts (1)

35-43: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fail fast when endpoint or tenant domain is missing before issuing the POST.

tenantMoesifAnalytics is initialized as an empty string in config state, and tenantDomain also falls back to empty. In that state, this call can build an invalid URL and silently hit the wrong target instead of surfacing a clear configuration/auth readiness error.

Proposed fix
 export const enableAdvancedAnalytics = async (): Promise<void> => {
 
     const tenantDomain: string = store.getState()?.auth?.tenantDomain ?? "";
     const enableAnalyticsEndpoint: string = store.getState().config.endpoints.tenantMoesifAnalytics;
+
+    if (!enableAnalyticsEndpoint || !tenantDomain) {
+        throw new IdentityAppsApiException(
+            "Failed to enable Moesif advanced analytics due to missing endpoint or tenant domain.",
+            null,
+            null,
+            null,
+            null,
+            null
+        );
+    }
 
     const response: { status: number } = await httpClient({
         headers: {
             "Accept": "application/json"
         },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@features/admin.org-insights.v1/api/enable-advanced-analytics.ts` around lines
35 - 43, Add validation checks before the httpClient call to ensure both
tenantDomain and enableAnalyticsEndpoint are non-empty strings. After extracting
tenantDomain from the store state and before issuing the POST request via
httpClient, verify that enableAnalyticsEndpoint is not an empty string and that
tenantDomain is not empty (since it defaults to empty string). If either
validation fails, throw an error or return early with a clear message indicating
that the required configuration or authentication state is not ready, preventing
the HTTP request from being made with an invalid URL.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@features/admin.org-insights.v1/api/enable-advanced-analytics.ts`:
- Around line 35-43: Add validation checks before the httpClient call to ensure
both tenantDomain and enableAnalyticsEndpoint are non-empty strings. After
extracting tenantDomain from the store state and before issuing the POST request
via httpClient, verify that enableAnalyticsEndpoint is not an empty string and
that tenantDomain is not empty (since it defaults to empty string). If either
validation fails, throw an error or return early with a clear message indicating
that the required configuration or authentication state is not ready, preventing
the HTTP request from being made with an invalid URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 6e8157ba-296f-41c0-9e22-c02499e1ef88

📥 Commits

Reviewing files that changed from the base of the PR and between c79e405 and 6160f62.

📒 Files selected for processing (11)
  • .changeset/huge-berries-thank.md
  • apps/console/src/public/deployment.config.json
  • features/admin.analytics.v1/pages/insights-page.tsx
  • features/admin.core.v1/store/reducers/config.ts
  • features/admin.org-insights.v1/api/enable-advanced-analytics.ts
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx
  • features/admin.org-insights.v1/pages/org-insights.tsx
  • features/admin.tenants.v1/configs/endpoints.ts
  • features/admin.tenants.v1/models/endpoints.ts
  • modules/i18n/src/models/namespaces/insights-ns.ts
  • modules/i18n/src/translations/en-US/portals/insights.ts
✅ Files skipped from review due to trivial changes (2)
  • features/admin.core.v1/store/reducers/config.ts
  • .changeset/huge-berries-thank.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • features/admin.analytics.v1/pages/insights-page.tsx
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx
  • features/admin.org-insights.v1/pages/org-insights.tsx
  • apps/console/src/public/deployment.config.json

Use a plain white announcement banner with a "New" chip and an enable
button, and restyle the confirmation dialog to match the CDS feature
preview modal (content first, full-width preview image, primary action
at the bottom right). Refine the copy for a more professional tone and
read the terms of service URLs from config instead of hardcoded values.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
features/admin.org-insights.v1/components/moesif-analytics-preview.tsx (1)

55-55: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Add explicit type annotation to useTranslation destructuring.

As per coding guidelines, explicit type annotations should be used everywhere and type inference should not be relied upon.

✏️ Suggested type annotation
-    const { t } = useTranslation();
+    const { t }: { t: TFunction } = useTranslation();

You'll need to import TFunction from react-i18next.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@features/admin.org-insights.v1/components/moesif-analytics-preview.tsx` at
line 55, The `useTranslation` destructuring in the moesif-analytics-preview.tsx
component is missing explicit type annotation for the `t` variable. Import
`TFunction` from the `react-i18next` library and add it as an explicit type
annotation to the destructured `t` variable in the line `const { t } =
useTranslation();` to align with the coding guideline of using explicit type
annotations instead of relying on type inference.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@features/admin.analytics.v1/models/moesif-analytics.ts`:
- Around line 27-31: The enableAllPublishers property in the interface has
misleading JSDoc claiming it's set by the enableAdvancedAnalytics API call, but
that API returns Promise<void> and never processes or returns response data.
Additionally, this property is never referenced or assigned anywhere in the
codebase. Either remove the unused enableAllPublishers property and its JSDoc
from the interface, or update the enableAdvancedAnalytics function to capture
and return the response body data that would populate this property, then update
the calling code to handle the returned data.

In `@features/admin.org-insights.v1/components/moesif-analytics-preview.tsx`:
- Around line 48-53: The MoesifAnalyticsPreview component accepts a
termsOfServiceUrl prop that defaults to an empty string, which creates a broken
link when rendered with href="". Fix this by providing a fallback constant for
termsOfServiceUrl similar to how MOESIF_TOS_URL_FALLBACK is used for
moesifTermsOfServiceUrl in the component's function signature, or alternatively
conditionally render the Terms of Service link element only when a valid
non-empty termsOfServiceUrl is provided. Choose the approach that best fits your
use case where the link is rendered at line 90.

---

Nitpick comments:
In `@features/admin.org-insights.v1/components/moesif-analytics-preview.tsx`:
- Line 55: The `useTranslation` destructuring in the
moesif-analytics-preview.tsx component is missing explicit type annotation for
the `t` variable. Import `TFunction` from the `react-i18next` library and add it
as an explicit type annotation to the destructured `t` variable in the line
`const { t } = useTranslation();` to align with the coding guideline of using
explicit type annotations instead of relying on type inference.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: df102568-c2ad-4d72-a7d4-8a90478e41ae

📥 Commits

Reviewing files that changed from the base of the PR and between 6160f62 and 5c670c0.

⛔ Files ignored due to path filters (1)
  • features/admin.org-insights.v1/assets/preview/analytics_preview.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • features/admin.analytics.v1/models/moesif-analytics.ts
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx
  • features/admin.org-insights.v1/components/moesif-analytics-preview.tsx
  • modules/i18n/src/models/namespaces/insights-ns.ts
  • modules/i18n/src/translations/en-US/portals/insights.ts
✅ Files skipped from review due to trivial changes (1)
  • modules/i18n/src/translations/en-US/portals/insights.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • modules/i18n/src/models/namespaces/insights-ns.ts
  • features/admin.org-insights.v1/components/advanced-analytics-upgrade-card.tsx

Comment on lines +27 to +31
/**
* When true, all event publishers are enabled (set by the server after the
* enableAdvancedAnalytics API call succeeds).
*/
enableAllPublishers?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for references to enableAllPublishers in the codebase

# Search for reads/writes of enableAllPublishers
rg -n --type=ts --type=tsx -C3 'enableAllPublishers'

Repository: wso2/identity-apps

Length of output: 90


🏁 Script executed:

#!/bin/bash
# Search for enableAllPublishers references with corrected command
rg -n 'enableAllPublishers' --type ts -C2

# Also search in the enable-advanced-analytics.ts file mentioned in the review
fd 'enable-advanced-analytics' -t f

Repository: wso2/identity-apps

Length of output: 568


🏁 Script executed:

#!/bin/bash
# Find and examine the MoesifPublisherInterface definition file
fd 'moesif-analytics' -t f

Repository: wso2/identity-apps

Length of output: 379


🏁 Script executed:

# View the enable-advanced-analytics API to verify return type and response handling
cat -n features/admin.org-insights.v1/api/enable-advanced-analytics.ts

Repository: wso2/identity-apps

Length of output: 2449


🏁 Script executed:

# View the moesif-analytics model file to see the full interface
cat -n features/admin.analytics.v1/models/moesif-analytics.ts

Repository: wso2/identity-apps

Length of output: 4032


🏁 Script executed:

# Search more broadly for enableAllPublishers property assignment or usage
rg -n 'enableAllPublishers' -A2 -B2

Repository: wso2/identity-apps

Length of output: 504


Remove the unused enableAllPublishers property or update the API to populate it.

The JSDoc states this property is "set by the server after the enableAdvancedAnalytics API call succeeds," but enableAdvancedAnalytics returns Promise<void> and does not process the response body—it only validates response.status !== 200. Additionally, the property is never referenced or assigned anywhere in the codebase. Either remove this unused property from the interface or update the API to extract and return the response data.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@features/admin.analytics.v1/models/moesif-analytics.ts` around lines 27 - 31,
The enableAllPublishers property in the interface has misleading JSDoc claiming
it's set by the enableAdvancedAnalytics API call, but that API returns
Promise<void> and never processes or returns response data. Additionally, this
property is never referenced or assigned anywhere in the codebase. Either remove
the unused enableAllPublishers property and its JSDoc from the interface, or
update the enableAdvancedAnalytics function to capture and return the response
body data that would populate this property, then update the calling code to
handle the returned data.

Comment thread features/admin.org-insights.v1/components/moesif-analytics-preview.tsx Outdated
Delete the unused MoesifAnalyticsPreview component (flagged by knip) that
was never wired into any page and imported preview images that do not
exist, causing lint/build failures. Drop the now-orphaned preview i18n
keys and their interface entries.
Determine advanced analytics enablement from the get-publishers API response
instead of the dashboardEnabled deployment flag. Treat enableAllPublishers as
enabled (the enablement map may be empty in that case), otherwise enable only
when at least one publisher is on, and fall back to the legacy view when the
publisher is not configured (404) or no publisher is enabled.
Update the dialog text, enlarge it to match the feature preview modal, add
spacing before the agreement checkbox, and fold the permanence note into the
bullet list (removing the separate warning alert).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants