Skip to content

Commit

Permalink
Merge pull request #584 from team-monite/fix/products-services-error-…
Browse files Browse the repository at this point in the history
…improvements

fix(DEV-14050): Improve error messages in products and services
  • Loading branch information
marcperezmonite authored Feb 18, 2025
2 parents 0c0892d + 18df891 commit 2fe07d1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/serious-games-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@monite/sdk-react': patch
'@monite/sdk-drop-in': patch
---

Improve error messages in Products&Services component
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ export const getValidationSchema = (i18n: I18n) =>
.required(),
smallestAmount: yup
.number()
.min(0)
.typeError(t(i18n)`Please enter a number`)
.min(0, t(i18n)`Minimum quantity must be 0 or greater`)
.label(t(i18n)`Minimum quantity`)
.required(),
pricePerUnit: yup
.number()
.typeError(t(i18n)`Please enter a number`)
.min(0)
.label(t(i18n)`Price per unit`)
.required(),
Expand All @@ -45,7 +47,10 @@ export const getValidationSchema = (i18n: I18n) =>
.oneOf(currenciesToStringArray(getCurrencies(i18n)))
.label(t(i18n)`Currency`)
.required(),
description: yup.string().label(t(i18n)`Description`),
description: yup
.string()
.max(255)
.label(t(i18n)`Description`),
});

export type IProductFormSubmitValues = yup.InferType<
Expand Down
17 changes: 13 additions & 4 deletions packages/sdk-react/src/core/i18n/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ msgstr "Cuba"
#: src/components/onboarding/OnboardingBankAccount/OnboardingBankAccount.tsx:58
#: src/components/onboarding/validators/validationSchemas.ts:116
#: src/components/payables/PayableDetails/PayableDetailsForm/PayableDetailsForm.tsx:137
#: src/components/products/ProductDetails/validation.ts:46
#: src/components/products/ProductDetails/validation.ts:48
#: src/components/receivables/InvoiceDetails/CreateReceivable/validation.ts:13
#: src/components/receivables/InvoiceDetails/CreateReceivable/validation.ts:85
#: src/ui/Currency/MoniteCurrency.tsx:51
Expand Down Expand Up @@ -2355,7 +2355,7 @@ msgstr "Department Stores"
#: src/components/approvalPolicies/ApprovalPolicyDetails/ExistingApprovalPolicyDetailsAdvanced/ExistingApprovalPolicyDetailsAdvanced.tsx:84
#: src/components/products/ProductDetails/components/ProductForm/ProductForm.tsx:97
#: src/components/products/ProductDetails/ExistingProductDetails.tsx:165
#: src/components/products/ProductDetails/validation.ts:48
#: src/components/products/ProductDetails/validation.ts:53
#: src/components/receivables/InvoiceDetails/CreateReceivable/sections/components/PaymentTerms/PaymentTermsForm.tsx:165
msgid "Description"
msgstr "Description"
Expand Down Expand Up @@ -4394,10 +4394,14 @@ msgstr "Minimum number of approvals required"

#: src/components/products/ProductDetails/components/ProductForm/ProductForm.tsx:160
#: src/components/products/ProductDetails/ExistingProductDetails.tsx:185
#: src/components/products/ProductDetails/validation.ts:36
#: src/components/products/ProductDetails/validation.ts:37
msgid "Minimum quantity"
msgstr "Minimum quantity"

#: src/components/products/ProductDetails/validation.ts:36
msgid "Minimum quantity must be 0 or greater"
msgstr "Minimum quantity must be 0 or greater"

#: src/components/onboarding/dicts/mccCodes.ts:884
msgid "Miscellaneous Apparel and Accessory Shops"
msgstr "Miscellaneous Apparel and Accessory Shops"
Expand Down Expand Up @@ -5315,6 +5319,11 @@ msgstr "Please add any individual who owns 25% or more of your business."
msgid "Please correct the errors in persons information."
msgstr "Please correct the errors in persons information."

#: src/components/products/ProductDetails/validation.ts:35
#: src/components/products/ProductDetails/validation.ts:41
msgid "Please enter a number"
msgstr "Please enter a number"

#: src/components/onboarding/validators/validators.ts:139
msgid "Please enter a phone number."
msgstr "Please enter a phone number."
Expand Down Expand Up @@ -5475,7 +5484,7 @@ msgstr "Price"

#: src/components/products/ProductDetails/components/ProductForm/ProductForm.tsx:174
#: src/components/products/ProductDetails/ExistingProductDetails.tsx:189
#: src/components/products/ProductDetails/validation.ts:41
#: src/components/products/ProductDetails/validation.ts:43
#: src/components/products/ProductsTable/ProductsTable.tsx:212
msgid "Price per unit"
msgstr "Price per unit"
Expand Down

0 comments on commit 2fe07d1

Please sign in to comment.