Skip to content

Commit

Permalink
feat: corrigido erro no wake secret
Browse files Browse the repository at this point in the history
  • Loading branch information
caiodna360 committed Dec 22, 2023
1 parent 01f06c3 commit e177004
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DECO_SITE_NAME=tools-dna
DECO_SITE_NAME=tools-dna
WORLD_TOOLS_STOREFRONT=tcs_world_87fcfcee43194e71a38974f4494275be
19 changes: 14 additions & 5 deletions components/product/ProductCardCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ function ProductCardCustom(
isVariantOf,
brand,
} = product;

const id = `product-card-${productID}`;
const hasVariant = isVariantOf?.hasVariant ?? [];
const productGroupID = isVariantOf?.productGroupID;
const description = product.description || isVariantOf?.description;
const [front, back] = images ?? [];
const { listPrice, price, installments } = useOffer(offers);
const { listPrice, price, installments, pixPrice } = useOffer(offers);
const possibilities = useVariantPossibilities(hasVariant, product);
const variants = Object.entries(Object.values(possibilities)[0] ?? {});

Expand Down Expand Up @@ -244,13 +245,20 @@ function ProductCardCustom(
{/* BRAND IMAGE */}
<a
style="display: block;min-height: 32px"
href={`/fabricante/${brandContent?.replace(" ", "-")}`}
// data-id={brand?.logo}
href={brand?.url}
>
<img
{
/* <img
style={{ maxWidth: "100px" }}
src={`https://worldtools.fbitsstatic.net/img/fb/${
brandContent?.replace(" ", "-")
}.png`}
/> */
}
<img
style={{ maxWidth: "100px" }}
src={brand?.logo}
/>
</a>
{l?.hide?.productName ? "" : (
Expand Down Expand Up @@ -283,10 +291,11 @@ function ProductCardCustom(
l?.basics?.oldPriceSize === "Normal" ? "lg:text-xl" : ""
}`}
>
De {formatPrice(listPrice, offers?.priceCurrency)}
De: {formatPrice(listPrice, offers?.priceCurrency)}
</div>
<div class="card-price text-base-600 text-xl lg:text-xl">
{formatPrice(price, offers?.priceCurrency)}
{/* {formatPrice(price, offers?.priceCurrency)} */}
{formatPrice(pixPrice, offers?.priceCurrency)}
</div>
</div>
{l?.hide?.installments
Expand Down
4 changes: 2 additions & 2 deletions components/product/ProductCardOdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function ProductCardOdd(
const productGroupID = isVariantOf?.productGroupID;
const description = product.description || isVariantOf?.description;
const [front, back] = images ?? [];
const { listPrice, price, installments } = useOffer(offers);
const { listPrice, price, installments, pixPrice } = useOffer(offers);
const possibilities = useVariantPossibilities(hasVariant, product);
const variants = Object.entries(Object.values(possibilities)[0] ?? {});

Expand Down Expand Up @@ -290,7 +290,7 @@ function ProductCardOdd(
De {formatPrice(listPrice, offers?.priceCurrency)}
</div>
<div class="card-price text-base-600 text-xl lg:text-xl">
{formatPrice(price, offers?.priceCurrency)}
{formatPrice(pixPrice, offers?.priceCurrency)}
</div>
</div>
{l?.hide?.installments
Expand Down
5 changes: 5 additions & 0 deletions sdk/useOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const installmentToString = (
return `${billingDuration}x no cartão`;
};


export const useOffer = (aggregateOffer?: AggregateOffer) => {
const offer = aggregateOffer?.offers[0];
const listPrice = offer?.priceSpecification.find((spec) =>
Expand All @@ -61,13 +62,17 @@ export const useOffer = (aggregateOffer?: AggregateOffer) => {
const installment = offer?.priceSpecification.reduce(bestInstallment, null);
const seller = offer?.seller;
const price = offer?.price;
const pixPrice = offer?.priceSpecification.find((item) =>
item.name === "PIX"
);
const availability = offer?.availability;

return {
price,
listPrice: listPrice?.price,
availability,
seller,
pixPrice: pixPrice?.price,
installments: installment && price
? installmentToString(installment)
: null,
Expand Down

0 comments on commit e177004

Please sign in to comment.