Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[linx] Add DisplayPrice on transform product, and remove cf headers from auctions details page #954

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
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 deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@
"jsx": "react-jsx",
"jsxImportSource": "preact"
},
"version": "0.56.12"
"version": "0.56.13"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "0.56.13"
"version": "0.56.12"

}
10 changes: 9 additions & 1 deletion linx/loaders/auction/detailsPage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AppContext } from "../../../linx/mod.ts";
import { nullOnNotFound } from "../../../utils/http.ts";
import { removeCFHeaders } from "../../../website/handlers/proxy.ts";
import { isAuctionDetailModel } from "../../utils/paths.ts";
import { toAuctionDetail } from "../../utils/transform.ts";
import { Model as AuctionDetail } from "../../utils/types/auctionDetailJSON.ts";
Expand All @@ -17,12 +18,19 @@ const loader = async (
const upstream = new URL(req.url);
const splat = upstream.pathname.slice(1);

const headers = new Headers(req.headers);
removeCFHeaders(headers)

const response = await api["GET /*splat"]({
splat,
}, {
headers: req.headers,
headers: {
...headers,
},
}).catch(nullOnNotFound);

console.log(response)

Comment on lines +32 to +33
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(response)

if (response === null) {
return null;
}
Expand Down
8 changes: 8 additions & 0 deletions linx/utils/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,20 @@ export const toProduct = (
additionalType: "categoryItem",
}));

const displayPrice = {
"@type": "PropertyValue",
name: product.DisplayPrice,
value: product.DisplayPrice,
additionalType: "displayPrice",
};

const additionalProperty = [
...skuOptions,
...metadatas,
...descriptions,
...prodOptions,
...categoryItems,
displayPrice,
];

const hasVariant = level < 1
Expand Down
Loading