@faststore/core 3.56.3 → 3.58.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 (94) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +23 -23
  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/83.js +1 -1
  15. package/.next/server/chunks/8474.js +1 -1
  16. package/.next/server/chunks/8569.js +1 -0
  17. package/.next/server/chunks/948.js +1 -1
  18. package/.next/server/chunks/9563.js +2 -2
  19. package/.next/server/chunks/UIBannerText.js +1 -1
  20. package/.next/server/middleware-build-manifest.js +1 -1
  21. package/.next/server/pages/404.js.nft.json +1 -1
  22. package/.next/server/pages/500.js.nft.json +1 -1
  23. package/.next/server/pages/[...slug].js.nft.json +1 -1
  24. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  25. package/.next/server/pages/_app.js.nft.json +1 -1
  26. package/.next/server/pages/_document.js.nft.json +1 -1
  27. package/.next/server/pages/_error.js.nft.json +1 -1
  28. package/.next/server/pages/account/403.js +1 -1
  29. package/.next/server/pages/account/403.js.nft.json +1 -1
  30. package/.next/server/pages/account/404.js +1 -1
  31. package/.next/server/pages/account/404.js.nft.json +1 -1
  32. package/.next/server/pages/account/[...unknown].js.nft.json +1 -1
  33. package/.next/server/pages/account/orders/[id].js +1 -1
  34. package/.next/server/pages/account/orders/[id].js.nft.json +1 -1
  35. package/.next/server/pages/account/orders.js +1 -1
  36. package/.next/server/pages/account/orders.js.nft.json +1 -1
  37. package/.next/server/pages/account/profile.js +1 -1
  38. package/.next/server/pages/account/profile.js.nft.json +1 -1
  39. package/.next/server/pages/account/security.js +1 -1
  40. package/.next/server/pages/account/security.js.nft.json +1 -1
  41. package/.next/server/pages/account/user-details.js +1 -1
  42. package/.next/server/pages/account/user-details.js.nft.json +1 -1
  43. package/.next/server/pages/account.js +1 -1
  44. package/.next/server/pages/account.js.nft.json +1 -1
  45. package/.next/server/pages/api/graphql.js +2 -2
  46. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  47. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  48. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  49. package/.next/server/pages/api/preview.js.nft.json +1 -1
  50. package/.next/server/pages/checkout.js.nft.json +1 -1
  51. package/.next/server/pages/en-US/404.html +2 -2
  52. package/.next/server/pages/en-US/500.html +2 -2
  53. package/.next/server/pages/en-US/checkout.html +2 -2
  54. package/.next/server/pages/en-US/login.html +2 -2
  55. package/.next/server/pages/en-US/s.html +2 -2
  56. package/.next/server/pages/en-US.html +2 -2
  57. package/.next/server/pages/index.js.nft.json +1 -1
  58. package/.next/server/pages/login.js.nft.json +1 -1
  59. package/.next/server/pages/s.js.nft.json +1 -1
  60. package/.next/server/pages-manifest.json +1 -1
  61. package/.next/static/chunks/pages/account/orders-2e03fa7da5518d2e.js +1 -0
  62. package/.next/static/chunks/{webpack-c7f9922d1ee74736.js → webpack-442c329509c9052f.js} +1 -1
  63. package/.next/static/css/8a3f440e0ff9cd8e.css +1 -0
  64. package/.next/static/{ISOeVhgVf_cwuga-IgttG → xEUAx3sARWz-pqtOPFb08}/_buildManifest.js +1 -1
  65. package/.next/trace +128 -128
  66. package/.turbo/turbo-build.log +10 -10
  67. package/.turbo/turbo-test.log +5 -5
  68. package/@generated/gql.ts +8 -0
  69. package/@generated/graphql.ts +20 -0
  70. package/@generated/persisted-documents.json +1 -0
  71. package/@generated/schema.graphql +7 -0
  72. package/CHANGELOG.md +12 -0
  73. package/package.json +3 -3
  74. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrders.tsx +50 -16
  75. package/src/components/account/orders/MyAccountListOrders/styles.module.scss +1 -1
  76. package/src/experimental/myAccountSeverSideProps.ts +11 -1
  77. package/src/pages/account/403.tsx +11 -1
  78. package/src/pages/account/404.tsx +11 -1
  79. package/src/pages/account/[...unknown].tsx +0 -2
  80. package/src/pages/account/index.tsx +15 -2
  81. package/src/pages/account/orders/[id].tsx +11 -1
  82. package/src/pages/account/orders/index.tsx +11 -1
  83. package/src/pages/account/profile.tsx +11 -1
  84. package/src/pages/account/security.tsx +11 -1
  85. package/src/pages/account/user-details.tsx +11 -1
  86. package/src/sdk/account/validateUser.ts +32 -0
  87. package/test/server/index.test.ts +1 -0
  88. package/.next/server/chunks/5772.js +0 -1
  89. package/.next/static/chunks/pages/account/orders-4318614ac8b796b0.js +0 -1
  90. package/.next/static/css/bae051e2b6768884.css +0 -1
  91. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/MyAccountListOrdersEmptyState.tsx +0 -20
  92. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/index.ts +0 -1
  93. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/styles.scss +0 -43
  94. /package/.next/static/{ISOeVhgVf_cwuga-IgttG → xEUAx3sARWz-pqtOPFb08}/_ssgManifest.js +0 -0
