@faststore/core 3.11.3 → 3.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +14 -14
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-minimal-server.js.nft.json +1 -1
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +10 -10
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/5754.js +2 -2
- package/.next/server/chunks/8640.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/api/graphql.js +1 -1
- package/.next/server/pages/en-US/404.html +1 -1
- package/.next/server/pages/en-US/500.html +1 -1
- package/.next/server/pages/en-US/account.html +1 -1
- package/.next/server/pages/en-US/checkout.html +1 -1
- package/.next/server/pages/en-US/login.html +1 -1
- package/.next/server/pages/en-US/s.html +1 -1
- package/.next/server/pages/en-US.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/{qw1fhkTKJwfp3KmckYsWd → FO1Q-M-kedNdmpX1S3tkc}/_buildManifest.js +1 -1
- package/.next/static/chunks/1978.8bdcdd4ec5c7ac88.js +1 -0
- package/.next/static/chunks/{5156.fe20405ee7a0d2d5.js → 5156.d1a2bac5ee6f64ac.js} +1 -1
- package/.next/static/chunks/7498-745c09c46899ea49.js +1 -0
- package/.next/static/chunks/{webpack-0b036af6daba5815.js → webpack-ed53dd91aa26df33.js} +1 -1
- package/.next/trace +102 -102
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +4 -0
- package/codegen.ts +1 -1
- package/discovery.config.default.js +1 -1
- package/next-seo.config.ts +1 -1
- package/package.json +6 -6
- package/src/components/auth/ProfileChallenge/ProfileChallenge.tsx +1 -1
- package/src/components/cart/CartSidebar/CartSidebar.tsx +1 -1
- package/src/components/cart/OrderSummary/OrderSummary.tsx +1 -1
- package/src/components/cms/GlobalSections.tsx +2 -2
- package/src/components/cms/RenderSections.tsx +4 -4
- package/src/components/cms/SectionBoundary.tsx +1 -1
- package/src/components/cms/global/Components.ts +1 -1
- package/src/components/cms/home/Components.ts +1 -1
- package/src/components/cms/plp/Components.ts +1 -1
- package/src/components/cms/search/Components.ts +1 -1
- package/src/components/common/Alert/Alert.tsx +1 -1
- package/src/components/common/Footer/Footer.tsx +1 -1
- package/src/components/product/NotAvailableButton/NotAvailableButton.tsx +1 -1
- package/src/components/product/ProductCard/ProductCard.tsx +1 -1
- package/src/components/product/ProductGrid/ProductGrid.tsx +1 -1
- package/src/components/region/RegionModal/RegionModal.tsx +1 -1
- package/src/components/search/Filter/FilterDesktop.tsx +1 -1
- package/src/components/search/SearchDropdown/SearchDropdown.tsx +2 -2
- package/src/components/search/SearchInput/SearchInput.tsx +1 -1
- package/src/components/search/SearchTop/SearchTop.tsx +1 -1
- package/src/components/sections/BannerText/BannerText.tsx +1 -1
- package/src/components/sections/Breadcrumb/Breadcrumb.tsx +4 -4
- package/src/components/sections/Hero/Hero.tsx +2 -2
- package/src/components/sections/Newsletter/Newsletter.tsx +1 -1
- package/src/components/sections/ProductGallery/ProductGallery.tsx +5 -5
- package/src/components/sections/ProductShelf/ProductShelf.tsx +1 -1
- package/src/components/sections/RegionBar/RegionBar.tsx +3 -1
- package/src/components/templates/ProductListingPage/ProductListing.tsx +2 -2
- package/src/components/templates/SearchPage/SearchPage.tsx +5 -3
- package/src/components/ui/Image/Image.tsx +1 -1
- package/src/components/ui/Image/loader.ts +1 -1
- package/src/components/ui/Link/Link.tsx +1 -1
- package/src/components/ui/ProductGallery/ProductGallery.tsx +5 -5
- package/src/components/ui/ProductGallery/ProductGalleryPage.tsx +1 -1
- package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +1 -1
- package/src/components/ui/SkuSelector/Selectors.tsx +2 -2
- package/src/customizations/src/components/overrides/Alert.tsx +1 -1
- package/src/customizations/src/components/overrides/BannerText.tsx +1 -1
- package/src/customizations/src/components/overrides/Breadcrumb.tsx +1 -1
- package/src/customizations/src/components/overrides/CrossSellingShelf.tsx +1 -1
- package/src/customizations/src/components/overrides/EmptyState.tsx +1 -1
- package/src/customizations/src/components/overrides/Hero.tsx +1 -1
- package/src/customizations/src/components/overrides/Navbar.tsx +1 -1
- package/src/customizations/src/components/overrides/Newsletter.tsx +1 -1
- package/src/customizations/src/components/overrides/ProductDetails.tsx +1 -1
- package/src/customizations/src/components/overrides/ProductGallery.tsx +1 -1
- package/src/customizations/src/components/overrides/ProductShelf.tsx +1 -1
- package/src/customizations/src/components/overrides/RegionBar.tsx +1 -1
- package/src/experimental/searchServerSideFunctions/getServerSideProps.ts +4 -4
- package/src/experimental/searchServerSideFunctions/getStaticProps.ts +4 -4
- package/src/pages/404.tsx +4 -4
- package/src/pages/500.tsx +4 -4
- package/src/pages/[...slug].tsx +6 -6
- package/src/pages/[slug]/p.tsx +6 -6
- package/src/pages/account.tsx +3 -3
- package/src/pages/api/preview.ts +12 -6
- package/src/pages/checkout.tsx +3 -3
- package/src/pages/index.tsx +1 -1
- package/src/pages/login.tsx +4 -4
- package/src/pages/s.tsx +1 -1
- package/src/sdk/analytics/platform/vtex/rc.ts +3 -3
- package/src/sdk/analytics/types.ts +2 -2
- package/src/sdk/error/ErrorBoundary/ErrorBoundary.tsx +1 -1
- package/src/sdk/error/MissingContentError/MissingContentError.ts +1 -1
- package/src/sdk/error/MultipleContentError/MultipleContentError.ts +1 -1
- package/src/sdk/graphql/request.ts +2 -2
- package/src/sdk/overrides/OverrideContext.tsx +3 -3
- package/src/sdk/overrides/PageProvider.tsx +3 -4
- package/src/sdk/overrides/getOverriddenSection.tsx +2 -2
- package/src/sdk/overrides/overrides.ts +1 -1
- package/src/sdk/product/useAllVariantProducts.ts +1 -1
- package/src/sdk/product/useLocalizedVariables.ts +1 -1
- package/src/sdk/product/usePageProductsQuery.ts +1 -1
- package/src/sdk/product/useProductGalleryQuery.ts +1 -1
- package/src/sdk/product/useProductsPrefetch.ts +1 -1
- package/src/sdk/search/useFilter.ts +10 -7
- package/src/sdk/shipping/useShippingSimulation.ts +2 -2
- package/src/server/cms/index.ts +1 -1
- package/src/server/cms/pdp.ts +2 -2
- package/src/server/cms/plp.ts +4 -4
- package/src/typings/global.d.ts +6 -6
- package/src/typings/overrides.ts +25 -25
- package/src/typings/overridesDefinition.ts +4 -4
- package/src/utils/multipleTemplates.ts +3 -3
- package/test/server/cms/index.test.ts +1 -1
- package/.next/static/chunks/1978.b33d8b2c02b89474.js +0 -1
- package/.next/static/chunks/7498-304bc236a51fc94c.js +0 -1
- /package/.next/static/{qw1fhkTKJwfp3KmckYsWd → FO1Q-M-kedNdmpX1S3tkc}/_ssgManifest.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { GetServerSideProps } from 'next'
|
|
2
|
-
import { SearchPageProps } from './getStaticProps'
|
|
1
|
+
import type { GetServerSideProps } from 'next'
|
|
2
|
+
import type { SearchPageProps } from './getStaticProps'
|
|
3
3
|
|
|
4
4
|
import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
|
|
5
|
-
import { SearchContentType, getPage } from 'src/server/cms'
|
|
6
|
-
import { Locator } from '@vtex/client-cms'
|
|
5
|
+
import { type SearchContentType, getPage } from 'src/server/cms'
|
|
6
|
+
import type { Locator } from '@vtex/client-cms'
|
|
7
7
|
import storeConfig from 'discovery.config'
|
|
8
8
|
|
|
9
9
|
export const getServerSideProps: GetServerSideProps<
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { GetStaticProps } from 'next'
|
|
1
|
+
import type { GetStaticProps } from 'next'
|
|
2
2
|
import {
|
|
3
3
|
getGlobalSectionsData,
|
|
4
|
-
GlobalSectionsData,
|
|
4
|
+
type GlobalSectionsData,
|
|
5
5
|
} from 'src/components/cms/GlobalSections'
|
|
6
|
-
import { SearchContentType, getPage } from 'src/server/cms'
|
|
7
|
-
import { Locator } from '@vtex/client-cms'
|
|
6
|
+
import { type SearchContentType, getPage } from 'src/server/cms'
|
|
7
|
+
import type { Locator } from '@vtex/client-cms'
|
|
8
8
|
import storeConfig from 'discovery.config'
|
|
9
9
|
|
|
10
10
|
export type SearchPageProps = {
|
package/src/pages/404.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Locator } from '@vtex/client-cms'
|
|
2
|
-
import { GetStaticProps } from 'next'
|
|
1
|
+
import type { Locator } from '@vtex/client-cms'
|
|
2
|
+
import type { GetStaticProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
5
5
|
import {
|
|
6
|
-
GlobalSectionsData,
|
|
6
|
+
type GlobalSectionsData,
|
|
7
7
|
getGlobalSectionsData,
|
|
8
8
|
} from 'src/components/cms/GlobalSections'
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ import RenderSections from 'src/components/cms/RenderSections'
|
|
|
12
12
|
import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
|
|
13
13
|
import PLUGINS_COMPONENTS from 'src/plugins'
|
|
14
14
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
15
|
-
import { PageContentType, getPage } from 'src/server/cms'
|
|
15
|
+
import { type PageContentType, getPage } from 'src/server/cms'
|
|
16
16
|
|
|
17
17
|
/* A list of components that can be used in the CMS. */
|
|
18
18
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
package/src/pages/500.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Locator } from '@vtex/client-cms'
|
|
2
|
-
import { GetStaticProps } from 'next'
|
|
1
|
+
import type { Locator } from '@vtex/client-cms'
|
|
2
|
+
import type { GetStaticProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
5
5
|
import {
|
|
6
|
-
GlobalSectionsData,
|
|
6
|
+
type GlobalSectionsData,
|
|
7
7
|
getGlobalSectionsData,
|
|
8
8
|
} from 'src/components/cms/GlobalSections'
|
|
9
9
|
|
|
@@ -12,7 +12,7 @@ import RenderSections from 'src/components/cms/RenderSections'
|
|
|
12
12
|
import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
|
|
13
13
|
import PLUGINS_COMPONENTS from 'src/plugins'
|
|
14
14
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
15
|
-
import { PageContentType, getPage } from 'src/server/cms'
|
|
15
|
+
import { type PageContentType, getPage } from 'src/server/cms'
|
|
16
16
|
|
|
17
17
|
/* A list of components that can be used in the CMS. */
|
|
18
18
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
package/src/pages/[...slug].tsx
CHANGED
|
@@ -9,22 +9,22 @@ import type {
|
|
|
9
9
|
} from '@generated/graphql'
|
|
10
10
|
import { execute } from 'src/server'
|
|
11
11
|
|
|
12
|
-
import { Locator } from '@vtex/client-cms'
|
|
12
|
+
import type { Locator } from '@vtex/client-cms'
|
|
13
13
|
import dynamic from 'next/dynamic'
|
|
14
14
|
import {
|
|
15
15
|
getGlobalSectionsData,
|
|
16
|
-
GlobalSectionsData,
|
|
16
|
+
type GlobalSectionsData,
|
|
17
17
|
} from 'src/components/cms/GlobalSections'
|
|
18
18
|
import {
|
|
19
19
|
getLandingPageBySlug,
|
|
20
|
-
LandingPageProps,
|
|
20
|
+
type LandingPageProps,
|
|
21
21
|
} from 'src/components/templates/LandingPage'
|
|
22
22
|
import ProductListingPage, {
|
|
23
|
-
ProductListingPageProps,
|
|
23
|
+
type ProductListingPageProps,
|
|
24
24
|
} from 'src/components/templates/ProductListingPage'
|
|
25
25
|
import { getRedirect } from 'src/sdk/redirects'
|
|
26
|
-
import { PageContentType } from 'src/server/cms'
|
|
27
|
-
import { getPLP, PLPContentType } from 'src/server/cms/plp'
|
|
26
|
+
import type { PageContentType } from 'src/server/cms'
|
|
27
|
+
import { getPLP, type PLPContentType } from 'src/server/cms/plp'
|
|
28
28
|
import { getDynamicContent } from 'src/utils/dynamicContent'
|
|
29
29
|
|
|
30
30
|
const LandingPage = dynamic(
|
package/src/pages/[slug]/p.tsx
CHANGED
|
@@ -6,9 +6,9 @@ import { BreadcrumbJsonLd, NextSeo, ProductJsonLd } from 'next-seo'
|
|
|
6
6
|
import type { ComponentType } from 'react'
|
|
7
7
|
|
|
8
8
|
import { gql } from '@generated'
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import type {
|
|
10
|
+
ServerProductQueryQuery,
|
|
11
|
+
ServerProductQueryQueryVariables,
|
|
12
12
|
} from '@generated/graphql'
|
|
13
13
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
14
14
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
@@ -28,12 +28,12 @@ import { execute } from 'src/server'
|
|
|
28
28
|
|
|
29
29
|
import storeConfig from 'discovery.config'
|
|
30
30
|
import {
|
|
31
|
-
GlobalSectionsData,
|
|
31
|
+
type GlobalSectionsData,
|
|
32
32
|
getGlobalSectionsData,
|
|
33
33
|
} from 'src/components/cms/GlobalSections'
|
|
34
|
-
import PageProvider, { PDPContext } from 'src/sdk/overrides/PageProvider'
|
|
34
|
+
import PageProvider, { type PDPContext } from 'src/sdk/overrides/PageProvider'
|
|
35
35
|
import { useProductQuery } from 'src/sdk/product/useProductQuery'
|
|
36
|
-
import { PDPContentType, getPDP } from 'src/server/cms/pdp'
|
|
36
|
+
import { type PDPContentType, getPDP } from 'src/server/cms/pdp'
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Sections: Components imported from each store's custom components and '../components/sections' only.
|
package/src/pages/account.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Locator } from '@vtex/client-cms'
|
|
2
|
-
import { GetStaticProps } from 'next'
|
|
1
|
+
import type { Locator } from '@vtex/client-cms'
|
|
2
|
+
import type { GetStaticProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
5
5
|
import { useEffect } from 'react'
|
|
6
6
|
import {
|
|
7
|
-
GlobalSectionsData,
|
|
7
|
+
type GlobalSectionsData,
|
|
8
8
|
getGlobalSectionsData,
|
|
9
9
|
} from 'src/components/cms/GlobalSections'
|
|
10
10
|
import RenderSections from 'src/components/cms/RenderSections'
|
package/src/pages/api/preview.ts
CHANGED
|
@@ -12,7 +12,10 @@ type Settings = {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
class StatusError extends Error {
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
message: string,
|
|
17
|
+
public status: number
|
|
18
|
+
) {
|
|
16
19
|
super(message)
|
|
17
20
|
}
|
|
18
21
|
}
|
|
@@ -35,13 +38,16 @@ const handler: NextApiHandler = async (req, res) => {
|
|
|
35
38
|
'documentId',
|
|
36
39
|
'versionId',
|
|
37
40
|
'releaseId',
|
|
38
|
-
].reduce(
|
|
39
|
-
|
|
41
|
+
].reduce(
|
|
42
|
+
(acc, param) => {
|
|
43
|
+
const value = pickParam(req, param)
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
if (value !== undefined) acc[param] = value
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
return acc
|
|
48
|
+
},
|
|
49
|
+
{} as Record<string, string>
|
|
50
|
+
)
|
|
45
51
|
|
|
46
52
|
// Check if required path params are present
|
|
47
53
|
if (!locator.contentType || !locator.documentId) {
|
package/src/pages/checkout.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { NextSeo } from 'next-seo'
|
|
2
2
|
import { useEffect } from 'react'
|
|
3
3
|
|
|
4
|
-
import { Locator } from '@vtex/client-cms'
|
|
5
|
-
import { GetStaticProps } from 'next'
|
|
4
|
+
import type { Locator } from '@vtex/client-cms'
|
|
5
|
+
import type { GetStaticProps } from 'next'
|
|
6
6
|
import type { ComponentType } from 'react'
|
|
7
7
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
8
8
|
import {
|
|
9
|
-
GlobalSectionsData,
|
|
9
|
+
type GlobalSectionsData,
|
|
10
10
|
getGlobalSectionsData,
|
|
11
11
|
} from 'src/components/cms/GlobalSections'
|
|
12
12
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
package/src/pages/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import type { PageContentType } from 'src/server/cms'
|
|
|
7
7
|
import { getPage } from 'src/server/cms'
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
GlobalSectionsData,
|
|
10
|
+
type GlobalSectionsData,
|
|
11
11
|
getGlobalSectionsData,
|
|
12
12
|
} from 'src/components/cms/GlobalSections'
|
|
13
13
|
import COMPONENTS from 'src/components/cms/home/Components'
|
package/src/pages/login.tsx
CHANGED
|
@@ -2,18 +2,18 @@ import { NextSeo } from 'next-seo'
|
|
|
2
2
|
import type { ComponentType } from 'react'
|
|
3
3
|
import { useEffect } from 'react'
|
|
4
4
|
|
|
5
|
-
import { Locator } from '@vtex/client-cms'
|
|
6
|
-
import { GetStaticProps } from 'next'
|
|
5
|
+
import type { Locator } from '@vtex/client-cms'
|
|
6
|
+
import type { GetStaticProps } from 'next'
|
|
7
7
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
8
8
|
import {
|
|
9
|
-
GlobalSectionsData,
|
|
9
|
+
type GlobalSectionsData,
|
|
10
10
|
getGlobalSectionsData,
|
|
11
11
|
} from 'src/components/cms/GlobalSections'
|
|
12
12
|
import RenderSections from 'src/components/cms/RenderSections'
|
|
13
13
|
import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
|
|
14
14
|
import PLUGINS_COMPONENTS from 'src/plugins'
|
|
15
15
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
16
|
-
import { PageContentType, getPage } from 'src/server/cms'
|
|
16
|
+
import { type PageContentType, getPage } from 'src/server/cms'
|
|
17
17
|
import storeConfig from '../../discovery.config'
|
|
18
18
|
|
|
19
19
|
/* A list of components that can be used in the CMS. */
|
package/src/pages/s.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import storeConfig from 'discovery.config'
|
|
|
18
18
|
import { SearchWrapper } from 'src/components/templates/SearchPage'
|
|
19
19
|
import {
|
|
20
20
|
getStaticProps,
|
|
21
|
-
SearchPageProps,
|
|
21
|
+
type SearchPageProps,
|
|
22
22
|
} from 'src/experimental/searchServerSideFunctions'
|
|
23
23
|
|
|
24
24
|
export interface SearchPageContextType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnalyticsEvent, PageViewEvent } from '@faststore/sdk'
|
|
2
|
-
import { ServerProductQueryQuery } from '@generated/graphql'
|
|
3
|
-
import {
|
|
1
|
+
import type { AnalyticsEvent, PageViewEvent } from '@faststore/sdk'
|
|
2
|
+
import type { ServerProductQueryQuery } from '@generated/graphql'
|
|
3
|
+
import type {
|
|
4
4
|
CategoryView,
|
|
5
5
|
DepartmentView,
|
|
6
6
|
HomeView,
|
|
@@ -72,7 +72,7 @@ export type SearchEvents =
|
|
|
72
72
|
* Types copied from Request Capture App: https://github.com/vtex/request-capture-app/blob/1becac32c002cb03a57bf36c8a7f9400eab8b933/react/typings/rcevents.d.ts
|
|
73
73
|
*/
|
|
74
74
|
|
|
75
|
-
export
|
|
75
|
+
export type HomeView = {}
|
|
76
76
|
|
|
77
77
|
export interface CategoryView {
|
|
78
78
|
departmentId?: string
|
|
@@ -114,4 +114,4 @@ export interface ProductView {
|
|
|
114
114
|
sellerIds: string // e.g.: "00443713,04412311,1"
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
export
|
|
117
|
+
export type OtherView = {}
|
|
@@ -51,8 +51,8 @@ const baseRequest = async <V = any, D = any>(
|
|
|
51
51
|
fetchOptions?.method !== undefined
|
|
52
52
|
? fetchOptions.method.toUpperCase()
|
|
53
53
|
: operationName.endsWith('Query')
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
? 'GET'
|
|
55
|
+
: 'POST'
|
|
56
56
|
|
|
57
57
|
const params = new URLSearchParams({
|
|
58
58
|
operationName,
|
|
@@ -4,7 +4,7 @@ import type { OverriddenComponents } from '../../typings/overridesDefinition'
|
|
|
4
4
|
import type { SectionsOverrides } from '../../typings/overrides'
|
|
5
5
|
|
|
6
6
|
type OverrideContextType<
|
|
7
|
-
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
|
|
7
|
+
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides,
|
|
8
8
|
> = {
|
|
9
9
|
className?: string
|
|
10
10
|
components: OverriddenComponents<SectionName>
|
|
@@ -15,11 +15,11 @@ const OverrideContext = createContext<OverrideContextType>(null)
|
|
|
15
15
|
export const OverrideProvider = OverrideContext.Provider
|
|
16
16
|
|
|
17
17
|
export const useOverrideContext = <
|
|
18
|
-
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
|
|
18
|
+
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides,
|
|
19
19
|
>() => useContext(OverrideContext) as OverrideContextType<SectionName>
|
|
20
20
|
|
|
21
21
|
export const useOverrideComponents = <
|
|
22
|
-
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
|
|
22
|
+
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides,
|
|
23
23
|
>() =>
|
|
24
24
|
useContext(OverrideContext)
|
|
25
25
|
.components as OverrideContextType<SectionName>['components']
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
ClientManyProductsQueryQuery,
|
|
3
3
|
ClientProductGalleryQueryQuery,
|
|
4
4
|
ClientProductQueryQuery,
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from '@generated/graphql'
|
|
8
8
|
import type { PropsWithChildren } from 'react'
|
|
9
9
|
import { createContext, useContext, useMemo } from 'react'
|
|
10
|
-
import { SearchPageContextType } from 'src/pages/s'
|
|
10
|
+
import type { SearchPageContextType } from 'src/pages/s'
|
|
11
11
|
|
|
12
12
|
export interface PDPContext {
|
|
13
13
|
data?: ServerProductQueryQuery &
|
|
@@ -87,7 +87,6 @@ export const usePLP = () => usePage<PLPContext>()
|
|
|
87
87
|
|
|
88
88
|
export const useSearchPage = () => usePage<SearchPageContext>()
|
|
89
89
|
|
|
90
|
-
export const useDynamicContent = <T
|
|
91
|
-
usePage<DynamicContent<T>>()
|
|
90
|
+
export const useDynamicContent = <T,>() => usePage<DynamicContent<T>>()
|
|
92
91
|
|
|
93
92
|
export default PageProvider
|
|
@@ -11,7 +11,7 @@ import { OverrideProvider } from './OverrideContext'
|
|
|
11
11
|
|
|
12
12
|
export function getOverridableSection<
|
|
13
13
|
Section extends ComponentType,
|
|
14
|
-
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides
|
|
14
|
+
SectionName extends keyof SectionsOverrides = keyof SectionsOverrides,
|
|
15
15
|
>(
|
|
16
16
|
sectionName: SectionName,
|
|
17
17
|
Section: Section,
|
|
@@ -58,7 +58,7 @@ export function getOverridableSection<
|
|
|
58
58
|
* @see https://www.faststore.dev/docs/building-sections/overriding-components-and-props
|
|
59
59
|
*/
|
|
60
60
|
export function getOverriddenSection<
|
|
61
|
-
Section extends SectionsOverrides[keyof SectionsOverrides]['Section']
|
|
61
|
+
Section extends SectionsOverrides[keyof SectionsOverrides]['Section'],
|
|
62
62
|
>(override: SectionOverrideDefinition<Section>) {
|
|
63
63
|
const { Section, ...rest } = override
|
|
64
64
|
|
|
@@ -11,7 +11,7 @@ import type { SectionsOverrides } from '../../typings/overrides'
|
|
|
11
11
|
issues of this file. Error lines have been marked with the @ts-ignore comment*/
|
|
12
12
|
|
|
13
13
|
export function getSectionOverrides<
|
|
14
|
-
SectionName extends keyof SectionsOverrides
|
|
14
|
+
SectionName extends keyof SectionsOverrides,
|
|
15
15
|
>(
|
|
16
16
|
defaultComponents: DefaultSectionComponentsDefinitions<SectionName>,
|
|
17
17
|
override: SectionOverrideDefinitionV1<SectionName>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
1
|
+
import type { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
2
2
|
import { useMemo } from 'react'
|
|
3
3
|
import { ITEMS_PER_SECTION } from 'src/constants'
|
|
4
4
|
import { useSession } from '../session'
|
|
@@ -4,7 +4,7 @@ import { useSession } from 'src/sdk/session'
|
|
|
4
4
|
import { useLocalizedVariables } from './useLocalizedVariables'
|
|
5
5
|
|
|
6
6
|
import { useSearch } from '@faststore/sdk'
|
|
7
|
-
import { Facet } from '@faststore/sdk/dist/types'
|
|
7
|
+
import type { Facet } from '@faststore/sdk/dist/types'
|
|
8
8
|
import type {
|
|
9
9
|
ClientManyProductsQueryQueryVariables,
|
|
10
10
|
ClientProductGalleryQueryQuery as Query,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSearch } from '@faststore/sdk'
|
|
2
2
|
|
|
3
3
|
import { gql } from '@generated'
|
|
4
|
-
import { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
4
|
+
import type { ClientManyProductsQueryQueryVariables } from '@generated/graphql'
|
|
5
5
|
import { useEffect, useCallback } from 'react'
|
|
6
6
|
|
|
7
7
|
import type { QueryOptions } from '../graphql/useQuery'
|
|
@@ -89,15 +89,18 @@ export const useFilter = (allFacets: Filter_FacetsFragment[]) => {
|
|
|
89
89
|
|
|
90
90
|
const selectedMap = useMemo(
|
|
91
91
|
() =>
|
|
92
|
-
selected.reduce(
|
|
93
|
-
|
|
94
|
-
acc.
|
|
95
|
-
|
|
92
|
+
selected.reduce(
|
|
93
|
+
(acc, facet) => {
|
|
94
|
+
if (!acc.has(facet.key)) {
|
|
95
|
+
acc.set(facet.key, new Map())
|
|
96
|
+
}
|
|
96
97
|
|
|
97
|
-
|
|
98
|
+
acc.get(facet.key)?.set(facet.value, facet)
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
return acc
|
|
101
|
+
},
|
|
102
|
+
new Map() as Map<string, Map<string, IStoreSelectedFacet>>
|
|
103
|
+
),
|
|
101
104
|
[selected]
|
|
102
105
|
)
|
|
103
106
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeEvent } from 'react'
|
|
2
2
|
import { useCallback, useEffect, useReducer, useRef } from 'react'
|
|
3
|
-
import { ClientShippingSimulationQueryQuery } from '@generated/graphql'
|
|
3
|
+
import type { ClientShippingSimulationQueryQuery } from '@generated/graphql'
|
|
4
4
|
import getShippingSimulation from '.'
|
|
5
5
|
import { useSession } from '../session'
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ const createEmptySimulation = () =>
|
|
|
46
46
|
errorMessage: '',
|
|
47
47
|
},
|
|
48
48
|
shippingSimulation: undefined,
|
|
49
|
-
} as State
|
|
49
|
+
}) as State
|
|
50
50
|
|
|
51
51
|
const reducer = (state: State, action: Action) => {
|
|
52
52
|
const { type } = action
|
package/src/server/cms/index.ts
CHANGED
package/src/server/cms/pdp.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ServerProductQueryQuery } from '@generated/graphql'
|
|
1
|
+
import type { ServerProductQueryQuery } from '@generated/graphql'
|
|
2
2
|
import type { ContentData, Locator } from '@vtex/client-cms'
|
|
3
3
|
import MissingContentError from 'src/sdk/error/MissingContentError'
|
|
4
4
|
import { findBestPDPTemplate } from 'src/utils/multipleTemplates'
|
|
5
|
-
import { Options, getCMSPage, getPage } from '.'
|
|
5
|
+
import { type Options, getCMSPage, getPage } from '.'
|
|
6
6
|
import config from '../../../discovery.config'
|
|
7
7
|
|
|
8
8
|
type PDPSettings = {
|
package/src/server/cms/plp.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ContentData, Locator } from '@vtex/client-cms'
|
|
1
|
+
import type { ContentData, Locator } from '@vtex/client-cms'
|
|
2
2
|
import MissingContentError from 'src/sdk/error/MissingContentError'
|
|
3
3
|
import {
|
|
4
|
-
Rewrite,
|
|
5
|
-
RewritesConfig,
|
|
4
|
+
type Rewrite,
|
|
5
|
+
type RewritesConfig,
|
|
6
6
|
findBestPLPTemplate,
|
|
7
7
|
} from 'src/utils/multipleTemplates'
|
|
8
8
|
import config from '../../../discovery.config'
|
|
9
|
-
import { Options, getCMSPage, getPage } from '../cms'
|
|
9
|
+
import { type Options, getCMSPage, getPage } from '../cms'
|
|
10
10
|
|
|
11
11
|
type PLPSettings = {
|
|
12
12
|
settings: {
|
package/src/typings/global.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
declare module '*.scss'
|
|
2
|
-
declare module '*.png'
|
|
1
|
+
declare module '*.scss'
|
|
2
|
+
declare module '*.png'
|
|
3
3
|
|
|
4
4
|
interface Window extends Window {
|
|
5
|
-
dataLayer: any[]
|
|
5
|
+
dataLayer: any[]
|
|
6
6
|
VTEX_METADATA: {
|
|
7
|
-
account: string
|
|
8
|
-
renderer:
|
|
9
|
-
}
|
|
7
|
+
account: string
|
|
8
|
+
renderer: 'faststore'
|
|
9
|
+
}
|
|
10
10
|
sendrc: (eventName: string, eventValues?: any) => void
|
|
11
11
|
}
|
package/src/typings/overrides.ts
CHANGED
|
@@ -48,18 +48,18 @@ import type {
|
|
|
48
48
|
ComponentOverrideDefinition,
|
|
49
49
|
SectionOverrideDefinitionV1,
|
|
50
50
|
} from './overridesDefinition'
|
|
51
|
-
import Alert from '../components/sections/Alert'
|
|
52
|
-
import Breadcrumb from '../components/sections/Breadcrumb'
|
|
53
|
-
import BannerText from '../components/sections/BannerText'
|
|
54
|
-
import CrossSellingShelf from '../components/sections/CrossSellingShelf'
|
|
55
|
-
import EmptyState from '../components/sections/EmptyState'
|
|
56
|
-
import Hero from '../components/sections/Hero'
|
|
57
|
-
import ProductShelf from '../components/sections/ProductShelf'
|
|
58
|
-
import ProductDetails from '../components/sections/ProductDetails'
|
|
59
|
-
import Navbar from '../components/sections/Navbar'
|
|
60
|
-
import Newsletter from '../components/sections/Newsletter'
|
|
61
|
-
import ProductGallery from '../components/sections/ProductGallery'
|
|
62
|
-
import RegionBar from '../components/sections/RegionBar'
|
|
51
|
+
import type Alert from '../components/sections/Alert'
|
|
52
|
+
import type Breadcrumb from '../components/sections/Breadcrumb'
|
|
53
|
+
import type BannerText from '../components/sections/BannerText'
|
|
54
|
+
import type CrossSellingShelf from '../components/sections/CrossSellingShelf'
|
|
55
|
+
import type EmptyState from '../components/sections/EmptyState'
|
|
56
|
+
import type Hero from '../components/sections/Hero'
|
|
57
|
+
import type ProductShelf from '../components/sections/ProductShelf'
|
|
58
|
+
import type ProductDetails from '../components/sections/ProductDetails'
|
|
59
|
+
import type Navbar from '../components/sections/Navbar'
|
|
60
|
+
import type Newsletter from '../components/sections/Newsletter'
|
|
61
|
+
import type ProductGallery from '../components/sections/ProductGallery'
|
|
62
|
+
import type RegionBar from '../components/sections/RegionBar'
|
|
63
63
|
|
|
64
64
|
export type SectionOverride = {
|
|
65
65
|
[K in keyof SectionsOverrides]: SectionOverrideDefinitionV1<K>
|
|
@@ -82,25 +82,25 @@ export type SectionOverride = {
|
|
|
82
82
|
* We then use ComponentsFromSection to extract the list of components
|
|
83
83
|
*/
|
|
84
84
|
export type OverrideComponentsForSection<
|
|
85
|
-
Section extends SectionsOverrides[keyof SectionsOverrides]['Section']
|
|
85
|
+
Section extends SectionsOverrides[keyof SectionsOverrides]['Section'],
|
|
86
86
|
> = {
|
|
87
|
-
// The first 'extends' condition is used to filter out sections that don't have overrides (typed 'never')
|
|
88
|
-
[K in keyof SectionsOverrides as SectionsOverrides[K] extends {
|
|
89
|
-
|
|
90
|
-
}
|
|
87
|
+
// The first 'extends' condition is used to filter out sections that don't have overrides (typed 'never')
|
|
88
|
+
[K in keyof SectionsOverrides as SectionsOverrides[K] extends {
|
|
89
|
+
Section: never
|
|
90
|
+
}
|
|
91
91
|
? never
|
|
92
92
|
: // In the second 'extends' condition, we check if the section matches the one we're looking for
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
SectionsOverrides[K] extends {
|
|
94
|
+
Section: Section
|
|
95
|
+
}
|
|
96
|
+
? // If it does, we return the components. Otherwise, we return 'never', which is filtered out
|
|
97
|
+
K
|
|
98
|
+
: never]: SectionsOverrides[K]['components']
|
|
99
|
+
}
|
|
100
100
|
|
|
101
101
|
// This type is used to extract only the list of components from the section override
|
|
102
102
|
export type ComponentsFromSection<
|
|
103
|
-
Section extends SectionsOverrides[keyof SectionsOverrides]['Section']
|
|
103
|
+
Section extends SectionsOverrides[keyof SectionsOverrides]['Section'],
|
|
104
104
|
> =
|
|
105
105
|
OverrideComponentsForSection<Section>[keyof OverrideComponentsForSection<Section>]
|
|
106
106
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComponentsFromSection, SectionsOverrides } from './overrides'
|
|
1
|
+
import type { ComponentsFromSection, SectionsOverrides } from './overrides'
|
|
2
2
|
|
|
3
3
|
export type SectionOverrideDefinitionV1<
|
|
4
|
-
SectionName extends keyof SectionsOverrides
|
|
4
|
+
SectionName extends keyof SectionsOverrides,
|
|
5
5
|
> = {
|
|
6
6
|
/**
|
|
7
7
|
* CSS class to be appended to the \<section\> element. Behaves similarly to React's className.
|
|
@@ -15,7 +15,7 @@ export type SectionOverrideDefinitionV1<
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export type SectionOverrideDefinition<
|
|
18
|
-
Section extends SectionsOverrides[keyof SectionsOverrides]['Section']
|
|
18
|
+
Section extends SectionsOverrides[keyof SectionsOverrides]['Section'],
|
|
19
19
|
> = {
|
|
20
20
|
/**
|
|
21
21
|
* CSS class to be appended to the \<section\> element. Behaves similarly to React's className.
|
|
@@ -36,7 +36,7 @@ export type OverriddenComponents<SectionName extends keyof SectionsOverrides> =
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export type DefaultSectionComponentsDefinitions<
|
|
39
|
-
K extends keyof SectionsOverrides
|
|
39
|
+
K extends keyof SectionsOverrides,
|
|
40
40
|
> = Record<keyof SectionsOverrides[K]['components'], React.ComponentType>
|
|
41
41
|
|
|
42
42
|
export type ComponentOverrideDefinition<ComponentProps, Props> =
|