Skip to content

Conversation

@ddiestra
Copy link
Contributor

Description

Testing required outside of automated testing?

  • Not Applicable

Screenshots (if appropriate):

Screenshot 2025-08-21 at 11 02 03 PM
  • Not Applicable

Rollback / Rollforward Procedure

  • Roll Forward
  • Roll Back

Reviewer Checklist

  • Description of Change
  • Description of outside testing if applicable.
  • Description of Roll Forward / Backward Procedure
  • Documentation updated for Change

@ddiestra ddiestra requested a review from a team as a code owner August 22, 2025 04:02
@ddiestra ddiestra force-pushed the bin-lookup-brand-selector branch from 977f610 to 55e1419 Compare August 27, 2025 20:32
@ddiestra ddiestra force-pushed the bin-lookup-brand-selector branch from 55e1419 to 2d5a60a Compare October 15, 2025 15:44
@ddiestra ddiestra requested a review from kevinperaza October 22, 2025 11:43
@ddiestra ddiestra force-pushed the bin-lookup-brand-selector branch from 2d5a60a to 3db305d Compare October 22, 2025 11:46
@ddiestra ddiestra force-pushed the bin-lookup-brand-selector branch from 3db305d to 417e20c Compare October 24, 2025 15:00
chore: remove console.log
Comment on lines +39 to +51
const hasCoBadgedSupport = (coBadgedSupport?.length ?? 0) > 0;

if (hasCoBadgedSupport && coBadgedSupport) {
const validValues = Object.values(CoBadgedSupport);
const invalidValues = coBadgedSupport.filter(value => !validValues.includes(value));

if (invalidValues.length > 0) {
throw new Error(
`Invalid coBadgedSupport values: ${invalidValues.join(', ')}. ` +
`Valid values are: ${validValues.join(', ')}`
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this also be wrapped in a useEffect?

Comment on lines +77 to +92
let errors = validate(value);

// Check if selectedNetwork is required but not set
const requiresNetworkSelection = !isNilOrEmpty(coBadgedSupport) && (brandOptionsCount ?? 0) > 1;
const networkNotSelected = requiresNetworkSelection && !selectedNetwork;

// Add network selection error if required but not selected
if (networkNotSelected && !empty) {
const networkError = {
targetId: type,
type: 'network_not_selected' as const,
};
errors = errors ? [...errors, networkError] : [networkError];
}

const valid = !empty && !errors && !networkNotSelected;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move this to a smaller function and test it in isolation?

Comment on lines +40 to +61
useEffect(() => {
const currentState = _elementMetadata[element.id];
const newMetadata = {
binInfo: element.binInfo,
selectedNetwork: element.selectedNetwork,
};

const hasChanged =
currentState?.binInfo !== newMetadata.binInfo ||
currentState?.selectedNetwork !== newMetadata.selectedNetwork;

if (hasChanged && onChange) {
const event = createEvent(_elementRawValues[element.id]?.toString() || '');
onChange(event);
}

_elementMetadata[element.id] = {
...currentState,
...newMetadata,
};
}, [element.binInfo, element.selectedNetwork, onChange, createEvent, element.id]);

Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if we should also encapsulate in a hook and test it independently 🤔

@ddiestra ddiestra merged commit b9bc3c8 into master Nov 4, 2025
4 checks passed
@ddiestra ddiestra deleted the bin-lookup-brand-selector branch November 4, 2025 16:13
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.

3 participants