@magento/venia-ui 9.1.0 → 9.2.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 (290) hide show
  1. package/i18n/en_US.json +22 -7
  2. package/lib/RootComponents/CMS/__tests__/cms.spec.js +50 -20
  3. package/lib/RootComponents/CMS/cms.js +39 -43
  4. package/lib/RootComponents/CMS/cms.module.css +17 -14
  5. package/lib/RootComponents/Category/NoProductsFound/noProductsFound.js +1 -1
  6. package/lib/RootComponents/Category/__tests__/__snapshots__/category.spec.js.snap +2 -2
  7. package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.spec.js.snap +60 -0
  8. package/lib/RootComponents/Category/__tests__/category.spec.js +1 -1
  9. package/lib/RootComponents/Category/__tests__/categoryContent.spec.js +8 -0
  10. package/lib/RootComponents/Category/category.gql.js +2 -1
  11. package/lib/RootComponents/Category/category.js +6 -6
  12. package/lib/RootComponents/Category/categoryContent.js +11 -4
  13. package/lib/components/Accordion/section.js +6 -2
  14. package/lib/components/AccountChip/accountChip.gql.js +1 -1
  15. package/lib/components/AccountInformationPage/accountInformationPage.gql.js +5 -7
  16. package/lib/components/AccountInformationPage/accountInformationPage.js +5 -1
  17. package/lib/components/AccountInformationPage/editForm.js +22 -4
  18. package/lib/components/AccountMenu/accountMenu.js +1 -1
  19. package/lib/components/AccountMenu/accountMenuItems.js +2 -1
  20. package/lib/components/AddressBookPage/__tests__/__snapshots__/addressCard.spec.js.snap +5 -0
  21. package/lib/components/AddressBookPage/addEditDialog.js +36 -10
  22. package/lib/components/AddressBookPage/addressBookPage.js +5 -2
  23. package/lib/components/AddressBookPage/addressCard.js +17 -4
  24. package/lib/components/App/app.js +5 -1
  25. package/lib/components/App/localeProvider.js +2 -1
  26. package/lib/components/Breadcrumbs/breadcrumbs.js +3 -3
  27. package/lib/components/Breadcrumbs/breadcrumbs.module.css +10 -3
  28. package/lib/components/CartPage/GiftCards/giftCard.js +1 -0
  29. package/lib/components/CartPage/GiftCards/giftCards.js +2 -0
  30. package/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js +3 -0
  31. package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.js +3 -0
  32. package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingForm.js +10 -2
  33. package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingMethods.js +2 -1
  34. package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingRadio.js +1 -1
  35. package/lib/components/CartPage/PriceAdjustments/ShippingMethods/shippingRadios.js +1 -1
  36. package/lib/components/CartPage/PriceAdjustments/giftCardSection.ee.js +1 -0
  37. package/lib/components/CartPage/PriceAdjustments/priceAdjustments.js +4 -1
  38. package/lib/components/CartPage/PriceSummary/discountSummary.js +8 -2
  39. package/lib/components/CartPage/PriceSummary/giftCardSummary.ee.js +4 -1
  40. package/lib/components/CartPage/PriceSummary/priceSummary.js +10 -3
  41. package/lib/components/CartPage/PriceSummary/shippingSummary.js +6 -1
  42. package/lib/components/CartPage/PriceSummary/taxSummary.js +1 -1
  43. package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productDetail.spec.js.snap +3 -3
  44. package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productForm.spec.js.snap +2 -2
  45. package/lib/components/CartPage/ProductListing/EditModal/productDetail.js +1 -1
  46. package/lib/components/CartPage/ProductListing/__tests__/__snapshots__/errorMessage.spec.js.snap +11 -0
  47. package/lib/components/CartPage/ProductListing/__tests__/errorMessage.spec.js +20 -0
  48. package/lib/components/CartPage/ProductListing/__tests__/product.spec.js +1 -0
  49. package/lib/components/CartPage/ProductListing/errorMessage.js +31 -0
  50. package/lib/components/CartPage/ProductListing/errorMessage.module.css +9 -0
  51. package/lib/components/CartPage/ProductListing/product.js +14 -7
  52. package/lib/components/CartPage/ProductListing/productListing.js +6 -1
  53. package/lib/components/CartPage/ProductListing/productListing.module.css +6 -0
  54. package/lib/components/CartPage/ProductListing/quantity.js +3 -0
  55. package/lib/components/CartPage/cartPage.js +1 -1
  56. package/lib/components/CategoryList/__tests__/categoryList.spec.js +2 -0
  57. package/lib/components/CategoryList/categoryList.js +4 -2
  58. package/lib/components/CategoryList/categoryList.module.css +2 -0
  59. package/lib/components/CategoryList/categoryTile.js +2 -0
  60. package/lib/components/CategoryList/categoryTile.module.css +2 -0
  61. package/lib/components/CategoryList/index.js +2 -0
  62. package/lib/components/CategoryTree/categoryBranch.js +2 -1
  63. package/lib/components/CategoryTree/categoryLeaf.js +1 -0
  64. package/lib/components/CategoryTree/categoryTree.js +3 -3
  65. package/lib/components/Checkbox/checkbox.module.css +11 -3
  66. package/lib/components/Checkout/addressForm.js +2 -3
  67. package/lib/components/CheckoutPage/GuestSignIn/guestSignIn.js +6 -2
  68. package/lib/components/CheckoutPage/ItemsReview/__fixtures__/cartItems.js +12 -12
  69. package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/item.spec.js.snap +2 -2
  70. package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/itemsReview.spec.js.snap +3 -3
  71. package/lib/components/CheckoutPage/ItemsReview/item.js +1 -1
  72. package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +4 -1
  73. package/lib/components/CheckoutPage/OrderConfirmationPage/__tests__/__snapshots__/orderConfirmationPage.spec.js.snap +1 -1
  74. package/lib/components/CheckoutPage/OrderConfirmationPage/createAccount.js +6 -0
  75. package/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +10 -4
  76. package/lib/components/CheckoutPage/OrderSummary/orderSummary.js +1 -1
  77. package/lib/components/CheckoutPage/PaymentInformation/braintreeSummary.js +2 -1
  78. package/lib/components/CheckoutPage/PaymentInformation/creditCard.js +11 -1
  79. package/lib/components/CheckoutPage/PaymentInformation/editCard.js +1 -1
  80. package/lib/components/CheckoutPage/PaymentInformation/editModal.js +1 -1
  81. package/lib/components/CheckoutPage/PaymentInformation/paymentInformation.js +1 -1
  82. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/__snapshots__/guestForm.spec.js.snap +8 -0
  83. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/__tests__/guestForm.spec.js +56 -1
  84. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/customerForm.js +27 -4
  85. package/lib/components/CheckoutPage/ShippingInformation/AddressForm/guestForm.js +96 -9
  86. package/lib/components/CheckoutPage/ShippingInformation/card.js +1 -1
  87. package/lib/components/CheckoutPage/ShippingInformation/shippingInformation.js +14 -3
  88. package/lib/components/CheckoutPage/ShippingMethod/completedView.js +1 -0
  89. package/lib/components/CheckoutPage/ShippingMethod/shippingMethod.js +2 -1
  90. package/lib/components/CheckoutPage/ShippingMethod/updateModal.js +1 -0
  91. package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +32 -0
  92. package/lib/components/CheckoutPage/__tests__/checkoutPage.spec.js +2 -0
  93. package/lib/components/CheckoutPage/checkoutPage.js +26 -4
  94. package/lib/components/ContactPage/__tests__/__snapshots__/contactLink.spec.js.snap +11 -0
  95. package/lib/components/ContactPage/__tests__/__snapshots__/contactPage.shimmer.spec.js.snap +113 -0
  96. package/lib/components/ContactPage/__tests__/__snapshots__/contactPage.spec.js.snap +312 -0
  97. package/lib/components/ContactPage/__tests__/contactLink.spec.js +58 -0
  98. package/lib/components/ContactPage/__tests__/contactPage.shimmer.spec.js +20 -0
  99. package/lib/components/ContactPage/__tests__/contactPage.spec.js +159 -0
  100. package/lib/components/ContactPage/contactLink.js +21 -0
  101. package/lib/components/ContactPage/contactPage.js +270 -0
  102. package/lib/components/ContactPage/contactPage.module.css +81 -0
  103. package/lib/components/ContactPage/contactPage.shimmer.js +104 -0
  104. package/lib/components/ContactPage/contactPage.shimmer.module.css +27 -0
  105. package/lib/components/ContactPage/index.js +2 -0
  106. package/lib/components/CreateAccount/createAccount.js +5 -0
  107. package/lib/components/Dialog/dialog.js +18 -4
  108. package/lib/components/ErrorMessage/errorMessage.js +7 -2
  109. package/lib/components/ErrorView/errorView.js +4 -2
  110. package/lib/components/Field/field.module.css +10 -6
  111. package/lib/components/FilterModal/CurrentFilters/currentFilter.js +7 -3
  112. package/lib/components/FilterModal/FilterList/__tests__/filterItem.spec.js +34 -5
  113. package/lib/components/FilterModal/FilterList/filterDefault.js +3 -2
  114. package/lib/components/FilterModal/FilterList/filterItem.js +27 -7
  115. package/lib/components/FilterModal/FilterList/filterList.js +6 -1
  116. package/lib/components/FilterModal/filterBlock.js +9 -4
  117. package/lib/components/FilterModal/filterFooter.js +1 -0
  118. package/lib/components/FilterModal/filterModal.js +6 -1
  119. package/lib/components/FilterModalOpenButton/filterModalOpenButton.js +1 -0
  120. package/lib/components/FilterSidebar/filterSidebar.js +6 -1
  121. package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +14 -0
  122. package/lib/components/Footer/__tests__/footer.spec.js +9 -1
  123. package/lib/components/Footer/footer.js +14 -7
  124. package/lib/components/Footer/sampleData.js +8 -3
  125. package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.js +3 -0
  126. package/lib/components/ForgotPassword/FormSubmissionSuccessful/formSubmissionSuccessful.js +4 -2
  127. package/lib/components/ForgotPassword/forgotPassword.gql.js +0 -1
  128. package/lib/components/FormError/formError.js +10 -4
  129. package/lib/components/Gallery/__tests__/__snapshots__/addToCartButton.spec.js.snap +0 -3
  130. package/lib/components/Gallery/__tests__/__snapshots__/item.spec.js.snap +1 -0
  131. package/lib/components/Gallery/addToCartButton.js +24 -20
  132. package/lib/components/Gallery/item.js +15 -4
  133. package/lib/components/Gallery/item.module.css +1 -0
  134. package/lib/components/Head/index.js +2 -1
  135. package/lib/components/Header/__tests__/header.spec.js +1 -1
  136. package/lib/components/Header/accountTrigger.js +1 -0
  137. package/lib/components/Header/cartTrigger.js +4 -1
  138. package/lib/components/Header/header.js +1 -1
  139. package/lib/components/Header/navTrigger.js +1 -0
  140. package/lib/components/Header/searchTrigger.js +1 -0
  141. package/lib/components/LegacyMiniCart/cartOptions.gql.js +4 -3
  142. package/lib/components/LegacyMiniCart/editFormFragment.gql.js +7 -3
  143. package/lib/components/LegacyMiniCart/kebab.js +1 -0
  144. package/lib/components/LegacyMiniCart/productOptions.js +6 -1
  145. package/lib/components/LegacyMiniCart/section.js +15 -5
  146. package/lib/components/Link/link.js +6 -4
  147. package/lib/components/Mask/mask.js +3 -3
  148. package/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +1 -0
  149. package/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +9 -0
  150. package/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +6 -0
  151. package/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +2 -0
  152. package/lib/components/MegaMenu/megaMenu.js +6 -2
  153. package/lib/components/MegaMenu/megaMenuItem.js +27 -6
  154. package/lib/components/MegaMenu/megaMenuItem.module.css +0 -5
  155. package/lib/components/MegaMenu/submenu.js +5 -3
  156. package/lib/components/MegaMenu/submenuColumn.js +15 -4
  157. package/lib/components/MiniCart/ProductList/__tests__/__snapshots__/item.spec.js.snap +4 -4
  158. package/lib/components/MiniCart/ProductList/item.js +5 -2
  159. package/lib/components/MiniCart/ProductList/productList.js +5 -1
  160. package/lib/components/MiniCart/__tests__/__snapshots__/miniCart.spec.js.snap +1 -1
  161. package/lib/components/MiniCart/miniCart.gql.js +3 -2
  162. package/lib/components/MiniCart/miniCart.js +9 -4
  163. package/lib/components/MyAccount/ResetPassword/resetPassword.gql.js +1 -1
  164. package/lib/components/Newsletter/__tests__/__snapshots__/newsletter.shimmer.spec.js.snap +40 -0
  165. package/lib/components/Newsletter/__tests__/__snapshots__/newsletter.spec.js.snap +14 -8
  166. package/lib/components/Newsletter/__tests__/newsletter.shimmer.spec.js +10 -0
  167. package/lib/components/Newsletter/__tests__/newsletter.spec.js +25 -2
  168. package/lib/components/Newsletter/newsletter.js +27 -6
  169. package/lib/components/Newsletter/newsletter.shimmer.js +46 -0
  170. package/lib/components/Newsletter/newsletter.shimmer.module.css +11 -0
  171. package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/item.spec.js.snap +1 -1
  172. package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/shippingMethod.spec.js.snap +3 -0
  173. package/lib/components/OrderHistoryPage/OrderDetails/billingInformation.js +4 -1
  174. package/lib/components/OrderHistoryPage/OrderDetails/item.js +1 -1
  175. package/lib/components/OrderHistoryPage/OrderDetails/items.js +1 -1
  176. package/lib/components/OrderHistoryPage/OrderDetails/paymentMethod.js +1 -1
  177. package/lib/components/OrderHistoryPage/OrderDetails/shippingInformation.js +4 -1
  178. package/lib/components/OrderHistoryPage/OrderDetails/shippingMethod.js +5 -1
  179. package/lib/components/OrderHistoryPage/orderHistoryPage.js +8 -1
  180. package/lib/components/Pagination/pagination.js +1 -1
  181. package/lib/components/Pagination/tile.js +5 -1
  182. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/__tests__/__snapshots__/boolean.spec.js.snap +20 -0
  183. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/__tests__/boolean.spec.js +52 -0
  184. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.js +74 -0
  185. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/boolean.module.css +9 -0
  186. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Boolean/index.js +1 -0
  187. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/__tests__/__snapshots__/date.spec.js.snap +25 -0
  188. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/__tests__/date.spec.js +52 -0
  189. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.js +82 -0
  190. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/date.module.css +9 -0
  191. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Date/index.js +1 -0
  192. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/__tests__/__snapshots__/dateTime.spec.js.snap +29 -0
  193. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/__tests__/dateTime.spec.js +53 -0
  194. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.js +85 -0
  195. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/dateTime.module.css +9 -0
  196. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/DateTime/index.js +1 -0
  197. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/__tests__/__snapshots__/multiSelect.spec.js.snap +36 -0
  198. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/__tests__/multiSelect.spec.js +88 -0
  199. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/index.js +1 -0
  200. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.js +99 -0
  201. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Multiselect/multiselect.module.css +13 -0
  202. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/__tests__/__snapshots__/price.spec.js.snap +23 -0
  203. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/__tests__/price.spec.js +52 -0
  204. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/index.js +1 -0
  205. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.js +74 -0
  206. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Price/price.module.css +9 -0
  207. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/__tests__/__snapshots__/select.spec.js.snap +36 -0
  208. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/__tests__/select.spec.js +88 -0
  209. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/index.js +1 -0
  210. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.js +99 -0
  211. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Select/select.module.css +13 -0
  212. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/__tests__/__snapshots__/text.spec.js.snap +33 -0
  213. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/__tests__/text.spec.js +74 -0
  214. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/index.js +1 -0
  215. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.js +88 -0
  216. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Text/text.module.css +13 -0
  217. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/__tests__/__snapshots__/textarea.spec.js.snap +33 -0
  218. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/__tests__/textarea.spec.js +74 -0
  219. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/index.js +1 -0
  220. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.js +88 -0
  221. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/Textarea/textarea.module.css +13 -0
  222. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/__tests__/__snapshots__/attributeType.spec.js.snap +101 -0
  223. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/__tests__/attributeType.spec.js +173 -0
  224. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/attributeType.js +61 -0
  225. package/lib/components/ProductFullDetail/CustomAttributes/AttributeType/index.js +1 -0
  226. package/lib/components/ProductFullDetail/CustomAttributes/__tests__/__snapshots__/customAttributes.spec.js.snap +49 -0
  227. package/lib/components/ProductFullDetail/CustomAttributes/__tests__/customAttributes.spec.js +78 -0
  228. package/lib/components/ProductFullDetail/CustomAttributes/customAttributes.js +66 -0
  229. package/lib/components/ProductFullDetail/CustomAttributes/customAttributes.module.css +14 -0
  230. package/lib/components/ProductFullDetail/CustomAttributes/index.js +1 -0
  231. package/lib/components/ProductFullDetail/__tests__/__snapshots__/productFullDetail.spec.js.snap +39 -0
  232. package/lib/components/ProductFullDetail/__tests__/productFullDetail.spec.js +3 -1
  233. package/lib/components/ProductFullDetail/productFullDetail.js +18 -3
  234. package/lib/components/ProductOptions/__tests__/__snapshots__/option.spec.js.snap +1 -1
  235. package/lib/components/ProductOptions/__tests__/__snapshots__/options.spec.js.snap +2 -2
  236. package/lib/components/ProductOptions/__tests__/__snapshots__/swatch.spec.js.snap +44 -2
  237. package/lib/components/ProductOptions/__tests__/__snapshots__/swatchList.spec.js.snap +22 -1
  238. package/lib/components/ProductOptions/__tests__/swatch.spec.js +0 -2
  239. package/lib/components/ProductOptions/option.js +2 -2
  240. package/lib/components/ProductOptions/swatch.js +7 -5
  241. package/lib/components/ProductOptions/swatch.module.css +11 -0
  242. package/lib/components/ProductOptions/tile.js +1 -0
  243. package/lib/components/ProductSort/__tests__/__snapshots__/sortItem.spec.js.snap +14 -0
  244. package/lib/components/ProductSort/__tests__/sortItem.spec.js +61 -0
  245. package/lib/components/ProductSort/productSort.js +84 -40
  246. package/lib/components/ProductSort/sortItem.js +26 -11
  247. package/lib/components/RadioGroup/radio.module.css +13 -5
  248. package/lib/components/RadioGroup/radioGroup.js +2 -1
  249. package/lib/components/Rating/__tests__/__snapshots__/rating.spec.js.snap +27 -0
  250. package/lib/components/Rating/__tests__/rating.spec.js +13 -0
  251. package/lib/components/Rating/index.js +1 -0
  252. package/lib/components/Rating/rating.js +30 -0
  253. package/lib/components/Rating/rating.module.css +21 -0
  254. package/lib/components/RichContent/richContent.module.css +52 -59
  255. package/lib/components/SearchBar/autocomplete.js +2 -0
  256. package/lib/components/SearchBar/searchBar.js +1 -1
  257. package/lib/components/SearchBar/searchField.js +1 -0
  258. package/lib/components/SearchBar/suggestedCategory.js +1 -1
  259. package/lib/components/SearchBar/suggestedProduct.js +6 -1
  260. package/lib/components/SearchPage/__tests__/__snapshots__/searchPage.spec.js.snap +41 -1
  261. package/lib/components/SearchPage/__tests__/searchPage.spec.js +8 -0
  262. package/lib/components/SearchPage/searchPage.js +12 -6
  263. package/lib/components/Shimmer/shimmer.js +11 -2
  264. package/lib/components/Shimmer/shimmer.module.css +4 -8
  265. package/lib/components/SignIn/__tests__/__snapshots__/signIn.spec.js.snap +126 -0
  266. package/lib/components/SignIn/__tests__/signIn.spec.js +11 -0
  267. package/lib/components/SignIn/signIn.gql.js +8 -4
  268. package/lib/components/SignIn/signIn.js +24 -4
  269. package/lib/components/TextArea/textArea.module.css +9 -0
  270. package/lib/components/TextInput/textInput.module.css +4 -0
  271. package/lib/components/ToastContainer/toast.js +23 -3
  272. package/lib/components/ToastContainer/toast.module.css +3 -0
  273. package/lib/components/Trigger/trigger.js +9 -2
  274. package/lib/components/Wishlist/AddToListButton/addToListButton.ee.js +1 -0
  275. package/lib/components/Wishlist/WishlistDialog/CreateWishlistForm/createWishlistForm.js +2 -0
  276. package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.js +1 -0
  277. package/lib/components/Wishlist/WishlistDialog/wishlistDialog.js +1 -0
  278. package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +5 -5
  279. package/lib/components/WishlistPage/createWishlist.ee.js +2 -0
  280. package/lib/components/WishlistPage/wishlist.js +8 -3
  281. package/lib/components/WishlistPage/wishlistItem.js +17 -4
  282. package/lib/components/WishlistPage/wishlistPage.js +5 -3
  283. package/lib/defaultRoutes.json +6 -0
  284. package/lib/targets/__tests__/venia-ui-targets.spec.js +2 -0
  285. package/lib/util/__tests__/shrinkGETQuery.spec.js +1 -1
  286. package/lib/util/apolloCache.js +2 -2
  287. package/lib/util/formValidators.js +10 -8
  288. package/lib/util/toCamelCase.js +3 -0
  289. package/package.json +17 -14
  290. package/upward.yml +19 -40
