@faststore/core 3.57.0 → 3.59.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 (84) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +22 -22
  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/7947.js +1 -0
  14. package/.next/server/chunks/9563.js +2 -2
  15. package/.next/server/functions-config-manifest.json +1 -1
  16. package/.next/server/middleware-build-manifest.js +1 -1
  17. package/.next/server/pages/404.js.nft.json +1 -1
  18. package/.next/server/pages/500.js.nft.json +1 -1
  19. package/.next/server/pages/[...slug].js.nft.json +1 -1
  20. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  21. package/.next/server/pages/_app.js.nft.json +1 -1
  22. package/.next/server/pages/_document.js.nft.json +1 -1
  23. package/.next/server/pages/_error.js.nft.json +1 -1
  24. package/.next/server/pages/account/403.js +1 -1
  25. package/.next/server/pages/account/403.js.nft.json +1 -1
  26. package/.next/server/pages/account/404.js +1 -1
  27. package/.next/server/pages/account/404.js.nft.json +1 -1
  28. package/.next/server/pages/account/[...unknown].js.nft.json +1 -1
  29. package/.next/server/pages/account/orders/[id].js +1 -1
  30. package/.next/server/pages/account/orders/[id].js.nft.json +1 -1
  31. package/.next/server/pages/account/orders.js +1 -1
  32. package/.next/server/pages/account/orders.js.nft.json +1 -1
  33. package/.next/server/pages/account/profile.js +1 -1
  34. package/.next/server/pages/account/profile.js.nft.json +1 -1
  35. package/.next/server/pages/account/security.js +1 -1
  36. package/.next/server/pages/account/security.js.nft.json +1 -1
  37. package/.next/server/pages/account/user-details.js +1 -1
  38. package/.next/server/pages/account/user-details.js.nft.json +1 -1
  39. package/.next/server/pages/account.js +1 -1
  40. package/.next/server/pages/account.js.nft.json +1 -1
  41. package/.next/server/pages/api/graphql.js +2 -2
  42. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  43. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  44. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  45. package/.next/server/pages/api/preview.js.nft.json +1 -1
  46. package/.next/server/pages/checkout.js.nft.json +1 -1
  47. package/.next/server/pages/en-US/404.html +2 -2
  48. package/.next/server/pages/en-US/500.html +2 -2
  49. package/.next/server/pages/en-US/checkout.html +2 -2
  50. package/.next/server/pages/en-US/login.html +2 -2
  51. package/.next/server/pages/en-US/s.html +2 -2
  52. package/.next/server/pages/en-US.html +2 -2
  53. package/.next/server/pages/index.js.nft.json +1 -1
  54. package/.next/server/pages/login.js.nft.json +1 -1
  55. package/.next/server/pages/s.js.nft.json +1 -1
  56. package/.next/server/pages-manifest.json +1 -1
  57. package/.next/static/chunks/pages/account/orders/[id]-40637c13cd4487aa.js +1 -0
  58. package/.next/static/chunks/{webpack-39ca6907398b1ba6.js → webpack-442c329509c9052f.js} +1 -1
  59. package/.next/static/{mRyzU18kzIS5letQIEfoD → egRlT4xicQ4NBiwpJy3A7}/_buildManifest.js +1 -1
  60. package/.next/trace +128 -128
  61. package/.turbo/turbo-build.log +9 -9
  62. package/.turbo/turbo-test.log +5 -6
  63. package/@generated/gql.ts +10 -2
  64. package/@generated/graphql.ts +24 -1
  65. package/@generated/persisted-documents.json +2 -1
  66. package/@generated/schema.graphql +9 -0
  67. package/CHANGELOG.md +12 -0
  68. package/package.json +3 -3
  69. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/MyAccountOrderActions.tsx +17 -17
  70. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx +1 -0
  71. package/src/experimental/myAccountSeverSideProps.ts +11 -1
  72. package/src/pages/account/403.tsx +11 -1
  73. package/src/pages/account/404.tsx +11 -1
  74. package/src/pages/account/[...unknown].tsx +0 -2
  75. package/src/pages/account/index.tsx +15 -2
  76. package/src/pages/account/orders/[id].tsx +12 -1
  77. package/src/pages/account/orders/index.tsx +11 -1
  78. package/src/pages/account/profile.tsx +11 -1
  79. package/src/pages/account/security.tsx +11 -1
  80. package/src/pages/account/user-details.tsx +11 -1
  81. package/src/sdk/account/validateUser.ts +32 -0
  82. package/test/server/index.test.ts +1 -0
  83. package/.next/static/chunks/pages/account/orders/[id]-cb129862a8abdc5d.js +0 -1
  84. /package/.next/static/{mRyzU18kzIS5letQIEfoD → egRlT4xicQ4NBiwpJy3A7}/_ssgManifest.js +0 -0
@@ -1,23 +1,23 @@
1
1
 
2
- > @faststore/core@3.56.3 prebuild /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.58.0 prebuild /home/runner/work/faststore/faststore/packages/core
3
3
  > na run partytown && na run generate
4
4
 
5
5
 
