@magento/venia-ui 9.4.0 → 9.5.0-alpha.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.
Files changed (65) hide show
  1. package/i18n/en_US.json +2 -0
  2. package/lib/RootComponents/CMS/__tests__/cms.spec.js +4 -0
  3. package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.spec.js.snap +9 -0
  4. package/lib/RootComponents/Category/category.js +19 -1
  5. package/lib/RootComponents/Category/categoryContent.js +1 -1
  6. package/lib/components/AccountInformationPage/__tests__/__snapshots__/accountInformationPage.spec.js.snap +1 -0
  7. package/lib/components/AccountInformationPage/accountInformationPage.js +1 -0
  8. package/lib/components/AddressBookPage/__tests__/__snapshots__/addressBookPage.spec.js.snap +3 -0
  9. package/lib/components/AddressBookPage/addressBookPage.js +5 -1
  10. package/lib/components/AddressBookPage/addressBookPage.module.css +3 -0
  11. package/lib/components/CartPage/__tests__/__snapshots__/cartPage.spec.js.snap +2 -0
  12. package/lib/components/CartPage/cartPage.js +5 -1
  13. package/lib/components/CheckoutPage/AddressBook/__tests__/__snapshots__/addressBook.spec.js.snap +2 -0
  14. package/lib/components/CheckoutPage/AddressBook/addressBook.js +1 -1
  15. package/lib/components/CheckoutPage/GuestSignIn/__tests__/__snapshots__/guestSignIn.spec.js.snap +3 -0
  16. package/lib/components/CheckoutPage/GuestSignIn/guestSignIn.js +1 -1
  17. package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +1 -1
  18. package/lib/components/CheckoutPage/OrderSummary/__tests__/__snapshots__/orderSummary.spec.js.snap +1 -0
  19. package/lib/components/CheckoutPage/OrderSummary/orderSummary.js +1 -1
  20. package/lib/components/CheckoutPage/PaymentInformation/brainTreeDropIn.js +7 -2
  21. package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +1 -0
  22. package/lib/components/CheckoutPage/checkoutPage.js +1 -0
  23. package/lib/components/CreateAccount/__tests__/createAccount.spec.js +4 -0
  24. package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +1 -0
  25. package/lib/components/Footer/footer.js +8 -2
  26. package/lib/components/Gallery/__tests__/gallery.spec.js +3 -0
  27. package/lib/components/Gallery/__tests__/item.spec.js +3 -0
  28. package/lib/components/Gallery/item.js +5 -0
  29. package/lib/components/Header/__tests__/__snapshots__/cartTrigger.spec.js.snap +6 -0
  30. package/lib/components/Header/__tests__/__snapshots__/currencySwitcher.spec.js.snap +16 -2
  31. package/lib/components/Header/__tests__/__snapshots__/storeSwitcher.spec.js.snap +17 -0
  32. package/lib/components/Header/cartTrigger.js +2 -0
  33. package/lib/components/Header/currencySwitcher.js +8 -2
  34. package/lib/components/Header/header.js +5 -0
  35. package/lib/components/Header/storeSwitcher.js +9 -4
  36. package/lib/components/Logo/logo.js +0 -1
  37. package/lib/components/MiniCart/miniCart.js +1 -0
  38. package/lib/components/MyAccount/ResetPassword/__tests__/__snapshots__/resetPassword.spec.js.snap +12 -4
  39. package/lib/components/MyAccount/ResetPassword/resetPassword.js +1 -1
  40. package/lib/components/OrderHistoryPage/__tests__/__snapshots__/orderHistoryPage.spec.js.snap +5 -0
  41. package/lib/components/OrderHistoryPage/orderHistoryPage.js +3 -1
  42. package/lib/components/PageLoadingIndicator/__tests__/__snapshots__/pageLoadingIndicator.spec.js.snap +21 -0
  43. package/lib/components/PageLoadingIndicator/__tests__/pageLoadingIndicator.spec.js +4 -4
  44. package/lib/components/PageLoadingIndicator/pageLoadingIndicator.js +6 -2
  45. package/lib/components/PageLoadingIndicator/pageLoadingIndicator.module.css +6 -1
  46. package/lib/components/ProductFullDetail/__tests__/__snapshots__/productFullDetail.spec.js.snap +13 -0
  47. package/lib/components/ProductFullDetail/productFullDetail.js +1 -0
  48. package/lib/components/SavedPaymentsPage/__tests__/__snapshots__/savedPaymentsPage.spec.js.snap +2 -0
  49. package/lib/components/SavedPaymentsPage/savedPaymentsPage.js +3 -1
  50. package/lib/components/SearchBar/__tests__/autocomplete.spec.js +25 -10
  51. package/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +3 -0
  52. package/lib/components/SearchBar/autocomplete.js +4 -0
  53. package/lib/components/SearchBar/suggestedProduct.js +20 -21
  54. package/lib/components/SearchPage/__tests__/__snapshots__/searchPage.spec.js.snap +22 -0
  55. package/lib/components/SearchPage/searchPage.js +11 -3
  56. package/lib/components/SignIn/__tests__/signIn.spec.js +4 -0
  57. package/lib/components/SortedByContainer/sortedByContainer.module.css +0 -2
  58. package/lib/components/StoreCodeRoute/__tests__/storeCodeRoute.spec.js +2 -2
  59. package/lib/components/StoreCodeRoute/storeCodeRoute.js +3 -3
  60. package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +5 -0
  61. package/lib/components/WishlistPage/wishlistPage.js +5 -1
  62. package/lib/index.module.css +14 -0
  63. package/lib/targets/__tests__/venia-ui-targets.spec.js +2 -2
  64. package/lib/tokens.module.css +1 -1
  65. package/package.json +5 -5
