@magento/venia-ui 9.2.0-alpha.3 → 9.2.0-beta.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.
@@ -7,12 +7,12 @@ exports[`Should render properly 1`] = `
7
7
  <Item
8
8
  closeMiniCart={[MockFunction closeMiniCart]}
9
9
  handleRemoveItem={[MockFunction handleRemoveItem]}
10
- id="1"
11
10
  product={
12
11
  Object {
13
12
  "name": "Simple Product",
14
13
  }
15
14
  }
15
+ uid="1"
16
16
  />
17
17
  </div>
18
18
  `;
@@ -15,7 +15,7 @@ const props = {
15
15
  handleRemoveItem: jest.fn().mockName('handleRemoveItem'),
16
16
  items: [
17
17
  {
18
- id: '1',
18
+ uid: '1',
19
19
  product: {
20
20
  name: 'Simple Product'
21
21
  }
@@ -21,7 +21,7 @@ const ProductList = props => {
21
21
  if (items) {
22
22
  return items.map(item => (
23
23
  <Item
24
- key={item.id}
24
+ key={item.uid}
25
25
  {...item}
26
26
  closeMiniCart={closeMiniCart}
27
27
  handleRemoveItem={handleRemoveItem}
@@ -11,8 +11,10 @@ exports[`#CustomAttributes renders with custom attributes visible on front only
11
11
  data={
12
12
  Object {
13
13
  "attribute_metadata": Object {
14
- "is_visible_on_front": true,
15
14
  "uid": "uid-1",
15
+ "used_in_components": Array [
16
+ "PRODUCT_DETAILS_PAGE",
17
+ ],
16
18
  },
17
19
  }
18
20
  }
@@ -23,8 +25,10 @@ exports[`#CustomAttributes renders with custom attributes visible on front only
23
25
  data={
24
26
  Object {
25
27
  "attribute_metadata": Object {
26
- "is_visible_on_front": true,
27
28
  "uid": "uid-2",
29
+ "used_in_components": Array [
30
+ "PRODUCT_DETAILS_PAGE",
31
+ ],
28
32
  },
29
33
  }
30
34
  }
@@ -35,8 +39,10 @@ exports[`#CustomAttributes renders with custom attributes visible on front only
35
39
  data={
36
40
  Object {
37
41
  "attribute_metadata": Object {
38
- "is_visible_on_front": true,
39
42
  "uid": "uid-4",
43
+ "used_in_components": Array [
44
+ "PRODUCT_DETAILS_PAGE",
45
+ ],
40
46
  },
41
47
  }
42
48
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { createTestInstance } from '@magento/peregrine';
4
4
 
5
- import CustomAttributes from '../customAttributes';
5
+ import CustomAttributes, { IS_VISIBLE_ON_FRONT } from '../customAttributes';
6
6
 
7
7
  jest.mock('react-intl', () => ({
8
8
  FormattedMessage: ({ defaultMessage }) => defaultMessage
@@ -40,31 +40,30 @@ describe('#CustomAttributes', () => {
40
40
  customAttributes: [
41
41
  {
42
42
  attribute_metadata: {
43
- is_visible_on_front: true,
43
+ used_in_components: [IS_VISIBLE_ON_FRONT],
44
44
  uid: 'uid-1'
45
45
  }
46
46
  },
47
47
  {
48
48
  attribute_metadata: {
49
- is_visible_on_front: true,
49
+ used_in_components: [IS_VISIBLE_ON_FRONT],
50
50
  uid: 'uid-2'
51
51
  }
52
52
  },
53
53
  {
54
54
  attribute_metadata: {
55
- is_visible_on_front: false,
55
+ used_in_components: [],
56
56
  uid: 'uid-3'
57
57
  }
58
58
  },
59
59
  {
60
60
  attribute_metadata: {
61
- is_visible_on_front: true,
61
+ used_in_components: [IS_VISIBLE_ON_FRONT],
62
62
  uid: 'uid-4'
63
63
  }
64
64
  },
65
65
  {
66
66
  attribute_metadata: {
67
- is_visible_on_front: false,
68
67
  uid: 'uid-5'
69
68
  }
70
69
  }
@@ -7,6 +7,8 @@ import { useStyle } from '@magento/venia-ui/lib/classify';
7
7
  import AttributeType from './AttributeType';
8
8
  import defaultClasses from './customAttributes.module.css';
9
9
 
10
+ export const IS_VISIBLE_ON_FRONT = 'PRODUCT_DETAILS_PAGE';
11
+
10
12
  const CustomAttributes = props => {
11
13
  const { customAttributes } = props;
12
14
  const classes = useStyle(defaultClasses, props.classes);
@@ -14,11 +16,11 @@ const CustomAttributes = props => {
14
16
  const list = useMemo(
15
17
  () =>
16
18
  customAttributes.reduce((previousAttribute, currentAttribute) => {
19
+ const usedInComponents =
20
+ currentAttribute.attribute_metadata?.used_in_components ||
21
+ [];
17
22
  // Visible on front attributes only
18
- if (
19
- currentAttribute.attribute_metadata.is_visible_on_front ===
20
- true
21
- ) {
23
+ if (usedInComponents.includes(IS_VISIBLE_ON_FRONT)) {
22
24
  const attributeContent = (
23
25
  <li
24
26
  key={currentAttribute.attribute_metadata.uid}
@@ -20,6 +20,7 @@ const GET_AUTOCOMPLETE_RESULTS = gql`
20
20
  label
21
21
  value
22
22
  }
23
+ position
23
24
  }
24
25
  # eslint-disable-next-line @graphql-eslint/require-id-when-available
25
26
  items {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magento/venia-ui",
3
- "version": "9.2.0-alpha.3",
3
+ "version": "9.2.0-beta.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -78,9 +78,9 @@
78
78
  },
79
79
  "peerDependencies": {
80
80
  "@apollo/client": "~3.4.0",
81
- "@magento/babel-preset-peregrine": "1.2.0-alpha.3",
82
- "@magento/peregrine": "12.2.0-alpha.3",
83
- "@magento/pwa-buildpack": "11.1.0-alpha.3",
81
+ "@magento/babel-preset-peregrine": "1.2.0-beta.1",
82
+ "@magento/peregrine": "12.2.0-beta.1",
83
+ "@magento/pwa-buildpack": "11.1.0-beta.1",
84
84
  "apollo-cache-persist": "~0.1.1",
85
85
  "braintree-web-drop-in": "~1.16.0",
86
86
  "graphql": "~15.5.0",