Skip to content

Conversation

@NipuniBhagya
Copy link
Contributor

@NipuniBhagya NipuniBhagya commented Dec 16, 2025

This pull request introduces support for fraud detection event publishing configurations (specifically for Sift integration) in the admin server configurations module. The main changes include new API utilities, models, endpoint wiring, UI icon support, utility methods, and i18n additions for configuring which user events and data are published for fraud analytics.

Preview

image

Key changes:

Fraud Detection Event Publishing Support

  • Added a new API utility (updateEventPublishingConfigurations) for updating fraud detection event publishing configurations, and a React hook (useFraudDetectionConfigurations) for fetching them. [1] [2]
  • Introduced new TypeScript interfaces in fraud-detection.ts to represent fraud detection configuration data structures, including event properties and metadata.

Endpoint and State Integration

  • Added the fraudDetectionConfigurations endpoint to resource endpoint configs and models, and initialized its state in the config reducer. [1] [2] [3]

UI and Icon Support

  • Added a Sift connector SVG icon and a utility function to retrieve it for UI use. [1] [2] [3]

Utility Enhancements

  • Extended GovernanceConnectorUtils with a method to resolve mappings for fraud analytic event metadata, supporting dynamic UI rendering and i18n. [1] [2]

Internationalization (i18n)

  • Added i18n namespace and English translations for Sift event publishing configuration screens, tooltips, warnings, and notifications. [1] [2] [3] [4]

Purpose

Related Issues

  • N/A

Related PRs

  • N/A

Checklist

  • e2e cypress tests locally verified. (for internal contributers)
  • Manual test round performed and verified.
  • UX/UI review done on the final implementation.
  • Documentation provided. (Add links if there are any)
  • Relevant backend changes deployed and verified
  • Unit tests provided. (Add links if there are any)
  • Integration tests provided. (Add links if there are any)

Security checks

Developer Checklist (Mandatory)

  • Complete the Developer Checklist in the related product-is issue to track any behavioral change or migration impact.

Summary by CodeRabbit

  • New Features

    • Event-publishing controls for the Sift integration: per-event toggles, PII warnings, optional user/device metadata, diagnostic logging, two-column event selection, updated connector icon, refined API-key UI, and async save with inline error handling.
  • API / Data

    • Fetch and update endpoints for fraud-detection/event-publishing configurations.
  • Localization

    • Expanded translations for event publishing, diagnostics, and update errors.
  • Chore

    • Version bump changeset.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Walkthrough

Adds fraud-detection/event-publishing: a new endpoint and endpoint interface, GET hook and PUT API, TypeScript models and metadata resolver, Sift connector form UI changes with per-event toggles and API-key handling, i18n entries, Sift icon export, feature-flag key, and a changeset bump.

Changes

