@faststore/core 0.3.12 → 0.3.13
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/CHANGELOG.md +7 -0
- package/README.md +4 -4
- package/cypress/global.js +1 -1
- package/cypress/integration/a11y.test.js +1 -1
- package/cypress/integration/analytics.test.js +1 -1
- package/cypress/integration/cart.test.js +1 -1
- package/cypress/integration/performance.test.js +1 -1
- package/cypress/integration/plp.test.js +1 -1
- package/cypress/integration/search.test.js +1 -1
- package/cypress/integration/seo.test.js +1 -1
- package/{store.config.js → faststore.config.js} +0 -0
- package/lighthouserc.js +1 -1
- package/package.json +1 -1
- package/src/components/ThirdPartyScripts/ThirdPartyScripts.tsx +2 -2
- package/src/components/product/ProductGrid/ProductGrid.stories.mdx +0 -1
- package/src/components/search/Filter/Facets.stories.mdx +0 -2
- package/src/components/search/Filter/Filter.stories.mdx +0 -2
- package/src/components/search/Filter/FilterSlider.stories.mdx +0 -2
- package/src/components/search/SearchProductCard/SearchProductCard.stories.mdx +0 -1
- package/src/components/ui/SlideOver/SlideOver.stories.mdx +0 -2
- package/src/pages/[...slug].tsx +1 -1
- package/src/pages/[slug]/p.tsx +1 -1
- package/src/pages/account.tsx +1 -1
- package/src/pages/checkout.tsx +1 -1
- package/src/pages/index.tsx +1 -1
- package/src/pages/login.tsx +1 -1
- package/src/pages/s.tsx +1 -1
- package/src/sdk/analytics/index.tsx +1 -1
- package/src/sdk/analytics/platform/vtex/search.ts +1 -1
- package/src/sdk/cart/useCheckoutButton.ts +2 -4
- package/src/sdk/session/index.ts +5 -6
- package/src/server/cms.ts +1 -1
- package/src/server/index.ts +1 -1
- package/src/stories/customizing.stories.mdx +1 -1
- package/src/stories/midnight.stories.mdx +1 -1
- package/src/stories/soft-blue.stories.mdx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog),
|
|
6
6
|
and this project adheres to [Calendar Versioning](https://calver.org/).
|
|
7
7
|
|
|
8
|
+
### [0.3.13](https://github.com/vtex-sites/nextjs.store/compare/0.3.12...0.3.13) (2022-12-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Chores
|
|
12
|
+
|
|
13
|
+
* using faststore.config avoid store.config ([#330](https://github.com/vtex-sites/nextjs.store/issues/330)) ([6f8ef30](https://github.com/vtex-sites/nextjs.store/commit/6f8ef30ec7c6a32ce29088fa7e506cc3b6b429bc))
|
|
14
|
+
|
|
8
15
|
### [0.3.12](https://github.com/vtex-sites/nextjs.store/compare/0.3.11...0.3.12) (2022-12-19)
|
|
9
16
|
|
|
10
17
|
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ As of Sep, 2022, this starter is still far from covering most basic cases found
|
|
|
43
43
|
yarn
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
2. **Setup
|
|
46
|
+
2. **Setup faststore.config.js**
|
|
47
47
|
|
|
48
48
|
Choose the ecommerce platform provider of your choice in the `store.config` file and set the corresponding options. For instance, to connect to the VTEX platform on the store `fashioneurope`:
|
|
49
49
|
|
|
@@ -94,7 +94,7 @@ A quick look at the top-level files and directories you'll see in a NextJS proje
|
|
|
94
94
|
└── yarn.lock
|
|
95
95
|
├── package.json
|
|
96
96
|
├── tsconfig.json
|
|
97
|
-
├──
|
|
97
|
+
├── faststore.config.js
|
|
98
98
|
├── README.md
|
|
99
99
|
├── CHANGELOG.md
|
|
100
100
|
├── __generated__
|
|
@@ -124,7 +124,7 @@ A quick look at the top-level files and directories you'll see in a NextJS proje
|
|
|
124
124
|
|
|
125
125
|
9. **`tsconfig.json`**: The configuration file for the typescript compiler. This will statically analyze your code for errors and bugs before releasing them into production
|
|
126
126
|
|
|
127
|
-
10. **`
|
|
127
|
+
10. **`faststore.config.js`**: Configure your e-commerce platform, default sales channel etc.
|
|
128
128
|
|
|
129
129
|
11. **`README.md`**: A text file containing useful reference information about your project.
|
|
130
130
|
|
|
@@ -405,7 +405,7 @@ The page rendered with CMS is:
|
|
|
405
405
|
|
|
406
406
|
### CMS configs
|
|
407
407
|
|
|
408
|
-
It's possible to change the CMS tenant and workspace at `
|
|
408
|
+
It's possible to change the CMS tenant and workspace at `faststore.config.js`.
|
|
409
409
|
|
|
410
410
|
## 🎓 Learning the Frameworks
|
|
411
411
|
|
package/cypress/global.js
CHANGED
|
File without changes
|
package/lighthouserc.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Partytown } from '@builder.io/partytown/react'
|
|
2
2
|
|
|
3
|
-
import storeConfig from '../../../
|
|
3
|
+
import storeConfig from '../../../faststore.config'
|
|
4
4
|
import GoogleTagManager from './GoogleTagManager'
|
|
5
5
|
import VTEX from './vtex'
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ const includeVTEX = storeConfig.platform === 'vtex'
|
|
|
13
13
|
|
|
14
14
|
if (process.env.NODE_ENV === 'development' && !includeGTM) {
|
|
15
15
|
console.warn(
|
|
16
|
-
'No GTM container id found. Check the analytics section on your
|
|
16
|
+
'No GTM container id found. Check the analytics section on your faststore.config.js file for enhanced observability of your store.'
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Meta, Canvas, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
2
|
import { SearchProvider } from '@faststore/sdk'
|
|
3
|
-
import storeConfig from 'store.config'
|
|
4
3
|
import Sentinel from 'src/sdk/search/Sentinel'
|
|
5
4
|
import { productGridItems } from 'src/../.storybook/mocks'
|
|
6
5
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import storeConfig from 'store.config'
|
|
5
|
-
|
|
6
4
|
import UIProvider, { useUI } from 'src/sdk/ui/Provider'
|
|
7
5
|
import { validateSession } from 'src/sdk/session'
|
|
8
6
|
import { useFilter } from './useFilter'
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import storeConfig from 'store.config'
|
|
5
|
-
|
|
6
4
|
import UIProvider, { useUI } from 'src/sdk/ui/Provider'
|
|
7
5
|
import { validateSession } from 'src/sdk/session'
|
|
8
6
|
import { useFilter } from './useFilter'
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { SearchProvider } from '@faststore/sdk'
|
|
2
2
|
import { useSearch } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import storeConfig from 'store.config'
|
|
5
|
-
|
|
6
4
|
import UIProvider, { useUI } from 'src/sdk/ui/Provider'
|
|
7
5
|
import { validateSession } from 'src/sdk/session'
|
|
8
6
|
import { useFilter } from './useFilter'
|
|
@@ -14,8 +14,6 @@ import CartSidebar from 'src/components/cart/CartSidebar'
|
|
|
14
14
|
import { cartItem } from 'src/../.storybook/mocks/cart-sidebar'
|
|
15
15
|
import { facets as facetsMock } from 'src/../.storybook/mocks/filter-slider'
|
|
16
16
|
|
|
17
|
-
import storeConfig from 'store.config'
|
|
18
|
-
|
|
19
17
|
import { validateSession } from 'src/sdk/session'
|
|
20
18
|
import { useFilter } from 'src/components/search/Filter/useFilter'
|
|
21
19
|
|
package/src/pages/[...slug].tsx
CHANGED
package/src/pages/[slug]/p.tsx
CHANGED
|
@@ -20,7 +20,7 @@ import { execute } from 'src/server'
|
|
|
20
20
|
import type { PDPContentType } from 'src/server/cms'
|
|
21
21
|
import { getPage } from 'src/server/cms'
|
|
22
22
|
|
|
23
|
-
import storeConfig from '../../../
|
|
23
|
+
import storeConfig from '../../../faststore.config'
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Sections: Components imported from each store's custom components and '../components/sections' only.
|
package/src/pages/account.tsx
CHANGED
package/src/pages/checkout.tsx
CHANGED
package/src/pages/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import { mark } from 'src/sdk/tests/mark'
|
|
|
15
15
|
import type { PageContentType } from 'src/server/cms'
|
|
16
16
|
import { getPage } from 'src/server/cms'
|
|
17
17
|
|
|
18
|
-
import storeConfig from '../../
|
|
18
|
+
import storeConfig from '../../faststore.config'
|
|
19
19
|
|
|
20
20
|
/* A list of components that can be used in the CMS. */
|
|
21
21
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
package/src/pages/login.tsx
CHANGED
package/src/pages/s.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { ITEMS_PER_PAGE } from 'src/constants'
|
|
|
11
11
|
import { useApplySearchState } from 'src/sdk/search/state'
|
|
12
12
|
import { mark } from 'src/sdk/tests/mark'
|
|
13
13
|
|
|
14
|
-
import storeConfig from '../../
|
|
14
|
+
import storeConfig from '../../faststore.config'
|
|
15
15
|
|
|
16
16
|
const useSearchParams = () => {
|
|
17
17
|
const [params, setParams] = useState<SearchState | null>(null)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnalyticsEvent } from '@faststore/sdk'
|
|
2
2
|
import { useAnalyticsEvent } from '@faststore/sdk'
|
|
3
3
|
|
|
4
|
-
import storeConfig from '../../../
|
|
4
|
+
import storeConfig from '../../../faststore.config'
|
|
5
5
|
|
|
6
6
|
if (typeof window !== 'undefined') {
|
|
7
7
|
window.dataLayer = window.dataLayer ?? []
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import storeConfig from '../../../faststore.config'
|
|
1
2
|
import { useCart } from './index'
|
|
2
|
-
import * as storeConfig from '../../../store.config'
|
|
3
|
-
|
|
4
|
-
const { checkoutUrl } = storeConfig
|
|
5
3
|
|
|
6
4
|
export const useCheckoutButton = () => {
|
|
7
5
|
const { isValidating, id } = useCart()
|
|
@@ -10,7 +8,7 @@ export const useCheckoutButton = () => {
|
|
|
10
8
|
e.preventDefault()
|
|
11
9
|
|
|
12
10
|
if (!isValidating && id) {
|
|
13
|
-
window.location.href = `${checkoutUrl}?orderFormId=${id}`
|
|
11
|
+
window.location.href = `${storeConfig.checkoutUrl}?orderFormId=${id}`
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
package/src/sdk/session/index.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { gql } from '@faststore/graphql-utils'
|
|
2
|
+
import type { Session } from '@faststore/sdk'
|
|
2
3
|
import { createSessionStore } from '@faststore/sdk'
|
|
3
4
|
import { useMemo } from 'react'
|
|
4
|
-
import type { Session } from '@faststore/sdk'
|
|
5
|
-
|
|
6
|
-
import storeConfig from 'store.config'
|
|
7
5
|
|
|
8
|
-
import { cartStore } from '../cart'
|
|
9
|
-
import { request } from '../graphql/request'
|
|
10
|
-
import { createValidationStore, useStore } from '../useStore'
|
|
11
6
|
import type {
|
|
12
7
|
ValidateSessionMutation,
|
|
13
8
|
ValidateSessionMutationVariables,
|
|
14
9
|
} from '../../../@generated/graphql/index'
|
|
10
|
+
import storeConfig from '../../../faststore.config'
|
|
11
|
+
import { cartStore } from '../cart'
|
|
12
|
+
import { request } from '../graphql/request'
|
|
13
|
+
import { createValidationStore, useStore } from '../useStore'
|
|
15
14
|
|
|
16
15
|
export const mutation = gql`
|
|
17
16
|
mutation ValidateSession($session: IStoreSession!, $search: String!) {
|
package/src/server/cms.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ClientCMS from '@vtex/client-cms'
|
|
2
2
|
import type { ContentData, Locator } from '@vtex/client-cms'
|
|
3
3
|
|
|
4
|
-
import config from '../../
|
|
4
|
+
import config from '../../faststore.config'
|
|
5
5
|
|
|
6
6
|
export const clientCMS = new ClientCMS({
|
|
7
7
|
workspace: config.api.workspace,
|
package/src/server/index.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { GraphQLError } from 'graphql'
|
|
|
14
14
|
import type { Maybe, Options as APIOptions, CacheControl } from '@faststore/api'
|
|
15
15
|
|
|
16
16
|
import persisted from '../../@generated/graphql/persisted.json'
|
|
17
|
-
import storeConfig from '../../
|
|
17
|
+
import storeConfig from '../../faststore.config'
|
|
18
18
|
|
|
19
19
|
interface ExecuteOptions<V = Record<string, unknown>> {
|
|
20
20
|
operationName: string
|
|
@@ -103,7 +103,7 @@ Its presets are defined on `src/styles/global/tokens.scss` and it's separated in
|
|
|
103
103
|
import '../styles/themes/my-theme.scss'
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
3. Go to `
|
|
106
|
+
3. Go to `faststore.config.js` and change the `theme` to your file's name:
|
|
107
107
|
|
|
108
108
|
```js
|
|
109
109
|
// Theming
|
|
@@ -32,7 +32,7 @@ A darkmode theme created for testing purposes.
|
|
|
32
32
|
import '../styles/themes/midnight.scss'
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
2. Go to `
|
|
35
|
+
2. Go to `faststore.config.js` and change the `theme` to your file's name:
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
// Theming
|
|
@@ -32,7 +32,7 @@ A basic theme created for testing purposes.
|
|
|
32
32
|
import '../styles/themes/soft-blue.scss'
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
2. Go to `
|
|
35
|
+
2. Go to `faststore.config.js` and change the `theme` to your file's name:
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
// Theming
|