diff --git a/accounts/yourViews.ts b/accounts/yourViews.ts deleted file mode 100644 index f592b64f..00000000 --- a/accounts/yourViews.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { ConfigYourViews } from "../commerce/yourViews/client.ts"; - -function YourViews(config: ConfigYourViews) { - return config; -} - -export default YourViews; diff --git a/commerce/yourViews/client.ts b/commerce/yourViews/client.ts index 8bf96b53..f97f12e6 100644 --- a/commerce/yourViews/client.ts +++ b/commerce/yourViews/client.ts @@ -1,5 +1,6 @@ +import DataLoader from "https://esm.sh/dataloader@2.2.2"; import { fetchAPI } from "../../utils/fetchAPI.ts"; -import { Ratings, Reviews } from "./types.ts"; +import { Rating, Ratings, Reviews } from "./types.ts"; export type ClientYourViews = ReturnType; @@ -14,42 +15,66 @@ export interface PaginationOptions { } const baseUrl = "http://service.yourviews.com.br"; +export type RatingFetcher = (productIds: string) => Promise; +const fetcherPool: Record< + string, + RatingFetcher +> = {}; -export const createClient = ({ token, appId }: ConfigYourViews) => { +const sameOrder = ( + productIds: readonly string[], + elements: Rating[], +): (Rating | undefined)[] => { + const ordered = new Array(productIds.length).fill( + undefined, + ); + for (let i = 0; i < productIds.length; i++) { + const ratingIdx = elements.findIndex((e) => e.ProductId === productIds[i]); + if (ratingIdx !== -1) { + ordered[i] = elements[ratingIdx]; + elements.splice(ratingIdx, 1); // remove already found rating + } + } + return ordered; +}; + +const getRatingFetcher = ( + { appId, token }: ConfigYourViews, +): RatingFetcher => { + const key = `${appId}${token}`; + if (fetcherPool[key]) { + return fetcherPool[key]; + } const headers = { "Authorization": token, }; - /** @description https://yourviews.freshdesk.com/support/solutions/articles/5000756179-buscar-as-estrelas-nas-prateleiras */ - const rating = ( - { page = 0, count = 1, productId }: PaginationOptions & { - productId: string; - }, - ) => - fetchAPI( - `${baseUrl}/api/${appId}/review/reviewshelf?${new URLSearchParams( - { page, count, productIds: productId } as unknown as Record< - string, - string - >, - )}`, - { headers, withProxyCache: true }, - ); - - /** @description https://yourviews.freshdesk.com/support/solutions/articles/5000756179-buscar-as-estrelas-nas-prateleiras */ - const ratings = ( - { page = 0, count, productIds }: PaginationOptions & { - productIds: string[]; - }, - ) => + const dl = new DataLoader((productIds: readonly string[]) => fetchAPI( `${baseUrl}/api/${appId}/review/reviewshelf?${new URLSearchParams({ - page, - count: count ?? productIds.length, + page: 0, + count: productIds.length, productIds: productIds.join(","), } as unknown as Record)}`, { headers, withProxyCache: true }, - ); + ).then((rat) => sameOrder(productIds, rat.Element)) + ); + return fetcherPool[key] = dl.load.bind(dl); +}; + +export const createClient = ({ token, appId }: ConfigYourViews) => { + const headers = { + "Authorization": token, + }; + const batchFetcher = getRatingFetcher({ token, appId }); + + /** @description https://yourviews.freshdesk.com/support/solutions/articles/5000756179-buscar-as-estrelas-nas-prateleiras */ + const rating = batchFetcher; + + /** @description https://yourviews.freshdesk.com/support/solutions/articles/5000756179-buscar-as-estrelas-nas-prateleiras */ + const ratings = ( + productIds: string[], + ) => Promise.all(productIds.map(batchFetcher)); /** @description https://yourviews.freshdesk.com/support/solutions/articles/5000740469-buscar-reviews-de-produto */ const review = ( diff --git a/commerce/yourViews/withYourViews.ts b/commerce/yourViews/withYourViews.ts deleted file mode 100644 index c64ffe84..00000000 --- a/commerce/yourViews/withYourViews.ts +++ /dev/null @@ -1,95 +0,0 @@ -import type { LiveState, LoaderFunction } from "$live/types.ts"; -import type { - Product, - ProductDetailsPage, - ProductListingPage, -} from "../types.ts"; -import { ConfigYourViews, createClient } from "./client.ts"; -import type { Ratings } from "./types.ts"; - -export const addRatingsToProduct = - (ratings: Ratings) => (product: Product): Product => { - const productId = getProductId(product); - const rating = ratings.Element.find((rating) => - rating.ProductId === productId - ); - - return { - ...product, - aggregateRating: rating - ? { - "@type": "AggregateRating", - ratingCount: rating.TotalRatings, - ratingValue: rating.Rating, - } - : undefined, - }; - }; - -const getProductId = (product: Product) => product.isVariantOf!.productGroupID; - -export const withYourViews = < - Props, - Data extends ProductDetailsPage | Product[] | ProductListingPage | null, - Global extends { configYourViews: ConfigYourViews | undefined }, ->( - loader: LoaderFunction>, -): LoaderFunction> => -async (req, ctx, props) => { - const response = await loader(req, ctx, props); - - if (response.data == null) { - return response; - } - - if (!ctx.state.global.configYourViews) { - console.error( - "Missing configuration from YourViews instegration. Open Deco admin and set YourViews appId and token on global sections at Library", - ); - - return response; - } - - const client = createClient(ctx.state.global.configYourViews); - - if (Array.isArray(response.data)) { - const productIds = response.data.map(getProductId); - - const ratings = await client.ratings({ productIds }); - - return { - ...response, - data: response.data.map(addRatingsToProduct(ratings)) as Data, - }; - } - - if (response.data["@type"] === "ProductDetailsPage") { - const productId = getProductId(response.data.product); - - const ratings = await client.rating({ productId }); - - return { - ...response, - data: { - ...response.data, - product: addRatingsToProduct(ratings)(response.data.product), - }, - }; - } - - if (response.data["@type"] === "ProductListingPage") { - const productIds = response.data.products.map(getProductId); - - const ratings = await client.ratings({ productIds }); - - return { - ...response, - data: { - ...response.data, - products: response.data.products.map(addRatingsToProduct(ratings)), - }, - }; - } - - return response; -}; diff --git a/extensions/yourViews.ts b/extensions/yourViews.ts new file mode 100644 index 00000000..0d6c68c3 --- /dev/null +++ b/extensions/yourViews.ts @@ -0,0 +1,32 @@ +import { Product } from "deco-sites/std/commerce/types.ts"; +import { + ConfigYourViews, + RatingFetcher, +} from "deco-sites/std/commerce/yourViews/client.ts"; +import { ExtensionOf } from "https://denopkg.com/deco-cx/live@3c5ca2344ff1d8168085a3d5685c57100e6bdedb/blocks/extension.ts"; +import { createClient } from "../commerce/yourViews/client.ts"; + +export type Props = ConfigYourViews; + +const aggregateRatingFor = + (fetcher: RatingFetcher) => async ({ isVariantOf }: Product) => { + const productId = isVariantOf!.productGroupID; + const rating = await fetcher(productId); + + return rating + ? { + "@type": "AggregateRating" as const, + ratingCount: rating.TotalRatings, + ratingValue: rating.Rating, + } + : undefined; + }; + +export default function AddYourViews(config: Props): ExtensionOf { + const client = createClient(config); + const aggregateRating = aggregateRatingFor(client.rating.bind(client)); + + return { + aggregateRating, + }; +} diff --git a/import_map.json b/import_map.json index 4715e908..c47c7f10 100644 --- a/import_map.json +++ b/import_map.json @@ -1,7 +1,7 @@ { "imports": { "deco-sites/std/": "./", - "$live/": "https://denopkg.com/deco-cx/live@1.0.0-rc.46/", + "$live/": "https://denopkg.com/deco-cx/live@extension-loaders/", "partytown/": "https://deno.land/x/partytown@0.2.1/", "$fresh/": "https://deno.land/x/fresh@1.1.3/", "preact": "https://esm.sh/preact@10.11.0", diff --git a/live.gen.ts b/live.gen.ts index 4657bbc6..6bfffb11 100644 --- a/live.gen.ts +++ b/live.gen.ts @@ -4,7 +4,6 @@ import config from "./deno.json" assert { type: "json" }; import { DecoManifest } from "$live/types.ts"; - import * as $0 from "./functions/vtexConfig.ts"; import * as $1 from "./functions/vtexProductListingPage.ts"; import * as $2 from "./functions/vndaProductList.ts"; @@ -24,44 +23,46 @@ import * as $15 from "./functions/shopifyProductList.ts"; import * as $16 from "./functions/shopifyProductDetailsPage.ts"; import * as $17 from "./functions/vtexLegacyRelatedProductsLoader.ts"; import * as $$0 from "./accounts/vnda.ts"; -import * as $$1 from "./accounts/yourViews.ts"; -import * as $$2 from "./accounts/vtex.ts"; -import * as $$3 from "./accounts/shopify.ts"; -import * as $$4 from "./accounts/occ.ts"; +import * as $$1 from "./accounts/vtex.ts"; +import * as $$2 from "./accounts/shopify.ts"; +import * as $$3 from "./accounts/occ.ts"; import * as $$$$0 from "./routes/404.tsx"; -import * as $$$$$$$$0 from "./sections/configYourViews.global.tsx"; -import * as $$$$$$$$1 from "./sections/SEO.tsx"; -import * as $$$$$$$$2 from "./sections/SEOPLP.tsx"; -import * as $$$$$$$$3 from "./sections/configOCC.global.tsx"; -import * as $$$$$$$$4 from "./sections/Analytics.tsx"; -import * as $$$$$$$$5 from "./sections/configShopify.global.tsx"; -import * as $$$$$$$$6 from "./sections/configVNDA.global.tsx"; -import * as $$$$$$$$7 from "./sections/configVTEX.global.tsx"; -import * as $$$$$$$$8 from "./sections/SEOPDP.tsx"; +import * as $$$$$$$$0 from "./sections/SEO.tsx"; +import * as $$$$$$$$1 from "./sections/SEOPLP.tsx"; +import * as $$$$$$$$2 from "./sections/configOCC.global.tsx"; +import * as $$$$$$$$3 from "./sections/Analytics.tsx"; +import * as $$$$$$$$4 from "./sections/configShopify.global.tsx"; +import * as $$$$$$$$5 from "./sections/configVNDA.global.tsx"; +import * as $$$$$$$$6 from "./sections/configVTEX.global.tsx"; +import * as $$$$$$$$7 from "./sections/SEOPDP.tsx"; +import * as $$$$$$$$$$$0 from "./extensions/yourViews.ts"; import * as $live_middleware from "$live/routes/_middleware.ts"; import * as $live_workbench from "$live/routes/live/workbench.ts"; +import * as $live_invoke from "$live/routes/live/invoke/index.ts"; import * as $live_editorData from "$live/routes/live/editorData.ts"; import * as $live_inspect from "$live/routes/live/inspect.ts"; import * as $live_meta from "$live/routes/live/_meta.ts"; import * as $live_previews from "$live/routes/live/previews/[...block].tsx"; import * as $live_catchall from "$live/routes/[...catchall].tsx"; -import * as i1$0 from "$live/handlers/routesSelection.ts"; -import * as i1$1 from "$live/handlers/router.ts"; -import * as i1$2 from "$live/handlers/devPage.ts"; -import * as i1$3 from "$live/handlers/fresh.ts"; -import * as i1$$0 from "$live/pages/LivePage.tsx"; -import * as i1$$$0 from "$live/sections/PageInclude.tsx"; -import * as i1$$$$0 from "$live/matchers/MatchDate.ts"; -import * as i1$$$$1 from "$live/matchers/MatchUserAgent.ts"; -import * as i1$$$$2 from "$live/matchers/MatchSite.ts"; -import * as i1$$$$3 from "$live/matchers/MatchMulti.ts"; -import * as i1$$$$4 from "$live/matchers/MatchRandom.ts"; -import * as i1$$$$5 from "$live/matchers/MatchEnvironment.ts"; -import * as i1$$$$6 from "$live/matchers/MatchAlways.ts"; -import * as i1$$$$$0 from "$live/flags/audience.ts"; -import * as i1$$$$$1 from "$live/flags/everyone.ts"; +import * as i1$0 from "$live/loaders/withExtensions.ts"; +import * as i1$$0 from "$live/handlers/routesSelection.ts"; +import * as i1$$1 from "$live/handlers/router.ts"; +import * as i1$$2 from "$live/handlers/devPage.ts"; +import * as i1$$3 from "$live/handlers/fresh.ts"; +import * as i1$$$0 from "$live/pages/LivePage.tsx"; +import * as i1$$$$0 from "$live/sections/PageInclude.tsx"; +import * as i1$$$$$0 from "$live/matchers/MatchDate.ts"; +import * as i1$$$$$1 from "$live/matchers/MatchUserAgent.ts"; +import * as i1$$$$$2 from "$live/matchers/MatchSite.ts"; +import * as i1$$$$$3 from "$live/matchers/MatchMulti.ts"; +import * as i1$$$$$4 from "$live/matchers/MatchRandom.ts"; +import * as i1$$$$$5 from "$live/matchers/MatchEnvironment.ts"; +import * as i1$$$$$6 from "$live/matchers/MatchAlways.ts"; +import * as i1$$$$$$0 from "$live/flags/audience.ts"; +import * as i1$$$$$$1 from "$live/flags/everyone.ts"; +import * as i1$$$$$$$0 from "$live/extensions/composite.ts"; -const manifest: DecoManifest = { +const manifest = { "functions": { "deco-sites/std/functions/vtexConfig.ts": $0, "deco-sites/std/functions/vtexProductListingPage.ts": $1, @@ -84,15 +85,15 @@ const manifest: DecoManifest = { }, "accounts": { "deco-sites/std/accounts/vnda.ts": $$0, - "deco-sites/std/accounts/yourViews.ts": $$1, - "deco-sites/std/accounts/vtex.ts": $$2, - "deco-sites/std/accounts/shopify.ts": $$3, - "deco-sites/std/accounts/occ.ts": $$4, + "deco-sites/std/accounts/vtex.ts": $$1, + "deco-sites/std/accounts/shopify.ts": $$2, + "deco-sites/std/accounts/occ.ts": $$3, }, "routes": { "./routes/404.tsx": $$$$0, "./routes/_middleware.ts": $live_middleware, "./routes/live/workbench.ts": $live_workbench, + "./routes/live/invoke/index.ts": $live_invoke, "./routes/live/editorData.ts": $live_editorData, "./routes/live/inspect.ts": $live_inspect, "./routes/live/_meta.ts": $live_meta, @@ -100,42 +101,50 @@ const manifest: DecoManifest = { "./routes/[...catchall].tsx": $live_catchall, }, "sections": { - "deco-sites/std/sections/configYourViews.global.tsx": $$$$$$$$0, - "deco-sites/std/sections/SEO.tsx": $$$$$$$$1, - "deco-sites/std/sections/SEOPLP.tsx": $$$$$$$$2, - "deco-sites/std/sections/configOCC.global.tsx": $$$$$$$$3, - "deco-sites/std/sections/Analytics.tsx": $$$$$$$$4, - "deco-sites/std/sections/configShopify.global.tsx": $$$$$$$$5, - "deco-sites/std/sections/configVNDA.global.tsx": $$$$$$$$6, - "deco-sites/std/sections/configVTEX.global.tsx": $$$$$$$$7, - "deco-sites/std/sections/SEOPDP.tsx": $$$$$$$$8, - "$live/sections/PageInclude.tsx": i1$$$0, + "deco-sites/std/sections/SEO.tsx": $$$$$$$$0, + "deco-sites/std/sections/SEOPLP.tsx": $$$$$$$$1, + "deco-sites/std/sections/configOCC.global.tsx": $$$$$$$$2, + "deco-sites/std/sections/Analytics.tsx": $$$$$$$$3, + "deco-sites/std/sections/configShopify.global.tsx": $$$$$$$$4, + "deco-sites/std/sections/configVNDA.global.tsx": $$$$$$$$5, + "deco-sites/std/sections/configVTEX.global.tsx": $$$$$$$$6, + "deco-sites/std/sections/SEOPDP.tsx": $$$$$$$$7, + "$live/sections/PageInclude.tsx": i1$$$$0, + }, + "extensions": { + "deco-sites/std/extensions/yourViews.ts": $$$$$$$$$$$0, + "$live/extensions/composite.ts": i1$$$$$$$0, + }, + "loaders": { + "$live/loaders/withExtensions.ts": i1$0, }, "handlers": { - "$live/handlers/routesSelection.ts": i1$0, - "$live/handlers/router.ts": i1$1, - "$live/handlers/devPage.ts": i1$2, - "$live/handlers/fresh.ts": i1$3, + "$live/handlers/routesSelection.ts": i1$$0, + "$live/handlers/router.ts": i1$$1, + "$live/handlers/devPage.ts": i1$$2, + "$live/handlers/fresh.ts": i1$$3, }, "pages": { - "$live/pages/LivePage.tsx": i1$$0, + "$live/pages/LivePage.tsx": i1$$$0, }, "matchers": { - "$live/matchers/MatchDate.ts": i1$$$$0, - "$live/matchers/MatchUserAgent.ts": i1$$$$1, - "$live/matchers/MatchSite.ts": i1$$$$2, - "$live/matchers/MatchMulti.ts": i1$$$$3, - "$live/matchers/MatchRandom.ts": i1$$$$4, - "$live/matchers/MatchEnvironment.ts": i1$$$$5, - "$live/matchers/MatchAlways.ts": i1$$$$6, + "$live/matchers/MatchDate.ts": i1$$$$$0, + "$live/matchers/MatchUserAgent.ts": i1$$$$$1, + "$live/matchers/MatchSite.ts": i1$$$$$2, + "$live/matchers/MatchMulti.ts": i1$$$$$3, + "$live/matchers/MatchRandom.ts": i1$$$$$4, + "$live/matchers/MatchEnvironment.ts": i1$$$$$5, + "$live/matchers/MatchAlways.ts": i1$$$$$6, }, "flags": { - "$live/flags/audience.ts": i1$$$$$0, - "$live/flags/everyone.ts": i1$$$$$1, + "$live/flags/audience.ts": i1$$$$$$0, + "$live/flags/everyone.ts": i1$$$$$$1, }, "islands": {}, "config": config, "baseUrl": import.meta.url, }; -export default manifest; +export type Manifest = typeof manifest; + +export default manifest satisfies DecoManifest; diff --git a/schemas.gen.json b/schemas.gen.json index 5560c57a..c08c301b 100644 --- a/schemas.gen.json +++ b/schemas.gen.json @@ -514,13 +514,6 @@ "required": [], "title": "ProductLeaf" }, - "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf[]": { - "type": "array", - "items": { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf" - }, - "title": "ProductLeaf[]" - }, "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductGroup": { "type": "object", "allOf": [ @@ -535,7 +528,10 @@ "title": "@type" }, "hasVariant": { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf[]", + "type": "array", + "items": { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf" + }, "title": "Has Variant" }, "productGroupID": { @@ -946,6 +942,13 @@ ], "title": "Review" }, + "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf[]": { + "type": "array", + "items": { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf" + }, + "title": "ProductLeaf[]" + }, "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@Product": { "type": "object", "allOf": [ @@ -1035,6 +1038,10 @@ "sku": { "type": "string", "title": "Sku" + }, + "isAccessoryOrSparePartFor": { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdHlwZXMudHM=@ProductLeaf[]", + "title": "Is Accessory Or Spare Part For" } }, "required": [ @@ -1143,7 +1150,8 @@ "breadcrumb", "filters", "products", - "pageInfo" + "pageInfo", + "sortOptions" ], "title": "ProductListingPage" }, @@ -1179,6 +1187,27 @@ } } }, + { + "title": "deco-sites/std/functions/vtexWishlist.ts", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhXaXNobGlzdC50cw==@Props" + } + ], + "required": [ + "__resolveType" + ], + "properties": { + "__resolveType": { + "type": "string", + "enum": [ + "deco-sites/std/functions/vtexWishlist.ts" + ], + "default": "deco-sites/std/functions/vtexWishlist.ts" + } + } + }, { "title": "deco-sites/std/functions/shopifyProductListingPage.ts", "type": "object", @@ -1316,22 +1345,6 @@ } } }, - { - "title": "deco-sites/std/functions/vtexWishlist.ts", - "type": "object", - "required": [ - "__resolveType" - ], - "properties": { - "__resolveType": { - "type": "string", - "enum": [ - "deco-sites/std/functions/vtexWishlist.ts" - ], - "default": "deco-sites/std/functions/vtexWishlist.ts" - } - } - }, { "title": "deco-sites/std/functions/vtexProductList.ts", "type": "object", @@ -1796,6 +1809,21 @@ "required": [], "title": "deco-sites/std/functions/vtexNavbar.ts@Props" }, + "ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhXaXNobGlzdC50cw==@Props": { + "type": "object", + "properties": { + "count": { + "type": "number", + "title": "Count", + "description": "Number of products per page to display", + "default": "12" + } + }, + "required": [ + "count" + ], + "title": "deco-sites/std/functions/vtexWishlist.ts@Props" + }, "ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Nob3BpZnlQcm9kdWN0TGlzdGluZ1BhZ2UudHM=@Props": { "type": "object", "properties": { @@ -2140,24 +2168,6 @@ ], "title": "deco-sites/std/commerce/vnda/types.ts@ConfigVNDA" }, - "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UveW91clZpZXdzL2NsaWVudC50cw==@ConfigYourViews": { - "type": "object", - "properties": { - "token": { - "type": "string", - "title": "Token" - }, - "appId": { - "type": "string", - "title": "App Id" - } - }, - "required": [ - "token", - "appId" - ], - "title": "deco-sites/std/commerce/yourViews/client.ts@ConfigYourViews" - }, "ZGVjby1jeC9saXZlL2Jsb2Nrcy9hY2NvdW50LnRz@Account": { "type": "object", "properties": {}, @@ -2266,6 +2276,28 @@ ], "title": "deco-sites/std/commerce/occ/client.ts@ConfigOCC" }, + "ZGVjby1jeC9saXZlL2Jsb2Nrcy9leHRlbnNpb24udHM=@Extension": { + "$ref": "#/root/extensions", + "title": "Extension" + }, + "ZGVjby1jeC9saXZlL2xvYWRlcnMvd2l0aEV4dGVuc2lvbnMudHM=@Props": { + "type": "object", + "properties": { + "data": { + "$ref": "#/root/functions", + "title": "Data" + }, + "extension": { + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9leHRlbnNpb24udHM=@Extension", + "title": "Extension" + } + }, + "required": [ + "data", + "extension" + ], + "title": "deco-cx/live/loaders/withExtensions.ts@Props" + }, "ZGVjby1jeC9saXZlL2Jsb2Nrcy9mbGFnLnRz@Flag": { "$ref": "#/root/flags", "title": "Flag" @@ -2355,27 +2387,12 @@ "$ref": "#/root/sections", "title": "Section" }, - "ZGVjby1jeC9saXZlL2Jsb2Nrcy9pc2xhbmQudHM=@Island": { - "$ref": "#/root/islands", - "title": "Island" - }, - "ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Island|Section": { - "anyOf": [ - { - "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Section" - }, - { - "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9pc2xhbmQudHM=@Island" - } - ], - "title": "Island|Section" - }, - "ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Island|Section[]": { + "ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Section[]": { "type": "array", "items": { - "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Island|Section" + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Section" }, - "title": "Island|Section[]" + "title": "Section[]" }, "ZGVjby1jeC9saXZlL3BhZ2VzL0xpdmVQYWdlLnRzeA==@Props": { "type": "object", @@ -2385,7 +2402,7 @@ "title": "Name" }, "sections": { - "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Island|Section[]", + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9zZWN0aW9uLnRz@Section[]", "title": "Sections" } }, @@ -2729,6 +2746,44 @@ "required": [], "title": "deco-cx/live/flags/everyone.ts@EveryoneConfig" }, + "ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UveW91clZpZXdzL2NsaWVudC50cw==@ConfigYourViews": { + "type": "object", + "properties": { + "token": { + "type": "string", + "title": "Token" + }, + "appId": { + "type": "string", + "title": "App Id" + } + }, + "required": [ + "token", + "appId" + ], + "title": "deco-sites/std/commerce/yourViews/client.ts@ConfigYourViews" + }, + "ZGVjby1jeC9saXZlL2Jsb2Nrcy9leHRlbnNpb24udHM=@Extension[]": { + "type": "array", + "items": { + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9leHRlbnNpb24udHM=@Extension" + }, + "title": "Extension[]" + }, + "ZGVjby1jeC9saXZlL2V4dGVuc2lvbnMvY29tcG9zaXRlLnRz@Props": { + "type": "object", + "properties": { + "extensions": { + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2Jsb2Nrcy9leHRlbnNpb24udHM=@Extension[]", + "title": "Extensions" + } + }, + "required": [ + "extensions" + ], + "title": "deco-cx/live/extensions/composite.ts@Props" + }, "ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhDb25maWcudHM=": { "title": "deco-sites/std/functions/vtexConfig.ts", "type": "object", @@ -2864,6 +2919,11 @@ "ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhXaXNobGlzdC50cw==": { "title": "deco-sites/std/functions/vtexWishlist.ts", "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvZnVuY3Rpb25zL3Z0ZXhXaXNobGlzdC50cw==@Props" + } + ], "required": [ "__resolveType" ], @@ -3093,12 +3153,12 @@ } } }, - "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMveW91clZpZXdzLnRz": { - "title": "deco-sites/std/accounts/yourViews.ts", + "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvdnRleC50cw==": { + "title": "deco-sites/std/accounts/vtex.ts", "type": "object", "allOf": [ { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UveW91clZpZXdzL2NsaWVudC50cw==@ConfigYourViews" + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdnRleC9jbGllbnQudHM=@ConfigVTEX" } ], "required": [ @@ -3108,18 +3168,18 @@ "__resolveType": { "type": "string", "enum": [ - "deco-sites/std/accounts/yourViews.ts" + "deco-sites/std/accounts/vtex.ts" ], - "default": "deco-sites/std/accounts/yourViews.ts" + "default": "deco-sites/std/accounts/vtex.ts" } } }, - "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvdnRleC50cw==": { - "title": "deco-sites/std/accounts/vtex.ts", + "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvc2hvcGlmeS50cw==": { + "title": "deco-sites/std/accounts/shopify.ts", "type": "object", "allOf": [ { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UvdnRleC9jbGllbnQudHM=@ConfigVTEX" + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2Uvc2hvcGlmeS9jbGllbnQudHM=@ConfigShopify" } ], "required": [ @@ -3129,18 +3189,18 @@ "__resolveType": { "type": "string", "enum": [ - "deco-sites/std/accounts/vtex.ts" + "deco-sites/std/accounts/shopify.ts" ], - "default": "deco-sites/std/accounts/vtex.ts" + "default": "deco-sites/std/accounts/shopify.ts" } } }, - "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvc2hvcGlmeS50cw==": { - "title": "deco-sites/std/accounts/shopify.ts", + "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvb2NjLnRz": { + "title": "deco-sites/std/accounts/occ.ts", "type": "object", "allOf": [ { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2Uvc2hvcGlmeS9jbGllbnQudHM=@ConfigShopify" + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2Uvb2NjL2NsaWVudC50cw==@ConfigOCC" } ], "required": [ @@ -3150,18 +3210,18 @@ "__resolveType": { "type": "string", "enum": [ - "deco-sites/std/accounts/shopify.ts" + "deco-sites/std/accounts/occ.ts" ], - "default": "deco-sites/std/accounts/shopify.ts" + "default": "deco-sites/std/accounts/occ.ts" } } }, - "ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvb2NjLnRz": { - "title": "deco-sites/std/accounts/occ.ts", + "JGxpdmUvbG9hZGVycy93aXRoRXh0ZW5zaW9ucy50cw==": { + "title": "$live/loaders/withExtensions.ts", "type": "object", "allOf": [ { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2Uvb2NjL2NsaWVudC50cw==@ConfigOCC" + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2xvYWRlcnMvd2l0aEV4dGVuc2lvbnMudHM=@Props" } ], "required": [ @@ -3171,9 +3231,9 @@ "__resolveType": { "type": "string", "enum": [ - "deco-sites/std/accounts/occ.ts" + "$live/loaders/withExtensions.ts" ], - "default": "deco-sites/std/accounts/occ.ts" + "default": "$live/loaders/withExtensions.ts" } } }, @@ -3282,27 +3342,6 @@ } } }, - "ZGVjby1zaXRlcy9zdGQvc2VjdGlvbnMvY29uZmlnWW91clZpZXdzLmdsb2JhbC50c3g=": { - "title": "deco-sites/std/sections/configYourViews.global.tsx", - "type": "object", - "allOf": [ - { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UveW91clZpZXdzL2NsaWVudC50cw==@ConfigYourViews" - } - ], - "required": [ - "__resolveType" - ], - "properties": { - "__resolveType": { - "type": "string", - "enum": [ - "deco-sites/std/sections/configYourViews.global.tsx" - ], - "default": "deco-sites/std/sections/configYourViews.global.tsx" - } - } - }, "ZGVjby1zaXRlcy9zdGQvc2VjdGlvbnMvU0VPLnRzeA==": { "title": "deco-sites/std/sections/SEO.tsx", "type": "object", @@ -3676,6 +3715,48 @@ } } }, + "ZGVjby1zaXRlcy9zdGQvZXh0ZW5zaW9ucy95b3VyVmlld3MudHM=": { + "title": "deco-sites/std/extensions/yourViews.ts", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvY29tbWVyY2UveW91clZpZXdzL2NsaWVudC50cw==@ConfigYourViews" + } + ], + "required": [ + "__resolveType" + ], + "properties": { + "__resolveType": { + "type": "string", + "enum": [ + "deco-sites/std/extensions/yourViews.ts" + ], + "default": "deco-sites/std/extensions/yourViews.ts" + } + } + }, + "JGxpdmUvZXh0ZW5zaW9ucy9jb21wb3NpdGUudHM=": { + "title": "$live/extensions/composite.ts", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ZGVjby1jeC9saXZlL2V4dGVuc2lvbnMvY29tcG9zaXRlLnRz@Props" + } + ], + "required": [ + "__resolveType" + ], + "properties": { + "__resolveType": { + "type": "string", + "enum": [ + "$live/extensions/composite.ts" + ], + "default": "$live/extensions/composite.ts" + } + } + }, "ZGVjby1jeC9saXZlL3JvdXRlcy9fbWlkZGxld2FyZS50cw==@MiddlewareConfig": { "type": "object", "properties": { @@ -3778,9 +3859,6 @@ { "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvdm5kYS50cw==" }, - { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMveW91clZpZXdzLnRz" - }, { "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvYWNjb3VudHMvdnRleC50cw==" }, @@ -3792,6 +3870,17 @@ } ] }, + "loaders": { + "title": "loaders", + "anyOf": [ + { + "$ref": "#/definitions/Resolvable" + }, + { + "$ref": "#/definitions/JGxpdmUvbG9hZGVycy93aXRoRXh0ZW5zaW9ucy50cw==" + } + ] + }, "handlers": { "title": "handlers", "anyOf": [ @@ -3829,9 +3918,6 @@ { "$ref": "#/definitions/Resolvable" }, - { - "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvc2VjdGlvbnMvY29uZmlnWW91clZpZXdzLmdsb2JhbC50c3g=" - }, { "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvc2VjdGlvbnMvU0VPLnRzeA==" }, @@ -3904,6 +3990,20 @@ } ] }, + "extensions": { + "title": "extensions", + "anyOf": [ + { + "$ref": "#/definitions/Resolvable" + }, + { + "$ref": "#/definitions/ZGVjby1zaXRlcy9zdGQvZXh0ZW5zaW9ucy95b3VyVmlld3MudHM=" + }, + { + "$ref": "#/definitions/JGxpdmUvZXh0ZW5zaW9ucy9jb21wb3NpdGUudHM=" + } + ] + }, "state": { "type": "object", "required": [ @@ -3934,6 +4034,9 @@ { "$ref": "#/root/accounts" }, + { + "$ref": "#/root/loaders" + }, { "$ref": "#/root/handlers" }, @@ -3948,9 +4051,12 @@ }, { "$ref": "#/root/flags" + }, + { + "$ref": "#/root/extensions" } ] } } } -} +} \ No newline at end of file diff --git a/sections/configYourViews.global.tsx b/sections/configYourViews.global.tsx deleted file mode 100644 index fd2c50e6..00000000 --- a/sections/configYourViews.global.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import type { ConfigYourViews } from "../commerce/yourViews/client.ts"; - -function ConfigSection(_: ConfigYourViews) { - return ( -
- "This is a global setting and not a component. Every change here will - impact all environments, published/archived/draft" -
- ); -} - -export default ConfigSection;