Skip to content

FEC-365: Extend UI-kit MoneyInput with Non-Iso Currencies#3223

Merged
nima-ct merged 4 commits intomainfrom
FEC-365-extends-money-inputs-non-iso
Mar 18, 2026
Merged

FEC-365: Extend UI-kit MoneyInput with Non-Iso Currencies#3223
nima-ct merged 4 commits intomainfrom
FEC-365-extends-money-inputs-non-iso

Conversation

@nima-ct
Copy link
Collaborator

@nima-ct nima-ct commented Mar 13, 2026

Summary

This PR adds support for non-ISO currency variants (HUF0, KZT0,...) in the currency lookup table from MoneyInput

This change is needed so that non-ISO currencies are correctly recognized and handled in the Merchant Center money inputs.

https://commercetools.atlassian.net/browse/FEC-354

@nima-ct nima-ct self-assigned this Mar 13, 2026
@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2026

🦋 Changeset detected

Latest commit: 573f2e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 98 packages
Name Type
@commercetools-uikit/money-input Minor
@commercetools-uikit/money-field Minor
@commercetools-uikit/localized-money-input Minor
@commercetools-uikit/inputs Minor
@commercetools-uikit/fields Minor
@commercetools-frontend/ui-kit Minor
@commercetools-uikit/design-system Minor
@commercetools-uikit/calendar-time-utils Minor
@commercetools-uikit/calendar-utils Minor
@commercetools-uikit/hooks Minor
@commercetools-uikit/i18n Minor
@commercetools-uikit/localized-utils Minor
@commercetools-uikit/utils Minor
@commercetools-uikit/accessible-hidden Minor
@commercetools-uikit/avatar Minor
@commercetools-uikit/card Minor
@commercetools-uikit/collapsible-motion Minor
@commercetools-uikit/collapsible-panel Minor
@commercetools-uikit/collapsible Minor
@commercetools-uikit/constraints Minor
@commercetools-uikit/data-table-manager Minor
@commercetools-uikit/data-table Minor
@commercetools-uikit/field-errors Minor
@commercetools-uikit/field-label Minor
@commercetools-uikit/field-warnings Minor
@commercetools-uikit/filters Minor
@commercetools-uikit/grid Minor
@commercetools-uikit/icons Minor
@commercetools-uikit/label Minor
@commercetools-uikit/link Minor
@commercetools-uikit/loading-spinner Minor
@commercetools-uikit/messages Minor
@commercetools-uikit/notifications Minor
@commercetools-uikit/pagination Minor
@commercetools-uikit/primary-action-dropdown Minor
@commercetools-uikit/progress-bar Minor
@commercetools-uikit/quick-filters Minor
@commercetools-uikit/stamp Minor
@commercetools-uikit/tag Minor
@commercetools-uikit/text Minor
@commercetools-uikit/tooltip Minor
@commercetools-uikit/view-switcher Minor
@commercetools-uikit/accessible-button Minor
@commercetools-uikit/flat-button Minor
@commercetools-uikit/icon-button Minor
@commercetools-uikit/link-button Minor
@commercetools-uikit/primary-button Minor
@commercetools-uikit/secondary-button Minor
@commercetools-uikit/secondary-icon-button Minor
@commercetools-uikit/dropdown-menu Minor
@commercetools-uikit/async-creatable-select-field Minor
@commercetools-uikit/async-select-field Minor
@commercetools-uikit/creatable-select-field Minor
@commercetools-uikit/date-field Minor
@commercetools-uikit/date-range-field Minor
@commercetools-uikit/date-time-field Minor
@commercetools-uikit/localized-multiline-text-field Minor
@commercetools-uikit/localized-text-field Minor
@commercetools-uikit/multiline-text-field Minor
@commercetools-uikit/number-field Minor
@commercetools-uikit/password-field Minor
@commercetools-uikit/radio-field Minor
@commercetools-uikit/search-select-field Minor
@commercetools-uikit/select-field Minor
@commercetools-uikit/text-field Minor
@commercetools-uikit/time-field Minor
@commercetools-uikit/async-creatable-select-input Minor
@commercetools-uikit/async-select-input Minor
@commercetools-uikit/checkbox-input Minor
@commercetools-uikit/creatable-select-input Minor
@commercetools-uikit/date-input Minor
@commercetools-uikit/date-range-input Minor
@commercetools-uikit/date-time-input Minor
@commercetools-uikit/input-utils Minor
@commercetools-uikit/localized-multiline-text-input Minor
@commercetools-uikit/localized-rich-text-input Minor
@commercetools-uikit/localized-text-input Minor
@commercetools-uikit/multiline-text-input Minor
@commercetools-uikit/number-input Minor
@commercetools-uikit/password-input Minor
@commercetools-uikit/radio-input Minor
@commercetools-uikit/rich-text-input Minor
@commercetools-uikit/rich-text-utils Minor
@commercetools-uikit/search-select-input Minor
@commercetools-uikit/search-text-input Minor
@commercetools-uikit/select-input Minor
@commercetools-uikit/select-utils Minor
@commercetools-uikit/selectable-search-input Minor
@commercetools-uikit/text-input Minor
@commercetools-uikit/time-input Minor
@commercetools-uikit/toggle-input Minor
@commercetools-uikit/spacings-inline Minor
@commercetools-uikit/spacings-inset-squish Minor
@commercetools-uikit/spacings-inset Minor
@commercetools-uikit/spacings-stack Minor
@commercetools-uikit/buttons Minor
@commercetools-uikit/spacings Minor
visual-testing-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Mar 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ui-kit Ready Ready Preview, Comment Mar 17, 2026 2:27pm

