@faststore/core 3.60.2 → 3.60.3

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 (35) 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/webpack/client-production/0.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/server-production/0.pack +0 -0
  8. package/.next/cache/webpack/server-production/index.pack +0 -0
  9. package/.next/prerender-manifest.js +1 -1
  10. package/.next/prerender-manifest.json +1 -1
  11. package/.next/routes-manifest.json +1 -1
  12. package/.next/server/chunks/6011.js +2 -2
  13. package/.next/server/chunks/9563.js +2 -2
  14. package/.next/server/middleware-build-manifest.js +1 -1
  15. package/.next/server/pages/api/graphql.js +2 -2
  16. package/.next/server/pages/en-US/404.html +2 -2
  17. package/.next/server/pages/en-US/500.html +2 -2
  18. package/.next/server/pages/en-US/checkout.html +2 -2
  19. package/.next/server/pages/en-US/login.html +2 -2
  20. package/.next/server/pages/en-US/s.html +2 -2
  21. package/.next/server/pages/en-US.html +2 -2
  22. package/.next/server/pages-manifest.json +1 -1
  23. package/.next/static/chunks/pages/{_app-cc7f46d0ed91905f.js → _app-52aa8f30f7707675.js} +1 -1
  24. package/.next/trace +128 -128
  25. package/.turbo/turbo-build.log +8 -8
  26. package/.turbo/turbo-test.log +6 -5
  27. package/@generated/gql.ts +2 -2
  28. package/@generated/graphql.ts +4 -1
  29. package/@generated/persisted-documents.json +1 -1
  30. package/@generated/schema.graphql +2 -0
  31. package/CHANGELOG.md +4 -0
  32. package/package.json +4 -4
  33. package/src/sdk/session/index.ts +13 -8
  34. /package/.next/static/{wR88hV-zsLUZ9DNHa360O → B1tGZHuLyVThpqeX7jh3X}/_buildManifest.js +0 -0
  35. /package/.next/static/{wR88hV-zsLUZ9DNHa360O → B1tGZHuLyVThpqeX7jh3X}/_ssgManifest.js +0 -0
@@ -1,23 +1,23 @@
1
1
 
2
- > @faststore/core@3.60.1 prebuild /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.60.2 prebuild /home/runner/work/faststore/faststore/packages/core
3
3
  > na run partytown && na run generate
4
4
 
5
5
 
6
- > @faststore/core@3.60.1 partytown /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@3.60.2 partytown /home/runner/work/faststore/faststore/packages/core
7
7
  > partytown copylib ./public/~partytown
8
8
 
9
9
  Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
10
10
 
11
- > @faststore/core@3.60.1 generate /home/runner/work/faststore/faststore/packages/core
11
+ > @faststore/core@3.60.2 generate /home/runner/work/faststore/faststore/packages/core
12
12
  > na run generate:schema && na run generate:codegen && na run format:generated
13
13
 
14
14
 
15
- > @faststore/core@3.60.1 generate:schema /home/runner/work/faststore/faststore/packages/core
15
+ > @faststore/core@3.60.2 generate:schema /home/runner/work/faststore/faststore/packages/core
16
16
  > tsx src/server/generator/generateGraphQLSchemaFile.ts
17
17
 
18
18
  Schema GraphQL file generated successfully
19
19
 
20
- > @faststore/core@3.60.1 generate:codegen /home/runner/work/faststore/faststore/packages/core
20
+ > @faststore/core@3.60.2 generate:codegen /home/runner/work/faststore/faststore/packages/core
21
21
  > graphql-codegen
22
22
 
23
23
  [STARTED] Parse Configuration
@@ -37,11 +37,11 @@ Running lifecycle hook "afterStart" scripts...
37
37
  [CLI] Loading Documents
38
38
  [CLI] Generating output
39
39
 