@@ -1,12 +1,12 @@
1
- import React, { useCallback, useMemo } from 'react';
1
+ import React from 'react';
2
2
  import { func, number, shape, string } from 'prop-types';
3
3
  import { Link } from 'react-router-dom';
4
- import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
5
4
  import Price from '@magento/venia-ui/lib/components/Price';
6
5
  import { useStyle } from '../../classify';
7
6
 
8
7
  import Image from '../Image';
9
8
  import defaultClasses from './suggestedProduct.module.css';
9
+ import { useSuggestedProduct } from '@magento/peregrine/lib/talons/SearchBar';
10
10
 
11
11
  const IMAGE_WIDTH = 60;
12
12
 
@@ -19,29 +19,21 @@ const SuggestedProduct = props => {
19
19
  onNavigate,
20
20
  price,
21
21
  price_range,
22
- url_suffix
22
+ url_suffix,
23
+ sku
23
24
  } = props;
24
25
 
25
- const handleClick = useCallback(() => {
26
- if (typeof onNavigate === 'function') {
27
- onNavigate();
28
- }
29
- }, [onNavigate]);
30
-
31
- const uri = useMemo(() => resourceUrl(`/${url_key}${url_suffix || ''}`), [
26
+ const talonProps = useSuggestedProduct({
27
+ name,
28
+ price,
29
+ price_range,
30
+ onNavigate,
32
31
  url_key,
33
- url_suffix
34
- ]);
32
+ url_suffix,
33
+ sku
34
+ });
35
35
 
36
- // fall back to deprecated field if price range is unavailable
37
- const priceProps = {
38
- currencyCode:
39
- price_range?.maximum_price?.final_price?.currency ||
40
- price.regularPrice.amount.currency,
41
- value:
42
- price_range?.maximum_price?.final_price?.value ||
43
- price.regularPrice.amount.value
44
- };
36
+ const { priceProps, handleClick, uri } = talonProps;
45
37
 
46
38
  return (
47
39
  <Link
@@ -83,6 +75,13 @@ SuggestedProduct.propTypes = {
83
75
  final_price: shape({
84
76
  currency: string,
85
77
  value: number
78
+ }),
79
+ regular_price: shape({
80
+ currency: string,
81
+ value: number
82
+ }),
83
+ discount: shape({
84
+ amount_off: number
86
85
  })
87
86
  })
88
87
  }),
