@graphcommerce/magento-product 4.8.0 → 4.8.1

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,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1684](https://github.com/graphcommerce-org/graphcommerce/pull/1684) [`aab6b4fa5`](https://github.com/graphcommerce-org/graphcommerce/commit/aab6b4fa5b4708003cfb5bf673a617dc5dbf3078) Thanks [@paales](https://github.com/paales)! - Make sure the images are sorted according to their position field
8
+
9
+ - Updated dependencies [[`ae28fb14c`](https://github.com/graphcommerce-org/graphcommerce/commit/ae28fb14cec298c52970260a4fc2c2551b5f175e), [`98d6a9cce`](https://github.com/graphcommerce-org/graphcommerce/commit/98d6a9cce1bb9514088be0af2736721b3edda467)]:
10
+ - @graphcommerce/magento-cart@4.9.2
11
+ - @graphcommerce/next-ui@4.29.1
12
+ - @graphcommerce/ecommerce-ui@1.5.6
13
+ - @graphcommerce/framer-scroller@2.1.43
14
+ - @graphcommerce/magento-store@4.3.4
15
+
3
16
  ## 4.8.0
4
17
 
5
18
  ### Minor Changes
@@ -1,4 +1,9 @@
1
- import { SidebarGallery, SidebarGalleryProps, TypeRenderer } from '@graphcommerce/next-ui'
1
+ import {
2
+ nonNullable,
3
+ SidebarGallery,
4
+ SidebarGalleryProps,
5
+ TypeRenderer,
6
+ } from '@graphcommerce/next-ui'
2
7
  import { PropsWithChildren } from 'react'
3
8
  import { ProductPageGalleryFragment } from './ProductPageGallery.gql'
4
9
 
@@ -23,14 +28,17 @@ export function ProductPageGallery(props: ProductPageGalleryProps) {
23
28
  sidebar={children}
24
29
  aspectRatio={[width, height]}
25
30
  images={
26
- media_gallery?.map((item) => {
27
- if (item?.__typename === 'ProductImage')
28
- return { src: item.url ?? '', alt: item.label || undefined, width, height }
29
- return {
30
- src: '',
31
- alt: `{${item?.__typename} not yet supported}`,
32
- }
33
- }) ?? []
31
+ media_gallery
32
+ ?.filter(nonNullable)
33
+ .sort((a, b) => (a.position ?? 0) - (b.position ?? 0))
34
+ .map((item) => {
35
+ if (item.__typename === 'ProductImage')
36
+ return { src: item.url ?? '', alt: item.label || undefined, width, height }
37
+ return {
38
+ src: '',
39
+ alt: `{${item.__typename} not yet supported}`,
40
+ }
41
+ }) ?? []
34
42
  }
35
43
  />
36
44
  )
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": "4.8.0",
5
+ "version": "4.8.1",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,15 +19,15 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/ecommerce-ui": "1.5.5",
23
- "@graphcommerce/framer-scroller": "2.1.42",
22
+ "@graphcommerce/ecommerce-ui": "1.5.6",
23
+ "@graphcommerce/framer-scroller": "2.1.43",
24
24
  "@graphcommerce/framer-next-pages": "3.3.2",
25
25
  "@graphcommerce/graphql": "3.5.0",
26
26
  "@graphcommerce/graphql-mesh": "4.2.0",
27
27
  "@graphcommerce/image": "3.1.10",
28
- "@graphcommerce/magento-cart": "4.9.1",
29
- "@graphcommerce/magento-store": "4.3.3",
30
- "@graphcommerce/next-ui": "4.29.0",
28
+ "@graphcommerce/magento-cart": "4.9.2",
29
+ "@graphcommerce/magento-store": "4.3.4",
30
+ "@graphcommerce/next-ui": "4.29.1",
31
31
  "schema-dts": "^1.1.0"
32
32
  },
33
33
  "peerDependencies": {