Request Review

@nima-ct nima-ct marked this pull request as ready for review March 13, 2026 13:50
@nima-ct nima-ct requested a review from a team as a code owner March 13, 2026 13:50
@nima-ct nima-ct changed the title FEC-365: Extends UI-kit MoneyInput with Non-Iso Currencies FEC-365: Extend UI-kit MoneyInput with Non-Iso Currencies Mar 13, 2026
Copy link
Contributor

@ByronDWall ByronDWall left a comment

Choose a reason for hiding this comment

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

This is a good safeguard and I'm going to approve, but I think it's worth considering a less naive fallback for the fractionDigits than always defaulting to 2.

currencyCode,
centAmount: NaN,
fractionDigits: allCurrencies[currencyCode].fractionDigits,
fractionDigits: allCurrencies[currencyCode].fractionDigits ?? 2,
Copy link
Contributor

@ByronDWall ByronDWall Mar 17, 2026

Choose a reason for hiding this comment

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

It's more verbose, but I think it would make sense to get the CLDR fraction digits for a currency code, I think the error state if the currency code isn't ISO standard when it has no fractionDigits would be very helpful. Also, I could see future issues if we naively default to 2.

Suggested change
fractionDigits: allCurrencies[currencyCode].fractionDigits ?? 2,
let fractionDigits = allCurrencies[currencyCode].fractionDigits;
if(!fractionDigits){
const formatter = new Intl.NumberFormat(locale, {
style: "currency",
currencyCode
});
// KRW → 0, USD → 2, BHD → 3
const { minimumFractionDigits } = formatter.resolvedOptions();
let fractionDigits = minimumFractionDigits;
}
const createEmptyMoneyValue = (currencyCode: TCurrencyCode): TMoneyValue => ({
type: 'centPrecision',
currencyCode,
centAmount: NaN,
fractionDigits
});

Copy link
Contributor

Choose a reason for hiding this comment

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

It does make sense, I mean it changes a default to the correct default, but it also changes existing behavior. Personally I can't foresee possible side-effects, but I can imagine there are some so this is probably better tackled in its own ticket.

@nima-ct
Copy link
Collaborator Author

nima-ct commented Mar 18, 2026

This is a good safeguard and I'm going to approve, but I think it's worth considering a less naive fallback for the fractionDigits than always defaulting to 2.

@ByronDWall Thx for pointing this out
Looking closer, I see that the component assumes in several other places known currency codes that can only be resolved via the lookup table.
I think addressing it in one spot won’t solve the overall issue. Unknown currency would throw in other places.
A proper solution would require a broader refactor. Let me know what you think.

@nima-ct nima-ct merged commit 4640ec0 into main Mar 18, 2026
9 checks passed
@nima-ct nima-ct deleted the FEC-365-extends-money-inputs-non-iso branch March 18, 2026 10:07
@ct-changesets ct-changesets bot mentioned this pull request Mar 18, 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.

3 participants