Skip to content

Commit

Permalink
feat(ui): use UUID to display the price in PriceWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
AliKdhim87 authored and Robbert committed Apr 15, 2024
1 parent 8e5ef8a commit 2019a9d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/ui/src/components/PriceWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type PriceTypes = {
value: string;
label: string;
currency: string;
id: string;
uuid?: string;
};

type FormatCurrencyTypes = {
Expand Down Expand Up @@ -43,9 +43,13 @@ export const PriceWidget = ({
freeProductText?: string;
}) => {
if (id && priceData && priceData.length > 0) {
const product = priceData.find(({ id: priceDataId }) => priceDataId === id);
const product = priceData.find(({ uuid }) => uuid === id);

if (!product) {
return null;
}
const price = formatCurrency({
price: Number(product?.value),
price: parseFloat(product?.value),
currency: product?.currency || 'EUR',
locale,
freeProductText,
Expand Down

0 comments on commit 2019a9d

Please sign in to comment.