@@ -1,23 +1,23 @@
1
1
 
2
- > @faststore/core@3.56.2 prebuild /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.57.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.2 partytown /home/runner/work/faststore/faststore/packages/core
6
+ > @faststore/core@3.57.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.2 generate /home/runner/work/faststore/faststore/packages/core
11
+ > @faststore/core@3.57.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.2 generate:schema /home/runner/work/faststore/faststore/packages/core
15
+ > @faststore/core@3.57.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.2 generate:codegen /home/runner/work/faststore/faststore/packages/core
20
+ > @faststore/core@3.57.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.2 format:generated /home/runner/work/faststore/faststore/packages/core
40
+ > @faststore/core@3.57.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.2 build /home/runner/work/faststore/faststore/packages/core
44
+ > @faststore/core@3.57.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
@@ -83,8 +83,8 @@ Route (pages) Size First Load JS
83
83
  ├ └ css/b7bba8fce075688b.css 4.2 kB
84
84
  ├ λ /account/404 2.03 kB 130 kB
85
85
  ├ └ css/5347dbc8b71de47d.css 4.25 kB
86
- ├ λ /account/orders 8.73 kB 137 kB
87
- ├ └ css/bae051e2b6768884.css 11.8 kB
86
+ ├ λ /account/orders 8.86 kB 137 kB
87
+ ├ └ css/8a3f440e0ff9cd8e.css 11.9 kB
88
88
  ├ λ /account/orders/[id] 10.1 kB 138 kB
89
89
  ├ └ css/506442c818624bd2.css 11.5 kB
90
90
  ├ λ /account/profile 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-c7f9922d1ee74736.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,15 @@
1
1
 
2
- > @faststore/core@3.56.2 test /home/runner/work/faststore/faststore/packages/core
2
+ > @faststore/core@3.57.0 test /home/runner/work/faststore/faststore/packages/core
3
3
  > jest
4
4
 
5
- PASS test/utils/multipleTemplates.test.ts (24.529 s)
6
- PASS test/server/cms/global.test.ts (24.645 s)
5
+ PASS test/server/cms/global.test.ts (24.83 s)
6
+ PASS test/utils/multipleTemplates.test.ts (24.884 s)
7
7
  PASS test/server/cms/index.test.ts
8
- PASS test/server/index.test.ts (29.556 s)
8
+ PASS test/server/index.test.ts (30.148 s)
9
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.
10
10
 
11
11
  Test Suites: 4 passed, 4 total
12
12
  Tests: 22 passed, 22 total
13
13
  Snapshots: 0 total
14
- Time: 30.928 s
14
+ Time: 31.704 s
15
15
  Ran all test suites.
