From d26ffb9c653fe28a647379ead836879ab19c0642 Mon Sep 17 00:00:00 2001 From: elizabeth-ilina Date: Fri, 3 Oct 2025 14:04:12 -0400 Subject: [PATCH] fix(payments-next): [SP3] Postal Code field on country selector modal allows unlimited charaters Because: * The Postal Code field allows a large number of characters. This commit: * Makes Postal Code field limited to a predefined number of characters. Closes #PAY-3229 --- .../lib/client/components/SelectTaxLocation/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/payments/ui/src/lib/client/components/SelectTaxLocation/index.tsx b/libs/payments/ui/src/lib/client/components/SelectTaxLocation/index.tsx index 43d4164d23f..218e367409c 100644 --- a/libs/payments/ui/src/lib/client/components/SelectTaxLocation/index.tsx +++ b/libs/payments/ui/src/lib/client/components/SelectTaxLocation/index.tsx @@ -421,6 +421,16 @@ const Expanded = ({ invalidPostalCode: false, })); }} + onInvalid={(e: React.FormEvent) => { + if (e?.currentTarget?.validity?.patternMismatch) { + setServerErrors((prev) => ({ + ...prev, + invalidPostalCode: true, + })); + } + }} + pattern="^[\p{L}\p{N}\s\-\.\,]{1,15}$" + maxLength={15} defaultValue={initialPostalCode} required aria-required