@faststore/core 2.0.162-alpha.0 → 2.0.164-alpha.0

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.
Files changed (41) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/next-server.js.nft.json +1 -1
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/index.pack +0 -0
  9. package/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.json +1 -1
  13. package/.next/routes-manifest.json +1 -1
  14. package/.next/server/chunks/183.js +7 -0
  15. package/.next/server/chunks/350.js +1 -1
  16. package/.next/server/chunks/576.js +7 -0
  17. package/.next/server/middleware-build-manifest.js +1 -1
  18. package/.next/server/pages/api/graphql.js +1 -1
  19. package/.next/server/pages/api/preview.js +2 -1
  20. package/.next/server/pages/en-US/404.html +2 -2
  21. package/.next/server/pages/en-US/500.html +2 -2
  22. package/.next/server/pages/en-US/account.html +2 -2
  23. package/.next/server/pages/en-US/checkout.html +2 -2
  24. package/.next/server/pages/en-US/login.html +2 -2
  25. package/.next/server/pages/en-US/s.html +2 -2
  26. package/.next/server/pages/en-US.html +2 -2
  27. package/.next/server/pages/en-US.json +1 -1
  28. package/.next/server/pages/index.js +2 -2
  29. package/.next/server/pages-manifest.json +4 -4
  30. package/.next/static/chunks/pages/{_app-f06fabc4661b3348.js → _app-78846ca9151cf266.js} +1 -1
  31. package/.next/trace +69 -69
  32. package/.turbo/turbo-build.log +5 -4
  33. package/@generated/graphql/index.ts +13 -0
  34. package/CHANGELOG.md +12 -0
  35. package/cms/faststore/content-types.json +49 -0
  36. package/faststore.config.js +8 -0
  37. package/package.json +3 -3
  38. package/src/pages/api/preview.ts +2 -1
  39. package/src/pages/index.tsx +2 -2
  40. /package/.next/static/{Udi5RBTy_YIARcxGrQTA2 → gIr9FWN1njlGkoTr4tYi8}/_buildManifest.js +0 -0
  41. /package/.next/static/{Udi5RBTy_YIARcxGrQTA2 → gIr9FWN1njlGkoTr4tYi8}/_ssgManifest.js +0 -0
@@ -16,6 +16,7 @@ info - Collecting page data...
16
16
  info - Generating static pages (0/7)
17
17
  info - Generating static pages (1/7)
18
18
  info - Generating static pages (3/7)
19
+ warn - IncentivesHeader not found. Add a new component for this section or remove it from the CMS
19
20
  info - Generating static pages (5/7)
20
21
  info - Generating static pages (7/7)
21
22
  info - Finalizing page optimization...
@@ -23,7 +24,7 @@ info - Finalizing page optimization...
23
24
  Route (pages) Size First Load JS
24
25
  ┌ ● / 3.1 kB 126 kB
25
26
  ├ └ css/13a4da555ff5e3be.css 7.19 kB
26
- ├ /_app 0 B 77.9 kB
27
+ ├ /_app 0 B 78 kB
27
28
  ├ ● /[...slug] 10.1 kB 133 kB
28
29
  ├ └ css/6e41f1b6078c14c1.css 7.9 kB
29
30
  ├ ● /[slug]/p 11.7 kB 135 kB
@@ -31,15 +32,15 @@ Route (pages) Size First Load JS
31
32
  ├ ○ /404 1.09 kB 113 kB
32
33
  ├ ● /500 1.11 kB 113 kB
33
34
  ├ ● /account 672 B 113 kB
34
- ├ λ /api/graphql 0 B 77.9 kB
35
- ├ λ /api/preview 0 B 77.9 kB
35
+ ├ λ /api/graphql 0 B 78 kB
36
+ ├ λ /api/preview 0 B 78 kB
36
37
  ├ ● /checkout 659 B 113 kB
37
38
  ├ ● /login 1.01 kB 113 kB
38
39
  └ ● /s 1.11 kB 124 kB
39
40
  + First Load JS shared by all 80.7 kB
40
41
  ├ chunks/framework-dfd14d7ce6600b03.js 45.3 kB
