@graphcommerce/magento-customer 8.0.1 → 8.0.2-canary.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.2-canary.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2197](https://github.com/graphcommerce-org/graphcommerce/pull/2197) [`044331c`](https://github.com/graphcommerce-org/graphcommerce/commit/044331cf1ea3a6040cfe8e0f79fb62025d5a9d90) - Revert: Change sorting for customer orders in Descending Created at order
8
+ ([@paales](https://github.com/paales))
9
+
10
+ ## 8.0.2-canary.1
11
+
12
+ ## 8.0.2-canary.0
13
+
3
14
  ## 8.0.1
4
15
 
5
16
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  fragment AccountOrders on Customer {
2
- orders(filter: {}, pageSize: $pageSize, currentPage: $currentPage, sort: $sort) {
2
+ orders(filter: {}, pageSize: $pageSize, currentPage: $currentPage) {
3
3
  items {
4
4
  ...OrderCard
5
5
  }
@@ -20,14 +20,16 @@ export function AccountOrders(props: AccountOrdersProps) {
20
20
  const pageInfo = orders?.page_info
21
21
  const isFirstPage = pageInfo?.current_page === 1
22
22
 
23
- const endLatestIndex = Math.min(2, orders?.items?.length || 2)
24
- const latestOrders = orders?.items?.slice(0, endLatestIndex)
23
+ // whenever it's possible, pick last {amountLatestOrders} items, then reverse the resulting array,
24
+ // because we want to render the latest order first,
25
+ // but the API returns the orders in ASC order...
26
+ const latestOrders = orders?.items
27
+ .slice(Math.max((orders?.items?.length ?? 0) - 2, 0), orders?.items?.length)
28
+ .reverse()
25
29
 
26
- const startOlderIndex = Math.min(2, orders?.items?.length || 0)
27
- const endOlderIndex = orders?.items?.length || 0
28
30
  const olderOrders = isFirstPage
29
- ? orders?.items?.slice(startOlderIndex, endOlderIndex)
30
- : orders?.items
31
+ ? orders?.items.slice(0, Math.max((orders?.items?.length ?? 0) - 2, 0)).reverse()
32
+ : orders?.items
31
33
 
32
34
  return (
33
35
  <Box
@@ -1,7 +1,4 @@
1
- query AccountDashboardOrders(
2
- $currentPage: Int!,
3
- $pageSize: Int!,
4
- $sort: CustomerOrderSortInput = { sort_direction: DESC, sort_field: CREATED_AT }) {
1
+ query AccountDashboardOrders($currentPage: Int!, $pageSize: Int!) {
5
2
  customer {
6
3
  ...AccountOrders
7
4
  }
@@ -1,7 +1,7 @@
1
1
  import { globalApolloClient } from '@graphcommerce/graphql'
2
2
  import { ApolloLink, fromPromise, onError, setContext } from '@graphcommerce/graphql/apollo'
3
3
  import { ErrorCategory } from '@graphcommerce/magento-graphql'
4
- import { GraphQLError } from 'graphql'
4
+ import type { GraphQLError } from 'graphql'
5
5
  import { NextRouter } from 'next/router'
6
6
  import { signOut } from '../components/SignOutForm/signOut'
7
7
  import { CustomerTokenDocument } from '../hooks'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-customer",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.1",
5
+ "version": "8.0.2-canary.2",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,19 +12,19 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.0.1",
16
- "@graphcommerce/eslint-config-pwa": "^8.0.1",
17
- "@graphcommerce/framer-next-pages": "^8.0.1",
18
- "@graphcommerce/framer-utils": "^8.0.1",
19
- "@graphcommerce/graphql": "^8.0.1",
20
- "@graphcommerce/graphql-mesh": "^8.0.1",
21
- "@graphcommerce/image": "^8.0.1",
22
- "@graphcommerce/magento-graphql": "^8.0.1",
23
- "@graphcommerce/magento-store": "^8.0.1",
24
- "@graphcommerce/next-ui": "^8.0.1",
25
- "@graphcommerce/prettier-config-pwa": "^8.0.1",
26
- "@graphcommerce/react-hook-form": "^8.0.1",
27
- "@graphcommerce/typescript-config-pwa": "^8.0.1",
15
+ "@graphcommerce/ecommerce-ui": "^8.0.2-canary.2",
16
+ "@graphcommerce/eslint-config-pwa": "^8.0.2-canary.2",
17
+ "@graphcommerce/framer-next-pages": "^8.0.2-canary.2",
18
+ "@graphcommerce/framer-utils": "^8.0.2-canary.2",
19
+ "@graphcommerce/graphql": "^8.0.2-canary.2",
20
+ "@graphcommerce/graphql-mesh": "^8.0.2-canary.2",
21
+ "@graphcommerce/image": "^8.0.2-canary.2",
22
+ "@graphcommerce/magento-graphql": "^8.0.2-canary.2",
23
+ "@graphcommerce/magento-store": "^8.0.2-canary.2",
24
+ "@graphcommerce/next-ui": "^8.0.2-canary.2",
25
+ "@graphcommerce/prettier-config-pwa": "^8.0.2-canary.2",
26
+ "@graphcommerce/react-hook-form": "^8.0.2-canary.2",
27
+ "@graphcommerce/typescript-config-pwa": "^8.0.2-canary.2",
28
28
  "@lingui/core": "^4.2.1",
29
29
  "@lingui/macro": "^4.2.1",
30
30
  "@lingui/react": "^4.2.1",