6
- > @faststore/core@3.56.3 partytown /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@3.58.0 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.56.3 generate /home/runner/work/faststore/faststore/packages/core
11
+ > @faststore/core@3.58.0 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.56.3 generate:schema /home/runner/work/faststore/faststore/packages/core
15
+ > @faststore/core@3.58.0 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.56.3 generate:codegen /home/runner/work/faststore/faststore/packages/core
20
+ > @faststore/core@3.58.0 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.56.3 format:generated /home/runner/work/faststore/faststore/packages/core
40
+ > @faststore/core@3.58.0 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.56.3 build /home/runner/work/faststore/faststore/packages/core
44
+ > @faststore/core@3.58.0 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
@@ -85,7 +85,7 @@ Route (pages) Size First Load JS
85
85
  ├ └ css/5347dbc8b71de47d.css 4.25 kB
86
86
  ├ λ /account/orders 8.86 kB 137 kB
87
87
  ├ └ css/8a3f440e0ff9cd8e.css 11.9 kB
88
- ├ λ /account/orders/[id] 10.1 kB 138 kB
88
+ ├ λ /account/orders/[id] 10 kB 138 kB
89
89
  ├ └ css/506442c818624bd2.css 11.5 kB
90
90
  ├ λ /account/profile 1.27 kB 129 kB
91
91
  ├ λ /account/security 1.27 kB 129 kB
@@ -101,7 +101,7 @@ Route (pages) Size First Load JS
101
101
  ├ chunks/framework-807b0f81cbc129f0.js 45.4 kB
102
102
  ├ chunks/main-f658704b53a96ab1.js 33.1 kB
103
103
  ├ chunks/pages/_app-eb6edb0ba4b4be67.js 16.3 kB
104
- ├ chunks/webpack-39ca6907398b1ba6.js 3.7 kB
104
+ ├ chunks/webpack-442c329509c9052f.js 3.7 kB
105
105
  └ css/0a57ee6c7a57788c.css 3.49 kB
106
106
 
107
107
  λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
@@ -1,15 +1,14 @@
1
1
 
2
- > @faststore/core@3.56.3 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.58.0 test /home/runner/work/faststore/faststore/packages/core
3
3
  > jest
4
4
 
5
- PASS test/server/cms/global.test.ts (24.316 s)
6
- PASS test/utils/multipleTemplates.test.ts (25.061 s)
5
+ PASS test/utils/multipleTemplates.test.ts (24.272 s)
6
+ PASS test/server/cms/global.test.ts (24.584 s)
7
7
  PASS test/server/cms/index.test.ts