package/@generated/gql.ts CHANGED
@@ -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':
@@ -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 = {
@@ -1997,6 +1999,11 @@ export type UserOrderTransactions = {
1997
1999
  transactionId: Maybe<Scalars['String']['output']>
1998
2000
  }
1999
2001
 
2002
+ export type ValidateUserData = {
2003
+ /** Indicates if the user is valid. */
2004
+ isValid: Scalars['Boolean']['output']
2005
+ }
2006
+
2000
2007
  export type ProductSummary_ProductFragment = {
2001
2008
  slug: string
2002
2009
  sku: string
@@ -2459,6 +2466,10 @@ export type CancelOrderMutationMutation = {
2459
2466
  cancelOrder: { data: string | null } | null
2460
2467
  }
2461
2468
 
2469
+ export type ValidateUserQueryVariables = Exact<{ [key: string]: never }>
2470
+
2471
+ export type ValidateUserQuery = { validateUser: { isValid: boolean } | null }
2472
+
2462
2473
  export type ValidateCartMutationMutationVariables = Exact<{
2463
2474
  cart: IStoreCart
2464
2475
  session: IStoreSession
@@ -3546,6 +3557,15 @@ export const CancelOrderMutationDocument = {
3546
3557
  CancelOrderMutationMutation,
3547
3558
  CancelOrderMutationMutationVariables
3548
3559
  >
3560
+ export const ValidateUserDocument = {
3561
+ __meta__: {
3562
+ operationName: 'ValidateUser',
3563
+ operationHash: '32f99c73c3de958b64d6bece1afe800469f54548',
3564
+ },
3565
+ } as unknown as TypedDocumentString<
3566
+ ValidateUserQuery,
3567
+ ValidateUserQueryVariables
3568
+ >
3549
3569
  export const ValidateCartMutationDocument = {
3550
3570
  __meta__: {
3551
3571
  operationName: 'ValidateCartMutation',
@@ -8,6 +8,7 @@
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
  """
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.58.0](https://github.com/vtex/faststore/compare/v3.57.0...v3.58.0) (2025-06-20)
7
+
8
+ ### Features
9
+
10
+ - 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))
11
+
12
+ # [3.57.0](https://github.com/vtex/faststore/compare/v3.56.3...v3.57.0) (2025-06-20)
13
+
14
+ ### Features
15
+
16
+ - show empty state instead of table ([#2913](https://github.com/vtex/faststore/issues/2913)) ([5803953](https://github.com/vtex/faststore/commit/580395323bde2f9f1ca5da222c75dc359ac695a5))
17
+
6
18
  ## [3.56.3](https://github.com/vtex/faststore/compare/v3.56.2...v3.56.3) (2025-06-20)
7
19
 
8
20
  **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.56.3",
3
+ "version": "3.58.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.58.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": "7d0a61602c3dca4d8080da99dea0c5d4e3cfb38b"
108
+ "gitHead": "714b4b286130446f08511010d3cb14309ed9a9c7"
109
109
  }
@@ -5,7 +5,9 @@ import { useRouter } from 'next/router'
5
5
 
6
6
  import {
7
7
  Button,
8
- Icon,
8
+ EmptyState,
9
+ Icon as UIIcon,
10
+ LinkButton,
9
11
  SearchInputField,
10
12
  useUI,
11
13
  type SearchInputFieldRef,
@@ -20,7 +22,6 @@ import {
20
22
  } from 'src/sdk/search/useMyAccountFilter'
21
23
  import useScreenResize from 'src/sdk/ui/useScreenResize'
22
24
  import { FastStoreOrderStatus } from 'src/utils/userOrderStatus'
23
- import MyAccountListOrdersEmptyState from './MyAccountListOrdersEmptyState'
24
25
  import MyAccountListOrdersTable, {
25
26
  Pagination,
26
27
  } from './MyAccountListOrdersTable/MyAccountListOrdersTable'
@@ -105,6 +106,17 @@ function getAllFacets({
105
106
  ]
106
107
  }
107
108
 
109
+ function hasActiveFilters(
110
+ filters: MyAccountListOrdersProps['filters']
111
+ ): boolean {
112
+ return (
113
+ filters.status.length > 0 ||
114
+ Boolean(filters.dateInitial) ||
115
+ Boolean(filters.dateFinal) ||
116
+ Boolean(filters.text)
117
+ )
118
+ }
119
+
108
120
  export default function MyAccountListOrders({
109
121
  listOrders,
110
122
  total,
@@ -163,13 +175,8 @@ export default function MyAccountListOrders({
163
175
 
164
176
  const { openFilter, filter: displayFilter } = useUI()
165
177
 
166
- if (listOrders.list.length === 0) {
167
- return (
168
- <div className={styles.page}>
169
- <MyAccountListOrdersEmptyState />
170
- </div>
171
- )
172
- }
178
+ const hasFilters = hasActiveFilters(filters)
179
+ const isEmpty = listOrders.list.length === 0
173
180
 
174
181
  return (
175
182
  <div className={styles.page}>
@@ -197,7 +204,7 @@ export default function MyAccountListOrders({
197
204
  data-fs-list-orders-search-filters-button
198
205
  variant="tertiary"
199
206
  icon={
200
- <Icon
207
+ <UIIcon
201
208
  width={16}
202
209
  height={16}
203
210
  name="FadersHorizontal"
@@ -279,12 +286,39 @@ export default function MyAccountListOrders({
279
286
  />
280
287
  )}
281
288
 
282
- <MyAccountListOrdersTable
283
- listOrders={listOrders}
284
- total={total}
285
- perPage={perPage}
286
- filters={filters}
287
- />
289
+ {isEmpty ? (
290
+ <EmptyState
291
+ titleIcon={
292
+ <UIIcon
293
+ name={hasFilters ? 'MagnifyingGlass' : 'Bag2'}
294
+ width={56}
295
+ height={56}
296
+ weight="thin"
297
+ />
298
+ }
299
+ title={
300
+ hasFilters ? 'No results found' : "You don't have any orders"
301
+ }
302
+ bkgColor="light"
303
+ >
304
+ {!hasFilters && (
305
+ <LinkButton
306
+ data-fs-list-orders-empty-state-link
307
+ href="/"
308
+ variant="secondary"
309
+ >
310
+ Start shopping
311
+ </LinkButton>
312
+ )}
313
+ </EmptyState>
314
+ ) : (
315
+ <MyAccountListOrdersTable
316
+ listOrders={listOrders}
317
+ total={total}
318
+ perPage={perPage}
319
+ filters={filters}
320
+ />
321
+ )}
288
322
  </div>
289
323
  {!isDesktop && (
290
324
  <Pagination page={filters.page} total={total} perPage={perPage} />
@@ -1,8 +1,8 @@
1
1
  .page {
2
2
  @import "./MyAccountListOrdersTable/styles.scss";
3
3
  @import "./MyAccountSelectedTags/styles.scss";
4
- @import "./MyAccountListOrdersEmptyState/styles.scss";
5
4
  @import "../../components/MyAccountStatusBadge/styles.scss";
5
+ @import "@faststore/ui/src/components/organisms/EmptyState/styles.scss";
6
6
 
7
7
  // --------------------------------------------------------
8
8
  // Design Tokens
@@ -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 {
@@ -204,7 +205,16 @@ export const getServerSideProps: GetServerSideProps<
204
205
  Record<string, string>,
205
206
  Locator
206
207
  > = async (context) => {
207
- // TODO validate permissions here
208
+ const isValid = await validateUser(context)
209
+
210
+ if (!isValid) {
211
+ return {
212
+ redirect: {
213
+ destination: '/login',
214
+ permanent: false,
215
+ },
216
+ }
217
+ }
208
218
 
209
219
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
210
220
  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,
@@ -24,6 +24,7 @@ import type {
24
24
  ServerUserDetailsQueryQuery,
25
25
  ServerUserDetailsQueryQueryVariables,
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>> = {
@@ -64,7 +65,16 @@ export const getServerSideProps: GetServerSideProps<
64
65
  Record<string, string>,
65
66
  Locator
66
67
  > = async (context) => {
67
- // TODO validate permissions here
68
+ const isValid = await validateUser(context)
69
+
70
+ if (!isValid) {
71
+ return {
72
+ redirect: {
73
+ destination: '/login',
74
+ permanent: false,
75
+ },
76
+ }
77
+ }
68
78
 
69
79
  const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
70
80
  query: context.query,
@@ -0,0 +1,32 @@
1
+ import { gql } from '@generated/gql'
2
+ import type {
3
+ ValidateUserQuery,
4
+ ValidateUserQueryVariables,
5
+ } from '@generated/graphql'
6
+ import type { GetServerSidePropsContext } from 'next'
7
+ import { execute } from 'src/server'
8
+
9
+ const query = gql(`
10
+ query ValidateUser {
11
+ validateUser {
12
+ isValid
13
+ }
14
+ }
15
+ `)
16
+
17
+ export async function validateUser(context: GetServerSidePropsContext) {
18
+ const validateUserResult = await execute<
19
+ ValidateUserQueryVariables,
20
+ ValidateUserQuery
21
+ >(
22
+ {
23
+ variables: {},
24
+ operation: query,
25
+ },
26
+ {
27
+ headers: { ...context.req.headers },
28
+ }
29
+ )
30
+
31
+ return validateUserResult?.data?.validateUser?.isValid
32
+ }
@@ -77,6 +77,7 @@ const QUERIES = [
77
77
  'userOrder',
78
78
  'listUserOrders',
79
79
  'accountName',
80
+ 'validateUser',
80
81
  ]
81
82
 
82
83
  const MUTATIONS = [
@@ -1 +0,0 @@
1
- "use strict";exports.id=5772,exports.ids=[5772],exports.modules={96396:(e,t,r)=>{r.d(t,{Z:()=>o});var a=r(16689),l=r.n(a),n=r(42256),i=r(37041),s=r(2614);let f=(0,a.forwardRef)(function({onSubmit:e,buttonIcon:t,"aria-label":r="search",testId:f="fs-search-input",buttonProps:o,...d},c){let u=(0,a.useRef)(null),m=(0,a.useRef)(null);return(0,a.useImperativeHandle)(c,()=>({inputRef:u.current,formRef:m.current})),l().createElement("form",{ref:m,"data-fs-search-input-field":!0,"data-testid":f,onSubmit:t=>{t.preventDefault(),u.current?.value!==""&&e(u.current.value)},role:"search"},l().createElement(n.Z,{ref:u,"aria-label":r,"data-fs-search-input-field-input":!0,...d}),l().createElement(i.Z,{type:"submit","aria-label":"Submit Search",icon:t??l().createElement(s.Z,{name:"MagnifyingGlass"}),size:"small",...o}))}),o=f},38846:(e,t,r)=>{r.d(t,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});var a=r(16689),l=r.n(a),n=r(13666),i=r(16652),s=r(77215),f=r(45049),o=r(83339);let __WEBPACK_DEFAULT_EXPORT__=function({title:e,size:t,direction:r,children:a,applyBtnProps:d,clearBtnProps:c,overlayProps:u,onClose:m,...E}){let{fade:p,fadeOut:_}=(0,n.b)(),{closeFilter:b}=(0,i.l)();return l().createElement(s.Z,{"data-fs-filter-slider":!0,isOpen:!0,fade:p,onDismiss:_,size:t,direction:r,onTransitionEnd:()=>"out"===p&&b(),overlayProps:u,...E},l().createElement("div",{"data-fs-filter-slider-content":!0},l().createElement(f.Z,{onClose:()=>{m(),_()}},l().createElement("h2",{"data-fs-filter-slider-title":!0},e)),a),l().createElement("footer",{"data-fs-filter-slider-footer":!0},l().createElement(o.Z,{"data-fs-filter-slider-footer-button-clear":!0,...c}),l().createElement(o.Z,{"data-fs-filter-slider-footer-button-apply":!0,"data-testid":"filter-slider-button-apply",...d,onClick:e=>{d?.onClick?.(e),_()}})))}}};