40
- > @faststore/core@3.60.1 format:generated /home/runner/work/faststore/faststore/packages/core
40
+ > @faststore/core@3.60.2 format:generated /home/runner/work/faststore/faststore/packages/core
41
41
  > prettier --write "@generated/**/*.{ts,js,tsx,jsx,json}" --loglevel error
42
42
 
43
43
 
44
- > @faststore/core@3.60.1 build /home/runner/work/faststore/faststore/packages/core
44
+ > @faststore/core@3.60.2 build /home/runner/work/faststore/faststore/packages/core
45
45
  > next build
46
46
 
47
47
  ⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
@@ -103,7 +103,7 @@ Route (pages) Size First Load JS
103
103
  + First Load JS shared by all 104 kB
104
104
  ├ chunks/framework-807b0f81cbc129f0.js 45.4 kB
105
105
  ├ chunks/main-f658704b53a96ab1.js 33.1 kB
106
- ├ chunks/pages/_app-cc7f46d0ed91905f.js 18 kB
106
+ ├ chunks/pages/_app-52aa8f30f7707675.js 18.1 kB
107
107
  ├ chunks/webpack-cde3c2053d848754.js 3.69 kB
108
108
  └ css/0a57ee6c7a57788c.css 3.49 kB
109
109
 
@@ -1,14 +1,15 @@
1
1
 
2
- > @faststore/core@3.60.1 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.60.2 test /home/runner/work/faststore/faststore/packages/core
3
3
  > jest
4
4
 
5
- PASS test/utils/multipleTemplates.test.ts (24.954 s)
6
- PASS test/server/cms/global.test.ts (25.301 s)
5
+ PASS test/server/cms/global.test.ts (25.298 s)
6
+ PASS test/utils/multipleTemplates.test.ts (26.037 s)
7
7
  PASS test/server/cms/index.test.ts
8
- PASS test/server/index.test.ts (30.982 s)
8
+ PASS test/server/index.test.ts (30.622 s)
9
+ A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
9
10
 
10
11
  Test Suites: 4 passed, 4 total
11
12
  Tests: 22 passed, 22 total
12
13
  Snapshots: 0 total
13
- Time: 32.119 s
14
+ Time: 32.048 s
14
15
  Ran all test suites.