41
42
  ├ chunks/main-fd466221927468fd.js 23.9 kB
42
- ├ chunks/pages/_app-f06fabc4661b3348.js 6.46 kB
43
+ ├ chunks/pages/_app-78846ca9151cf266.js 6.49 kB
43
44
  ├ chunks/webpack-e9bf82a67cc08d0f.js 2.27 kB
44
45
  └ css/47d82dcec9a7dbc2.css 2.78 kB
45
46
 
@@ -371,6 +371,8 @@ export type Query = {
371
371
  collection: StoreCollection
372
372
  /** Returns the details of a product based on the specified locator. */
373
373
  product: StoreProduct
374
+ /** Returns if there's a redirect for a search. */
375
+ redirect: Maybe<StoreRedirect>
374
376
  /** Returns the result of a product, facet, or suggestion search. */
375
377
  search: StoreSearchResult
376
378
  /** Returns information about shipping simulation. */
@@ -395,6 +397,11 @@ export type QueryProductArgs = {
395
397
  locator: Array<IStoreSelectedFacet>
396
398
  }
397
399
 
400
+ export type QueryRedirectArgs = {
401
+ selectedFacets: InputMaybe<Array<IStoreSelectedFacet>>
402
+ term: InputMaybe<Scalars['String']>
403
+ }
404
+
398
405
  export type QuerySearchArgs = {
399
406
  after: InputMaybe<Scalars['String']>
400
407
  first: Scalars['Int']
@@ -863,6 +870,12 @@ export type StorePropertyValue = {
863
870
  valueReference: Scalars['String']
864
871
  }
865
872
 
873
+ /** Redirect informations, including url returned by the query. */
874
+ export type StoreRedirect = {
875
+ /** URL to redirect */
876
+ url: Maybe<Scalars['String']>
877
+ }
878
+
866
879
  /** Information of a given review. */
867
880
  export type StoreReview = {
868
881
  /** Review author. */
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.164-alpha.0](https://github.com/vtex/faststore/compare/v2.0.163-alpha.0...v2.0.164-alpha.0) (2023-05-26)
7
+
8
+ ### Features
9
+
10
+ - Apply adjusts in preview and content-types ([#1787](https://github.com/vtex/faststore/issues/1787)) ([bcf3772](https://github.com/vtex/faststore/commit/bcf377282bf21351961f028654d62cc8f046f593))
11
+
12
+ ## [2.0.163-alpha.0](https://github.com/vtex/faststore/compare/v2.0.162-alpha.0...v2.0.163-alpha.0) (2023-05-26)
13
+
14
+ ### Features
15
+
16
+ - add search redirect at api package 2.x ([#1749](https://github.com/vtex/faststore/issues/1749)) ([fe198e1](https://github.com/vtex/faststore/commit/fe198e1de73eda89c220f8a61bd2e83efbd4af9c))
17
+
6
18
  ## [2.0.162-alpha.0](https://github.com/vtex/faststore/compare/v2.0.161-alpha.0...v2.0.162-alpha.0) (2023-05-26)
7
19
 
8
20
  **Note:** Version bump only for package @faststore/core
@@ -50,14 +50,62 @@
50
50
  }
51
51
  ]
52
52
  },
53
+ {
54
+ "id": "home",
55
+ "name": "Home",
56
+ "isSingleton": true,
57
+ "configurationSchemaSets": [
58
+ {
59
+ "name": "Settings",
60
+ "configurations": [
61
+ {
62
+ "name": "seo",
63
+ "schema": {
64
+ "title": "SEO",
65
+ "description": "Search Engine Optimization options",
66
+ "type": "object",
67
+ "widget": {
68
+ "ui:ObjectFieldTemplate": "GoogleSeoPreview"
69
+ },
70
+ "required": ["slug", "title", "description"],
71
+ "properties": {
72
+ "slug": {
73
+ "title": "Path",
74
+ "type": "string",
75
+ "default": "/"
76
+ },
77
+ "title": {
78
+ "title": "Default page title",
79
+ "description": "Display this title when no other tile is available",
80
+ "type": "string",
81
+ "default": "FastStore"
82
+ },
83
+ "description": {
84
+ "title": "Meta tag description",
85
+ "type": "string",
86
+ "default": "A beautifuly designed store"
87
+ },
88
+ "canonical": {
89
+ "title": "Canonical url for the page",
90
+ "type": "string"
91
+ }
92
+ }
93
+ }
94
+ }
95
+ ]
96
+ }
97
+ ]
98
+ },
53
99
  {
54
100
  "id": "pdp",
55
101
  "name": "Product Page",
102
+ "isSingleton": true,
56
103
  "configurationSchemaSets": []
57
104
  },
58
105
  {
59
106
  "id": "plp",
60
107
  "name": "Product List Page",
108
+ "isSingleton": true,
61
109
  "configurationSchemaSets": [
62
110
  {
63
111
  "name": "Settings",
@@ -110,6 +158,7 @@
110
158
  {
111
159
  "id": "search",
112
160
  "name": "Search Page",
161
+ "isSingleton": true,
113
162
  "configurationSchemaSets": [
114
163
  {
115
164
  "name": "Settings",
@@ -52,6 +52,14 @@ module.exports = {
52
52
  loginUrl: 'https://secure.vtexfaststore.com/api/io/login',
53
53
  accountUrl: 'https://secure.vtexfaststore.com/api/io/account',
54
54
 
55
+ // Preview redirects
56
+ previewRedirects: {
57
+ home: '/',
58
+ plp: '/office',
59
+ search: '/s?q=headphone',
60
+ pdp: '/apple-magic-mouse/p',
61
+ },
62
+
55
63
  // Lighthouse CI
56
64
  lighthouse: {
57
65
  server: process.env.BASE_SITE_URL || 'http://localhost:3000',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "2.0.162-alpha.0",
3
+ "version": "2.0.164-alpha.0",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "@envelop/graphql-jit": "^1.1.1",
30
30
  "@envelop/parser-cache": "^2.2.0",
31
31
  "@envelop/validation-cache": "^2.2.0",
32
- "@faststore/api": "^2.0.162-alpha.0",
32
+ "@faststore/api": "^2.0.163-alpha.0",
33
33
  "@faststore/components": "^2.0.160-alpha.0",
34
34
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
35
35
  "@faststore/sdk": "^2.0.162-alpha.0",
@@ -108,5 +108,5 @@
108
108
  "msw": {
109
109
  "workerDirectory": "public"
110
110
  },
111
- "gitHead": "cd6e9dd9d3e2cc8560a806466dcabfe3b8d5b62e"
111
+ "gitHead": "ebc531057b79cf537588260555839e5d0c93824b"
112
112
  }
@@ -1,6 +1,7 @@
1
1
  import type { NextApiHandler, NextApiRequest } from 'next'
2
2
 
3
3
  import { clientCMS } from 'src/server/cms'
4
+ import { previewRedirects } from '../../../faststore.config'
4
5
 
5
6
  class StatusError extends Error {
6
7
  constructor(message: string, public status: number) {
@@ -46,7 +47,7 @@ const handler: NextApiHandler = async (req, res) => {
46
47
 
47
48
  // Redirect to the path from the fetched locator
48
49
  // TODO: apply redirect based on the content
49
- res.redirect('/')
50
+ res.redirect(previewRedirects[locator.contentType] ?? '/')
50
51
  } catch (error) {
51
52
  if (error instanceof StatusError) {
52
53
  res.status(error.status).end(error.message)
@@ -87,10 +87,10 @@ export const getStaticProps: GetStaticProps<
87
87
  > = async ({ previewData }) => {
88
88
  const [page, globalSections] = await Promise.all([
89
89
  getPage<PageContentType>({
90
- ...(previewData?.contentType === 'page'
90
+ ...(previewData?.contentType === 'home'
91
91
  ? previewData
92
92
  : { filters: { 'settings.seo.slug': '/' } }),
93
- contentType: 'page',
93
+ contentType: 'home',
94
94
  }),
95
95
  getGlobalSectionsData(previewData),
96
96
  ])