8
- PASS test/server/index.test.ts (29.248 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.
8
+ PASS test/server/index.test.ts (28.664 s)
10
9
 
11
10
  Test Suites: 4 passed, 4 total
12
11
  Tests: 22 passed, 22 total
13
12
  Snapshots: 0 total
14
- Time: 30.556 s
13
+ Time: 29.743 s
15
14
  Ran all test suites.
package/@generated/gql.ts CHANGED
@@ -44,7 +44,7 @@ const documents = {
44
44
  types.ServerProductQueryDocument,
45
45
  '\n fragment UserOrderItemsFragment on UserOrderItems {\n id\n name\n quantity\n sellingPrice\n unitMultiplier\n measurementUnit\n imageUrl\n detailUrl\n refId\n rewardValue\n }\n':
46
46
  types.UserOrderItemsFragmentFragmentDoc,
47
- '\n query ServerOrderDetailsQuery($orderId: String!) {\n userOrder(orderId: $orderId) {\n orderId\n status\n statusDescription\n allowCancellation\n storePreferencesData {\n currencyCode\n }\n clientProfileData {\n firstName\n lastName\n email\n phone\n corporateName\n isCorporate\n }\n customFields {\n type\n id\n fields {\n name\n value\n refId\n }\n }\n deliveryOptionsData {\n deliveryOptions {\n selectedSla\n deliveryChannel\n deliveryCompany\n deliveryWindow {\n startDateUtc\n endDateUtc\n price\n }\n shippingEstimate\n shippingEstimateDate\n friendlyShippingEstimate\n friendlyDeliveryOptionName\n seller\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n pickupStoreInfo {\n additionalInfo\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n dockId\n friendlyName\n isPickupStore\n }\n quantityOfDifferentItems\n total\n items {\n id\n name\n quantity\n price\n imageUrl\n tax\n total\n }\n }\n contact {\n email\n phone\n name\n }\n }\n paymentData {\n transactions {\n isActive\n payments {\n id\n paymentSystemName\n value\n installments\n referenceValue\n lastDigits\n url\n group\n tid\n connectorResponses {\n authId\n }\n bankIssuedInvoiceIdentificationNumber\n redemptionCode\n paymentOrigin\n }\n }\n }\n totals {\n id\n name\n value\n }\n }\n accountName\n }\n':
47
+ '\n query ServerOrderDetailsQuery($orderId: String!) {\n userOrder(orderId: $orderId) {\n orderId\n status\n canCancelOrder\n statusDescription\n allowCancellation\n storePreferencesData {\n currencyCode\n }\n clientProfileData {\n firstName\n lastName\n email\n phone\n corporateName\n isCorporate\n }\n customFields {\n type\n id\n fields {\n name\n value\n refId\n }\n }\n deliveryOptionsData {\n deliveryOptions {\n selectedSla\n deliveryChannel\n deliveryCompany\n deliveryWindow {\n startDateUtc\n endDateUtc\n price\n }\n shippingEstimate\n shippingEstimateDate\n friendlyShippingEstimate\n friendlyDeliveryOptionName\n seller\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n pickupStoreInfo {\n additionalInfo\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n dockId\n friendlyName\n isPickupStore\n }\n quantityOfDifferentItems\n total\n items {\n id\n name\n quantity\n price\n imageUrl\n tax\n total\n }\n }\n contact {\n email\n phone\n name\n }\n }\n paymentData {\n transactions {\n isActive\n payments {\n id\n paymentSystemName\n value\n installments\n referenceValue\n lastDigits\n url\n group\n tid\n connectorResponses {\n authId\n }\n bankIssuedInvoiceIdentificationNumber\n redemptionCode\n paymentOrigin\n }\n }\n }\n totals {\n id\n name\n value\n }\n }\n accountName\n }\n':
48
48
  types.ServerOrderDetailsQueryDocument,
49
49
  '\n query ServerListOrdersQuery ($page: Int,$perPage: Int, $status: [String], $dateInitial: String, $dateFinal: String, $text: String, $clientEmail: String) {\n listUserOrders (page: $page, perPage: $perPage, status: $status, dateInitial: $dateInitial, dateFinal: $dateFinal, text: $text, clientEmail: $clientEmail) {\n list {\n orderId\n creationDate\n clientName\n items {\n seller\n quantity\n description\n ean\n refId\n id\n productId\n sellingPrice\n price\n }\n totalValue\n status\n statusDescription\n ShippingEstimatedDate\n currencyCode\n customFields {\n type\n value\n }\n }\n paging {\n total\n pages\n currentPage\n perPage\n }\n }\n accountName\n }\n':
50
50
  types.ServerListOrdersQueryDocument,
@@ -56,6 +56,8 @@ const documents = {
56
56
  types.ServerUserDetailsQueryDocument,
57
57
  '\n mutation CancelOrderMutation($data: IUserOrderCancel!) {\n cancelOrder(data: $data) {\n data\n }\n }\n':
58
58
  types.CancelOrderMutationDocument,
59
+ '\n query ValidateUser {\n validateUser {\n isValid\n }\n }\n':
60
+ types.ValidateUserDocument,
59
61
  '\n mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) {\n validateCart(cart: $cart, session: $session) {\n order {\n orderNumber\n acceptedOffer {\n ...CartItem\n }\n shouldSplitItem\n }\n messages {\n ...CartMessage\n }\n }\n }\n\n fragment CartMessage on StoreCartMessage {\n text\n status\n }\n\n fragment CartItem on StoreOffer {\n seller {\n identifier\n }\n quantity\n price\n priceWithTaxes\n listPrice\n listPriceWithTaxes\n itemOffered {\n ...CartProductItem\n }\n }\n\n fragment CartProductItem on StoreProduct {\n sku\n name\n unitMultiplier\n image {\n url\n alternateName\n }\n brand {\n name\n }\n isVariantOf {\n productGroupID\n name\n skuVariants {\n activeVariations\n slugsMap\n availableVariations\n }\n }\n gtin\n additionalProperty {\n propertyID\n name\n value\n valueReference\n }\n }\n':
60
62
  types.ValidateCartMutationDocument,
61
63
  '\n mutation SubscribeToNewsletter($data: IPersonNewsletter!) {\n subscribeToNewsletter(data: $data) {\n id\n }\n }\n':
@@ -184,7 +186,7 @@ export function gql(
184
186
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
185
187
  */
186
188
  export function gql(
187
- source: '\n query ServerOrderDetailsQuery($orderId: String!) {\n userOrder(orderId: $orderId) {\n orderId\n status\n statusDescription\n allowCancellation\n storePreferencesData {\n currencyCode\n }\n clientProfileData {\n firstName\n lastName\n email\n phone\n corporateName\n isCorporate\n }\n customFields {\n type\n id\n fields {\n name\n value\n refId\n }\n }\n deliveryOptionsData {\n deliveryOptions {\n selectedSla\n deliveryChannel\n deliveryCompany\n deliveryWindow {\n startDateUtc\n endDateUtc\n price\n }\n shippingEstimate\n shippingEstimateDate\n friendlyShippingEstimate\n friendlyDeliveryOptionName\n seller\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n pickupStoreInfo {\n additionalInfo\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n dockId\n friendlyName\n isPickupStore\n }\n quantityOfDifferentItems\n total\n items {\n id\n name\n quantity\n price\n imageUrl\n tax\n total\n }\n }\n contact {\n email\n phone\n name\n }\n }\n paymentData {\n transactions {\n isActive\n payments {\n id\n paymentSystemName\n value\n installments\n referenceValue\n lastDigits\n url\n group\n tid\n connectorResponses {\n authId\n }\n bankIssuedInvoiceIdentificationNumber\n redemptionCode\n paymentOrigin\n }\n }\n }\n totals {\n id\n name\n value\n }\n }\n accountName\n }\n'
189
+ source: '\n query ServerOrderDetailsQuery($orderId: String!) {\n userOrder(orderId: $orderId) {\n orderId\n status\n canCancelOrder\n statusDescription\n allowCancellation\n storePreferencesData {\n currencyCode\n }\n clientProfileData {\n firstName\n lastName\n email\n phone\n corporateName\n isCorporate\n }\n customFields {\n type\n id\n fields {\n name\n value\n refId\n }\n }\n deliveryOptionsData {\n deliveryOptions {\n selectedSla\n deliveryChannel\n deliveryCompany\n deliveryWindow {\n startDateUtc\n endDateUtc\n price\n }\n shippingEstimate\n shippingEstimateDate\n friendlyShippingEstimate\n friendlyDeliveryOptionName\n seller\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n pickupStoreInfo {\n additionalInfo\n address {\n addressType\n receiverName\n addressId\n versionId\n entityId\n postalCode\n city\n state\n country\n street\n number\n neighborhood\n complement\n reference\n geoCoordinates\n }\n dockId\n friendlyName\n isPickupStore\n }\n quantityOfDifferentItems\n total\n items {\n id\n name\n quantity\n price\n imageUrl\n tax\n total\n }\n }\n contact {\n email\n phone\n name\n }\n }\n paymentData {\n transactions {\n isActive\n payments {\n id\n paymentSystemName\n value\n installments\n referenceValue\n lastDigits\n url\n group\n tid\n connectorResponses {\n authId\n }\n bankIssuedInvoiceIdentificationNumber\n redemptionCode\n paymentOrigin\n }\n }\n }\n totals {\n id\n name\n value\n }\n }\n accountName\n }\n'
188
190
  ): typeof import('./graphql').ServerOrderDetailsQueryDocument
189
191
  /**
190
192
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
@@ -216,6 +218,12 @@ export function gql(
216
218
  export function gql(
217
219
  source: '\n mutation CancelOrderMutation($data: IUserOrderCancel!) {\n cancelOrder(data: $data) {\n data\n }\n }\n'
218
220
  ): typeof import('./graphql').CancelOrderMutationDocument
221
+ /**
222
+ * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
223
+ */
224
+ export function gql(
225
+ source: '\n query ValidateUser {\n validateUser {\n isValid\n }\n }\n'
226
+ ): typeof import('./graphql').ValidateUserDocument
219
227
  /**
220
228
  * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
221
229
  */
@@ -561,6 +561,8 @@ export type Query = {
561
561
  shipping: Maybe<ShippingData>
562
562
  /** Returns information about the Details of an User Order. */
563
563
  userOrder: Maybe<UserOrderResult>
564
+ /** Returns information about the user validation. */
565
+ validateUser: Maybe<ValidateUserData>
564
566
  }
565
567
 
566
568
  export type QueryAllCollectionsArgs = {
@@ -1266,6 +1268,7 @@ export type UserOrder = {
1266
1268
  allowEdition: Maybe<Scalars['Boolean']['output']>
1267
1269
  authorizedDate: Maybe<Scalars['String']['output']>
1268
1270
  callCenterOperatorData: Maybe<Scalars['String']['output']>
1271
+ canCancelOrder: Maybe<Scalars['Boolean']['output']>
1269
1272
  cancelReason: Maybe<Scalars['String']['output']>
1270
1273
  cancellationData: Maybe<UserOrderCancellationData>
1271
1274
  cancellationRequests: Maybe<Array<Maybe<UserOrderCancellationRequest>>>
@@ -1913,6 +1916,7 @@ export type UserOrderRestitutions = {
1913
1916
 
1914
1917
  export type UserOrderResult = {
1915
1918
  allowCancellation: Maybe<Scalars['Boolean']['output']>
1919
+ canCancelOrder: Maybe<Scalars['Boolean']['output']>
1916
1920
  clientProfileData: Maybe<UserOrderClientProfileData>
1917
1921
  customData: Maybe<UserOrderCustomData>
1918
1922
  customFields: Maybe<Array<Maybe<UserOrderCustomFieldsGrouped>>>
@@ -1997,6 +2001,11 @@ export type UserOrderTransactions = {
1997
2001
  transactionId: Maybe<Scalars['String']['output']>
1998
2002
  }
1999
2003
 
2004
+ export type ValidateUserData = {
2005
+ /** Indicates if the user is valid. */
2006
+ isValid: Scalars['Boolean']['output']
2007
+ }
2008
+
2000
2009
  export type ProductSummary_ProductFragment = {
2001
2010
  slug: string
2002
2011
  sku: string
@@ -2266,6 +2275,7 @@ export type ServerOrderDetailsQueryQuery = {
2266
2275
  userOrder: {
2267
2276
  orderId: string | null
2268
2277
  status: string | null
2278
+ canCancelOrder: boolean | null
2269
2279
  statusDescription: string | null
2270
2280
  allowCancellation: boolean | null
2271
2281
  storePreferencesData: { currencyCode: string | null } | null
@@ -2459,6 +2469,10 @@ export type CancelOrderMutationMutation = {
2459
2469
  cancelOrder: { data: string | null } | null
2460
2470
  }
2461
2471
 
2472
+ export type ValidateUserQueryVariables = Exact<{ [key: string]: never }>
2473
+
2474
+ export type ValidateUserQuery = { validateUser: { isValid: boolean } | null }
2475
+
2462
2476
  export type ValidateCartMutationMutationVariables = Exact<{
2463
2477
  cart: IStoreCart
2464
2478
  session: IStoreSession
@@ -3495,7 +3509,7 @@ export const ServerProductQueryDocument = {
3495
3509
  export const ServerOrderDetailsQueryDocument = {
3496
3510
  __meta__: {
3497
3511
  operationName: 'ServerOrderDetailsQuery',
3498
- operationHash: 'c957b142e7f211126246f91a42db6d76c519da77',
3512
+ operationHash: 'e0fbde45eca1af0aeda0314c5d1c37e8fe520312',
3499
3513
  },
3500
3514
  } as unknown as TypedDocumentString<
3501
3515
  ServerOrderDetailsQueryQuery,
@@ -3546,6 +3560,15 @@ export const CancelOrderMutationDocument = {
3546
3560
  CancelOrderMutationMutation,
3547
3561
  CancelOrderMutationMutationVariables
3548
3562
  >
3563
+ export const ValidateUserDocument = {
3564
+ __meta__: {
3565
+ operationName: 'ValidateUser',
3566
+ operationHash: '32f99c73c3de958b64d6bece1afe800469f54548',
3567
+ },
3568
+ } as unknown as TypedDocumentString<
3569
+ ValidateUserQuery,
3570
+ ValidateUserQueryVariables
3571
+ >
3549
3572
  export const ValidateCartMutationDocument = {
3550
3573
  __meta__: {
3551
3574
  operationName: 'ValidateCartMutation',
@@ -2,12 +2,13 @@
2
2
  "47315a3cd26ddd9c7fa963778988464341b8193f": "query ServerAccountPageQuery { accountName }",
3
3
  "4b33c5c07f440dc7489e55619dc2211a13786e72": "fragment ServerCollectionPage on Query { collection(slug: $slug) { id } } query ServerCollectionPageQuery($slug: String!) { collection(slug: $slug) { breadcrumbList { itemListElement { item name position } } meta { selectedFacets { key value } } seo { description title } } ...ServerCollectionPage }",
4
4
  "46103bee661405bde706d72126fdbf9b0a0c9e6e": "fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku unitMultiplier } fragment ProductDetailsFragment_product on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } description gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name offers { lowPrice lowPriceWithTaxes offers { availability listPrice listPriceWithTaxes price priceWithTaxes seller { identifier } } } id: productID sku unitMultiplier ...CartProductItem } fragment ServerProduct on Query { product(locator: $locator) { id: productID } } query ServerProductQuery($locator: [IStoreSelectedFacet!]!) { product(locator: $locator) { brand { name } breadcrumbList { itemListElement { item name position } } description gtin image { alternateName url } isVariantOf { productGroupID } name offers { highPrice lowPrice lowPriceWithTaxes offers { availability itemCondition price priceCurrency priceValidUntil seller { identifier } } priceCurrency } id: productID releaseDate seo { canonical description title } sku ...ProductDetailsFragment_product } ...ServerProduct }",
5
- "c957b142e7f211126246f91a42db6d76c519da77": "query ServerOrderDetailsQuery($orderId: String!) { accountName userOrder(orderId: $orderId) { allowCancellation clientProfileData { corporateName email firstName isCorporate lastName phone } customFields { fields { name refId value } id type } deliveryOptionsData { contact { email name phone } deliveryOptions { address { addressId addressType city complement country entityId geoCoordinates neighborhood number postalCode receiverName reference state street versionId } deliveryChannel deliveryCompany deliveryWindow { endDateUtc price startDateUtc } friendlyDeliveryOptionName friendlyShippingEstimate items { id imageUrl name price quantity tax total } pickupStoreInfo { additionalInfo address { addressId addressType city complement country entityId geoCoordinates neighborhood number postalCode receiverName reference state street versionId } dockId friendlyName isPickupStore } quantityOfDifferentItems selectedSla seller shippingEstimate shippingEstimateDate total } } orderId paymentData { transactions { isActive payments { bankIssuedInvoiceIdentificationNumber connectorResponses { authId } group id installments lastDigits paymentOrigin paymentSystemName redemptionCode referenceValue tid url value } } } status statusDescription storePreferencesData { currencyCode } totals { id name value } } }",
5
+ "e0fbde45eca1af0aeda0314c5d1c37e8fe520312": "query ServerOrderDetailsQuery($orderId: String!) { accountName userOrder(orderId: $orderId) { allowCancellation canCancelOrder clientProfileData { corporateName email firstName isCorporate lastName phone } customFields { fields { name refId value } id type } deliveryOptionsData { contact { email name phone } deliveryOptions { address { addressId addressType city complement country entityId geoCoordinates neighborhood number postalCode receiverName reference state street versionId } deliveryChannel deliveryCompany deliveryWindow { endDateUtc price startDateUtc } friendlyDeliveryOptionName friendlyShippingEstimate items { id imageUrl name price quantity tax total } pickupStoreInfo { additionalInfo address { addressId addressType city complement country entityId geoCoordinates neighborhood number postalCode receiverName reference state street versionId } dockId friendlyName isPickupStore } quantityOfDifferentItems selectedSla seller shippingEstimate shippingEstimateDate total } } orderId paymentData { transactions { isActive payments { bankIssuedInvoiceIdentificationNumber connectorResponses { authId } group id installments lastDigits paymentOrigin paymentSystemName redemptionCode referenceValue tid url value } } } status statusDescription storePreferencesData { currencyCode } totals { id name value } } }",
6
6
  "ee84ac3f5b58c5e1950a927a42c5c1dd6012fcc4": "query ServerListOrdersQuery($clientEmail: String, $dateFinal: String, $dateInitial: String, $page: Int, $perPage: Int, $status: [String], $text: String) { accountName listUserOrders( page: $page perPage: $perPage status: $status dateInitial: $dateInitial dateFinal: $dateFinal text: $text clientEmail: $clientEmail ) { list { ShippingEstimatedDate clientName creationDate currencyCode customFields { type value } items { description ean id price productId quantity refId seller sellingPrice } orderId status statusDescription totalValue } paging { currentPage pages perPage total } } }",
7
7
  "c4191223fe0b642eee3aaaa2c56563da7d163265": "query ServerProfileQuery { accountName }",
8
8
  "9f24767f16e6e05c168336701a6c6c7b6b5dc1c6": "query ServerSecurityQuery { accountName }",
9
9
  "92d9db34aa133d60d474c6d4cdcdd2fc19041a5e": "query ServerUserDetailsQuery { accountName }",
10
10
  "e2b06da6840614d3c72768e56579b9d3b8e80802": "mutation CancelOrderMutation($data: IUserOrderCancel!) { cancelOrder(data: $data) { data } }",
11
+ "32f99c73c3de958b64d6bece1afe800469f54548": "query ValidateUser { validateUser { isValid } }",
11
12
  "c2b3f8bff73ebf6ac79d758c66cabbc21ba9fcc0": "fragment CartItem on StoreOffer { itemOffered { ...CartProductItem } listPrice listPriceWithTaxes price priceWithTaxes quantity seller { identifier } } fragment CartMessage on StoreCartMessage { status text } fragment CartProductItem on StoreProduct { additionalProperty { name propertyID value valueReference } brand { name } gtin image { alternateName url } isVariantOf { name productGroupID skuVariants { activeVariations availableVariations slugsMap } } name sku unitMultiplier } mutation ValidateCartMutation($cart: IStoreCart!, $session: IStoreSession!) { validateCart(cart: $cart, session: $session) { messages { ...CartMessage } order { acceptedOffer { ...CartItem } orderNumber shouldSplitItem } } }",
12
13
  "feb7005103a859e2bc8cf2360d568806fd88deba": "mutation SubscribeToNewsletter($data: IPersonNewsletter!) { subscribeToNewsletter(data: $data) { id } }",
13
14
  "dc912e7272e3d9f5ced206837df87f544d39d0a5": "query ClientProductCountQuery($term: String) { productCount(term: $term) { total } }",
@@ -710,6 +710,13 @@ type Query {
710
710
  ): UserOrderListMinimalResult @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
711
711
  """Returns the account name of the current user or the B2B contract name if applicable."""
712
712
  accountName: String @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
713
+ """Returns information about the user validation."""
714
+ validateUser: ValidateUserData @cacheControl(scope: "public", sMaxAge: 120, staleWhileRevalidate: 3600)
715
+ }
716
+
717
+ type ValidateUserData {
718
+ """Indicates if the user is valid."""
719
+ isValid: Boolean!
713
720
  }
714
721
 
715
722
  """
@@ -1271,11 +1278,13 @@ type UserOrder {
1271
1278
  totals: [UserOrderTotals]
1272
1279
  deliveryOptionsData: UserOrderDeliveryOptionsData
1273
1280
  customFields: [UserOrderCustomFieldsGrouped]
1281
+ canCancelOrder: Boolean
1274
1282
  }
1275
1283
 
1276
1284
  type UserOrderResult {
1277
1285
  orderId: String
1278
1286
  status: String
1287
+ canCancelOrder: Boolean
1279
1288
  statusDescription: String
1280
1289
  allowCancellation: Boolean
1281
1290
  storePreferencesData: UserOrderStorePreferencesData
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
+ # [3.59.0](https://github.com/vtex/faststore/compare/v3.58.0...v3.59.0) (2025-06-20)
7
+
8
+ ### Features
9
+
10
+ - add canCancelOrder flag ([#2914](https://github.com/vtex/faststore/issues/2914)) ([033aadc](https://github.com/vtex/faststore/commit/033aadcf50adadc1a101664533d3e1cbc72017e0))
11
+
12
+ # [3.58.0](https://github.com/vtex/faststore/compare/v3.57.0...v3.58.0) (2025-06-20)
13
+
14
+ ### Features
15
+
16
+ - add user validation query and implement access control in MyAccount ([#2899](https://github.com/vtex/faststore/issues/2899)) ([48978bf](https://github.com/vtex/faststore/commit/48978bf90e486b5eaa38ee230e7d8f9a269fb910))
17
+
6
18
  # [3.57.0](https://github.com/vtex/faststore/compare/v3.56.3...v3.57.0) (2025-06-20)
7
19
 
8
20
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.57.0",
3
+ "version": "3.59.0",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -44,7 +44,7 @@
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.56.3",
47
+ "@faststore/api": "^3.59.0",
48
48
  "@faststore/graphql-utils": "^3.56.1",
49
49
  "@faststore/lighthouse": "^3.56.1",
50
50
  "@faststore/sdk": "^3.56.1",
@@ -105,5 +105,5 @@
105
105
  "ts-jest": "29.1.1",
106
106
  "typescript": "5.3.2"
107
107
  },
108
- "gitHead": "9852b7744c562a56723ee8099ea534b6e5b527aa"
108
+ "gitHead": "94f1d5be2e0fa11a98a5b6a08f0d68a8eb2bd95b"
109
109
  }
@@ -1,9 +1,4 @@
1
- import {
2
- Button as UIButton,
3
- Icon as UIIcon,
4
- IconButton as UIIconButton,
5
- useUI,
6
- } from '@faststore/ui'
1
+ import { Button as UIButton, Icon as UIIcon, useUI } from '@faststore/ui'
7
2
  import useScreenResize from 'src/sdk/ui/useScreenResize'
8
3
  import MyAccountOrderActionModal, {
9
4
  useOrderActionModal,
@@ -28,11 +23,13 @@ const TOASTS_CONFIG = {
28
23
  }
29
24
 
30
25
  interface MyAccountOrderActionsProps {
26
+ canCancelOrder: boolean
31
27
  orderId: string
32
28
  customerEmail?: string
33
29
  }
34
30
 
35
31
  export default function MyAccountOrderActions({
32
+ canCancelOrder,
36
33
  orderId,
37
34
  customerEmail,
38
35
  }: MyAccountOrderActionsProps) {
@@ -92,16 +89,19 @@ export default function MyAccountOrderActions({
92
89
  return (
93
90
  <>
94
91
  <div data-fs-order-details-header-actions>
95
- <UIButton
96
- variant="secondary"
97
- data-fs-order-details-header-actions-cancel
98
- size={isMobile || isTablet ? 'regular' : 'small'}
99
- type="button"
100
- onClick={() => openDialog('cancel')}
101
- >
102
- Cancel order
103
- </UIButton>
104
- {isMobile || isTablet ? (
92
+ {canCancelOrder && (
93
+ <UIButton
94
+ variant="secondary"
95
+ data-fs-order-details-header-actions-cancel
96
+ size={isMobile || isTablet ? 'regular' : 'small'}
97
+ type="button"
98
+ onClick={() => openDialog('cancel')}
99
+ >
100
+ Cancel order
101
+ </UIButton>
102
+ )}
103
+ {/* TODO: This will be replaced for approval flow with buying policies */}
104
+ {/* {isMobile || isTablet ? (
105
105
  <UIIconButton
106
106
  aria-label="Reject"
107
107
  icon={<UIIcon name="XCircle" />}
@@ -138,7 +138,7 @@ export default function MyAccountOrderActions({
138
138
  >
139
139
  Approve
140
140
  </UIButton>
141
- )}
141
+ )} */}
142
142
  </div>
143
143
 
144
144
  <MyAccountOrderActionModal
@@ -52,6 +52,7 @@ export default function MyAccountOrderDetails({
52
52
  </div>
53
53
  </div>
54
54
  <MyAccountOrderActions
55
+ canCancelOrder={order.canCancelOrder}
55
56
  orderId={order.orderId}
56
57
  customerEmail={order.clientProfileData?.email}
57
58
  />
@@ -14,6 +14,7 @@ import { execute } from 'src/server'
14
14
 
15
15
  import { injectGlobalSections } from 'src/server/cms/global'
16
16
  import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
17
+ import { validateUser } from 'src/sdk/account/validateUser'
17
18
 
18
19
  export type MyAccountProps = {
19
20
  globalSections: GlobalSectionsData
@@ -31,7 +32,16 @@ export const getServerSideProps: GetServerSideProps<
31
32
  Record<string, string>,
32
33
  Locator
33
34
  > = async (context) => {
34
- // TODO validate permissions here
35
+ const isValid = await validateUser(context)
36
+
37
+ if (!isValid) {
38
+ return {
39
+ redirect: {
40
+ destination: '/login',
41
+ permanent: false,
42
+ },
43
+ }
44
+ }
35
45
 
36
46
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
37
47
  query: context.query,
@@ -23,6 +23,7 @@ import type {
23
23
  ServerAccountPageQueryQuery,
24
24
  ServerAccountPageQueryQueryVariables,
25
25
  } from '@generated/graphql'
26
+ import { validateUser } from 'src/sdk/account/validateUser'
26
27
 
27
28
  /* A list of components that can be used in the CMS. */
28
29
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -71,7 +72,16 @@ export const getServerSideProps: GetServerSideProps<
71
72
  Record<string, string>,
72
73
  Locator
73
74
  > = async (context) => {
74
- // TODO validate permissions here
75
+ const isValid = await validateUser(context)
76
+
77
+ if (!isValid) {
78
+ return {
79
+ redirect: {
80
+ destination: '/login',
81
+ permanent: false,
82
+ },
83
+ }
84
+ }
75
85
 
76
86
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
77
87
  query: context.query,
@@ -24,6 +24,7 @@ import type {
24
24
  ServerAccountPageQueryQuery,
25
25
  ServerAccountPageQueryQueryVariables,
26
26
  } from '@generated/graphql'
27
+ import { validateUser } from 'src/sdk/account/validateUser'
27
28
 
28
29
  /* A list of components that can be used in the CMS. */
29
30
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -67,7 +68,16 @@ export const getServerSideProps: GetServerSideProps<
67
68
  Record<string, string>,
68
69
  Locator
69
70
  > = async (context) => {
70
- // TODO validate permissions here
71
+ const isValid = await validateUser(context)
72
+
73
+ if (!isValid) {
74
+ return {
75
+ redirect: {
76
+ destination: '/login',
77
+ permanent: false,
78
+ },
79
+ }
80
+ }
71
81
 
72
82
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
73
83
  query: context.query,
@@ -13,8 +13,6 @@ export const getStaticProps: GetStaticProps<
13
13
  Record<string, string>,
14
14
  Locator
15
15
  > = async () => {
16
- // TODO validate permissions here
17
-
18
16
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
19
17
  query: {},
20
18
  })
@@ -1,3 +1,4 @@
1
+ import { validateUser } from 'src/sdk/account/validateUser'
1
2
  import type { GetServerSideProps, NextPage } from 'next'
2
3
  import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
3
4
 
@@ -5,8 +6,20 @@ const MyAccountRedirectPage: NextPage = () => {
5
6
  return null
6
7
  }
7
8
 
8
- export const getServerSideProps: GetServerSideProps = async ({ query }) => {
9
- // TODO validate permissions here
9
+ export const getServerSideProps: GetServerSideProps = async ({
10
+ query,
11
+ req,
12
+ }) => {
13
+ const isValid = await validateUser({ query, req } as any)
14
+
15
+ if (!isValid) {
16
+ return {
17
+ redirect: {
18
+ destination: '/login',
19
+ permanent: false,
20
+ },
21
+ }
22
+ }
10
23
 
11
24
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
12
25
  query,
@@ -8,6 +8,7 @@ import RenderSections from 'src/components/cms/RenderSections'
8
8
  import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
9
9
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
10
10
  import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
11
+ import { validateUser } from 'src/sdk/account/validateUser'
11
12
 
12
13
  import { gql } from '@generated'
13
14
  import type {
@@ -72,6 +73,7 @@ const query = gql(`
72
73
  userOrder(orderId: $orderId) {
73
74
  orderId
74
75
  status
76
+ canCancelOrder
75
77
  statusDescription
76
78
  allowCancellation
77
79
  storePreferencesData {
@@ -204,7 +206,16 @@ export const getServerSideProps: GetServerSideProps<
204
206
  Record<string, string>,
205
207
  Locator
206
208
  > = async (context) => {
207
- // TODO validate permissions here
209
+ const isValid = await validateUser(context)
210
+
211
+ if (!isValid) {
212
+ return {
213
+ redirect: {
214
+ destination: '/login',
215
+ permanent: false,
216
+ },
217
+ }
218
+ }
208
219
 
209
220
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
210
221
  query: context.query,
@@ -24,6 +24,7 @@ import { groupOrderStatusByLabel } from 'src/utils/userOrderStatus'
24
24
 
25
25
  import { MyAccountListOrders } from 'src/components/account/orders/MyAccountListOrders'
26
26
  import { extractStatusFromError } from 'src/utils/utilities'
27
+ import { validateUser } from 'src/sdk/account/validateUser'
27
28
 
28
29
  /* A list of components that can be used in the CMS. */
29
30
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -118,7 +119,16 @@ export const getServerSideProps: GetServerSideProps<
118
119
  Record<string, string>,
119
120
  Locator
120
121
  > = async (context) => {
121
- // TODO validate permissions here
122
+ const isValid = await validateUser(context)
123
+
124
+ if (!isValid) {
125
+ return {
126
+ redirect: {
127
+ destination: '/login',
128
+ permanent: false,
129
+ },
130
+ }
131
+ }
122
132
 
123
133
  const { previewData } = context
124
134
 
@@ -23,6 +23,7 @@ import type {
23
23
  ServerProfileQueryQuery,
24
24
  ServerProfileQueryQueryVariables,
25
25
  } from '@generated/graphql'
26
+ import { validateUser } from 'src/sdk/account/validateUser'
26
27
 
27
28
  /* A list of components that can be used in the CMS. */
28
29
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -63,7 +64,16 @@ export const getServerSideProps: GetServerSideProps<
63
64
  Record<string, string>,
64
65
  Locator
65
66
  > = async (context) => {
66
- // TODO validate permissions here
67
+ const isValid = await validateUser(context)
68
+
69
+ if (!isValid) {
70
+ return {
71
+ redirect: {
72
+ destination: '/login',
73
+ permanent: false,
74
+ },
75
+ }
76
+ }
67
77
 
68
78
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
69
79
  query: context.query,
@@ -24,6 +24,7 @@ import type {
24
24
  ServerSecurityQueryQuery,
25
25
  ServerSecurityQueryQueryVariables,
26
26
  } from '@generated/graphql'
27
+ import { validateUser } from 'src/sdk/account/validateUser'
27
28
 
28
29
  /* A list of components that can be used in the CMS. */
29
30
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -68,7 +69,16 @@ export const getServerSideProps: GetServerSideProps<
68
69
  Record<string, string>,
69
70
  Locator
70
71
  > = async (context) => {
71
- // TODO validate permissions here
72
+ const isValid = await validateUser(context)
73
+
74
+ if (!isValid) {
75
+ return {
76
+ redirect: {
77
+ destination: '/login',
78
+ permanent: false,
79
+ },
80
+ }
81
+ }
72
82
 
73
83
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
74
84
  query: context.query,