Skip to content

Commit

Permalink
create sales channel loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
guitavano committed Nov 12, 2024
1 parent 4bcb115 commit e020a97
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 40 deletions.
22 changes: 22 additions & 0 deletions vtex/loaders/logistics/getSalesChannelById.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { AppContext } from "../../mod.ts";
import { SalesChannel } from "../../utils/types.ts";

interface Props {
id: string;
}

export default async function loader(
props: Props,
_req: Request,
ctx: AppContext,
): Promise<SalesChannel> {
const { vcs } = ctx;

const salesChannel = await vcs
["GET /api/catalog_system/pub/saleschannel/:salesChannelId"]({
salesChannelId: props.id,
})
.then((r) => r.json());

return salesChannel;
}
22 changes: 22 additions & 0 deletions vtex/loaders/logistics/listSalesChannelById.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { AppContext } from "../../mod.ts";
import { SalesChannel } from "../../utils/types.ts";

interface Props {
id: string;
}

export default async function loader(
props: Props,
_req: Request,
ctx: AppContext,
): Promise<SalesChannel[]> {
const { vcs } = ctx;

const salesChannel = await vcs
["GET /api/catalog_system/pvt/saleschannel/list"]({
salesChannelId: props.id,
})
.then((r) => r.json());

return salesChannel;
}
84 changes: 44 additions & 40 deletions vtex/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,28 @@ import * as $$$13 from "./loaders/legacy/productList.ts";
import * as $$$14 from "./loaders/legacy/productListingPage.ts";
import * as $$$15 from "./loaders/legacy/relatedProductsLoader.ts";
import * as $$$16 from "./loaders/legacy/suggestions.ts";
import * as $$$17 from "./loaders/logistics/listPickupPoints.ts";
import * as $$$18 from "./loaders/logistics/listPickupPointsByLocation.ts";
import * as $$$19 from "./loaders/logistics/listStockByStore.ts";
import * as $$$20 from "./loaders/masterdata/searchDocuments.ts";
import * as $$$21 from "./loaders/navbar.ts";
import * as $$$22 from "./loaders/options/productIdByTerm.ts";
import * as $$$23 from "./loaders/orders/list.ts";
import * as $$$24 from "./loaders/paths/PDPDefaultPath.ts";
import * as $$$25 from "./loaders/paths/PLPDefaultPath.ts";
import * as $$$26 from "./loaders/product/extend.ts";
import * as $$$27 from "./loaders/product/extensions/detailsPage.ts";
import * as $$$28 from "./loaders/product/extensions/list.ts";
import * as $$$29 from "./loaders/product/extensions/listingPage.ts";
import * as $$$30 from "./loaders/product/extensions/suggestions.ts";
import * as $$$31 from "./loaders/product/wishlist.ts";
import * as $$$32 from "./loaders/proxy.ts";
import * as $$$33 from "./loaders/user.ts";
import * as $$$34 from "./loaders/wishlist.ts";
import * as $$$35 from "./loaders/workflow/product.ts";
import * as $$$36 from "./loaders/workflow/products.ts";
import * as $$$17 from "./loaders/logistics/getSalesChannelById.ts";
import * as $$$18 from "./loaders/logistics/listPickupPoints.ts";
import * as $$$19 from "./loaders/logistics/listPickupPointsByLocation.ts";
import * as $$$20 from "./loaders/logistics/listSalesChannelById.ts";
import * as $$$21 from "./loaders/logistics/listStockByStore.ts";
import * as $$$22 from "./loaders/masterdata/searchDocuments.ts";
import * as $$$23 from "./loaders/navbar.ts";
import * as $$$24 from "./loaders/options/productIdByTerm.ts";
import * as $$$25 from "./loaders/orders/list.ts";
import * as $$$26 from "./loaders/paths/PDPDefaultPath.ts";
import * as $$$27 from "./loaders/paths/PLPDefaultPath.ts";
import * as $$$28 from "./loaders/product/extend.ts";
import * as $$$29 from "./loaders/product/extensions/detailsPage.ts";
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 $$$$$$0 from "./sections/Analytics/Vtex.tsx";
import * as $$$$$$$$$$0 from "./workflows/events.ts";
import * as $$$$$$$$$$1 from "./workflows/product/index.ts";
Expand All @@ -87,26 +89,28 @@ const manifest = {
"vtex/loaders/legacy/productListingPage.ts": $$$14,
"vtex/loaders/legacy/relatedProductsLoader.ts": $$$15,
"vtex/loaders/legacy/suggestions.ts": $$$16,
"vtex/loaders/logistics/listPickupPoints.ts": $$$17,
"vtex/loaders/logistics/listPickupPointsByLocation.ts": $$$18,
"vtex/loaders/logistics/listStockByStore.ts": $$$19,
"vtex/loaders/masterdata/searchDocuments.ts": $$$20,
"vtex/loaders/navbar.ts": $$$21,
"vtex/loaders/options/productIdByTerm.ts": $$$22,
"vtex/loaders/orders/list.ts": $$$23,
"vtex/loaders/paths/PDPDefaultPath.ts": $$$24,
"vtex/loaders/paths/PLPDefaultPath.ts": $$$25,
"vtex/loaders/product/extend.ts": $$$26,
"vtex/loaders/product/extensions/detailsPage.ts": $$$27,
"vtex/loaders/product/extensions/list.ts": $$$28,
"vtex/loaders/product/extensions/listingPage.ts": $$$29,
"vtex/loaders/product/extensions/suggestions.ts": $$$30,
"vtex/loaders/product/wishlist.ts": $$$31,
"vtex/loaders/proxy.ts": $$$32,
"vtex/loaders/user.ts": $$$33,
"vtex/loaders/wishlist.ts": $$$34,
"vtex/loaders/workflow/product.ts": $$$35,
"vtex/loaders/workflow/products.ts": $$$36,
"vtex/loaders/logistics/getSalesChannelById.ts": $$$17,
"vtex/loaders/logistics/listPickupPoints.ts": $$$18,
"vtex/loaders/logistics/listPickupPointsByLocation.ts": $$$19,
"vtex/loaders/logistics/listSalesChannelById.ts": $$$20,
"vtex/loaders/logistics/listStockByStore.ts": $$$21,
"vtex/loaders/masterdata/searchDocuments.ts": $$$22,
"vtex/loaders/navbar.ts": $$$23,
"vtex/loaders/options/productIdByTerm.ts": $$$24,
"vtex/loaders/orders/list.ts": $$$25,
"vtex/loaders/paths/PDPDefaultPath.ts": $$$26,
"vtex/loaders/paths/PLPDefaultPath.ts": $$$27,
"vtex/loaders/product/extend.ts": $$$28,
"vtex/loaders/product/extensions/detailsPage.ts": $$$29,
"vtex/loaders/product/extensions/list.ts": $$$30,
"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,
},
"handlers": {
"vtex/handlers/sitemap.ts": $$$$0,
Expand Down
24 changes: 24 additions & 0 deletions vtex/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1339,3 +1339,27 @@ export interface Orders {
};
};
}

export interface SalesChannel {
Id?: number;
Name?: string;
IsActive?: boolean;
ProductClusterId?: number | null;
CountryCode?: string;
CultureInfo?: string;
TimeZone?: string;
CurrencyCode?: string;
CurrencySymbol?: string;
CurrencyLocale?: number;
CurrencyFormatInfo?: {
CurrencyDecimalDigits?: number;
CurrencyDecimalSeparator?: string;
CurrencyGroupSeparator?: string;
CurrencyGroupSize?: number;
StartsWithCurrencySymbol?: boolean;
};
Origin?: string | null;
Position?: number | null;
ConditionRule?: string | null;
CurrencyDecimalDigits?: number;
}

0 comments on commit e020a97

Please sign in to comment.