Cohort / File(s) Summary
Endpoints & Reducer
features/admin.core.v1/store/reducers/config.ts, features/admin.server-configurations.v1/configs/endpoints.ts, features/admin.server-configurations.v1/models/endpoints.ts
Add fraudDetectionConfigurations endpoint to reducer initial state, endpoints builder, and endpoints interface.
API & Hook
features/admin.server-configurations.v1/api/event-publishing-configurations.ts, features/admin.server-configurations.v1/api/use-fraud-detection-configurations.ts
New PUT API updateEventPublishingConfigurations and GET hook useFraudDetectionConfigurations using the centralized endpoint, Asgardeo HTTP client, response status validation, and IdentityAppsApiException-wrapped errors.
Models
features/admin.server-configurations.v1/models/fraud-detection.ts
Add FraudDetectionConfigurationsInterface, FraudAnalyticEventPropertyInterface, and FraudAnalyticEventMetadataInterface.
Sift Form UI & Styles
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx, features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.scss
Large Sift form changes: feature-flagged event-publishing UI, fetch/enrich fraud configs, per-event toggles, API-key visibility/delete handling, conditional submit flow and mutation; minor SCSS whitespace tweak.
Utilities & UI
features/admin.server-configurations.v1/utils/governance-connector-utils.ts, features/admin.server-configurations.v1/configs/ui.ts
Add resolveEventPropertyMappings() to provide event metadata and getSiftConnectorIcon() to expose the Sift SVG icon.
i18n
modules/i18n/src/models/namespaces/governance-connectors-ns.ts, modules/i18n/src/translations/en-US/portals/governance-connectors.ts
Add eventPublishing translations and event metadata (labels, hints, warnings, diagnostics); replace configurationUpdate notification with eventPropertiesUpdate.
Constants / Feature Flags
features/admin.server-configurations.v1/constants/governance-connector-constants.ts
Add HIDE_FRAUD_DETECTION_EVENT_PUBLISHING_CONFIGURATION key and map to governanceConnectors.fraudDetection.eventPublishingConfigurations.
Changeset & Lint
.changeset/wet-drinks-visit.md, .eslintrc.js
Add changeset entry bumping related packages; update license header year range in ESLint config.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant Form as Sift Connector Form
    participant Hook as useFraudDetectionConfigurations
    participant Store as Redux Store
    participant HTTP as HTTP Client
    participant API as Server API

    User->>Form: Open form
    Form->>Hook: fetch configs (shouldFetch=true)
    Hook->>Store: read `endpoints.fraudDetectionConfigurations`
    Hook->>HTTP: GET /api/server/v1/configs/fraud-detection
    HTTP->>API: request
    API-->>HTTP: 200 OK (config)
    HTTP-->>Hook: data
    Hook-->>Form: data, isLoading=false

    rect rgba(200,220,255,0.5)
    Note over Form: Render events, metadata, checkboxes, API key field
    end

    User->>Form: Toggle events / set API key
    User->>Form: Submit
    Form->>HTTP: PUT /api/server/v1/configs/fraud-detection (payload)
    HTTP->>API: update request
    API-->>HTTP: 200 OK
    HTTP-->>Form: success
    Form->>Hook: call mutate()
    Hook->>HTTP: GET refreshed config
    HTTP->>API: request
    API-->>HTTP: updated config
    HTTP-->>Hook: data
    Hook-->>Form: refreshed data
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰
I nibble keys and toggle lights,
Two-column boxes, eventful nights.
Fetch, mutate, then hop away,
Metadata blooms in tidy array.
Hooray — Sift's garden sings today!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. While it provides a good overview of key changes with a preview image and links, all checklist items (e2e tests, manual tests, UX/UI review, documentation, backend verification, unit/integration tests, security checks, and developer checklist) remain unchecked, indicating testing and verification work is incomplete. Complete and check off all required checklist items: e2e/manual/UX-UI testing, documentation, backend deployment verification, unit and integration tests, security compliance checks, and developer checklist completion before merging.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Improve Sift configuration page' accurately summarizes the main change—enhancing the Sift connector configuration UI with fraud detection event publishing support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (3)
features/admin.server-configurations.v1/api/event-publishing-configurations.ts (1)

54-62: Consider accepting 204 (No Content) as a success status.

The function currently only accepts HTTP 200 as success. For PUT operations, HTTP 204 (No Content) is also a valid success response, especially when the server doesn't return a response body.

If the backend can return 204, apply this diff:

-        if (response.status !== 200) {
+        if (response.status !== 200 && response.status !== 204) {
             throw new IdentityAppsApiException(
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx (2)

530-539: Add type="submit" to the button.

The button is inside a form but lacks an explicit type="submit" attribute. Add it to ensure consistent form submission behavior across browsers.

                             <PrimaryButton
+                                type="submit"
                                 size="small"
                                 disabled={ isSubmitting || readOnly }
                                 loading={ isSubmitting }

213-213: Add type annotation for the form parameter.

The form parameter lacks a TypeScript type annotation. Consider adding it for better type safety.

-    const renderEventPublishingSection = (form): ReactElement => {
+    const renderEventPublishingSection = (form: FormRenderProps["form"]): ReactElement => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between edcb6ce and f4a6f99.

⛔ Files ignored due to path filters (1)
  • modules/theme/src/themes/wso2is/assets/images/connectors/sift.svg is excluded by !**/*.svg
📒 Files selected for processing (12)
  • features/admin.core.v1/store/reducers/config.ts (1 hunks)
  • features/admin.server-configurations.v1/api/event-publishing-configurations.ts (1 hunks)
  • features/admin.server-configurations.v1/api/use-fraud-detection-configurations.ts (1 hunks)
  • features/admin.server-configurations.v1/configs/endpoints.ts (1 hunks)
  • features/admin.server-configurations.v1/configs/ui.ts (3 hunks)
  • features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.scss (1 hunks)
  • features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx (4 hunks)
  • features/admin.server-configurations.v1/models/endpoints.ts (1 hunks)
  • features/admin.server-configurations.v1/models/fraud-detection.ts (1 hunks)
  • features/admin.server-configurations.v1/utils/governance-connector-utils.ts (2 hunks)
  • modules/i18n/src/models/namespaces/governance-connectors-ns.ts (2 hunks)
  • modules/i18n/src/translations/en-US/portals/governance-connectors.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
features/admin.server-configurations.v1/api/event-publishing-configurations.ts (1)
features/admin.server-configurations.v1/models/fraud-detection.ts (1)
  • FraudDetectionConfigurationsInterface (22-27)
features/admin.server-configurations.v1/api/use-fraud-detection-configurations.ts (1)
features/admin.server-configurations.v1/models/fraud-detection.ts (1)
  • FraudDetectionConfigurationsInterface (22-27)
features/admin.server-configurations.v1/utils/governance-connector-utils.ts (1)
features/admin.server-configurations.v1/models/fraud-detection.ts (1)
  • FraudAnalyticEventMetadataInterface (44-48)
🔇 Additional comments (11)
modules/i18n/src/translations/en-US/portals/governance-connectors.ts (1)

279-334: LGTM! Comprehensive and well-structured i18n for event publishing.

The event publishing configuration strings are thorough and well-organized. The privacy warnings appropriately alert users about PII data sharing with clear guidance about compliance requirements. The structure logically groups related configuration options and follows the existing patterns in this file.

modules/i18n/src/models/namespaces/governance-connectors-ns.ts (1)

341-406: LGTM! TypeScript interfaces correctly define the i18n structure.

The interface definitions accurately mirror the implementation in the translations file. The type structure is comprehensive and properly captures all the nested configuration options for the Sift connector event publishing feature.

features/admin.server-configurations.v1/utils/governance-connector-utils.ts (1)

593-644: LGTM! Well-structured event property metadata mapping.

The new resolveEventPropertyMappings method provides a centralized registry for fraud detection event metadata. The implementation correctly returns i18n keys (rather than translated values) to support dynamic translation, and the displayOrder values provide clear UI sequencing.

features/admin.core.v1/store/reducers/config.ts (1)

126-126: LGTM! Consistent endpoint initialization.

The new fraudDetectionConfigurations endpoint follows the established pattern for endpoint initialization in the reducer state.

features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.scss (1)

19-19: Formatting improvement applied.

The added space before the opening brace aligns with standard CSS/SCSS formatting conventions.

features/admin.server-configurations.v1/models/endpoints.ts (1)

43-43: LGTM! Interface extended correctly.

The new fraudDetectionConfigurations property is properly typed and extends the endpoint interface consistently.

features/admin.server-configurations.v1/configs/endpoints.ts (1)

46-46: LGTM! Endpoint URL constructed correctly.

The new fraud detection configurations endpoint follows the established pattern and uses the appropriate API path structure.

features/admin.server-configurations.v1/configs/ui.ts (1)

163-172: LGTM! Icon utility properly typed.

The getSiftConnectorIcon function is well-typed and correctly returns the SVG component. The explicit return type annotation ensures type safety across the codebase.

features/admin.server-configurations.v1/api/event-publishing-configurations.ts (1)

39-75: Well-structured API function with comprehensive error handling.

The updateEventPublishingConfigurations function correctly uses the centralized endpoint configuration, includes appropriate headers, and properly wraps errors in IdentityAppsApiException.

features/admin.server-configurations.v1/api/use-fraud-detection-configurations.ts (1)

28-51: LGTM! Well-designed React hook with proper typing.

The useFraudDetectionConfigurations hook follows React hooks best practices with generic type support, conditional fetching, and proper state management. The type cast on line 45 is defensive but safe.

features/admin.server-configurations.v1/models/fraud-detection.ts (1)

22-48: LGTM!

The interfaces are well-structured with clear separation of concerns between configuration data (FraudDetectionConfigurationsInterface), event properties (FraudAnalyticEventPropertyInterface), and display metadata (FraudAnalyticEventMetadataInterface). The optional properties are appropriately marked.

Comment on lines +117 to +136
const { leftColumnEvents, rightColumnEvents } = useMemo(() => {
if (!enrichedFraudDetectionConfigurations?.events) {
return { leftColumnEvents: [], rightColumnEvents: [] };
}

enrichedFraudDetectionConfigurations.events.sort(
(a: FraudAnalyticEventPropertyInterface, b: FraudAnalyticEventPropertyInterface) => {
const orderA: number = eventMetadata[a.eventName]?.displayOrder || 0;
const orderB: number = eventMetadata[b.eventName]?.displayOrder || 0;

return orderA - orderB;
}
);
const midPoint: number = Math.ceil(enrichedFraudDetectionConfigurations.events.length / 2);

return {
leftColumnEvents: enrichedFraudDetectionConfigurations.events.slice(0, midPoint),
rightColumnEvents: enrichedFraudDetectionConfigurations.events.slice(midPoint)
};
}, [ enrichedFraudDetectionConfigurations ]);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid mutating the memoized array during sort.

Array.sort() mutates in place, so calling enrichedFraudDetectionConfigurations.events.sort(...) modifies the array from the previous useMemo result. This violates immutability and can cause unpredictable behavior.

     const { leftColumnEvents, rightColumnEvents } = useMemo(() => {
         if (!enrichedFraudDetectionConfigurations?.events) {
             return { leftColumnEvents: [], rightColumnEvents: [] };
         }

-        enrichedFraudDetectionConfigurations.events.sort(
+        const sortedEvents = [...enrichedFraudDetectionConfigurations.events].sort(
             (a: FraudAnalyticEventPropertyInterface, b: FraudAnalyticEventPropertyInterface) => {
                 const orderA: number = eventMetadata[a.eventName]?.displayOrder || 0;
                 const orderB: number = eventMetadata[b.eventName]?.displayOrder || 0;

                 return orderA - orderB;
             }
         );
-        const midPoint: number = Math.ceil(enrichedFraudDetectionConfigurations.events.length / 2);
+        const midPoint: number = Math.ceil(sortedEvents.length / 2);

         return {
-            leftColumnEvents: enrichedFraudDetectionConfigurations.events.slice(0, midPoint),
-            rightColumnEvents: enrichedFraudDetectionConfigurations.events.slice(midPoint)
+            leftColumnEvents: sortedEvents.slice(0, midPoint),
+            rightColumnEvents: sortedEvents.slice(midPoint)
         };
     }, [ enrichedFraudDetectionConfigurations ]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { leftColumnEvents, rightColumnEvents } = useMemo(() => {
if (!enrichedFraudDetectionConfigurations?.events) {
return { leftColumnEvents: [], rightColumnEvents: [] };
}
enrichedFraudDetectionConfigurations.events.sort(
(a: FraudAnalyticEventPropertyInterface, b: FraudAnalyticEventPropertyInterface) => {
const orderA: number = eventMetadata[a.eventName]?.displayOrder || 0;
const orderB: number = eventMetadata[b.eventName]?.displayOrder || 0;
return orderA - orderB;
}
);
const midPoint: number = Math.ceil(enrichedFraudDetectionConfigurations.events.length / 2);
return {
leftColumnEvents: enrichedFraudDetectionConfigurations.events.slice(0, midPoint),
rightColumnEvents: enrichedFraudDetectionConfigurations.events.slice(midPoint)
};
}, [ enrichedFraudDetectionConfigurations ]);
const { leftColumnEvents, rightColumnEvents } = useMemo(() => {
if (!enrichedFraudDetectionConfigurations?.events) {
return { leftColumnEvents: [], rightColumnEvents: [] };
}
const sortedEvents = [...enrichedFraudDetectionConfigurations.events].sort(
(a: FraudAnalyticEventPropertyInterface, b: FraudAnalyticEventPropertyInterface) => {
const orderA: number = eventMetadata[a.eventName]?.displayOrder || 0;
const orderB: number = eventMetadata[b.eventName]?.displayOrder || 0;
return orderA - orderB;
}
);
const midPoint: number = Math.ceil(sortedEvents.length / 2);
return {
leftColumnEvents: sortedEvents.slice(0, midPoint),
rightColumnEvents: sortedEvents.slice(midPoint)
};
}, [ enrichedFraudDetectionConfigurations ]);
🤖 Prompt for AI Agents
In
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx
around lines 117-136, the code calls
enrichedFraudDetectionConfigurations.events.sort(...) which mutates the original
array; instead, create a shallow copy of the events array before sorting (e.g.,
const events = [...enrichedFraudDetectionConfigurations.events]) and run sort on
that copy, then compute midPoint and slice from the sorted copy to produce
leftColumnEvents and rightColumnEvents; also ensure the useMemo dependency list
includes any external values used for sorting (like eventMetadata) so the memo
updates correctly.

Comment on lines +182 to +206
const renderEventSelectionCheckbox = (event: FraudAnalyticEventPropertyInterface): ReactElement => {
return (
<Box mb={ 2 } key={ event.eventName } className="channel-checkbox-container">
<FinalFormField
ariaLabel={ event.eventName }
data-componentid={ `${componentId}-${event.eventName}-checkbox` }
name={ `events.${GovernanceConnectorUtils.encodeConnectorPropertyName(event.eventName)}` }
component={ CheckboxAdapter }
checked={ event.enabled }
label={
(<Box className="checkbox-label">
<Box className="event-name-container">
<Typography variant="body1" component="span" className="event-name">
{ t(event.displayName) }
</Typography>
</Box>
<Typography variant="caption" component="div" className="event-description">
{ t(event.description) }
</Typography>
</Box>)
}
/>
</Box>
);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove the redundant checked prop.

The checked prop on line 190 conflicts with FinalForm's state management. Since initial values are set via resolveInitialFormValues(), the form already controls the checkbox state. Passing checked explicitly can cause the checkbox to not reflect user interactions.

                 <FinalFormField
                     ariaLabel={ event.eventName }
                     data-componentid={ `${componentId}-${event.eventName}-checkbox` }
                     name={ `events.${GovernanceConnectorUtils.encodeConnectorPropertyName(event.eventName)}` }
                     component={ CheckboxAdapter }
-                    checked={ event.enabled }
                     label={
🤖 Prompt for AI Agents
In
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx
around lines 182 to 206, the FinalFormField is passing a redundant checked prop
(line ~190) which overrides Final Form's managed value and prevents user
interactions from updating the checkbox; remove the checked={ event.enabled }
prop so the CheckboxAdapter/FinalFormField relies on Final Form's input.value
and initial values (set via resolveInitialFormValues()), ensuring the
component's state is fully controlled by the form.

Comment on lines +377 to +409
const handleEventPublishingSubmit = (values: Record<string, unknown>) => {
const eventPublishingPayload: FraudDetectionConfigurationsInterface = {
events: enrichedFraudDetectionConfigurations?.events.map((event: FraudAnalyticEventPropertyInterface) => ({
enabled: values.events?.[ GovernanceConnectorUtils
.encodeConnectorPropertyName(event.eventName)] as boolean,
eventName: event.eventName,
properties: []
})) || [],
logRequestPayload: values.logRequestPayload as boolean || false,
publishDeviceMetadata: values.publishDeviceMetadata as boolean || false,
publishUserInfo: values.publishUserInfo as boolean || false
};

updateEventPublishingConfigurations(eventPublishingPayload).then(() => {
if (values[GovernanceConnectorUtils.encodeConnectorPropertyName(
ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY
)] !== undefined) {
onSubmit(getUpdatedAPIKey(values));
}

mutateEventPublishingConfigurations();
}).catch(() => {
dispatch(
addAlert({
description: t("governanceConnectors:connectorCategories.loginAttemptsSecurity" +
".connectors.siftConnector.notifications.eventPropertiesUpdate.error.description"),
level: AlertLevels.ERROR,
message: t("governanceConnectors:connectorCategories.loginAttemptsSecurity" +
".connectors.siftConnector.notifications.eventPropertiesUpdate.error.message")
})
);
});
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Add guard against submitting empty events and provide success feedback.

Two concerns:

  1. If enrichedFraudDetectionConfigurations is undefined when submitting, an empty events array is sent which could overwrite existing configurations on the server.

  2. There's no success notification after a successful update, unlike the error case which shows an alert.

     const handleEventPublishingSubmit = (values: Record<string, unknown>) => {
+        if (!enrichedFraudDetectionConfigurations?.events) {
+            return;
+        }
+
         const eventPublishingPayload: FraudDetectionConfigurationsInterface = {
-            events: enrichedFraudDetectionConfigurations?.events.map((event: FraudAnalyticEventPropertyInterface) => ({
+            events: enrichedFraudDetectionConfigurations.events.map((event: FraudAnalyticEventPropertyInterface) => ({
                 enabled: values.events?.[ GovernanceConnectorUtils
                     .encodeConnectorPropertyName(event.eventName)] as boolean,
                 eventName: event.eventName,
                 properties: []
-            })) || [],
+            })),
             logRequestPayload: values.logRequestPayload as boolean || false,
             publishDeviceMetadata: values.publishDeviceMetadata as boolean || false,
             publishUserInfo: values.publishUserInfo as boolean || false
         };

         updateEventPublishingConfigurations(eventPublishingPayload).then(() => {
+            dispatch(
+                addAlert({
+                    description: t("governanceConnectors:connectorCategories.loginAttemptsSecurity" +
+                        ".connectors.siftConnector.notifications.eventPropertiesUpdate.success.description"),
+                    level: AlertLevels.SUCCESS,
+                    message: t("governanceConnectors:connectorCategories.loginAttemptsSecurity" +
+                        ".connectors.siftConnector.notifications.eventPropertiesUpdate.success.message")
+                })
+            );
+
             if (values[GovernanceConnectorUtils.encodeConnectorPropertyName(
🤖 Prompt for AI Agents
In
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx
around lines 377-409, prevent sending an empty events array when
enrichedFraudDetectionConfigurations is missing and add a success alert: before
building eventPublishingPayload, guard that
enrichedFraudDetectionConfigurations?.events exists and has length — if not,
abort the update call and dispatch a warning/error alert (or preserve existing
events by omitting the events field), otherwise map events as before; then, in
the .then() handler after updateEventPublishingConfigurations resolves, dispatch
an addAlert success notification (similar to the error case) and only then call
mutateEventPublishingConfigurations(); ensure the API-key onSubmit path remains
unchanged.

Comment on lines +415 to +431
const resolveInitialFormValues = () => {
return {
[ GovernanceConnectorUtils
.encodeConnectorPropertyName(ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY)
]: initialValues?.properties[0]?.value ?? "",
events: enrichedFraudDetectionConfigurations?.events.reduce(
(formValue: Record<string, boolean>, event: FraudAnalyticEventPropertyInterface) => {

formValue[GovernanceConnectorUtils.encodeConnectorPropertyName(event.eventName)] = event.enabled;

return formValue;
}, {} as Record<string, boolean>) ?? {},
logRequestPayload: enrichedFraudDetectionConfigurations?.logRequestPayload ?? false,
publishDeviceMetadata: enrichedFraudDetectionConfigurations?.publishDeviceMetadata ?? false,
publishUserInfo: enrichedFraudDetectionConfigurations?.publishUserInfo ?? false
};
};
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid accessing properties by index; find by property name instead.

Accessing initialValues?.properties[0]?.value assumes the API key is always the first property. This is fragile and will break if the property order changes.

     const resolveInitialFormValues = () => {
+        const apiKeyProperty = initialValues?.properties?.find(
+            (prop) => prop.name === ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY
+        );
+
         return {
             [ GovernanceConnectorUtils
                 .encodeConnectorPropertyName(ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY)
-            ]: initialValues?.properties[0]?.value ?? "",
+            ]: apiKeyProperty?.value ?? "",
             events: enrichedFraudDetectionConfigurations?.events.reduce(
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const resolveInitialFormValues = () => {
return {
[ GovernanceConnectorUtils
.encodeConnectorPropertyName(ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY)
]: initialValues?.properties[0]?.value ?? "",
events: enrichedFraudDetectionConfigurations?.events.reduce(
(formValue: Record<string, boolean>, event: FraudAnalyticEventPropertyInterface) => {
formValue[GovernanceConnectorUtils.encodeConnectorPropertyName(event.eventName)] = event.enabled;
return formValue;
}, {} as Record<string, boolean>) ?? {},
logRequestPayload: enrichedFraudDetectionConfigurations?.logRequestPayload ?? false,
publishDeviceMetadata: enrichedFraudDetectionConfigurations?.publishDeviceMetadata ?? false,
publishUserInfo: enrichedFraudDetectionConfigurations?.publishUserInfo ?? false
};
};
const resolveInitialFormValues = () => {
const apiKeyProperty = initialValues?.properties?.find(
(prop) => prop.name === ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY
);
return {
[ GovernanceConnectorUtils
.encodeConnectorPropertyName(ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY)
]: apiKeyProperty?.value ?? "",
events: enrichedFraudDetectionConfigurations?.events.reduce(
(formValue: Record<string, boolean>, event: FraudAnalyticEventPropertyInterface) => {
formValue[GovernanceConnectorUtils.encodeConnectorPropertyName(event.eventName)] = event.enabled;
return formValue;
}, {} as Record<string, boolean>) ?? {},
logRequestPayload: enrichedFraudDetectionConfigurations?.logRequestPayload ?? false,
publishDeviceMetadata: enrichedFraudDetectionConfigurations?.publishDeviceMetadata ?? false,
publishUserInfo: enrichedFraudDetectionConfigurations?.publishUserInfo ?? false
};
};
🤖 Prompt for AI Agents
In
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx
around lines 415-431, the code reads the API key via
initialValues?.properties[0]?.value which assumes the API key is at index 0;
instead, find the property by name: compute the encoded property name with
GovernanceConnectorUtils.encodeConnectorPropertyName(ServerConfigurationsConstants.SIFT_CONNECTOR_API_KEY_PROPERTY),
search initialValues?.properties for an entry whose name matches that encoded
key, and use its value (or fallback to "" if not found); update the return
object to use that foundValue rather than indexing into properties[0].

},
userVerifications: {
label: "User Verifications",
hint: "Publish notification based user verification events."
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Hyphenate the compound adjective.

The phrase "notification based user verification events" should use a hyphen: "notification-based user verification events" to form a proper compound adjective.

Apply this diff:

-                                    hint: "Publish notification based user verification events."
+                                    hint: "Publish notification-based user verification events."
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
hint: "Publish notification based user verification events."
hint: "Publish notification-based user verification events."
🤖 Prompt for AI Agents
In modules/i18n/src/translations/en-US/portals/governance-connectors.ts around
line 323, the string value uses "notification based user verification events"
without a hyphen; change it to "notification-based user verification events" so
the compound adjective is hyphenated correctly.

Comment on lines 343 to 350
notifications: {
configurationUpdate: {
eventPropertiesUpdate: {
error: {
description: "An error occurred while updating the Sift configuration.",
message: "Update Error"
},
success: {
description: "Successfully updated the Sift configuration.",
message: "Update Successful"
description: "An error occurred while updating the event publishing configurations.",
message: "Event Configurations Update Error"
}
}
}
Copy link
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
# Step 1: Find the governance-connectors.ts file
echo "=== Locating governance-connectors.ts ==="
find . -name "governance-connectors.ts" -type f

echo ""
echo "=== Examining lines 343-350 for eventPropertiesUpdate ==="
fd -e ts governance-connectors | while read file; do
  if [ "$(wc -l < "$file")" -gt 340 ]; then
    echo "File: $file"
    echo "Lines 343-350:"
    sed -n '343,350p' "$file"
    echo ""
  fi
done

echo ""
echo "=== Checking for accountDisableHandler and comparing patterns ==="
rg -n "accountDisableHandler" --type ts -A 10 | head -40

echo ""
echo "=== Searching for eventPropertiesUpdate with success notifications ==="
rg -n "eventPropertiesUpdate" --type ts -B 2 -A 5

echo ""
echo "=== Searching for success notification patterns in the file ==="
rg -n "success.*notification|notifications.*success" --type ts modules/i18n

Repository: wso2/identity-apps

Length of output: 9362


Confirm that the eventPropertiesUpdate notification intentionally excludes success handling.

The eventPropertiesUpdate notification defines only an error variant, unlike similar handlers (e.g., accountDisableHandler at lines 445-447) that include both success and error. The type definition in governance-connectors-ns.ts (line 403) explicitly specifies only error: NotificationItem, and the form implementation references only the error notification path. If success feedback is not required for this operation, add a comment explaining why, or consider adding success notifications for consistency with other connectors.

🤖 Prompt for AI Agents
In modules/i18n/src/translations/en-US/portals/governance-connectors.ts around
lines 343 to 350, the eventPropertiesUpdate notification currently only defines
an error variant; either confirm this is intentional by adding an inline comment
explaining why no success message is needed (e.g., operation is silent or UI
already indicates success), or add a matching success entry (message and
description) to mirror other handlers for consistency; update the translation
object accordingly and ensure any consumer code still references the expected
path.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.88%. Comparing base (712a5ac) to head (e5f3761).
⚠️ Report is 763 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9510      +/-   ##
==========================================
+ Coverage   48.75%   55.88%   +7.12%     
==========================================
  Files          42       42              
  Lines        1003     1020      +17     
  Branches      250      254       +4     
==========================================
+ Hits          489      570      +81     
+ Misses        474      416      -58     
+ Partials       40       34       -6     
Flag Coverage Δ
@wso2is/core 55.88% <ø> (+7.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 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.

@@ -0,0 +1,77 @@
/**
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).

Check other files as well :)

brionmario
brionmario previously approved these changes Jan 27, 2026
brionmario
brionmario previously approved these changes Jan 27, 2026
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