Skip to content

Commit

Permalink
feat: implement loader promotion VTEX
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-kerchner committed Jan 13, 2025
1 parent 44e5c4c commit 6c59583
Show file tree
Hide file tree
Showing 7 changed files with 1,690 additions and 23 deletions.
24 changes: 12 additions & 12 deletions blog/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/Author.ts";
import * as $$$3 from "./loaders/Blogpost.ts";
import * as $$$4 from "./loaders/Blogpost.ts";
import * as $$$1 from "./loaders/BlogPostItem.ts";
import * as $$$4 from "./loaders/BlogpostList.ts";
import * as $$$5 from "./loaders/BlogpostListing.ts";
import * as $$$5 from "./loaders/BlogpostList.ts";
import * as $$$6 from "./loaders/BlogpostListing.ts";
import * as $$$2 from "./loaders/BlogPostPage.ts";
import * as $$$6 from "./loaders/Category.ts";
import * as $$$7 from "./loaders/GetCategories.ts";
import * as $$$8 from "./loaders/BlogRelatedPosts.ts";
import * as $$$3 from "./loaders/BlogRelatedPosts.ts";
import * as $$$7 from "./loaders/Category.ts";
import * as $$$8 from "./loaders/GetCategories.ts";
import * as $$$$$$0 from "./sections/Seo/SeoBlogPost.tsx";
import * as $$$$$$1 from "./sections/Seo/SeoBlogPostListing.tsx";
import * as $$$$$$2 from "./sections/Template.tsx";

const manifest = {
"loaders": {
"blog/loaders/Author.ts": $$$0,
"blog/loaders/Blogpost.ts": $$$3,
"blog/loaders/Blogpost.ts": $$$4,
"blog/loaders/BlogPostItem.ts": $$$1,
"blog/loaders/BlogpostList.ts": $$$4,
"blog/loaders/BlogpostListing.ts": $$$5,
"blog/loaders/BlogpostList.ts": $$$5,
"blog/loaders/BlogpostListing.ts": $$$6,
"blog/loaders/BlogPostPage.ts": $$$2,
"blog/loaders/Category.ts": $$$6,
"blog/loaders/GetCategories.ts": $$$7,
"blog/loaders/BlogRelatedPosts.ts": $$$8,
"blog/loaders/BlogRelatedPosts.ts": $$$3,
"blog/loaders/Category.ts": $$$7,
"blog/loaders/GetCategories.ts": $$$8,
},
"sections": {
"blog/sections/Seo/SeoBlogPost.tsx": $$$$$$0,
Expand Down
2 changes: 1 addition & 1 deletion konfidency/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.

import * as $$$0 from "./loaders/productDetailsPage.ts";
import * as $$$$$$$$$0 from "./actions/submitReviews.ts";
import * as $$$0 from "./loaders/productDetailsPage.ts";

const manifest = {
"loaders": {
Expand Down
33 changes: 33 additions & 0 deletions vtex/loaders/promotion/getPromotionById.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { AppContext } from "../../mod.ts";
import type { Document } from "../../utils/types.ts";
import { parseCookie } from "../../utils/vtexId.ts";

interface Props {
/**
* @description Promotion ID.
*/
idCalculatorConfiguration: string;
}

export default async function loader(
props: Props,
req: Request,
ctx: AppContext,
): Promise<Document[]> {
const { vcs } = ctx;
const { idCalculatorConfiguration } = props;
const { cookie } = parseCookie(req.headers, ctx.account);

const promotionById = await vcs
["GET /api/rnb/pvt/calculatorconfiguration/:idCalculatorConfiguration"]({
idCalculatorConfiguration,
}, {
headers: {
accept: "application/json",
"content-type": "application/json",
cookie,
},
}).then((response: Response) => response.json());

return promotionById;
}
22 changes: 12 additions & 10 deletions vtex/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ import * as $$$30 from "./loaders/product/extensions/list.ts";
import * as $$$31 from "./loaders/product/extensions/listingPage.ts";
import * as $$$32 from "./loaders/product/extensions/suggestions.ts";
import * as $$$33 from "./loaders/product/wishlist.ts";
import * as $$$34 from "./loaders/proxy.ts";
import * as $$$35 from "./loaders/user.ts";
import * as $$$36 from "./loaders/wishlist.ts";
import * as $$$37 from "./loaders/workflow/product.ts";
import * as $$$38 from "./loaders/workflow/products.ts";
import * as $$$34 from "./loaders/promotion/getPromotionById.ts";
import * as $$$35 from "./loaders/proxy.ts";
import * as $$$36 from "./loaders/user.ts";
import * as $$$37 from "./loaders/wishlist.ts";
import * as $$$38 from "./loaders/workflow/product.ts";
import * as $$$39 from "./loaders/workflow/products.ts";
import * as $$$$$$0 from "./sections/Analytics/Vtex.tsx";
import * as $$$$$$$$$$0 from "./workflows/events.ts";
import * as $$$$$$$$$$1 from "./workflows/product/index.ts";
Expand Down Expand Up @@ -106,11 +107,12 @@ const manifest = {
"vtex/loaders/product/extensions/listingPage.ts": $$$31,
"vtex/loaders/product/extensions/suggestions.ts": $$$32,
"vtex/loaders/product/wishlist.ts": $$$33,
"vtex/loaders/proxy.ts": $$$34,
"vtex/loaders/user.ts": $$$35,
"vtex/loaders/wishlist.ts": $$$36,
"vtex/loaders/workflow/product.ts": $$$37,
"vtex/loaders/workflow/products.ts": $$$38,
"vtex/loaders/promotion/getPromotionById.ts": $$$34,
"vtex/loaders/proxy.ts": $$$35,
"vtex/loaders/user.ts": $$$36,
"vtex/loaders/wishlist.ts": $$$37,
"vtex/loaders/workflow/product.ts": $$$38,
"vtex/loaders/workflow/products.ts": $$$39,
},
"handlers": {
"vtex/handlers/sitemap.ts": $$$$0,
Expand Down
Loading

0 comments on commit 6c59583

Please sign in to comment.