Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nuvemshop/loaders/productList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function loader(
const response = await api["GET /v1/:storeId/products"]({
storeId: storeId,
q: props.term || "",
sort_by: props.sort || "user",
sort_by: props.sort || "price-ascending",
per_page: props.limit || 10,
});
result = await response.json();
Expand Down
5 changes: 3 additions & 2 deletions nuvemshop/loaders/productListingPage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ProductListingPage } from "../../commerce/types.ts";
import { AppContext } from "../mod.ts";
import { ProductBaseNuvemShop } from "../utils/types.ts";
import { NuvemShopSort, ProductBaseNuvemShop } from "../utils/types.ts";
import { toProduct } from "../utils/transform.ts";

export interface Props {
Expand All @@ -15,6 +15,7 @@ export interface Props {
limit: number;
// Sort in NuvemShort do not work when using q in query params
// sort?: NuvemShopSort;
sort?: NuvemShopSort;

/**
* @hide true
Expand Down Expand Up @@ -59,7 +60,7 @@ async function loader(
per_page,
price_max: maxPrice,
price_min: minPrice,
sort_by: "price-ascending",
sort_by: props.sort || "price-descending",
});
result = await response.json();
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions nuvemshop/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function Nuvemshop({ storeId, accessToken, publicUrl }: Props) {
headers.set("accept", "application/json");
headers.set("Authentication", `bearer ${stringAccessToken}`);
headers.set("content-type", "application/json");
headers.set("User-Agent", storeId);
const api = createHttpClient<NuvemShopAPI>({
base: `${BASE_URL}`,
fetcher: fetchSafe,
Expand Down
1 change: 0 additions & 1 deletion nuvemshop/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export interface Category {
updated_at: Date;
}
export type NuvemShopSort =
| "user"
| "price-ascending"
| "price-descending"
| "alpha-ascending"
Expand Down
4 changes: 4 additions & 0 deletions website/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ const optimizeVTEX = (opts: OptimizationOptions) => {
export const getOptimizedMediaUrl = (opts: OptimizationOptions) => {
const { originalSrc, width, height, fit } = opts;

if (originalSrc.startsWith("https://dcdn-us.mitiendanube.com")) {
return originalSrc;
}

if (originalSrc.startsWith("data:")) {
return originalSrc;
}
Expand Down
Loading