package/@generated/gql.ts CHANGED
@@ -78,7 +78,7 @@ const documents = {
78
78
  types.ClientSearchSuggestionsQueryDocument,
79
79
  '\n query ClientTopSearchSuggestionsQuery(\n $term: String!\n $selectedFacets: [IStoreSelectedFacet!]\n ) {\n ...ClientTopSearchSuggestions\n search(first: 5, term: $term, selectedFacets: $selectedFacets) {\n suggestions {\n terms {\n value\n }\n }\n }\n }\n':
80
80
  types.ClientTopSearchSuggestionsQueryDocument,
81
- '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n city\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n b2b {\n customerId\n isRepresentative\n unitName\n unitId\n firstName\n lastName\n userName\n userEmail\n }\n marketingData {\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPage\n utmiPart\n }\n }\n }\n':
81
+ '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n city\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n b2b {\n customerId\n isRepresentative\n unitName\n unitId\n firstName\n lastName\n userName\n userEmail\n savedPostalCode\n }\n marketingData {\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPage\n utmiPart\n }\n }\n }\n':
82
82
  types.ValidateSessionDocument,
83
83
  '\n query ClientShippingSimulationQuery(\n $postalCode: String!\n $country: String!\n $items: [IShippingItem!]!\n ) {\n ...ClientShippingSimulation\n shipping(items: $items, postalCode: $postalCode, country: $country) {\n logisticsInfo {\n slas {\n carrier\n price\n availableDeliveryWindows {\n startDateUtc\n endDateUtc\n price\n listPrice\n }\n shippingEstimate\n localizedEstimates\n deliveryChannel\n }\n }\n address {\n city\n neighborhood\n state\n }\n }\n }\n':
84
84
  types.ClientShippingSimulationQueryDocument,
@@ -288,7 +288,7 @@ export function gql(
288
288
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
289
289
  */
290
290
  export function gql(
291
- source: '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n city\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n b2b {\n customerId\n isRepresentative\n unitName\n unitId\n firstName\n lastName\n userName\n userEmail\n }\n marketingData {\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPage\n utmiPart\n }\n }\n }\n'
291
+ source: '\n mutation ValidateSession($session: IStoreSession!, $search: String!) {\n validateSession(session: $session, search: $search) {\n locale\n channel\n country\n addressType\n postalCode\n city\n deliveryMode {\n deliveryChannel\n deliveryMethod\n deliveryWindow {\n startDate\n endDate\n }\n }\n geoCoordinates {\n latitude\n longitude\n }\n currency {\n code\n symbol\n }\n person {\n id\n email\n givenName\n familyName\n }\n b2b {\n customerId\n isRepresentative\n unitName\n unitId\n firstName\n lastName\n userName\n userEmail\n savedPostalCode\n }\n marketingData {\n utmCampaign\n utmMedium\n utmSource\n utmiCampaign\n utmiPage\n utmiPart\n }\n }\n }\n'
292
292
  ): typeof import('./graphql').ValidateSessionDocument
293
293
  /**
294
294
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -187,6 +187,7 @@ export type IStoreB2B = {
187
187
  firstName: InputMaybe<Scalars['String']['input']>
188
188
  isRepresentative: InputMaybe<Scalars['Boolean']['input']>
189
189
  lastName: InputMaybe<Scalars['String']['input']>
190
+ savedPostalCode: InputMaybe<Scalars['String']['input']>
190
191
  unitId: InputMaybe<Scalars['String']['input']>
191
192
  unitName: InputMaybe<Scalars['String']['input']>
192
193
  userEmail: InputMaybe<Scalars['String']['input']>
@@ -775,6 +776,7 @@ export type StoreB2B = {
775
776
  firstName: Maybe<Scalars['String']['output']>
776
777
  isRepresentative: Maybe<Scalars['Boolean']['output']>
777
778
  lastName: Maybe<Scalars['String']['output']>
779
+ savedPostalCode: Maybe<Scalars['String']['output']>
778
780
  unitId: Maybe<Scalars['String']['output']>
779
781
  unitName: Maybe<Scalars['String']['output']>
780
782
  userEmail: Maybe<Scalars['String']['output']>
@@ -2909,6 +2911,7 @@ export type ValidateSessionMutation = {
2909
2911
  lastName: string | null
2910
2912
  userName: string | null
2911
2913
  userEmail: string | null
2914
+ savedPostalCode: string | null
2912
2915
  } | null
2913
2916
  marketingData: {
2914
2917
  utmCampaign: string | null
@@ -3662,7 +3665,7 @@ export const ClientTopSearchSuggestionsQueryDocument = {
3662
3665
  export const ValidateSessionDocument = {
3663
3666
  __meta__: {
3664
3667
  operationName: 'ValidateSession',
3665
- operationHash: '6f6d66826c836c3633a8dc3d2fe8220c386584d6',
3668
+ operationHash: '259dd10b1c65ce4b20c9181feb7bec85ecb402e6',
3666
3669
  },
3667
3670
  } as unknown as TypedDocumentString<
3668
3671
  ValidateSessionMutation,
@@ -19,7 +19,7 @@
19
19
  "34ea14c0d4a57ddf9bc11e4be0cd2b5a6506d3d4": "query ClientProfileQuery($id: String!) { profile(id: $id) { addresses { city country geoCoordinate postalCode } } }",
20
20
  "b548281d477a173be7b6960434604d69769a97e7": "fragment ClientSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } advertisement { adId adResponseId } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations allVariantsByName availableVariations slugsMap } } name offers { lowPrice lowPriceWithTaxes offers { availability listPrice listPriceWithTaxes price priceWithTaxes quantity seller { identifier } } } id: productID sku slug unitMultiplier } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ClientSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { metadata { ...SearchEvent_metadata } products { pageInfo { totalCount } } suggestions { products { ...ProductSummary_product } terms { value } } } ...ClientSearchSuggestions }",
21
21
  "e2385b0f11726d0068f96548f57a8dd441c064e3": "fragment ClientTopSearchSuggestions on Query { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } } query ClientTopSearchSuggestionsQuery($selectedFacets: [IStoreSelectedFacet!], $term: String!) { search(first: 5, term: $term, selectedFacets: $selectedFacets) { suggestions { terms { value } } } ...ClientTopSearchSuggestions }",
22
- "6f6d66826c836c3633a8dc3d2fe8220c386584d6": "mutation ValidateSession($search: String!, $session: IStoreSession!) { validateSession(session: $session, search: $search) { addressType b2b { customerId firstName isRepresentative lastName unitId unitName userEmail userName } channel city country currency { code symbol } deliveryMode { deliveryChannel deliveryMethod deliveryWindow { endDate startDate } } geoCoordinates { latitude longitude } locale marketingData { utmCampaign utmMedium utmSource utmiCampaign utmiPage utmiPart } person { email familyName givenName id } postalCode } }",
22
+ "259dd10b1c65ce4b20c9181feb7bec85ecb402e6": "mutation ValidateSession($search: String!, $session: IStoreSession!) { validateSession(session: $session, search: $search) { addressType b2b { customerId firstName isRepresentative lastName savedPostalCode unitId unitName userEmail userName } channel city country currency { code symbol } deliveryMode { deliveryChannel deliveryMethod deliveryWindow { endDate startDate } } geoCoordinates { latitude longitude } locale marketingData { utmCampaign utmMedium utmSource utmiCampaign utmiPage utmiPart } person { email familyName givenName id } postalCode } }",
23
23
  "c35bad22f67f3eb34fea52bb49efa6b1da6b728d": "fragment ClientShippingSimulation on Query { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city } } } query ClientShippingSimulationQuery($country: String!, $items: [IShippingItem!]!, $postalCode: String!) { shipping(items: $items, postalCode: $postalCode, country: $country) { address { city neighborhood state } logisticsInfo { slas { availableDeliveryWindows { endDateUtc listPrice price startDateUtc } carrier deliveryChannel localizedEstimates price shippingEstimate } } } ...ClientShippingSimulation }",
24
24
  "5c2181dde311ca80b72e0cc76ac0855d8aa8b51e": "fragment ClientManyProducts on Query { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets sponsoredCount: $sponsoredCount ) { products { pageInfo { totalCount } } } } fragment ProductSummary_product on StoreProduct { additionalProperty { name propertyID value valueReference } advertisement { adId adResponseId } brand { brandName: name } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations allVariantsByName availableVariations slugsMap } } name offers { lowPrice lowPriceWithTaxes offers { availability listPrice listPriceWithTaxes price priceWithTaxes quantity seller { identifier } } } id: productID sku slug unitMultiplier } fragment SearchEvent_metadata on SearchMetadata { fuzzy isTermMisspelled logicalOperator } query ServerManyProductsQuery($after: String, $first: Int!, $selectedFacets: [IStoreSelectedFacet!]!, $sort: StoreSort!, $sponsoredCount: Int, $term: String!) { search( first: $first after: $after sort: $sort term: $term selectedFacets: $selectedFacets sponsoredCount: $sponsoredCount ) { metadata { ...SearchEvent_metadata } products { edges { node { ...ProductSummary_product } } pageInfo { totalCount } } } ...ClientManyProducts }"
25
25
  }
@@ -895,6 +895,7 @@ type StoreB2B {
895
895
  lastName: String
896
896
  userName: String
897
897
  userEmail: String
898
+ savedPostalCode: String
898
899
  }
899
900
 
900
901
  input IStoreB2B {
@@ -906,6 +907,7 @@ input IStoreB2B {
906
907
  lastName: String
907
908
  userName: String
908
909
  userEmail: String
910
+ savedPostalCode: String
909
911
  }
910
912
 
911
913
  """Session input."""
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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
+ ## [3.60.3](https://github.com/vtex/faststore/compare/v3.60.2...v3.60.3) (2025-07-02)
7
+
8
+ **Note:** Version bump only for package @faststore/core
9
+
6
10
  ## [3.60.2](https://github.com/vtex/faststore/compare/v3.60.1...v3.60.2) (2025-07-02)
7
11
 
8
12
  **Note:** Version bump only for package @faststore/core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.60.2",
3
+ "version": "3.60.3",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -44,10 +44,10 @@
44
44
  "@envelop/graphql-jit": "^8.0.3",
45
45
  "@envelop/parser-cache": "^6.0.2",
46
46
  "@envelop/validation-cache": "^6.0.2",
47
- "@faststore/api": "^3.59.0",
47
+ "@faststore/api": "^3.60.3",
48
48
  "@faststore/graphql-utils": "^3.56.1",
49
49
  "@faststore/lighthouse": "^3.56.1",
50
- "@faststore/sdk": "^3.60.2",
50
+ "@faststore/sdk": "^3.60.3",
51
51
  "@faststore/ui": "^3.56.1",
52
52
  "@graphql-codegen/cli": "5.0.2",
53
53
  "@graphql-codegen/client-preset": "4.2.6",
@@ -105,5 +105,5 @@
105
105
  "ts-jest": "29.1.1",
106
106
  "typescript": "5.3.2"
107
107
  },
108
- "gitHead": "a83d344763f1031e67ccf6ee2d4afb0d9a815cf2"
108
+ "gitHead": "e0f5b29a904c59d59bdf348d5d6caebd311358fe"
109
109
  }
@@ -53,6 +53,7 @@ export const mutation = gql(`
53
53
  lastName
54
54
  userName
55
55
  userEmail
56
+ savedPostalCode
56
57
  }
57
58
  marketingData {
58
59
  utmCampaign
@@ -69,12 +70,17 @@ export const mutation = gql(`
69
70
  export const validateSession = async (session: Session) => {
70
71
  // If deliveryPromise is enabled and there is no postalCode in the session
71
72
  if (storeConfig.deliveryPromise?.enabled && !session.postalCode) {
72
- const isLoggedIn = !!session.person?.id
73
+ // Case B2B: If a B2B shopper is logged in and a saved address is available, the postalCode field is automatically updated with the postal code from that address by the B2B session apps (shopper-session and profile-session).
74
+ if (session.b2b && session.b2b?.savedPostalCode) {
75
+ sessionStore.set({
76
+ ...session,
77
+ postalCode: session.b2b.savedPostalCode,
78
+ })
79
+ }
73
80
 
74
- // If user is logged try to get the location (postalCode / geoCoordinates / country) from the user's address
75
- if (isLoggedIn) {
76
- const userId = session.person?.id
77
- const address = await getSavedAddress(userId)
81
+ // Case B2C: If a B2C shopper is logged in, try to get the location (postalCode, geoCoordinates, and country) from their saved address
82
+ else if (session.person?.id) {
83
+ const address = await getSavedAddress(session.person?.id)
78
84
 
79
85
  // Save the location in the session
80
86
  if (address) {
@@ -93,12 +99,11 @@ export const validateSession = async (session: Session) => {
93
99
  })
94
100
  }
95
101
  } else {
96
- // Use the initial postalCode defined in discovery.config.js
102
+ // Fallback: use the initial postalCode defined in discovery.config.js
97
103
  const initialPostalCode = defaultStore.readInitial().postalCode
98
104
 
99
- if (!!initialPostalCode) {
105
+ !!initialPostalCode &&
100
106
  sessionStore.set({ ...session, postalCode: initialPostalCode })
101
- }
102
107
  }
103
108
  }
104
109