@@ -0,0 +1,88 @@
1
+ import React, { Fragment } from 'react';
2
+ import { bool, shape, string } from 'prop-types';
3
+
4
+ import { useStyle } from '@magento/venia-ui/lib/classify';
5
+ import RichContent from '@magento/venia-ui/lib/components/RichContent';
6
+
7
+ import defaultClasses from './textarea.module.css';
8
+
9
+ /**
10
+ * Custom Attributes Textarea Type component.
11
+ *
12
+ * @typedef Textarea
13
+ * @kind functional component
14
+ *
15
+ * @param {props} props React component props
16
+ *
17
+ * @returns {React.Element} A React component that displays a Textarea Type Product Attribute.
18
+ */
19
+ const Textarea = props => {
20
+ const classes = useStyle(defaultClasses, props.classes);
21
+ const { attribute_metadata = {}, entered_attribute_value = {} } = props;
22
+
23
+ const attributeLabel = attribute_metadata.label ? (
24
+ <div className={classes.label}>{attribute_metadata.label}</div>
25
+ ) : null;
26
+ let attributeContent;
27
+
28
+ if (entered_attribute_value.value) {
29
+ const { is_html_allowed: isHtml } = attribute_metadata.ui_input;
30
+
31
+ if (isHtml) {
32
+ // TODO: Get decoded wysiwyg widgets from GraphQl
33
+ attributeContent = (
34
+ <div className={classes.contentHtml}>
35
+ <RichContent html={entered_attribute_value.value} />
36
+ </div>
37
+ );
38
+ } else {
39
+ attributeContent = (
40
+ <div className={classes.content}>
41
+ {entered_attribute_value.value}
42
+ </div>
43
+ );
44
+ }
45
+ }
46
+
47
+ return (
48
+ <Fragment>
49
+ {attributeLabel}
50
+ {attributeContent}
51
+ </Fragment>
52
+ );
53
+ };
54
+
55
+ /**
56
+ * Props for {@link Textarea}
57
+ *
58
+ * @typedef props
59
+ *
60
+ * @property {Object} classes An object containing the class names for the attribute
61
+ * @property {String} classes.label CSS class for the attribute label
62
+ * @property {String} classes.content CSS class for the attribute content
63
+ * @property {String} classes.contentHtml CSS class for the attribute content containing html
64
+ * @property {Object} attribute_metadata An object containing the attribute metadata
65
+ * @property {String} attribute_metadata.label The attribute label
66
+ * @property {Object} attribute_metadata.ui_input An object containing the input ui data
67
+ * @property {Boolean} attribute_metadata.ui_input.is_html_allowed Indicates if value might contain html
68
+ * @property {Object} entered_attribute_value An object containing the attribute value
69
+ * @property {String} entered_attribute_value.value Attribute value
70
+ */
71
+ Textarea.propTypes = {
72
+ classes: shape({
73
+ label: string,
74
+ content: string,
75
+ contentHtml: string
76
+ }),
77
+ attribute_metadata: shape({
78
+ label: string,
79
+ ui_input: shape({
80
+ is_html_allowed: bool
81
+ })
82
+ }),
83
+ entered_attribute_value: shape({
84
+ value: string
85
+ })
86
+ };
87
+
88
+ export default Textarea;
@@ -0,0 +1,13 @@
1
+ .label {
2
+ composes: font-bold from global;
3
+ composes: inline-block from global;
4
+ composes: mr-2 from global;
5
+ }
6
+
7
+ .content {
8
+ composes: inline-block from global;
9
+ }
10
+
11
+ .contentHtml {
12
+ composes: block from global;
13
+ }
@@ -0,0 +1,101 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`#AttributeType renders boolean attribute type component 1`] = `
4
+ <mock-Boolean
5
+ attribute_metadata={
6
+ Object {
7
+ "ui_input": Object {
8
+ "ui_input_type": "BOOLEAN",
9
+ },
10
+ }
11
+ }
12
+ />
13
+ `;
14
+
15
+ exports[`#AttributeType renders date attribute type component 1`] = `
16
+ <mock-Date
17
+ attribute_metadata={
18
+ Object {
19
+ "ui_input": Object {
20
+ "ui_input_type": "DATE",
21
+ },
22
+ }
23
+ }
24
+ />
25
+ `;
26
+
27
+ exports[`#AttributeType renders date time attribute type component 1`] = `
28
+ <mock-DateTime
29
+ attribute_metadata={
30
+ Object {
31
+ "ui_input": Object {
32
+ "ui_input_type": "DATETIME",
33
+ },
34
+ }
35
+ }
36
+ />
37
+ `;
38
+
39
+ exports[`#AttributeType renders multiselect attribute type component 1`] = `
40
+ <mock-Multiselect
41
+ attribute_metadata={
42
+ Object {
43
+ "ui_input": Object {
44
+ "ui_input_type": "MULTISELECT",
45
+ },
46
+ }
47
+ }
48
+ />
49
+ `;
50
+
51
+ exports[`#AttributeType renders null when no data is provided 1`] = `null`;
52
+
53
+ exports[`#AttributeType renders null when type is not found 1`] = `null`;
54
+
55
+ exports[`#AttributeType renders price attribute type component 1`] = `
56
+ <mock-Price
57
+ attribute_metadata={
58
+ Object {
59
+ "ui_input": Object {
60
+ "ui_input_type": "PRICE",
61
+ },
62
+ }
63
+ }
64
+ />
65
+ `;
66
+
67
+ exports[`#AttributeType renders select attribute type component 1`] = `
68
+ <mock-Select
69
+ attribute_metadata={
70
+ Object {
71
+ "ui_input": Object {
72
+ "ui_input_type": "SELECT",
73
+ },
74
+ }
75
+ }
76
+ />
77
+ `;
78
+
79
+ exports[`#AttributeType renders text attribute type component 1`] = `
80
+ <mock-Text
81
+ attribute_metadata={
82
+ Object {
83
+ "ui_input": Object {
84
+ "ui_input_type": "TEXT",
85
+ },
86
+ }
87
+ }
88
+ />
89
+ `;
90
+
91
+ exports[`#AttributeType renders textarea attribute type component 1`] = `
92
+ <mock-Textarea
93
+ attribute_metadata={
94
+ Object {
95
+ "ui_input": Object {
96
+ "ui_input_type": "TEXTAREA",
97
+ },
98
+ }
99
+ }
100
+ />
101
+ `;
@@ -0,0 +1,173 @@
1
+ import React from 'react';
2
+
3
+ import { createTestInstance } from '@magento/peregrine';
4
+
5
+ import AttributeType from '../attributeType';
6
+
7
+ // jest.mock('@magento/peregrine/lib/talons/ProductFullDetail/CustomAttributes/AttributeType', () => ({
8
+ // useAttributeType: jest.fn(() => {
9
+ // return {
10
+ // getAttributeTypeConfig: jest.fn().mockImplementation(() => {
11
+ // return 'test';
12
+ // })
13
+ // };
14
+ // })
15
+ // }));
16
+
17
+ jest.mock('../Boolean', () => props => <mock-Boolean {...props} />);
18
+ jest.mock('../Date', () => props => <mock-Date {...props} />);
19
+ jest.mock('../DateTime', () => props => <mock-DateTime {...props} />);
20
+ jest.mock('../Multiselect', () => props => <mock-Multiselect {...props} />);
21
+ jest.mock('../Price', () => props => <mock-Price {...props} />);
22
+ jest.mock('../Select', () => props => <mock-Select {...props} />);
23
+ jest.mock('../Text', () => props => <mock-Text {...props} />);
24
+ jest.mock('../Textarea', () => props => <mock-Textarea {...props} />);
25
+
26
+ let inputProps = {};
27
+
28
+ const Component = () => {
29
+ return <AttributeType {...inputProps} />;
30
+ };
31
+
32
+ describe('#AttributeType', () => {
33
+ it('renders null when no data is provided', () => {
34
+ const tree = createTestInstance(<Component />);
35
+
36
+ expect(tree.toJSON()).toMatchSnapshot();
37
+ });
38
+
39
+ it('renders null when type is not found', () => {
40
+ inputProps = {
41
+ data: {
42
+ attribute_metadata: {
43
+ ui_input: {
44
+ ui_input_type: 'FAKETYPE'
45
+ }
46
+ }
47
+ }
48
+ };
49
+ const tree = createTestInstance(<Component />);
50
+
51
+ expect(tree.toJSON()).toMatchSnapshot();
52
+ });
53
+
54
+ it('renders boolean attribute type component', () => {
55
+ inputProps = {
56
+ data: {
57
+ attribute_metadata: {
58
+ ui_input: {
59
+ ui_input_type: 'BOOLEAN'
60
+ }
61
+ }
62
+ }
63
+ };
64
+ const tree = createTestInstance(<Component />);
65
+
66
+ expect(tree.toJSON()).toMatchSnapshot();
67
+ });
68
+
69
+ it('renders date attribute type component', () => {
70
+ inputProps = {
71
+ data: {
72
+ attribute_metadata: {
73
+ ui_input: {
74
+ ui_input_type: 'DATE'
75
+ }
76
+ }
77
+ }
78
+ };
79
+ const tree = createTestInstance(<Component />);
80
+
81
+ expect(tree.toJSON()).toMatchSnapshot();
82
+ });
83
+
84
+ it('renders date time attribute type component', () => {
85
+ inputProps = {
86
+ data: {
87
+ attribute_metadata: {
88
+ ui_input: {
89
+ ui_input_type: 'DATETIME'
90
+ }
91
+ }
92
+ }
93
+ };
94
+ const tree = createTestInstance(<Component />);
95
+
96
+ expect(tree.toJSON()).toMatchSnapshot();
97
+ });
98
+
99
+ it('renders multiselect attribute type component', () => {
100
+ inputProps = {
101
+ data: {
102
+ attribute_metadata: {
103
+ ui_input: {
104
+ ui_input_type: 'MULTISELECT'
105
+ }
106
+ }
107
+ }
108
+ };
109
+ const tree = createTestInstance(<Component />);
110
+
111
+ expect(tree.toJSON()).toMatchSnapshot();
112
+ });
113
+
114
+ it('renders price attribute type component', () => {
115
+ inputProps = {
116
+ data: {
117
+ attribute_metadata: {
118
+ ui_input: {
119
+ ui_input_type: 'PRICE'
120
+ }
121
+ }
122
+ }
123
+ };
124
+ const tree = createTestInstance(<Component />);
125
+
126
+ expect(tree.toJSON()).toMatchSnapshot();
127
+ });
128
+
129
+ it('renders select attribute type component', () => {
130
+ inputProps = {
131
+ data: {
132
+ attribute_metadata: {
133
+ ui_input: {
134
+ ui_input_type: 'SELECT'
135
+ }
136
+ }
137
+ }
138
+ };
139
+ const tree = createTestInstance(<Component />);
140
+
141
+ expect(tree.toJSON()).toMatchSnapshot();
142
+ });
143
+
144
+ it('renders text attribute type component', () => {
145
+ inputProps = {
146
+ data: {
147
+ attribute_metadata: {
148
+ ui_input: {
149
+ ui_input_type: 'TEXT'
150
+ }
151
+ }
152
+ }
153
+ };
154
+ const tree = createTestInstance(<Component />);
155
+
156
+ expect(tree.toJSON()).toMatchSnapshot();
157
+ });
158
+
159
+ it('renders textarea attribute type component', () => {
160
+ inputProps = {
161
+ data: {
162
+ attribute_metadata: {
163
+ ui_input: {
164
+ ui_input_type: 'TEXTAREA'
165
+ }
166
+ }
167
+ }
168
+ };
169
+ const tree = createTestInstance(<Component />);
170
+
171
+ expect(tree.toJSON()).toMatchSnapshot();
172
+ });
173
+ });
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+
3
+ import { useAttributeType } from '@magento/peregrine/lib/talons/ProductFullDetail/CustomAttributes/AttributeType/useAttributeType';
4
+
5
+ import Boolean from './Boolean';
6
+ import Date from './Date';
7
+ import DateTime from './DateTime';
8
+ import Multiselect from './Multiselect';
9
+ import Price from './Price';
10
+ import Select from './Select';
11
+ import Text from './Text';
12
+ import Textarea from './Textarea';
13
+
14
+ const defaultTypeConfig = {
15
+ boolean: {
16
+ component: Boolean
17
+ },
18
+ date: {
19
+ component: Date
20
+ },
21
+ datetime: {
22
+ component: DateTime
23
+ },
24
+ multiselect: {
25
+ component: Multiselect
26
+ },
27
+ price: {
28
+ component: Price
29
+ },
30
+ select: {
31
+ component: Select
32
+ },
33
+ text: {
34
+ component: Text
35
+ },
36
+ textarea: {
37
+ component: Textarea
38
+ }
39
+ };
40
+
41
+ const AttributeType = props => {
42
+ const { data, ...rest } = props;
43
+ const { ui_input_type: type } = data?.attribute_metadata.ui_input || {};
44
+
45
+ const { getAttributeTypeConfig } = useAttributeType({
46
+ typeConfig: defaultTypeConfig
47
+ });
48
+
49
+ if (type) {
50
+ const attributeTypeConfig = getAttributeTypeConfig(type.toLowerCase());
51
+ if (attributeTypeConfig && attributeTypeConfig.component) {
52
+ const Component = attributeTypeConfig.component;
53
+
54
+ return <Component {...data} {...rest} />;
55
+ }
56
+ }
57
+
58
+ return null;
59
+ };
60
+
61
+ export default AttributeType;
@@ -0,0 +1 @@
1
+ export { default } from './attributeType';
@@ -0,0 +1,49 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`#CustomAttributes renders with custom attributes visible on front only 1`] = `
4
+ <div>
5
+ <p>
6
+ Details
7
+ </p>
8
+ <ul>
9
+ <li>
10
+ <mock-AttributeType
11
+ data={
12
+ Object {
13
+ "attribute_metadata": Object {
14
+ "is_visible_on_front": true,
15
+ "uid": "uid-1",
16
+ },
17
+ }
18
+ }
19
+ />
20
+ </li>
21
+ <li>
22
+ <mock-AttributeType
23
+ data={
24
+ Object {
25
+ "attribute_metadata": Object {
26
+ "is_visible_on_front": true,
27
+ "uid": "uid-2",
28
+ },
29
+ }
30
+ }
31
+ />
32
+ </li>
33
+ <li>
34
+ <mock-AttributeType
35
+ data={
36
+ Object {
37
+ "attribute_metadata": Object {
38
+ "is_visible_on_front": true,
39
+ "uid": "uid-4",
40
+ },
41
+ }
42
+ }
43
+ />
44
+ </li>
45
+ </ul>
46
+ </div>
47
+ `;
48
+
49
+ exports[`#CustomAttributes renders without custom attributes 1`] = `null`;
@@ -0,0 +1,78 @@
1
+ import React from 'react';
2
+
3
+ import { createTestInstance } from '@magento/peregrine';
4
+
5
+ import CustomAttributes from '../customAttributes';
6
+
7
+ jest.mock('react-intl', () => ({
8
+ FormattedMessage: ({ defaultMessage }) => defaultMessage
9
+ }));
10
+
11
+ jest.mock('../AttributeType', () => {
12
+ return props => <mock-AttributeType {...props} />;
13
+ });
14
+
15
+ let inputProps = {};
16
+
17
+ const Component = () => {
18
+ return <CustomAttributes {...inputProps} />;
19
+ };
20
+
21
+ const givenDefaultValues = () => {
22
+ inputProps = {
23
+ customAttributes: []
24
+ };
25
+ };
26
+
27
+ describe('#CustomAttributes', () => {
28
+ beforeEach(() => {
29
+ givenDefaultValues();
30
+ });
31
+
32
+ it('renders without custom attributes', () => {
33
+ const tree = createTestInstance(<Component />);
34
+
35
+ expect(tree.toJSON()).toMatchSnapshot();
36
+ });
37
+
38
+ it('renders with custom attributes visible on front only', () => {
39
+ inputProps = {
40
+ customAttributes: [
41
+ {
42
+ attribute_metadata: {
43
+ is_visible_on_front: true,
44
+ uid: 'uid-1'
45
+ }
46
+ },
47
+ {
48
+ attribute_metadata: {
49
+ is_visible_on_front: true,
50
+ uid: 'uid-2'
51
+ }
52
+ },
53
+ {
54
+ attribute_metadata: {
55
+ is_visible_on_front: false,
56
+ uid: 'uid-3'
57
+ }
58
+ },
59
+ {
60
+ attribute_metadata: {
61
+ is_visible_on_front: true,
62
+ uid: 'uid-4'
63
+ }
64
+ },
65
+ {
66
+ attribute_metadata: {
67
+ is_visible_on_front: false,
68
+ uid: 'uid-5'
69
+ }
70
+ }
71
+ ]
72
+ };
73
+
74
+ const tree = createTestInstance(<Component />);
75
+
76
+ expect(tree.toJSON()).toMatchSnapshot();
77
+ });
78
+ });
@@ -0,0 +1,66 @@
1
+ import React, { useMemo } from 'react';
2
+ import { array, shape, string } from 'prop-types';
3
+ import { FormattedMessage } from 'react-intl';
4
+
5
+ import { useStyle } from '@magento/venia-ui/lib/classify';
6
+
7
+ import AttributeType from './AttributeType';
8
+ import defaultClasses from './customAttributes.module.css';
9
+
10
+ const CustomAttributes = props => {
11
+ const { customAttributes } = props;
12
+ const classes = useStyle(defaultClasses, props.classes);
13
+
14
+ const list = useMemo(
15
+ () =>
16
+ customAttributes.reduce((previousAttribute, currentAttribute) => {
17
+ // Visible on front attributes only
18
+ if (
19
+ currentAttribute.attribute_metadata.is_visible_on_front ===
20
+ true
21
+ ) {
22
+ const attributeContent = (
23
+ <li
24
+ key={currentAttribute.attribute_metadata.uid}
25
+ className={classes.listItem}
26
+ >
27
+ <AttributeType data={currentAttribute} />
28
+ </li>
29
+ );
30
+
31
+ previousAttribute.push(attributeContent);
32
+ }
33
+
34
+ return previousAttribute;
35
+ }, []),
36
+ [classes, customAttributes]
37
+ );
38
+
39
+ if (list.length === 0) {
40
+ return null;
41
+ }
42
+
43
+ return (
44
+ <div className={classes.root}>
45
+ <p className={classes.title}>
46
+ <FormattedMessage
47
+ id={'customAttributes.title'}
48
+ defaultMessage={'Details'}
49
+ />
50
+ </p>
51
+ <ul className={classes.list}>{list}</ul>
52
+ </div>
53
+ );
54
+ };
55
+
56
+ CustomAttributes.propTypes = {
57
+ classes: shape({
58
+ root: string,
59
+ title: string,
60
+ list: string,
61
+ listItem: string
62
+ }),
63
+ customAttributes: array.isRequired
64
+ };
65
+
66
+ export default CustomAttributes;
@@ -0,0 +1,14 @@
1
+ .root {
2
+ composes: mt-8 from global;
3
+ }
4
+
5
+ .title {
6
+ composes: font-semibold from global;
7
+ }
8
+
9
+ .list {
10
+ composes: list-disc from global;
11
+ composes: mb-4 from global;
12
+ composes: mt-4 from global;
13
+ composes: pl-6 from global;
14
+ }
@@ -0,0 +1 @@
1
+ export { default } from './customAttributes';