-
Notifications
You must be signed in to change notification settings - Fork 335
Improve Sift configuration page #9510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this 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: Addtype="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 theformparameter.The
formparameter 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
⛔ Files ignored due to path filters (1)
modules/theme/src/themes/wso2is/assets/images/connectors/sift.svgis 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
resolveEventPropertyMappingsmethod 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
fraudDetectionConfigurationsendpoint 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
fraudDetectionConfigurationsproperty 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
getSiftConnectorIconfunction 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
updateEventPublishingConfigurationsfunction correctly uses the centralized endpoint configuration, includes appropriate headers, and properly wraps errors inIdentityAppsApiException.features/admin.server-configurations.v1/api/use-fraud-detection-configurations.ts (1)
28-51: LGTM! Well-designed React hook with proper typing.The
useFraudDetectionConfigurationshook 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.
| 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 ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
| 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> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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") | ||
| }) | ||
| ); | ||
| }); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add guard against submitting empty events and provide success feedback.
Two concerns:
-
If
enrichedFraudDetectionConfigurationsis undefined when submitting, an emptyeventsarray is sent which could overwrite existing configurations on the server. -
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.
| 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 | ||
| }; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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].
features/admin.server-configurations.v1/forms/sift-connector-form/sift-connector-form.tsx
Show resolved
Hide resolved
| }, | ||
| userVerifications: { | ||
| label: "User Verifications", | ||
| hint: "Publish notification based user verification events." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
| 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.
| 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" | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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/i18nRepository: 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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| @@ -0,0 +1,77 @@ | |||
| /** | |||
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | |
| * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). |
Check other files as well :)
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
Key changes:
Fraud Detection Event Publishing Support
updateEventPublishingConfigurations) for updating fraud detection event publishing configurations, and a React hook (useFraudDetectionConfigurations) for fetching them. [1] [2]fraud-detection.tsto represent fraud detection configuration data structures, including event properties and metadata.Endpoint and State Integration
fraudDetectionConfigurationsendpoint to resource endpoint configs and models, and initialized its state in the config reducer. [1] [2] [3]UI and Icon Support
Utility Enhancements
GovernanceConnectorUtilswith a method to resolve mappings for fraud analytic event metadata, supporting dynamic UI rendering and i18n. [1] [2]Internationalization (i18n)
Purpose
Related Issues
Related PRs
Checklist
Security checks
Developer Checklist (Mandatory)
product-isissue to track any behavioral change or migration impact.Summary by CodeRabbit
New Features
API / Data
Localization
Chore
✏️ Tip: You can customize this high-level summary in your review settings.