@graphcommerce/magento-product 11.0.0-canary.56 → 11.0.0-canary.58

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,25 @@
1
1
  # Change Log
2
2
 
3
+ ## 11.0.0-canary.58
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2718](https://github.com/graphcommerce-org/graphcommerce/pull/2718) [`d6145eb`](https://github.com/graphcommerce-org/graphcommerce/commit/d6145ebbabc4f3cad3bbc78e5f32794098577223) - Fix the product list pagination scrolling to the products before the next page was loaded. The shopper saw the products of the previous page until the new products arrived. The pagination loads the products first and then scrolls, the same as the filters. ([@bramvanderholst](https://github.com/bramvanderholst))
8
+
9
+ ## 11.0.0-canary.57
10
+
11
+ ### Major Changes
12
+
13
+ - [#2708](https://github.com/graphcommerce-org/graphcommerce/pull/2708) [`28aa653`](https://github.com/graphcommerce-org/graphcommerce/commit/28aa653188ed5dc4a0cc5401ee5149b31858e01d) - **Breaking change:** GraphCommerce imports `motion/react` and requires the `motion` package. In your project, replace the `framer-motion` dependency with `motion` 14 and change the imports from `framer-motion` to `motion/react`. ([@paales](https://github.com/paales))
14
+
15
+ - [#2708](https://github.com/graphcommerce-org/graphcommerce/pull/2708) [`cb36d6c`](https://github.com/graphcommerce-org/graphcommerce/commit/cb36d6c219e067ffe2fb2e847a8ff84e8f87a5e8) - **Breaking change:** GraphCommerce requires Lingui 6 and Node.js 22.19 or later. Lingui 6 has no `@lingui/macro` package: import the JSX macros from `@lingui/react/macro`. The `lingui-next` config excludes `.d.ts` files and `node_modules` outside the working directory too. ([@paales](https://github.com/paales))
16
+
17
+ ### Patch Changes
18
+
19
+ - [#2708](https://github.com/graphcommerce-org/graphcommerce/pull/2708) [`4442f72`](https://github.com/graphcommerce-org/graphcommerce/commit/4442f72de4139d4a10df3f4a9364fbeabdfc4f51) - The `handleSubmit` of `useFormGql` returns the result of `onValid`, the same as `handleSubmit` of React Hook Form 7.91. `ProductFiltersProContext.submit` returns `Promise<unknown>`. ([@paales](https://github.com/paales))
20
+
21
+ - [#2708](https://github.com/graphcommerce-org/graphcommerce/pull/2708) [`1c97bc6`](https://github.com/graphcommerce-org/graphcommerce/commit/1c97bc6d6d01e80d98fe70e595b06804be2ba905) - Uses `@googlemaps/js-api-loader` 2, `cookie` 2, `fetch-retry` 6, `web-vitals` 6 and `schema-dts` 2. `usePlacesAutocomplete` loads the Places library with `setOptions` and `importLibrary`. ([@paales](https://github.com/paales))
22
+
3
23
  ## 11.0.0-canary.56
4
24
 
5
25
  ## 11.0.0-canary.55
@@ -9,7 +9,7 @@ import { useMatchMediaMotionValue, useMemoObject } from '@graphcommerce/next-ui'
9
9
  import type { Theme } from '@mui/material'
10
10
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
11
11
  import { useEventCallback, useMediaQuery, useTheme } from '@mui/material'
12
- import { m, useTransform } from 'framer-motion'
12
+ import { m, useTransform } from 'motion/react'
13
13
  import { useRouter } from 'next/router'
14
14
  import type { BaseSyntheticEvent, MutableRefObject } from 'react'
15
15
  import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react'
@@ -44,7 +44,8 @@ export type ProductFiltersProContext = DataProps & {
44
44
  * To get active form values use `useWatch`.
45
45
  */
46
46
  params: ProductFilterParams
47
- submit: (e?: BaseSyntheticEvent<object, any, any> | undefined) => Promise<void>
47
+ submit: (e?: BaseSyntheticEvent<object, any, any> | undefined) => Promise<unknown>
48
+ handleSubmit: FilterFormProviderProps['handleSubmit']
48
49
  }
49
50
 
50
51
  const FilterFormContext = createContext<ProductFiltersProContext | null>(null)
@@ -145,13 +146,14 @@ export function ProductFiltersPro(props: FilterFormProviderProps) {
145
146
  form,
146
147
  params: defaultValues,
147
148
  submit,
149
+ handleSubmit,
148
150
  appliedAggregations,
149
151
  filterTypes,
150
152
  aggregations: aggregations ?? appliedAggregations,
151
153
  }
152
154
  globalFormContextRef.current = ctx
153
155
  return ctx
154
- }, [form, defaultValues, submit, appliedAggregations, filterTypes, aggregations])
156
+ }, [form, defaultValues, submit, handleSubmit, appliedAggregations, filterTypes, aggregations])
155
157
 
156
158
  // When the component unmounts, we want to clear the global filter form
157
159
  useEffect(
@@ -9,7 +9,7 @@ import {
9
9
  } from '@graphcommerce/next-ui'
10
10
  import type { SxProps, Theme } from '@mui/material'
11
11
  import { Box, styled } from '@mui/material'
12
- import { m, useTransform } from 'framer-motion'
12
+ import { m, useTransform } from 'motion/react'
13
13
  import React, { useEffect, useRef, useState } from 'react'
14
14
 
15
15
  const MotionDiv = styled(m.div)({})
@@ -1,9 +1,13 @@
1
1
  import { productListPaginationVariant } from '@graphcommerce/next-config/config'
2
+ import type { LinkProps } from '@graphcommerce/next-ui'
2
3
  import { NextLink, Pagination, PaginationExtended } from '@graphcommerce/next-ui'
3
4
  import type { PaginationProps } from '@mui/material'
4
5
  import { Link } from '@mui/material'
6
+ import { useRouter } from 'next/router'
5
7
  import { productListLink } from '../../hooks/useProductListLink'
8
+ import { useProductFiltersPro } from '../ProductFiltersPro/ProductFiltersPro'
6
9
  import type { ProductListParams } from '../ProductListItems/filterTypes'
10
+ import { toFilterParams } from '../ProductListItems/filterTypes'
7
11
  import type { ProductListPaginationFragment } from './ProductListPagination.gql'
8
12
 
9
13
  export type ProductPaginationProps = ProductListPaginationFragment &
@@ -16,8 +20,22 @@ export function ProductListPagination({
16
20
  params,
17
21
  ...paginationProps
18
22
  }: ProductPaginationProps) {
23
+ const router = useRouter()
24
+ const handleSubmit = useProductFiltersPro(true)?.handleSubmit
25
+
19
26
  if (!page_info || !page_info.total_pages || !page_info.current_page) return null
20
27
 
28
+ // Loads the products before the URL changes, so the page scrolls to the loaded products.
29
+ const onNavigate = (page: number | null): LinkProps['onNavigate'] =>
30
+ handleSubmit &&
31
+ ((e) => {
32
+ e.preventDefault()
33
+ const path = `${productListLink({ ...params, currentPage: page })}${page === 1 ? '' : '#products'}`
34
+ void handleSubmit({ ...toFilterParams(params), currentPage: page ?? 1 }, async (shallow) => {
35
+ await router.push(path, path, { shallow, scroll: true })
36
+ })
37
+ })
38
+
21
39
  if (productListPaginationVariant !== 'EXTENDED') {
22
40
  return (
23
41
  <Pagination
@@ -31,6 +49,7 @@ export function ProductListPagination({
31
49
  href={`${productListLink({ ...params, currentPage: btnProps.page })}${suffix}`}
32
50
  component={NextLink}
33
51
  shallow
52
+ onNavigate={onNavigate(btnProps.page)}
34
53
  color='inherit'
35
54
  >
36
55
  {icon}
@@ -50,6 +69,7 @@ export function ProductListPagination({
50
69
  paginationHref={({ page }) =>
51
70
  `${productListLink({ ...params, currentPage: page })}${page === 1 ? '' : '#products'}`
52
71
  }
72
+ onNavigate={({ page }) => onNavigate(page)}
53
73
  {...paginationProps}
54
74
  />
55
75
  )
@@ -1,7 +1,7 @@
1
1
  import type { MotionImageAspectPropsAdditional } from '@graphcommerce/framer-scroller'
2
2
  import { Fab, iconPlay, IconSvg, sxx, YoutubeEmbed, type FabProps } from '@graphcommerce/next-ui'
3
3
  import { Avatar, Box, IconButton, styled, type SxProps, type Theme } from '@mui/material'
4
- import { m, type MotionProps, type MotionStyle } from 'framer-motion'
4
+ import { m, type MotionProps, type MotionStyle } from 'motion/react'
5
5
  import React, { useState } from 'react'
6
6
  import type { ProductVideoFragment } from './ProductVideo.gql'
7
7
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-product",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "11.0.0-canary.56",
5
+ "version": "11.0.0-canary.58",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,29 +12,28 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "schema-dts": "^1.1.5"
15
+ "schema-dts": "^2.1.0"
16
16
  },
17
17
  "devDependencies": {
18
- "typescript": "5.9.3"
18
+ "typescript": "6.0.3"
19
19
  },
20
20
  "peerDependencies": {
21
- "@graphcommerce/ecommerce-ui": "^11.0.0-canary.56",
22
- "@graphcommerce/eslint-config-pwa": "^11.0.0-canary.56",
23
- "@graphcommerce/framer-next-pages": "^11.0.0-canary.56",
24
- "@graphcommerce/framer-scroller": "^11.0.0-canary.56",
25
- "@graphcommerce/graphql": "^11.0.0-canary.56",
26
- "@graphcommerce/graphql-mesh": "^11.0.0-canary.56",
27
- "@graphcommerce/image": "^11.0.0-canary.56",
28
- "@graphcommerce/magento-cart": "^11.0.0-canary.56",
29
- "@graphcommerce/magento-store": "^11.0.0-canary.56",
30
- "@graphcommerce/next-ui": "^11.0.0-canary.56",
31
- "@graphcommerce/prettier-config-pwa": "^11.0.0-canary.56",
32
- "@graphcommerce/typescript-config-pwa": "^11.0.0-canary.56",
33
- "@lingui/core": "^5",
34
- "@lingui/macro": "^5",
35
- "@lingui/react": "^5",
21
+ "@graphcommerce/ecommerce-ui": "^11.0.0-canary.58",
22
+ "@graphcommerce/eslint-config-pwa": "^11.0.0-canary.58",
23
+ "@graphcommerce/framer-next-pages": "^11.0.0-canary.58",
24
+ "@graphcommerce/framer-scroller": "^11.0.0-canary.58",
25
+ "@graphcommerce/graphql": "^11.0.0-canary.58",
26
+ "@graphcommerce/graphql-mesh": "^11.0.0-canary.58",
27
+ "@graphcommerce/image": "^11.0.0-canary.58",
28
+ "@graphcommerce/magento-cart": "^11.0.0-canary.58",
29
+ "@graphcommerce/magento-store": "^11.0.0-canary.58",
30
+ "@graphcommerce/next-ui": "^11.0.0-canary.58",
31
+ "@graphcommerce/prettier-config-pwa": "^11.0.0-canary.58",
32
+ "@graphcommerce/typescript-config-pwa": "^11.0.0-canary.58",
33
+ "@lingui/core": "^6",
34
+ "@lingui/react": "^6",
36
35
  "@mui/material": "^7.0.0",
37
- "framer-motion": "^11.0.0",
36
+ "motion": "^14.0.0",
38
37
  "next": "*",
39
38
  "react": "^19.2.0",
40
39
  "react-dom": "^19.2.0"