@@ -21,6 +21,8 @@ exports[`Search Page Component error view does not render when data is present 1
21
21
  id="searchPage.searchTermEmpty"
22
22
  />
23
23
  <span
24
+ aria-busy="true"
25
+ aria-live="polite"
24
26
  className="totalPages"
25
27
  >
26
28
  0 items
@@ -90,6 +92,7 @@ exports[`Search Page Component error view renders when data is not present and n
90
92
  />
91
93
  </div>
92
94
  <div
95
+ aria-live="polite"
93
96
  className="noResult"
94
97
  >
95
98
  <mock-FormattedMessage
@@ -133,6 +136,8 @@ exports[`Search Page Component filter button/modal does not render if there are
133
136
  id="searchPage.searchTermEmpty"
134
137
  />
135
138
  <span
139
+ aria-busy="true"
140
+ aria-live="polite"
136
141
  className="totalPages"
137
142
  >
138
143
  0 items
@@ -210,6 +215,8 @@ exports[`Search Page Component filter button/modal renders when there are filter
210
215
  id="searchPage.searchTermEmpty"
211
216
  />
212
217
  <span
218
+ aria-busy="true"
219
+ aria-live="polite"
213
220
  className="totalPages"
214
221
  >
215
222
  0 items
@@ -443,6 +450,7 @@ exports[`Search Page Component search results does not render if data returned h
443
450
  <SortedByContainerShimmer />
444
451
  </div>
445
452
  <div
453
+ aria-live="polite"
446
454
  className="noResult"
447
455
  >
448
456
  <mock-FormattedMessage
@@ -486,6 +494,8 @@ exports[`Search Page Component search results heading renders a generic message
486
494
  id="searchPage.searchTermEmpty"
487
495
  />
488
496
  <span
497
+ aria-busy="true"
498
+ aria-live="polite"
489
499
  className="totalPages"
490
500
  >
491
501
  1 items
@@ -594,6 +604,8 @@ exports[`Search Page Component search results heading renders a specific message
594
604
  }
595
605
  />
596
606
  <span
607
+ aria-busy="true"
608
+ aria-live="polite"
597
609
  className="totalPages"
598
610
  >
599
611
  1 items
@@ -764,6 +776,8 @@ exports[`Search Page Component sort button/container does not render if total co
764
776
  id="searchPage.searchTermEmpty"
765
777
  />
766
778
  <span
779
+ aria-busy="true"
780
+ aria-live="polite"
767
781
  className="totalPages"
768
782
  >
769
783
  0 items
@@ -774,6 +788,7 @@ exports[`Search Page Component sort button/container does not render if total co
774
788
  />
775
789
  </div>
776
790
  <div
791
+ aria-live="polite"
777
792
  className="noResult"
778
793
  >
779
794
  <mock-FormattedMessage
@@ -817,6 +832,8 @@ exports[`Search Page Component sort button/container renders when total count >
817
832
  id="searchPage.searchTermEmpty"
818
833
  />
819
834
  <span
835
+ aria-busy="true"
836
+ aria-live="polite"
820
837
  className="totalPages"
821
838
  >
822
839
  1 items
@@ -918,6 +935,8 @@ exports[`Search Page Component total count renders 0 items if data.products.tota
918
935
  id="searchPage.searchTermEmpty"
919
936
  />
920
937
  <span
938
+ aria-busy="true"
939
+ aria-live="polite"
921
940
  className="totalPages"
922
941
  >
923
942
  0 items
@@ -928,6 +947,7 @@ exports[`Search Page Component total count renders 0 items if data.products.tota
928
947
  />
929
948
  </div>
930
949
  <div
950
+ aria-live="polite"
931
951
  className="noResult"
932
952
  >
933
953
  <mock-FormattedMessage
@@ -971,6 +991,8 @@ exports[`Search Page Component total count renders results from data 1`] = `
971
991
  id="searchPage.searchTermEmpty"
972
992
  />
973
993
  <span
994
+ aria-busy="true"
995
+ aria-live="polite"
974
996
  className="totalPages"
975
997
  >
976
998
  1 items
@@ -55,7 +55,7 @@ const SearchPage = props => {
55
55
 
56
56
  if (!data && error) {
57
57
  return (
58
- <div className={classes.noResult}>
58
+ <div aria-live="polite" className={classes.noResult}>
59
59
  <FormattedMessage
60
60
  id={'searchPage.noResult'}
61
61
  defaultMessage={
@@ -72,7 +72,11 @@ const SearchPage = props => {
72
72
 
73
73
  if (data.products.items.length === 0) {
74
74
  return (
75
- <div className={classes.noResult} data-cy="SearchPage-noResult">
75
+ <div
76
+ aria-live="polite"
77
+ className={classes.noResult}
78
+ data-cy="SearchPage-noResult"
79
+ >
76
80
  <FormattedMessage
77
81
  id={'searchPage.noResultImportant'}
78
82
  defaultMessage={'No results found!'}
@@ -169,7 +173,11 @@ const SearchPage = props => {
169
173
 
170
174
  const itemCountHeading =
171
175
  data && !loading ? (
172
- <span className={classes.totalPages}>
176
+ <span
177
+ aria-live="polite"
178
+ aria-busy="true"
179
+ className={classes.totalPages}
180
+ >
173
181
  {formatMessage(
174
182
  {
175
183
  id: 'searchPage.totalPages',
@@ -63,6 +63,10 @@ jest.mock('@magento/peregrine/lib/hooks/useAwaitQuery', () => {
63
63
  return { useAwaitQuery };
64
64
  });
65
65
 
66
+ jest.mock('@magento/peregrine/lib/context/eventing', () => ({
67
+ useEventingContext: jest.fn().mockReturnValue([{}, { dispatch: jest.fn() }])
68
+ }));
69
+
66
70
  const props = {
67
71
  setDefaultUsername: jest.fn(),
68
72
  showCreateAccount: jest.fn(),
@@ -2,8 +2,6 @@
2
2
  composes: pb-xs from global;
3
3
  composes: text-center from global;
4
4
  composes: text-sm from global;
5
- composes: text-subtle from global;
6
-
7
5
  composes: lg_hidden from global;
8
6
  }
9
7
 
@@ -18,7 +18,7 @@ beforeEach(() => {
18
18
  global.AVAILABLE_STORE_VIEWS = [
19
19
  {
20
20
  base_currency_code: 'USD',
21
- code: 'default',
21
+ store_code: 'default',
22
22
  default_display_currency_code: 'USD',
23
23
  id: 1,
24
24
  locale: 'en_US',
@@ -27,7 +27,7 @@ beforeEach(() => {
27
27
  },
28
28
  {
29
29
  base_currency_code: 'EUR',
30
- code: 'french',
30
+ store_code: 'french',
31
31
  default_display_currency_code: 'EUR',
32
32
  id: 2,
33
33
  locale: 'fr_FR',
@@ -17,9 +17,9 @@ const StoreCodeRoute = () => {
17
17
  const storeSecureBaseMediaUrl = useMemo(() => ({}), []);
18
18
 
19
19
  AVAILABLE_STORE_VIEWS.forEach(store => {
20
- storeCodes.push(store.code);
21
- storeCurrencies[store.code] = store.default_display_currency_code;
22
- storeSecureBaseMediaUrl[store.code] = store.secure_base_media_url;
20
+ storeCodes.push(store.store_code);
21
+ storeCurrencies[store.store_code] = store.default_display_currency_code;
22
+ storeSecureBaseMediaUrl[store.store_code] = store.secure_base_media_url;
23
23
  });
24
24
 
25
25
  // Sort by length (longest first) to avoid false hits ie "en" matching just
@@ -5,6 +5,7 @@ exports[`empty single wishlist 1`] = `
5
5
  className="root"
6
6
  >
7
7
  <h1
8
+ aria-live="polite"
8
9
  className="heading"
9
10
  >
10
11
  <mock-FormattedMessage
@@ -29,6 +30,7 @@ exports[`renders a single wishlist without visibility toggle 1`] = `
29
30
  className="root"
30
31
  >
31
32
  <h1
33
+ aria-live="polite"
32
34
  className="heading"
33
35
  >
34
36
  <mock-FormattedMessage
@@ -61,6 +63,7 @@ exports[`renders disabled feature error 1`] = `
61
63
  className="root"
62
64
  >
63
65
  <h1
66
+ aria-live="polite"
64
67
  className="heading"
65
68
  >
66
69
  <mock-FormattedMessage
@@ -91,6 +94,7 @@ exports[`renders general fetch error 1`] = `
91
94
  className="root"
92
95
  >
93
96
  <h1
97
+ aria-live="polite"
94
98
  className="heading"
95
99
  >
96
100
  <mock-FormattedMessage
@@ -203,6 +207,7 @@ exports[`renders wishlist data 1`] = `
203
207
  className="root"
204
208
  >
205
209
  <h1
210
+ aria-live="polite"
206
211
  className="heading"
207
212
  >
208
213
  <mock-FormattedMessage
@@ -81,7 +81,11 @@ const WishlistPage = props => {
81
81
 
82
82
  return (
83
83
  <div className={classes.root} data-cy="Wishlist-root">
84
- <h1 className={classes.heading} data-cy="WishlistPage-heading">
84
+ <h1
85
+ aria-live="polite"
86
+ className={classes.heading}
87
+ data-cy="WishlistPage-heading"
88
+ >
85
89
  <FormattedMessage
86
90
  values={{ count: wishlists.length }}
87
91
  id={'wishlistPage.headingText'}
@@ -123,3 +123,17 @@
123
123
  cursor: default;
124
124
  touch-action: none;
125
125
  }
126
+
127
+ :global(.braintree-sheet__content--form
128
+ .braintree-form__field-group
129
+ .braintree-form__field
130
+ .braintree-form__hosted-field
131
+ input.braintree-form__raw-input) {
132
+ color: #8f8f8f !important;
133
+ }
134
+
135
+ :global(.braintree-sheet__content--form
136
+ .braintree-form__field-group
137
+ .braintree-form__descriptor) {
138
+ color: #757575 !important;
139
+ }
@@ -67,7 +67,7 @@ test('uses RichContentRenderers to inject a default strategy into RichContent',
67
67
  AVAILABLE_STORE_VIEWS: `[
68
68
  {
69
69
  base_currency_code: 'USD',
70
- code: 'default',
70
+ store_code: 'default',
71
71
  default_display_currency_code: 'USD',
72
72
  id: 1,
73
73
  locale: 'en_US',
@@ -75,7 +75,7 @@ test('uses RichContentRenderers to inject a default strategy into RichContent',
75
75
  },
76
76
  {
77
77
  base_currency_code: 'EUR',
78
- code: 'french',
78
+ store_code: 'french',
79
79
  default_display_currency_code: 'EUR',
80
80
  id: 2,
81
81
  locale: 'fr_FR',
@@ -8,7 +8,7 @@
8
8
 
9
9
  /* color */
10
10
  --venia-global-color-blue-100: 194 200 255;
11
- --venia-global-color-blue-400: 61 132 255;
11
+ --venia-global-color-blue-400: 71 139 255;
12
12
  /* --venia-global-color-blue-500: 51 109 255; */
13
13
  /* --venia-global-color-blue-600: 41 84 255; */
14
14
  --venia-global-color-blue-700: 31 57 255;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magento/venia-ui",
3
- "version": "9.4.0",
3
+ "version": "9.5.0-alpha.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -51,7 +51,7 @@
51
51
  "uuid": "~8.3.2"
52
52
  },
53
53
  "devDependencies": {
54
- "@apollo/client": "~3.4.0",
54
+ "@apollo/client": "~3.5.0",
55
55
  "@babel/cli": "~7.2.3",
56
56
  "@babel/core": "~7.15.0",
57
57
  "@babel/plugin-proposal-class-properties": "~7.14.5",
@@ -78,10 +78,10 @@
78
78
  "redux": "~4.0.1"
79
79
  },
80
80
  "peerDependencies": {
81
- "@apollo/client": "~3.4.0",
81
+ "@apollo/client": "~3.5.0",
82
82
  "@magento/babel-preset-peregrine": "~1.2.1",
83
- "@magento/peregrine": "~12.4.0",
84
- "@magento/pwa-buildpack": "~11.3.0",
83
+ "@magento/peregrine": "12.5.0-alpha.1",
84
+ "@magento/pwa-buildpack": "11.4.0-alpha.1",
85
85
  "apollo-cache-persist": "~0.1.1",
86
86
  "braintree-web-drop-in": "~1.16.0",
87
87
  "graphql": "~15.5.0",