@shopgate/engage 7.12.3-beta.1 → 7.20.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.
Files changed (419) hide show
  1. package/a11y/components/Section/index.js +2 -2
  2. package/a11y/components/VisuallyHidden/index.js +8 -0
  3. package/a11y/components/index.js +1 -0
  4. package/a11y/constants/index.js +1 -0
  5. package/a11y/helpers/index.js +1 -0
  6. package/a11y/index.js +1 -4
  7. package/account/actions/addContacts.js +1 -1
  8. package/account/actions/deleteContact.js +1 -1
  9. package/account/actions/deleteCustomer.js +1 -1
  10. package/account/actions/fetchContacts.js +1 -1
  11. package/account/actions/fetchCustomer.js +1 -1
  12. package/account/actions/updateContact.js +1 -1
  13. package/account/actions/updateCustomer.js +1 -1
  14. package/account/components/Account/Account.style.js +1 -1
  15. package/account/components/Profile/Profile.provider.js +3 -3
  16. package/account/components/ProfileContact/ProfileContact.js +1 -1
  17. package/app-rating/action-creators/appStart.js +3 -3
  18. package/app-rating/action-creators/ordersPlaced.js +3 -3
  19. package/app-rating/action-creators/popup.js +4 -4
  20. package/app-rating/action-creators/timer.js +3 -3
  21. package/app-rating/actions/showModal.js +6 -6
  22. package/app-rating/constants/index.js +2 -2
  23. package/app-rating/reducers/index.js +2 -2
  24. package/app-rating/subscriptions/index.js +4 -4
  25. package/back-in-stock/actions/index.js +14 -0
  26. package/back-in-stock/components/BackInStockButton/connector.js +1 -0
  27. package/back-in-stock/components/BackInStockButton/index.js +14 -0
  28. package/back-in-stock/components/BackInStockButton/style.js +1 -0
  29. package/back-in-stock/components/CharacteristicsButton/connector.js +3 -0
  30. package/back-in-stock/components/CharacteristicsButton/index.js +8 -0
  31. package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +3 -0
  32. package/back-in-stock/components/ProductInfoBackInStockButton/index.js +10 -0
  33. package/back-in-stock/components/Subscriptions/components/List/index.js +4 -0
  34. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +7 -0
  35. package/back-in-stock/components/Subscriptions/index.js +4 -0
  36. package/back-in-stock/components/index.js +1 -0
  37. package/back-in-stock/constants/Actions.js +1 -0
  38. package/back-in-stock/constants/Common.js +1 -0
  39. package/back-in-stock/constants/Pipelines.js +1 -0
  40. package/back-in-stock/constants/Portals.js +9 -0
  41. package/back-in-stock/constants/index.js +1 -0
  42. package/back-in-stock/hooks/index.js +4 -0
  43. package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +7 -0
  44. package/back-in-stock/providers/BackInStockSubscriptionsProvider.context.js +1 -0
  45. package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +5 -0
  46. package/back-in-stock/providers/index.js +1 -0
  47. package/back-in-stock/reducers/index.js +5 -0
  48. package/back-in-stock/selectors/index.js +43 -0
  49. package/back-in-stock/streams/index.js +1 -0
  50. package/back-in-stock/subscriptions/index.js +11 -0
  51. package/cart/cart.helpers.js +2 -2
  52. package/cart/components/CartItem/CartItemCoupon.js +10 -6
  53. package/cart/components/CartItem/CartItemCouponCode.js +2 -2
  54. package/cart/components/CartItem/CartItemCouponDelete.js +1 -1
  55. package/cart/components/CartItem/CartItemCouponFreeShipping.js +1 -1
  56. package/cart/components/CartItem/CartItemCouponIcon.js +2 -2
  57. package/cart/components/CartItem/CartItemCouponLayout.style.js +5 -1
  58. package/cart/components/CartItem/CartItemCouponTitle.js +2 -2
  59. package/cart/components/CartItem/CartItemProductLayout.js +3 -2
  60. package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
  61. package/cart/components/CartItem/CartItemProductTitle.js +2 -2
  62. package/cart/components/CartItem/CartItemQuantityPicker.js +26 -14
  63. package/cart/components/CartItem/CartItemSubstitution.js +1 -1
  64. package/cart/components/CartItems/CartItemCardReservation.js +1 -1
  65. package/cart/components/CartItems/CartItemGroupReservation.js +1 -1
  66. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
  67. package/cart/components/PaymentBar/PaymentBar.js +1 -1
  68. package/cart/components/PaymentBar/PaymentBarCheckoutButton.style.js +1 -1
  69. package/cart/components/PaymentBar/PaymentBarPromotionCouponMessages.js +1 -1
  70. package/cart/index.js +1 -1
  71. package/category/actions/index.js +1 -0
  72. package/category/components/CategoryList/index.js +7 -0
  73. package/category/components/CategoryList/style.js +1 -0
  74. package/category/components/index.js +1 -1
  75. package/category/constants/index.js +1 -0
  76. package/category/helpers/index.js +1 -0
  77. package/category/index.js +1 -6
  78. package/category/selectors/index.js +2 -0
  79. package/category/streams/index.js +1 -1
  80. package/checkout/actions/errorCheckout.js +1 -1
  81. package/checkout/actions/fetchCheckoutOrder.js +1 -1
  82. package/checkout/actions/fetchPaymentMethods.js +1 -1
  83. package/checkout/actions/initializeCheckout.js +1 -1
  84. package/checkout/actions/prepareCheckout.js +2 -2
  85. package/checkout/actions/submitCheckoutOrder.js +1 -1
  86. package/checkout/actions/updateCheckoutOrder.js +1 -1
  87. package/checkout/components/Checkout/CheckoutSectionMessages.js +1 -1
  88. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +1 -1
  89. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationBilledTo.js +1 -1
  90. package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +1 -1
  91. package/checkout/components/ShippingMethods/ShippingMethods.js +4 -4
  92. package/checkout/paymentMethods/index.js +2 -2
  93. package/checkout/paymentMethods/paypal/PaypalButtonApp.js +1 -1
  94. package/checkout/paymentMethods/paypal/PaypalButtonWeb.js +1 -1
  95. package/checkout/paymentMethods/paypal/PaypalPayButton.js +1 -1
  96. package/checkout/paymentMethods/paypal/PaypalProvider.js +1 -1
  97. package/checkout/paymentMethods/stripe/StripeButton.js +2 -2
  98. package/checkout/paymentMethods/stripe/StripeCreditCard.js +3 -3
  99. package/checkout/paymentMethods/stripe/StripeProvider.js +8 -8
  100. package/checkout/paymentMethods/stripe/sdk.js +1 -1
  101. package/checkout/providers/AddressBookProvider.js +1 -1
  102. package/checkout/providers/CheckoutProvider.js +8 -8
  103. package/components/ChipLayout/index.js +38 -0
  104. package/components/ChipLayout/spec.js +5 -0
  105. package/components/ChipLayout/style.js +5 -0
  106. package/components/Footer/Footer.js +7 -7
  107. package/components/Form/Builder/Builder.js +50 -29
  108. package/components/Form/Builder/ElementCheckbox.js +1 -1
  109. package/components/Form/Builder/ElementMultiSelect.js +1 -1
  110. package/components/Form/Builder/ElementPhoneNumber.js +3 -3
  111. package/components/Form/Builder/ElementRadio.js +1 -1
  112. package/components/Form/Builder/ElementSelect.js +1 -1
  113. package/components/Form/Builder/ElementText.js +3 -3
  114. package/components/Form/Builder/classes/ActionListener.constants.js +2 -2
  115. package/components/Form/Builder/classes/ActionListener.js +73 -16
  116. package/components/Form/Builder/helpers/buildFormElements.js +2 -2
  117. package/components/Form/Form.js +8 -5
  118. package/components/IntersectionVisibility/index.js +14 -7
  119. package/components/Logo/connector.js +4 -0
  120. package/components/Logo/index.js +4 -0
  121. package/components/Logo/spec.js +1 -0
  122. package/components/Logo/style.js +1 -0
  123. package/components/Menu/components/Position/index.js +5 -5
  124. package/components/Menu/index.js +9 -9
  125. package/components/MessageBar/MessageBar.js +1 -1
  126. package/components/MessageBar/index.js +1 -1
  127. package/components/NavigationHandler/index.js +4 -4
  128. package/components/NavigationHandler/spec.js +1 -1
  129. package/components/Picker/components/Button/index.js +1 -1
  130. package/components/Picker/components/List/index.js +2 -2
  131. package/components/Picker/components/Modal/index.js +7 -7
  132. package/components/Picker/index.js +18 -9
  133. package/components/PickerUtilize/components/Button/index.js +5 -0
  134. package/components/PickerUtilize/components/Button/style.js +1 -0
  135. package/components/PickerUtilize/index.js +17 -0
  136. package/components/PickerUtilize/spec.js +1 -0
  137. package/components/PickerUtilize/style.js +1 -0
  138. package/components/QuantityInput/QuantityInput.js +2 -2
  139. package/components/Radio/Radio.js +1 -1
  140. package/components/RadioCard/RadioCard.js +1 -1
  141. package/components/RangeSlider/components/Handle/index.js +1 -1
  142. package/components/RangeSlider/index.js +36 -24
  143. package/components/SheetList/components/Item/index.js +5 -5
  144. package/components/SheetList/index.js +4 -4
  145. package/components/SideNavigation/SideNavigationCategories.connector.js +2 -2
  146. package/components/SnackBarContainer/index.js +5 -0
  147. package/components/Switch/index.js +12 -0
  148. package/components/Switch/style.js +1 -0
  149. package/components/Tabs/components/TabIndicator.js +2 -2
  150. package/components/Tabs/components/Tabs.js +1 -1
  151. package/components/TimeBoundary/index.js +8 -6
  152. package/components/VideoPlayer/index.js +9 -6
  153. package/components/View/components/Above/index.js +1 -1
  154. package/components/View/components/Below/index.js +1 -1
  155. package/components/View/components/Content/index.js +18 -11
  156. package/components/View/index.js +1 -1
  157. package/components/View/provider.js +22 -5
  158. package/components/index.js +2 -2
  159. package/core/action-creators/app.js +5 -0
  160. package/core/action-creators/appPermissions.js +9 -0
  161. package/core/action-creators/index.js +1 -1
  162. package/core/actions/getGeolocation.js +2 -2
  163. package/core/actions/grantAppTrackingTransparencyPermission.js +6 -0
  164. package/core/actions/grantCameraPermissions.js +1 -1
  165. package/core/actions/grantGeolocationPermissions.js +1 -1
  166. package/core/actions/grantPermissions.js +13 -6
  167. package/core/actions/grantPushPermissions.js +22 -0
  168. package/core/actions/index.js +7 -0
  169. package/core/actions/requestAppPermission.js +12 -0
  170. package/core/actions/requestAppPermissionStatus.js +12 -0
  171. package/core/classes/GeolocationRequest.js +2 -3
  172. package/core/classes/GeolocationRequestApp.js +6 -6
  173. package/core/classes/GeolocationRequestBrowser.js +2 -2
  174. package/core/classes/index.js +1 -0
  175. package/core/collections/AppInitialization.js +49 -0
  176. package/core/collections/index.js +1 -0
  177. package/core/commands/analyticsSetConsent.js +11 -0
  178. package/core/commands/index.js +1 -0
  179. package/core/config/ThemeConfigResolver.js +2 -2
  180. package/core/config/config.action-creators.js +1 -1
  181. package/core/config/config.actions.js +1 -1
  182. package/core/config/config.reducers.js +1 -1
  183. package/core/config/config.subscriptions.js +2 -2
  184. package/core/config/index.js +1 -1
  185. package/core/constants/actionTypes.js +1 -0
  186. package/core/constants/appFeatures.js +1 -0
  187. package/core/constants/index.js +6 -1
  188. package/core/contexts/index.js +1 -0
  189. package/core/helpers/appFeatures.js +14 -0
  190. package/core/helpers/appPermissions.js +43 -6
  191. package/core/helpers/baseUrl.js +14 -0
  192. package/core/helpers/environment.js +4 -0
  193. package/core/helpers/getFullImageSource.js +1 -1
  194. package/core/helpers/i18n.js +5 -3
  195. package/core/helpers/index.js +7 -0
  196. package/core/hocs/index.js +1 -0
  197. package/core/hocs/withCurrentProduct.js +6 -6
  198. package/core/hocs/withTheme.js +2 -2
  199. package/core/hooks/index.js +1 -0
  200. package/core/hooks/useAsyncMemo.js +1 -1
  201. package/core/hooks/useFormState.js +1 -1
  202. package/core/hooks/useScrollTo.js +1 -1
  203. package/core/hooks/useTheme.js +2 -2
  204. package/core/index.js +5 -52
  205. package/core/initialization/index.js +4 -2
  206. package/core/providers/AppProvider.js +10 -8
  207. package/core/providers/index.js +1 -0
  208. package/core/reducers/app.js +6 -0
  209. package/core/reducers/index.js +1 -1
  210. package/core/reducers/merchantSettings.js +1 -1
  211. package/core/reducers/shopSettings.js +1 -1
  212. package/core/selectors/app.js +9 -0
  213. package/core/selectors/index.js +6 -1
  214. package/core/streams/app.js +8 -0
  215. package/core/streams/appPermissions.js +19 -0
  216. package/core/streams/index.js +4 -0
  217. package/core/subscriptions/app.js +7 -0
  218. package/favorites/components/Item/Item.js +5 -5
  219. package/favorites/components/List/List.js +1 -1
  220. package/favorites/components/Lists/Lists.js +4 -4
  221. package/filter/components/PriceSlider/index.js +9 -9
  222. package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +9 -0
  223. package/filter/helpers/buildUpdatedFilters.js +1 -1
  224. package/filter/helpers/index.js +1 -0
  225. package/filter/helpers/translateFilterLabel.js +6 -0
  226. package/filter/index.js +1 -1
  227. package/filter/providers/SortProvider.helpers.js +1 -1
  228. package/locations/actions/fetchFulfillmentSlots.js +5 -3
  229. package/locations/actions/fetchInventories.js +5 -4
  230. package/locations/actions/fetchLocations.js +18 -3
  231. package/locations/actions/fetchProductInventories.js +4 -2
  232. package/locations/actions/fetchProductLocations.js +9 -2
  233. package/locations/actions/index.js +1 -1
  234. package/locations/actions/setUserGeolocation.js +1 -1
  235. package/locations/actions/setUserSearchGeolocation.js +1 -1
  236. package/locations/actions/submitReservation.js +2 -2
  237. package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.js +1 -1
  238. package/locations/components/FulfillmentPath/FulfillmentPath.js +1 -1
  239. package/locations/components/FulfillmentPath/FulfillmentPathItem.js +2 -2
  240. package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +2 -2
  241. package/locations/components/FulfillmentSelector/FulfillmentSelectorAlternativeLocation.js +1 -1
  242. package/locations/components/FulfillmentSheet/FulfillmentSheet.js +2 -2
  243. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +1 -1
  244. package/locations/components/ReserveForm/ReserveForm.js +1 -1
  245. package/locations/components/ReserveForm/ReserveFormPhone.js +1 -1
  246. package/locations/components/StockInfo/StockInfo.defaultSettings.js +1 -1
  247. package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -2
  248. package/locations/components/StoreList/StoreListSearch.js +2 -2
  249. package/locations/locations.streams.js +1 -1
  250. package/locations/providers/FulfillmentProvider.js +4 -4
  251. package/locations/providers/StoreFinderProvider.js +1 -1
  252. package/locations/reducers/storage.js +3 -3
  253. package/locations/selectors/index.js +2 -2
  254. package/locations/subscriptions.js +13 -13
  255. package/login/components/ForgotPassword/ForgotPassword.js +1 -1
  256. package/orders/actions/cancelOrder.js +1 -1
  257. package/orders/actions/fetchOrderDetails.js +1 -1
  258. package/orders/constants/status.js +2 -2
  259. package/orders/providers/OrderDetailsPrivateProvider.js +1 -1
  260. package/orders/providers/OrderDetailsProvider.js +3 -3
  261. package/package.json +8 -8
  262. package/page/actions/index.js +1 -0
  263. package/page/components/index.js +1 -0
  264. package/page/constants/index.js +1 -0
  265. package/page/index.js +2 -4
  266. package/page/selectors/index.js +1 -0
  267. package/product/collections/index.js +1 -0
  268. package/product/components/Availability/Availability.connector.js +4 -5
  269. package/product/components/Availability/Availability.js +3 -3
  270. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +20 -0
  271. package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +10 -0
  272. package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -0
  273. package/product/components/Characteristics/Characteristic/index.js +18 -0
  274. package/product/components/Characteristics/Characteristic/style.js +1 -0
  275. package/product/components/Characteristics/Swatch/index.js +12 -0
  276. package/product/components/Characteristics/Swatch/style.js +1 -0
  277. package/product/components/Characteristics/index.js +12 -0
  278. package/product/components/Characteristics/transition.js +1 -0
  279. package/product/components/Description/index.js +2 -2
  280. package/product/components/EffectivityDates/helpers.js +3 -3
  281. package/product/components/EffectivityDates/index.js +1 -1
  282. package/product/components/Header/PriceStriked/connector.js +9 -0
  283. package/product/components/Header/PriceStriked/index.js +5 -0
  284. package/product/components/Header/PriceStriked/style.js +1 -0
  285. package/product/components/Header/Shipping/components/Label/index.js +6 -0
  286. package/product/components/Header/Shipping/components/Label/style.js +1 -0
  287. package/product/components/Header/Shipping/connector.js +9 -0
  288. package/product/components/Header/Shipping/index.js +5 -0
  289. package/product/components/Header/Shipping/mock.js +1 -0
  290. package/product/components/Header/Shipping/spec.js +5 -0
  291. package/product/components/Header/Shipping/style.js +1 -0
  292. package/product/components/Header/Tiers/components/Tier/index.js +6 -0
  293. package/product/components/Header/Tiers/components/Tier/spec.js +1 -0
  294. package/product/components/Header/Tiers/connector.js +10 -0
  295. package/product/components/Header/Tiers/index.js +5 -0
  296. package/product/components/Header/Tiers/spec.js +1 -0
  297. package/product/components/Header/Tiers/style.js +1 -0
  298. package/product/components/Header/index.js +1 -0
  299. package/product/components/MapPriceHint/index.js +1 -1
  300. package/product/components/Media/FeaturedMedia.js +1 -1
  301. package/product/components/MediaSlider/index.js +1 -1
  302. package/product/components/Options/components/Content/connector.js +10 -0
  303. package/product/components/Options/components/Content/index.js +16 -0
  304. package/product/components/Options/components/Content/spec.js +2 -0
  305. package/product/components/Options/components/Option/index.js +4 -0
  306. package/product/components/Options/components/TextOption/components/OptionInfo/index.js +9 -0
  307. package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -0
  308. package/product/components/Options/components/TextOption/components/OptionInfo/style.js +1 -0
  309. package/product/components/Options/components/TextOption/index.js +22 -0
  310. package/product/components/Options/components/TextOption/style.js +1 -0
  311. package/product/components/Options/index.js +5 -0
  312. package/product/components/OrderQuantityHint/index.js +3 -2
  313. package/product/components/OrderQuantityHint/style.js +1 -1
  314. package/product/components/PriceDifference/index.js +1 -1
  315. package/product/components/ProductCard/index.js +2 -2
  316. package/product/components/ProductCharacteristics/helpers/index.js +1 -1
  317. package/product/components/ProductCharacteristics/index.js +28 -12
  318. package/product/components/ProductDiscountBadge/spec.js +1 -1
  319. package/product/components/ProductGridPrice/index.js +2 -2
  320. package/product/components/ProductImage/index.js +15 -12
  321. package/product/components/ProductList/components/Item/index.js +5 -0
  322. package/product/components/ProductList/components/Item/style.js +2 -0
  323. package/product/components/ProductList/components/Iterator/index.js +5 -0
  324. package/product/components/ProductList/components/Iterator/style.js +1 -0
  325. package/product/components/ProductList/components/Layout/index.js +5 -0
  326. package/product/components/ProductList/components/Layout/style.js +1 -0
  327. package/product/components/ProductList/index.js +5 -0
  328. package/product/components/ProductProperties/Content.js +1 -1
  329. package/product/components/ProductProperties/GroupedProperties.js +1 -1
  330. package/product/components/ProductProperties/ListsHTML.js +1 -1
  331. package/product/components/ProductProperties/ProductProperties.js +1 -1
  332. package/product/components/ProductProperties/RowHTML.js +1 -1
  333. package/product/components/ProductProperties/Wrapper.js +1 -1
  334. package/product/components/ProductProperties/style.js +1 -1
  335. package/product/components/ProductProvider/connector.js +5 -0
  336. package/product/components/ProductProvider/index.js +4 -0
  337. package/product/components/ProductSlider/index.js +4 -0
  338. package/product/components/ProductSlider/spec.js +1 -0
  339. package/product/components/ProductSlider/style.js +1 -0
  340. package/product/components/Rating/connector.js +9 -0
  341. package/product/components/Rating/index.js +7 -0
  342. package/product/components/Rating/mock.js +5 -0
  343. package/product/components/Rating/spec.js +5 -0
  344. package/product/components/Rating/style.js +1 -0
  345. package/product/components/Swatch/SwatchContent.js +1 -1
  346. package/product/components/index.js +1 -0
  347. package/product/constants/index.js +1 -1
  348. package/product/contexts/index.js +1 -0
  349. package/product/helpers/index.js +2 -2
  350. package/product/helpers/redirects.js +1 -1
  351. package/product/hocs/index.js +1 -0
  352. package/product/hocs/withProductListEntryProduct.js +12 -0
  353. package/product/hooks/index.js +1 -0
  354. package/product/index.js +4 -11
  355. package/product/providers/index.js +1 -0
  356. package/product/selectors/product.js +13 -2
  357. package/product/selectors/variants.js +2 -2
  358. package/product/streams/index.js +1 -0
  359. package/push-opt-in/action-creators/index.js +1 -0
  360. package/push-opt-in/action-creators/optInTrigger.js +23 -0
  361. package/push-opt-in/action-creators/pushOptIn.js +7 -0
  362. package/push-opt-in/actions/index.js +1 -0
  363. package/push-opt-in/actions/pushOptInModal.js +8 -0
  364. package/push-opt-in/components/PushOptInModal/connector.js +9 -0
  365. package/push-opt-in/components/PushOptInModal/index.js +10 -0
  366. package/push-opt-in/components/PushOptInModal/push-opt-in.svg +62 -0
  367. package/push-opt-in/components/PushOptInModal/style.js +1 -0
  368. package/push-opt-in/components/index.js +1 -0
  369. package/push-opt-in/constants/index.js +1 -0
  370. package/push-opt-in/constants/optInModal.js +1 -0
  371. package/push-opt-in/constants/optInTrigger.js +1 -0
  372. package/push-opt-in/reducers/index.js +1 -0
  373. package/push-opt-in/reducers/optInModal.js +6 -0
  374. package/push-opt-in/reducers/optInTrigger.js +6 -0
  375. package/push-opt-in/selectors/index.js +1 -0
  376. package/push-opt-in/selectors/optInModal.js +8 -0
  377. package/push-opt-in/selectors/optInTrigger.js +5 -0
  378. package/push-opt-in/subscriptions/index.js +1 -0
  379. package/push-opt-in/subscriptions/optInTrigger.js +14 -0
  380. package/registration/providers/GuestRegistrationProvider.actions.js +2 -2
  381. package/registration/providers/GuestRegistrationProvider.js +3 -3
  382. package/registration/providers/RegistrationProvider.actions.js +3 -3
  383. package/registration/providers/RegistrationProvider.js +2 -2
  384. package/registration/subscriptions/index.js +1 -1
  385. package/reviews/actions/index.js +1 -0
  386. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +1 -1
  387. package/reviews/components/Reviews/components/List/index.js +3 -3
  388. package/reviews/components/Reviews/components/List/spec.js +1 -1
  389. package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
  390. package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
  391. package/reviews/components/Reviews/spec.js +1 -1
  392. package/reviews/components/index.js +1 -0
  393. package/reviews/constants/index.js +1 -0
  394. package/reviews/index.js +1 -7
  395. package/reviews/selectors/index.js +1 -0
  396. package/reviews/streams/index.js +1 -0
  397. package/scanner/action-creators/index.js +1 -0
  398. package/scanner/actions/index.js +1 -0
  399. package/scanner/classes/index.js +1 -0
  400. package/scanner/constants/index.js +1 -0
  401. package/scanner/helpers/index.js +1 -0
  402. package/scanner/index.js +1 -6
  403. package/scanner/streams/index.js +1 -0
  404. package/search/actions/index.js +1 -0
  405. package/search/constants/index.js +1 -0
  406. package/search/helpers/index.js +1 -0
  407. package/search/index.js +1 -6
  408. package/search/selectors/index.js +1 -0
  409. package/search/streams/index.js +1 -0
  410. package/styles/helpers/index.js +1 -0
  411. package/styles/helpers/initCSSCustomProperties.js +3 -3
  412. package/styles/helpers/setPageContentWidth.js +2 -1
  413. package/styles/index.js +1 -1
  414. package/tracking/components/CookieConsent/CookieConsentContent.js +1 -1
  415. package/tracking/constants/index.js +2 -1
  416. package/components/MessageBar/MessageBar.types.js +0 -0
  417. package/components/MessageBar/style.js +0 -1
  418. package/product/components/Availability/Availability.types.js +0 -1
  419. /package/page/{NotFound.js → components/NotFound.js} +0 -0
@@ -1,4 +1,4 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{Component}from'react';import PropTypes from'prop-types';import'intersection-observer';var thresholds=[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0];/**
1
+ var _IntersectionVisibility;function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{Component}from'react';import PropTypes from'prop-types';import'intersection-observer';/**
2
2
  * The IntersectionVisibility component.
3
3
  * @example
4
4
  * <IntersectionVisibility>
@@ -6,12 +6,19 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
6
6
  <Video autoPlay={visible && ratio > 0.8} ref={setRef} />}
7
7
  )}
8
8
  * </IntersectionVisibility>
9
- */var IntersectionVisibility=/*#__PURE__*/function(_Component){_inherits(IntersectionVisibility,_Component);function IntersectionVisibility(){var _getPrototypeOf2;var _this;_classCallCheck(this,IntersectionVisibility);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(IntersectionVisibility)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"state",{visible:true,ratio:1});_defineProperty(_assertThisInitialized(_this),"setRef",function(ref){if(!ref){return;}_this.node=ref;if(_this.io){_this.io.observe(_this.node);}});_defineProperty(_assertThisInitialized(_this),"handleIntersectionEvent",function(_ref){var _ref2=_slicedToArray(_ref,1),intersectionRatio=_ref2[0].intersectionRatio;_this.setState({visible:intersectionRatio>0,ratio:intersectionRatio});});return _this;}_createClass(IntersectionVisibility,[{key:"componentDidMount",/**
9
+ */var IntersectionVisibility=/*#__PURE__*/function(_Component){function IntersectionVisibility(){var _this2;_classCallCheck(this,IntersectionVisibility);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,IntersectionVisibility,[].concat(args));_defineProperty(_this2,"state",{visible:true,ratio:1,entries:null});/**
10
+ * @param {Object} ref ref
11
+ */_defineProperty(_this2,"setRef",function(ref){if(!ref){return;}_this2.node=ref;if(_this2.io){_this2.io.observe(_this2.node);}});/**
12
+ * @param {IntersectionObserverEntry[]} entries first entry
13
+ */_defineProperty(_this2,"handleIntersectionEvent",function(entries){var _entries=_slicedToArray(entries,1),intersectionRatio=_entries[0].intersectionRatio;_this2.setState({visible:intersectionRatio>0,ratio:intersectionRatio,entries:entries});});return _this2;}_inherits(IntersectionVisibility,_Component);return _createClass(IntersectionVisibility,[{key:"componentDidMount",value:/**
10
14
  * Start the observer when the component is mounted
11
- */value:function componentDidMount(){this.io=new IntersectionObserver(this.handleIntersectionEvent,{threshold:this.props.thresholds});if(this.node){this.io.observe(this.node);}}/**
15
+ */function componentDidMount(){this.io=new IntersectionObserver(this.handleIntersectionEvent,{threshold:this.props.thresholds});if(this.node){this.io.observe(this.node);}}/**
12
16
  * @inheritDoc
13
- */},{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.io){this.io.disconnect();}}/**
14
- * @param {Object} ref ref
15
- */},{key:"render",/**
17
+ */},{key:"componentWillUnmount",value:function componentWillUnmount(){if(this.io){this.io.disconnect();}}},{key:"render",value:/**
16
18
  * @returns {JSX.Element}
17
- */value:function render(){return this.props.children(_extends({},this.state,{setRef:this.setRef}));}}]);return IntersectionVisibility;}(Component);_defineProperty(IntersectionVisibility,"defaultProps",{thresholds:thresholds});export default IntersectionVisibility;
19
+ */function render(){return this.props.children(_extends({},this.state,{setRef:this.setRef}));}}]);}(Component);_IntersectionVisibility=IntersectionVisibility;/**
20
+ * Calculate threshold by number of steps
21
+ * Ex: 5 steps will be [0.20, 0.40, 0.60, 0.80, 1.00]
22
+ * @param {number} steps .
23
+ * @returns {number[]}
24
+ */_defineProperty(IntersectionVisibility,"buildThresholdList",function(steps){return Array(steps).fill(0).map(function(v,i){return(i+1)/steps;});});_defineProperty(IntersectionVisibility,"defaultProps",{thresholds:_IntersectionVisibility.buildThresholdList(10)});export default IntersectionVisibility;
@@ -0,0 +1,4 @@
1
+ import{connect}from'react-redux';import{hasWebBridge,makeGetShopSettingByKey,SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP,SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB}from'@shopgate/engage/core';/**
2
+ * Creates the mapStateToProps connector function.
3
+ * @returns {Function}
4
+ */var makeMapStateToProps=function makeMapStateToProps(){var getShowShopLogoInApp=makeGetShopSettingByKey(SHOP_SETTING_SHOW_SHOP_LOGO_IN_APP);var getShowShopLogoInWeb=makeGetShopSettingByKey(SHOP_SETTING_SHOW_SHOP_LOGO_IN_WEB);return function(state){return{showLogo:hasWebBridge()?getShowShopLogoInWeb(state):getShowShopLogoInApp(state)};};};export default connect(makeMapStateToProps);
@@ -0,0 +1,4 @@
1
+ import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import noop from'lodash/noop';import styles from"./style";import connect from"./connector";/**
2
+ * The Logo component.
3
+ * @return {JSX}
4
+ */var Logo=function Logo(_ref){var className=_ref.className,onClick=_ref.onClick,showLogo=_ref.showLogo;if(!showLogo){return null;}return(/* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-static-element-interactions */React.createElement("div",{onClick:onClick,className:classNames(styles.container,className,'engage__logo')},React.createElement("img",{className:styles.image,src:appConfig.logo||appConfig.logoFallback,alt:appConfig.shopName}))/* eslint-enable jsx-a11y/no-static-element-interactions */ /* eslint-enable jsx-a11y/click-events-have-key-events */);};Logo.defaultProps={className:'',onClick:noop,showLogo:true};export default connect(Logo);
@@ -0,0 +1 @@
1
+ import React from'react';import{shallow}from'enzyme';import Logo from"./index";jest.mock("./connector",function(){return function(Component){return Component;};});describe('<Logo />',function(){it('should render an image',function(){var wrapper=shallow(React.createElement(Logo,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find('img').exists()).toBe(true);});});
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;var container=css({alignItems:'center',display:'flex',flexGrow:1});var image=css({margin:'0 auto',maxHeight:variables.navigator.height,maxWidth:"calc(var(--page-content-width) - ".concat(variables.navigator.height*3+variables.gap.xbig,"px)"),overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'});export default{container:container,image:image};
@@ -1,11 +1,11 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import clamp from'lodash/clamp';import styles from"./style";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import clamp from'lodash/clamp';import styles from"./style";/**
2
2
  * The Context Menu Position component.
3
- */var Position=/*#__PURE__*/function(_Component){_inherits(Position,_Component);/**
3
+ */var Position=/*#__PURE__*/function(_Component){/**
4
4
  * The Constructor.
5
5
  * @param {Object} props The component props.
6
- */function Position(props){var _this;_classCallCheck(this,Position);_this=_possibleConstructorReturn(this,_getPrototypeOf(Position).call(this,props));_this.elementRef=null;return _this;}/**
6
+ */function Position(props){var _this2;_classCallCheck(this,Position);_this2=_callSuper(this,Position,[props]);_this2.elementRef=null;return _this2;}/**
7
7
  * Calculate and apply the correct menu position after mounting.
8
- */_createClass(Position,[{key:"componentDidMount",value:function componentDidMount(){var offset=this.props.offset;// Get ref to the actual child DOM element and calculate bounding rect.
8
+ */_inherits(Position,_Component);return _createClass(Position,[{key:"componentDidMount",value:function componentDidMount(){var offset=this.props.offset;// Get ref to the actual child DOM element and calculate bounding rect.
9
9
  var _this$elementRef$chil=_slicedToArray(this.elementRef.childNodes,1),child=_this$elementRef$chil[0];var bounds=child.getBoundingClientRect();// Get window dimensions
10
10
  var width=window.innerWidth;var height=window.innerHeight;// Get the outer gap from styles
11
11
  var gap=styles.outerGap;// Calculate clamped menu position
@@ -13,4 +13,4 @@ var left=clamp(offset.left,0,width-bounds.width-gap*2);var top=clamp(offset.top-
13
13
  this.elementRef.style.left="".concat(left,"px");this.elementRef.style.top="".concat(top,"px");}/**
14
14
  * Renders the component.
15
15
  * @returns {JSX}
16
- */},{key:"render",value:function render(){var _this2=this;return React.createElement("div",{ref:function ref(_ref){_this2.elementRef=_ref;},className:styles.container},this.props.children);}}]);return Position;}(Component);_defineProperty(Position,"defaultProps",{children:null,offset:{top:0,left:0}});export default Position;
16
+ */},{key:"render",value:function render(){var _this3=this;return React.createElement("div",{ref:function ref(_ref){_this3.elementRef=_ref;},className:styles.container},this.props.children);}}]);}(Component);_defineProperty(Position,"defaultProps",{children:null,offset:{top:0,left:0}});export default Position;
@@ -1,12 +1,12 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component,Children}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import Position from"./components/Position";import Item from"./components/Item";import styles from"./style";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component,Children}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import Backdrop from'@shopgate/pwa-common/components/Backdrop';import Position from"./components/Position";import Item from"./components/Item";import styles from"./style";/**
2
2
  * The Menu component.
3
- */var Menu=/*#__PURE__*/function(_Component){_inherits(Menu,_Component);function Menu(){var _getPrototypeOf2;var _this;_classCallCheck(this,Menu);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(Menu)).call.apply(_getPrototypeOf2,[this].concat(args)));_defineProperty(_assertThisInitialized(_this),"handleMenuToggle",function(e){var _this$props$contextRe;if(e){e.preventDefault();e.stopPropagation();}if((_this$props$contextRe=_this.props.contextRef)===null||_this$props$contextRe===void 0?void 0:_this$props$contextRe.current){_this.props.onClose();}});return _this;}_createClass(Menu,[{key:"render",/**
4
- * Renders the component.
5
- * @returns {JSX}
6
- */value:function render(){var _this$props=this.props,children=_this$props.children,isOpen=_this$props.isOpen,onClose=_this$props.onClose;return React.createElement(Portal,{isOpened:isOpen},React.createElement("div",{className:styles.overlay},React.createElement(Backdrop,{isVisible:true,level:0,opacity:0,onClick:onClose}),React.createElement(Position,{offset:this.offset},React.createElement("div",{className:styles.menu},Children.map(children,function(child){if(!child){return null;}return React.cloneElement(child,{closeMenu:onClose});})))));}},{key:"offset",/**
7
- * Gets the offset of the DOM element.
8
- * @returns {Object}
9
- */get:function get(){var _this$props$contextRe2;if((_this$props$contextRe2=this.props.contextRef)===null||_this$props$contextRe2===void 0?void 0:_this$props$contextRe2.current){var bounds=this.props.contextRef.current.getBoundingClientRect();return{height:bounds.height,width:bounds.width,left:bounds.left,right:bounds.right,bottom:bounds.bottom,top:bounds.top+bounds.height};}return{top:0,left:0};}/**
3
+ */var Menu=/*#__PURE__*/function(_Component){function Menu(){var _this2;_classCallCheck(this,Menu);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this2=_callSuper(this,Menu,[].concat(args));/**
10
4
  * Handles any menu toggling interactions.
11
5
  * @param {Object} [e] Event
12
- */}]);return Menu;}(Component);_defineProperty(Menu,"Item",Item);_defineProperty(Menu,"defaultProps",{children:null,contextRef:null,isOpen:false,onClose:function onClose(){}});export default Menu;
6
+ */_defineProperty(_this2,"handleMenuToggle",function(e){var _this2$props$contextR;if(e){e.preventDefault();e.stopPropagation();}if((_this2$props$contextR=_this2.props.contextRef)===null||_this2$props$contextR===void 0?void 0:_this2$props$contextR.current){_this2.props.onClose();}});return _this2;}_inherits(Menu,_Component);return _createClass(Menu,[{key:"offset",get:/**
7
+ * Gets the offset of the DOM element.
8
+ * @returns {Object}
9
+ */function get(){var _this$props$contextRe;if((_this$props$contextRe=this.props.contextRef)===null||_this$props$contextRe===void 0?void 0:_this$props$contextRe.current){var bounds=this.props.contextRef.current.getBoundingClientRect();return{height:bounds.height,width:bounds.width,left:bounds.left,right:bounds.right,bottom:bounds.bottom,top:bounds.top+bounds.height};}return{top:0,left:0};}},{key:"render",value:/**
10
+ * Renders the component.
11
+ * @returns {JSX}
12
+ */function render(){var _this$props=this.props,children=_this$props.children,isOpen=_this$props.isOpen,onClose=_this$props.onClose;return React.createElement(Portal,{isOpened:isOpen},React.createElement("div",{className:styles.overlay},React.createElement(Backdrop,{isVisible:true,level:0,opacity:0,onClick:onClose}),React.createElement(Position,{offset:this.offset},React.createElement("div",{className:styles.menu},Children.map(children,function(child){if(!child){return null;}return React.cloneElement(child,{closeMenu:onClose});})))));}}]);}(Component);_defineProperty(Menu,"Item",Item);_defineProperty(Menu,"defaultProps",{children:null,contextRef:null,isOpen:false,onClose:function onClose(){}});export default Menu;
@@ -1,4 +1,4 @@
1
- import{hot}from'react-hot-loader/root';import*as React from'react';import classnames from'classnames';import{i18n,errorBehavior}from'@shopgate/engage/core';import StopIcon from'@shopgate/pwa-ui-shared/icons/StopIcon';import InfoIcon from'@shopgate/pwa-ui-shared/icons/InfoIcon';import WarningIcon from'@shopgate/pwa-ui-shared/icons/WarningIcon';import*as styles from"./MessageBar.style";var iconMapping={info:InfoIcon,warning:WarningIcon,error:StopIcon};/**
1
+ import{hot}from'react-hot-loader/root';import*as React from'react';import PropTypes from'prop-types';import classnames from'classnames';import{i18n,errorBehavior}from'@shopgate/engage/core';import StopIcon from'@shopgate/pwa-ui-shared/icons/StopIcon';import InfoIcon from'@shopgate/pwa-ui-shared/icons/InfoIcon';import WarningIcon from'@shopgate/pwa-ui-shared/icons/WarningIcon';import*as styles from"./MessageBar.style";var iconMapping={info:InfoIcon,warning:WarningIcon,error:StopIcon};/**
2
2
  * The MessageBar component.
3
3
  * @param {Object} props The component props.
4
4
  * @property {Array} props.messages The message content.
@@ -1 +1 @@
1
- export{default as MessageBar}from"./MessageBar";// TYPES
1
+ export{default as MessageBar}from"./MessageBar";
@@ -1,9 +1,9 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import{UIEvents}from'@shopgate/pwa-core';import{NAVIGATION_PUSH,NAVIGATION_POP,NAVIGATION_REPLACE,NAVIGATION_RESET}from"../../core/router/helpers";import connect from"./connector";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import{UIEvents}from'@shopgate/pwa-core';import{NAVIGATION_PUSH,NAVIGATION_POP,NAVIGATION_REPLACE,NAVIGATION_RESET}from"../../core/router/helpers";import connect from"./connector";/**
2
2
  * Handles
3
- */var NavigationHandler=/*#__PURE__*/function(_React$PureComponent){_inherits(NavigationHandler,_React$PureComponent);function NavigationHandler(props){var _this;_classCallCheck(this,NavigationHandler);_this=_possibleConstructorReturn(this,_getPrototypeOf(NavigationHandler).call(this,props));UIEvents.addListener(NAVIGATION_PUSH,props.push);UIEvents.addListener(NAVIGATION_POP,props.pop);UIEvents.addListener(NAVIGATION_REPLACE,props.replace);UIEvents.addListener(NAVIGATION_RESET,props.reset);return _this;}/**
3
+ */var NavigationHandler=/*#__PURE__*/function(_React$PureComponent){function NavigationHandler(props){var _this2;_classCallCheck(this,NavigationHandler);_this2=_callSuper(this,NavigationHandler,[props]);UIEvents.addListener(NAVIGATION_PUSH,props.push);UIEvents.addListener(NAVIGATION_POP,props.pop);UIEvents.addListener(NAVIGATION_REPLACE,props.replace);UIEvents.addListener(NAVIGATION_RESET,props.reset);return _this2;}/**
4
4
  * Removes the event listeners.
5
- */_createClass(NavigationHandler,[{key:"componentWillUnmount",value:function componentWillUnmount(){UIEvents.removeListener(NAVIGATION_PUSH,this.props.push);UIEvents.removeListener(NAVIGATION_POP,this.props.pop);UIEvents.removeListener(NAVIGATION_REPLACE,this.props.replace);UIEvents.removeListener(NAVIGATION_RESET,this.props.reset);}/**
5
+ */_inherits(NavigationHandler,_React$PureComponent);return _createClass(NavigationHandler,[{key:"componentWillUnmount",value:function componentWillUnmount(){UIEvents.removeListener(NAVIGATION_PUSH,this.props.push);UIEvents.removeListener(NAVIGATION_POP,this.props.pop);UIEvents.removeListener(NAVIGATION_REPLACE,this.props.replace);UIEvents.removeListener(NAVIGATION_RESET,this.props.reset);}/**
6
6
  * @returns {null}
7
- */},{key:"render",value:function render(){return this.props.children;}}]);return NavigationHandler;}(React.PureComponent);_defineProperty(NavigationHandler,"defaultProps",{pop:function pop(){},push:function push(){},replace:function replace(){},reset:function reset(){}/**
7
+ */},{key:"render",value:function render(){return this.props.children;}}]);}(React.PureComponent);_defineProperty(NavigationHandler,"defaultProps",{pop:function pop(){},push:function push(){},replace:function replace(){},reset:function reset(){}/**
8
8
  * @param {Object} props The component props.
9
9
  */});export default connect(NavigationHandler);
@@ -1 +1 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{Provider}from'react-redux';import{mount}from'enzyme';import{UIEvents}from'@shopgate/pwa-core';import{createMockStore}from'@shopgate/pwa-common/store';import NavigationHandler from"./index";import{NAVIGATION_PUSH,NAVIGATION_POP,NAVIGATION_REPLACE,NAVIGATION_RESET,push,pop,replace,reset}from"../../core/router/helpers";jest.mock('@shopgate/pwa-core',function(){var map={};return{UIEvents:{addListener:jest.fn(function(event,cb){map[event]=cb;}),removeListener:jest.fn(),emit:jest.fn(function(event,params){map[event](params);})}};});describe('<NavigationHandler />',function(){var store=createMockStore();var wrapper=mount(React.createElement(Provider,{store:store},React.createElement(NavigationHandler,null,React.createElement("div",null,"Some content"))));it('should render as expected',function(){expect(wrapper).toMatchSnapshot();});it('should trigger the push() callbacks on navigation.push event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return push({pathname:'/test'});case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_PUSH,{pathname:'/test'});UIEvents.emit.mockClear();case 4:case"end":return _context.stop();}}},_callee);})));it('should trigger the pop() callbacks on navigation.pop event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return pop();case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_POP);UIEvents.emit.mockClear();case 4:case"end":return _context2.stop();}}},_callee2);})));it('should trigger the replace() callbacks on navigation.replace event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.next=2;return replace({pathname:'/test'});case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_REPLACE,{pathname:'/test'});UIEvents.emit.mockClear();case 4:case"end":return _context3.stop();}}},_callee3);})));it('should trigger the reset() callbacks on navigation.reset event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(){return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.next=2;return reset();case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_RESET);UIEvents.emit.mockClear();case 4:case"end":return _context4.stop();}}},_callee4);})));it('should register the navigation event listener',function(){var props=wrapper.find('NavigationHandler').props();expect(UIEvents.addListener.mock.calls.length).toBe(4);expect(UIEvents.addListener.mock.calls[0][0]).toEqual(NAVIGATION_PUSH,props.push);expect(UIEvents.addListener.mock.calls[1][0]).toEqual(NAVIGATION_POP,props.pop);expect(UIEvents.addListener.mock.calls[2][0]).toEqual(NAVIGATION_REPLACE,props.replace);expect(UIEvents.addListener.mock.calls[3][0]).toEqual(NAVIGATION_RESET,props.reset);UIEvents.addListener.mockClear();});it('should unregister the navigation event listener when the component unmounts',function(){var props=wrapper.find('NavigationHandler').props();wrapper.unmount();expect(UIEvents.removeListener.mock.calls.length).toBe(4);expect(UIEvents.removeListener.mock.calls[0][0]).toEqual(NAVIGATION_PUSH,props.push);expect(UIEvents.removeListener.mock.calls[1][0]).toEqual(NAVIGATION_POP,props.pop);expect(UIEvents.removeListener.mock.calls[2][0]).toEqual(NAVIGATION_REPLACE,props.replace);expect(UIEvents.removeListener.mock.calls[3][0]).toEqual(NAVIGATION_RESET,props.reset);UIEvents.removeListener.mockClear();});});
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React from'react';import{Provider}from'react-redux';import{mount}from'enzyme';import{UIEvents}from'@shopgate/pwa-core';import{createMockStore}from'@shopgate/pwa-common/store';import NavigationHandler from"./index";import{NAVIGATION_PUSH,NAVIGATION_POP,NAVIGATION_REPLACE,NAVIGATION_RESET,push,pop,replace,reset}from"../../core/router/helpers";jest.mock('@shopgate/pwa-core',function(){var map={};return{UIEvents:{addListener:jest.fn(function(event,cb){map[event]=cb;}),removeListener:jest.fn(),emit:jest.fn(function(event,params){map[event](params);})}};});describe('<NavigationHandler />',function(){var store=createMockStore();var wrapper=mount(React.createElement(Provider,{store:store},React.createElement(NavigationHandler,null,React.createElement("div",null,"Some content"))));it('should render as expected',function(){expect(wrapper).toMatchSnapshot();});it('should trigger the push() callbacks on navigation.push event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return push({pathname:'/test'});case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_PUSH,{pathname:'/test'});UIEvents.emit.mockClear();case 4:case"end":return _context.stop();}},_callee);})));it('should trigger the pop() callbacks on navigation.pop event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(){return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return pop();case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_POP);UIEvents.emit.mockClear();case 4:case"end":return _context2.stop();}},_callee2);})));it('should trigger the replace() callbacks on navigation.replace event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(){return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return replace({pathname:'/test'});case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_REPLACE,{pathname:'/test'});UIEvents.emit.mockClear();case 4:case"end":return _context3.stop();}},_callee3);})));it('should trigger the reset() callbacks on navigation.reset event',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(){return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return reset();case 2:expect(UIEvents.emit).toBeCalledWith(NAVIGATION_RESET);UIEvents.emit.mockClear();case 4:case"end":return _context4.stop();}},_callee4);})));it('should register the navigation event listener',function(){var props=wrapper.find('NavigationHandler').props();expect(UIEvents.addListener.mock.calls.length).toBe(4);expect(UIEvents.addListener.mock.calls[0][0]).toEqual(NAVIGATION_PUSH,props.push);expect(UIEvents.addListener.mock.calls[1][0]).toEqual(NAVIGATION_POP,props.pop);expect(UIEvents.addListener.mock.calls[2][0]).toEqual(NAVIGATION_REPLACE,props.replace);expect(UIEvents.addListener.mock.calls[3][0]).toEqual(NAVIGATION_RESET,props.reset);UIEvents.addListener.mockClear();});it('should unregister the navigation event listener when the component unmounts',function(){var props=wrapper.find('NavigationHandler').props();wrapper.unmount();expect(UIEvents.removeListener.mock.calls.length).toBe(4);expect(UIEvents.removeListener.mock.calls[0][0]).toEqual(NAVIGATION_PUSH,props.push);expect(UIEvents.removeListener.mock.calls[1][0]).toEqual(NAVIGATION_POP,props.pop);expect(UIEvents.removeListener.mock.calls[2][0]).toEqual(NAVIGATION_REPLACE,props.replace);expect(UIEvents.removeListener.mock.calls[3][0]).toEqual(NAVIGATION_RESET,props.reset);UIEvents.removeListener.mockClear();});});
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
2
2
  * The default button for the Picker component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX} The button component.
5
- */var PickerButton=function PickerButton(_ref){var value=_ref.value,label=_ref.label,openList=_ref.openList;return React.createElement("button",{className:styles.button,onClick:openList,type:"button"},React.createElement("span",{className:styles.label},label),value!==null&&React.createElement("span",{className:styles.value},value));};PickerButton.defaultProps={value:null};export default PickerButton;
5
+ */var PickerButton=function PickerButton(_ref){var value=_ref.value,label=_ref.label,openList=_ref.openList;return React.createElement("button",{className:"".concat(styles.button," engage__picker__button"),onClick:openList,type:"button"},React.createElement("span",{className:styles.label},label),value!==null&&React.createElement("span",{className:styles.value},value));};PickerButton.defaultProps={value:null};export default PickerButton;
@@ -1,5 +1,5 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import styles from"./style";/**
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useMemo}from'react';import PropTypes from'prop-types';import classNames from'classnames';import styles from"./style";/**
2
2
  * The default button for the Picker component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX} The button component.
5
- */var PickerList=function PickerList(props){var items=props.items,onClose=props.onClose,onSelect=props.onSelect,selectedIndex=props.selectedIndex;return React.createElement("ul",null,items.map(function(item,currentIndex){return React.createElement("li",{key:item.value,className:classNames(_defineProperty({},styles.active,currentIndex===selectedIndex))},React.createElement("button",{className:styles.button,disabled:item.disabled,onClick:function onClick(){onSelect(item.value);onClose();},type:"button"},item.label));}));};PickerList.defaultProps={onClose:function onClose(){},selectedIndex:null};export default PickerList;
5
+ */var PickerList=function PickerList(props){var items=props.items,onClose=props.onClose,onSelect=props.onSelect,selectedIndex=props.selectedIndex,query=props.query;var filteredItems=useMemo(function(){if(!query||!query.length){return items;}return items.filter(function(_ref){var _ref$label=_ref.label,label=_ref$label===void 0?'':_ref$label;var searchLabel=label.replaceAll(' ','').toLowerCase();var searchValue=query.replaceAll(' ','').toLowerCase();return searchLabel.includes(searchValue);});},[items,query]);return React.createElement("ul",{className:"engage__picker_list"},filteredItems.map(function(item,currentIndex){return React.createElement("li",{key:item.value,className:classNames(_defineProperty({},styles.active,currentIndex===selectedIndex))},React.createElement("button",{className:styles.button,disabled:item.disabled,onClick:function onClick(){onSelect(item.value);onClose();},type:"button"},item.label));}));};PickerList.defaultProps={onClose:function onClose(){},selectedIndex:null,query:''};export default PickerList;
@@ -1,14 +1,14 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import styles from"./style";/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import styles from"./style";/**
2
2
  * The picker modal.
3
- */var PickerModal=/*#__PURE__*/function(_Component){_inherits(PickerModal,_Component);/**
3
+ */var PickerModal=/*#__PURE__*/function(_Component){/**
4
4
  * The constructor.
5
5
  * @param {Object} props The props.
6
- */function PickerModal(props){var _this;_classCallCheck(this,PickerModal);_this=_possibleConstructorReturn(this,_getPrototypeOf(PickerModal).call(this,props));_defineProperty(_assertThisInitialized(_this),"closeModal",function(){_this.setState({active:false});clearTimeout(_this.timeout);_this.timeout=setTimeout(_this.props.onClose,styles.duration);});_this.timeout=null;_this.state={active:true};return _this;}/**
6
+ */function PickerModal(props){var _this2;_classCallCheck(this,PickerModal);_this2=_callSuper(this,PickerModal,[props]);/**
7
+ * Closes the modal after the closing animations have finished.
8
+ */_defineProperty(_this2,"closeModal",function(){_this2.setState({active:false});clearTimeout(_this2.timeout);_this2.timeout=setTimeout(_this2.props.onClose,styles.duration);});_this2.timeout=null;_this2.state={active:true};return _this2;}/**
7
9
  * Update state when isOpen changes.
8
10
  * @param {Object} nextProps The next component props.
9
- */_createClass(PickerModal,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isOpen!==nextProps.isOpen){this.setState({active:nextProps.isOpen});}}/**
10
- * Closes the modal after the closing animations have finished.
11
- */},{key:"render",/**
11
+ */_inherits(PickerModal,_Component);return _createClass(PickerModal,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){if(this.props.isOpen!==nextProps.isOpen){this.setState({active:nextProps.isOpen});}}},{key:"render",value:/**
12
12
  * Render all the things!
13
13
  * @returns {JSX} The picker modal with the picker list inside.
14
- */value:function render(){var backgroundClassName=classNames(styles.background.base,_defineProperty({},styles.background.inactive,!this.state.active));var containerClassName=classNames(styles.container.base,_defineProperty({},styles.container.inactive,!this.state.active));if(!this.props.isOpen){return null;}return React.createElement("div",{className:styles.wrapper},React.createElement("div",{"aria-hidden":true,className:backgroundClassName,onClick:this.closeModal}),React.createElement("div",{className:containerClassName},React.cloneElement(this.props.children,{onClose:this.closeModal})));}}]);return PickerModal;}(Component);export default PickerModal;
14
+ */function render(){var backgroundClassName=classNames(styles.background.base,_defineProperty({},styles.background.inactive,!this.state.active));var containerClassName=classNames(styles.container.base,_defineProperty({},styles.container.inactive,!this.state.active));if(!this.props.isOpen){return null;}return React.createElement("div",{className:"".concat(styles.wrapper," engage__picker_modal")},React.createElement("div",{"aria-hidden":true,className:backgroundClassName,onClick:this.closeModal}),React.createElement("div",{className:containerClassName},React.cloneElement(this.props.children,{onClose:this.closeModal})));}}]);}(Component);export default PickerModal;
@@ -1,4 +1,4 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}import React,{Component}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import{withForwardedRef}from"../../core";import PickerModal from"./components/Modal";import PickerButton from"./components/Button";import PickerList from"./components/List";/**
1
+ function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}import React,{Component}from'react';import PropTypes from'prop-types';import Portal from'react-portal';import{withForwardedRef}from"../../core";import PickerModal from"./components/Modal";import PickerButton from"./components/Button";import PickerList from"./components/List";/**
2
2
  * Converts an item of any type (e.g. string or number)
3
3
  * to an object representation containing value and label properties.
4
4
  * @param {*} item - An item of any type.
@@ -10,19 +10,28 @@ function _classCallCheck(instance,Constructor){if(!(instance instanceof Construc
10
10
  * @returns {number} The found item index or undefined.
11
11
  */var findItemIndexByValue=function findItemIndexByValue(items,value){return items.map(normalizeItem).findIndex(function(item){return item.value===value;});};/**
12
12
  * The picker component (acts like a selectbox).
13
- */var Picker=/*#__PURE__*/function(_Component){_inherits(Picker,_Component);/**
13
+ */var Picker=/*#__PURE__*/function(_Component){/**
14
14
  * The constructor.
15
15
  * @param {Object} props - The component props.
16
- */function Picker(props){var _this;_classCallCheck(this,Picker);_this=_possibleConstructorReturn(this,_getPrototypeOf(Picker).call(this,props));_defineProperty(_assertThisInitialized(_this),"triggerChangeCallback",function(nextValue){var nextSelectedIndex=findItemIndexByValue(_this.props.items,nextValue);if(nextSelectedIndex>-1&&_this.state.selectedIndex!==nextSelectedIndex){_this.props.onChange(nextValue);}_this.props.onSelect(nextValue);});_defineProperty(_assertThisInitialized(_this),"triggerCloseCallback",function(nextOpenState){if(_this.state.isOpen&&!nextOpenState){_this.props.onClose();}});_defineProperty(_assertThisInitialized(_this),"handleItemSelect",function(value){_this.triggerChangeCallback(value);_this.setState({selectedIndex:findItemIndexByValue(_this.props.items,value)});});_defineProperty(_assertThisInitialized(_this),"toggleOpenState",function(open){_this.setState(function(_ref){var isOpen=_ref.isOpen;var nextIsOpen=typeof open==='boolean'?open:!isOpen;_this.triggerCloseCallback(nextIsOpen);return{isOpen:nextIsOpen};});});_this.state={selectedIndex:findItemIndexByValue(props.items,props.value),isOpen:props.isOpen};return _this;}/**
16
+ */function Picker(props){var _this2;_classCallCheck(this,Picker);_this2=_callSuper(this,Picker,[props]);/**
17
+ * Triggers the onChange callback if the selected value has changed.
18
+ * @param {Object} nextValue - The value the user picked.
19
+ */_defineProperty(_this2,"triggerChangeCallback",function(nextValue){var nextSelectedIndex=findItemIndexByValue(_this2.props.items,nextValue);if(nextSelectedIndex>-1&&_this2.state.selectedIndex!==nextSelectedIndex){_this2.props.onChange(nextValue);}_this2.props.onSelect(nextValue);});/**
20
+ * Triggers the onChange callback if the selected value has changed.
21
+ * @param {Object} nextOpenState - The value the user picked.
22
+ */_defineProperty(_this2,"triggerCloseCallback",function(nextOpenState){if(_this2.state.isOpen&&!nextOpenState){_this2.props.onClose();}});/**
23
+ * Gets called when a new item is selected
24
+ * @param {string} value - The selected value.
25
+ */_defineProperty(_this2,"handleItemSelect",function(value){_this2.triggerChangeCallback(value);_this2.setState({selectedIndex:findItemIndexByValue(_this2.props.items,value)});});/**
26
+ * Sets or toggles the open state of the component.
27
+ * @param {boolean} [open] New open state.
28
+ */_defineProperty(_this2,"toggleOpenState",function(open){_this2.setState(function(_ref){var isOpen=_ref.isOpen;var nextIsOpen=typeof open==='boolean'?open:!isOpen;_this2.triggerCloseCallback(nextIsOpen);return{isOpen:nextIsOpen};});});_this2.state={selectedIndex:findItemIndexByValue(props.items,props.value),isOpen:props.isOpen};return _this2;}/**
17
29
  * Updates the selected item when the value prop changes.
18
30
  * @param {Object} nextProps - The next props.
19
- */_createClass(Picker,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Only update if a value is present and also changed.
31
+ */_inherits(Picker,_Component);return _createClass(Picker,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Only update if a value is present and also changed.
20
32
  if(!this.selectedItem||nextProps.value!==this.selectedItem.value){this.setState({selectedIndex:findItemIndexByValue(nextProps.items,nextProps.value)});}if(this.props.isOpen!==nextProps.isOpen&&nextProps.isOpen!==this.state.isOpen){this.setState({isOpen:nextProps.isOpen});}}/**
21
33
  * Getter for the selected item.
22
- */},{key:"render",/**
34
+ */},{key:"selectedItem",get:function get(){return normalizeItem(this.props.items[this.state.selectedIndex]);}},{key:"render",value:/**
23
35
  * Renders the component.
24
36
  * @returns {JSX}
25
- */value:function render(){var _this2=this;var hasSelection=!!this.selectedItem;var buttonValue=hasSelection?this.selectedItem.label:'';var buttonLabel=hasSelection?this.props.label:this.props.placeholder;var buttonProps=_extends({},this.props.buttonProps,{label:buttonLabel,value:buttonValue,disabled:this.props.disabled,openList:this.props.disabled?null:function(){_this2.toggleOpenState(true);}});var modalProps={isOpen:this.state.isOpen,duration:this.props.duration,onClose:function onClose(){return _this2.toggleOpenState(false);}};var listProps={items:this.props.items.map(normalizeItem),selectedIndex:this.state.selectedIndex,onSelect:this.handleItemSelect};return React.createElement("div",{role:"button",className:this.props.className,ref:this.props.forwardedRef,tabIndex:0,"aria-haspopup":true},React.createElement(this.props.buttonComponent,buttonProps),React.createElement(Portal,{onClose:function onClose(){return _this2.toggleOpenState(false);},isOpened:true},React.createElement(this.props.modalComponent,modalProps,React.createElement(this.props.listComponent,listProps))));}},{key:"selectedItem",get:function get(){return normalizeItem(this.props.items[this.state.selectedIndex]);}/**
26
- * Triggers the onChange callback if the selected value has changed.
27
- * @param {Object} nextValue - The value the user picked.
28
- */}]);return Picker;}(Component);_defineProperty(Picker,"defaultProps",{buttonComponent:PickerButton,buttonProps:{},duration:300,disabled:false,forwardedRef:null,label:'',listComponent:PickerList,modalComponent:PickerModal,className:'',isOpen:false,items:[],onChange:function onChange(){},onClose:function onClose(){},onSelect:function onSelect(){},placeholder:'Pick ...',value:null});export default withForwardedRef(Picker);
37
+ */function render(){var _this3=this;var hasSelection=!!this.selectedItem;var buttonValue=hasSelection?this.selectedItem.label:'';var buttonLabel=hasSelection?this.props.label:this.props.placeholder;var buttonProps=_extends({},this.props.buttonProps,{label:buttonLabel,value:buttonValue,disabled:this.props.disabled,openList:this.props.disabled?null:function(){_this3.toggleOpenState(true);}});var modalProps={isOpen:this.state.isOpen,duration:this.props.duration,onClose:function onClose(){return _this3.toggleOpenState(false);}};var listProps={items:this.props.items.map(normalizeItem),selectedIndex:this.state.selectedIndex,onSelect:this.handleItemSelect};return React.createElement("div",{role:"button",className:"".concat(this.props.className," engage__picker"),ref:this.props.forwardedRef,tabIndex:0,"aria-haspopup":true},React.createElement(this.props.buttonComponent,buttonProps),React.createElement(Portal,{onClose:function onClose(){return _this3.toggleOpenState(false);},isOpened:true},React.createElement(this.props.modalComponent,modalProps,React.createElement(this.props.listComponent,listProps))));}}]);}(Component);_defineProperty(Picker,"defaultProps",{buttonComponent:PickerButton,buttonProps:{},duration:300,disabled:false,forwardedRef:null,label:'',listComponent:PickerList,modalComponent:PickerModal,className:'',isOpen:false,items:[],onChange:function onChange(){},onClose:function onClose(){},onSelect:function onSelect(){},placeholder:'Pick ...',value:null});export default withForwardedRef(Picker);
@@ -0,0 +1,5 @@
1
+ import React from'react';import PropTypes from'prop-types';import styles from"./style";/**
2
+ * The Picker Button component.
3
+ * @param {Object} props The component props.
4
+ * @return {JSX}
5
+ */var Button=function Button(_ref){var disabled=_ref.disabled,label=_ref.label,openList=_ref.openList,value=_ref.value;return React.createElement("button",{className:"".concat(disabled?styles.buttonDisabled:styles.button),onClick:openList,type:"button"},React.createElement("span",{className:styles.label},label),value&&React.createElement("span",{className:styles.value},value));};Button.defaultProps={disabled:false,openList:function openList(){}};export default Button;
@@ -0,0 +1 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var buttonDefaults={display:'block',width:'100%',padding:"".concat(variables.gap.small,"px ").concat(variables.gap.big,"px"),fontFamily:'inherit',textAlign:'left',lineHeight:1.2,outline:'none',background:colors.shade8};var button=css(_extends({},buttonDefaults)).toString();var buttonDisabled=css(_extends({},buttonDefaults,{color:colors.shade4})).toString();var label=css({display:'block',fontWeight:500,':not(:only-child)':{fontWeight:400,fontSize:'0.75rem',marginBottom:4}}).toString();var value=css({display:'block',fontWeight:500}).toString();export default{button:button,buttonDisabled:buttonDisabled,label:label,value:value};
@@ -0,0 +1,17 @@
1
+ var _excluded=["hasButton","sheetProps"];function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import{SheetList,Picker as BasePicker,Sheet}from'@shopgate/engage/components';import{ViewContext}from'@shopgate/engage/components/View';import Button from"./components/Button";import styles from"./style";/**
2
+ * The template version of the Picker component.
3
+ * @param {Object} props The same component props as in the base Picker component.
4
+ */var PickerUtilize=/*#__PURE__*/function(_Component){/**
5
+ * Constructor
6
+ * @param {Object} props Props of the component
7
+ */function PickerUtilize(props){var _this2;_classCallCheck(this,PickerUtilize);_this2=_callSuper(this,PickerUtilize,[props]);/**
8
+ * Focuses the picker button for screen readers.
9
+ */_defineProperty(_this2,"onDidOpen",function(){_this2.props.setViewAriaHidden(true);if(_this2.firstSelectableItemRef.current){_this2.firstSelectableItemRef.current.focus();}});/**
10
+ * Focuses the first selectable item for screen readers.
11
+ */_defineProperty(_this2,"onClose",function(){_this2.props.setViewAriaHidden(false);if(_this2.pickerRef.current){_this2.pickerRef.current.focus();}});_this2.modalComponent=function(sheetProps){return React.createElement(Sheet,_extends({},_extends({},_this2.props.sheetProps,{},sheetProps),{title:_this2.props.label,onDidOpen:_this2.onDidOpen}));};_this2.pickerRef=React.createRef();_this2.firstSelectableItemRef=React.createRef();_this2.listComponent=function(prps){return React.createElement(SheetList,null,prps.items.map(function(item,index){return React.createElement(SheetList.Item,{key:item.value,title:item.label,onClick:function onClick(){setTimeout(function(){prps.onSelect(item.value);prps.onClose();},_this2.props.clickDelay);},isDisabled:item.disabled,isSelected:index===prps.selectedIndex,rightComponent:item.rightComponent,testId:item.label,ref:index===prps.selectedIndex?_this2.firstSelectableItemRef:null});}));};return _this2;}_inherits(PickerUtilize,_Component);return _createClass(PickerUtilize,[{key:"render",value:/**
12
+ * Render
13
+ * @returns {JSX}
14
+ */function render(){var _this$props=this.props,hasButton=_this$props.hasButton,ignore=_this$props.sheetProps,restProps=_objectWithoutProperties(_this$props,_excluded);return React.createElement(BasePicker,_extends({},restProps,{className:"".concat(hasButton?styles:''," engage__picker-utilize"),modalComponent:this.modalComponent,buttonProps:this.props.buttonProps,buttonComponent:this.props.buttonComponent||Button,listComponent:this.listComponent,onClose:this.onClose,ref:this.pickerRef}));}}]);}(Component);_defineProperty(PickerUtilize,"defaultProps",{buttonComponent:null,buttonProps:{},/**
15
+ * Time in ms that delays picker interaction in order
16
+ * to let animations complete first.
17
+ */clickDelay:150,hasButton:true,sheetProps:{}});export default(function(props){return React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return React.createElement(PickerUtilize,_extends({},props,{setViewAriaHidden:setAriaHidden}));});});
@@ -0,0 +1 @@
1
+ import React from'react';import{mount}from'enzyme';import Picker from"./index";jest.mock('@shopgate/engage/components/View');describe('<Picker />',function(){it('should render the picker',function(){var label='Picker label';var wrapper=mount(React.createElement(Picker,{label:label}));expect(wrapper).toMatchSnapshot();});});
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export default css({display:'flex',marginBottom:variables.gap.small,minHeight:56}).toString();
@@ -1,7 +1,7 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React,{useRef,useState,useCallback,useLayoutEffect,useEffect,forwardRef}from'react';import PropTypes from'prop-types';import{isIOs}from'@shopgate/pwa-core';import{parseFloatString,formatFloat}from"./helper";/**
1
+ var _excluded=["className","onChange","onFocus","onBlur","value","maxDecimals","unit","minValue","maxValue"];function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}import React,{useRef,useState,useCallback,useLayoutEffect,useEffect,forwardRef}from'react';import PropTypes from'prop-types';import{isIOs}from'@shopgate/pwa-core';import{parseFloatString,formatFloat}from"./helper";/**
2
2
  * A Quantity Input with unit support.
3
3
  * @returns {JSX}
4
- */var QuantityInput=forwardRef(function(_ref,outerInputRef){var className=_ref.className,onChange=_ref.onChange,customOnFocus=_ref.onFocus,customOnBlur=_ref.onBlur,value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,minValue=_ref.minValue,maxValue=_ref.maxValue,inputProps=_objectWithoutProperties(_ref,["className","onChange","onFocus","onBlur","value","maxDecimals","unit","minValue","maxValue"]);var inputRef=outerInputRef||useRef();var _useState=useState(formatFloat(value,maxDecimals)),_useState2=_slicedToArray(_useState,2),inputValue=_useState2[0],setInputValue=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isFocused=_useState4[0],setIsFocused=_useState4[1];var onFocus=useCallback(function(event){customOnFocus(event);setIsFocused(true);},[customOnFocus]);var onBlur=useCallback(function(event){var newValue=parseFloatString(inputValue,maxDecimals);setIsFocused(false);// If invalid switch to old value.
4
+ */var QuantityInput=forwardRef(function(_ref,outerInputRef){var className=_ref.className,onChange=_ref.onChange,customOnFocus=_ref.onFocus,customOnBlur=_ref.onBlur,value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,minValue=_ref.minValue,maxValue=_ref.maxValue,inputProps=_objectWithoutProperties(_ref,_excluded);var inputRef=outerInputRef||useRef();var _useState=useState(formatFloat(value,maxDecimals)),_useState2=_slicedToArray(_useState,2),inputValue=_useState2[0],setInputValue=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),isFocused=_useState4[0],setIsFocused=_useState4[1];var onFocus=useCallback(function(event){customOnFocus(event);setIsFocused(true);},[customOnFocus]);var onBlur=useCallback(function(event){var newValue=parseFloatString(inputValue,maxDecimals);setIsFocused(false);// If invalid switch to old value.
5
5
  if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}if(newValue!==value){onChange(newValue);}customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;if(newValue!==''){if(minValue&&newValue<minValue){newValue="".concat(minValue);}if(maxValue&&newValue>maxValue){newValue="".concat(maxValue);}}setInputValue(newValue);},[maxValue,minValue]);// Select the current input value after focus.
6
6
  useLayoutEffect(function(){if(isFocused&&isIOs){inputRef.current.select();}},[inputRef,isFocused]);// Sync actual float value with displayed content.
7
7
  useEffect(function(){setInputValue(formatFloat(value,maxDecimals));},[maxDecimals,value]);// Stop the context menu from opening.
@@ -2,4 +2,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
2
2
  * The Radio component
3
3
  * @param {Object} props The component props
4
4
  * @returns {JSX}
5
- */var Radio=function Radio(_ref){var _classNames;var classes=_ref.classes,nameProp=_ref.name,onChangeProp=_ref.onChange,checkedProp=_ref.checked,disabledProp=_ref.disabled,valueProp=_ref.value,attributes=_ref.attributes;var radioGroup=useRadioGroup();var name=nameProp;var checked=checkedProp;var onChange=onChangeProp;if(radioGroup){if(checked===null){checked=radioGroup.value===valueProp;}if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.onChange!=='undefined'){onChange=radioGroup.onChange;}}return React.createElement("span",{className:classNames(styles.root,classes.root)},React.createElement(Ripple,{className:styles.ripple,color:"var(--color-primary)"},React.createElement("input",_extends({className:styles.input,type:"radio",name:name,value:valueProp,checked:checked,onChange:onChange,disabled:disabledProp,id:"".concat(name,"_").concat(valueProp)},attributes)),React.createElement("div",{className:classNames(styles.radioContainer,(_classNames={},_defineProperty(_classNames,styles.radioDisabled,disabledProp),_defineProperty(_classNames,classes.disabled,disabledProp),_classNames))},checked&&React.createElement(CheckedIcon,{className:classNames(styles.radio,styles.radioChecked,classes.radioChecked,'checkedIcon')}),!checked&&React.createElement(UncheckedIcon,{className:classNames(styles.radio,classes.radioUnchecked,'uncheckedIcon')}))));};Radio.defaultProps={classes:{},checked:null,disabled:false,onChange:null,name:null,value:null,attributes:null};export default hot(Radio);
5
+ */var Radio=function Radio(_ref){var classes=_ref.classes,nameProp=_ref.name,onChangeProp=_ref.onChange,checkedProp=_ref.checked,disabledProp=_ref.disabled,valueProp=_ref.value,attributes=_ref.attributes;var radioGroup=useRadioGroup();var name=nameProp;var checked=checkedProp;var onChange=onChangeProp;if(radioGroup){if(checked===null){checked=radioGroup.value===valueProp;}if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.onChange!=='undefined'){onChange=radioGroup.onChange;}}return React.createElement("span",{className:classNames(styles.root,classes.root)},React.createElement(Ripple,{className:styles.ripple,color:"var(--color-primary)"},React.createElement("input",_extends({className:styles.input,type:"radio",name:name,value:valueProp,checked:checked,onChange:onChange,disabled:disabledProp,id:"".concat(name,"_").concat(valueProp)},attributes)),React.createElement("div",{className:classNames(styles.radioContainer,_defineProperty(_defineProperty({},styles.radioDisabled,disabledProp),classes.disabled,disabledProp))},checked&&React.createElement(CheckedIcon,{className:classNames(styles.radio,styles.radioChecked,classes.radioChecked,'checkedIcon')}),!checked&&React.createElement(UncheckedIcon,{className:classNames(styles.radio,classes.radioUnchecked,'uncheckedIcon')}))));};Radio.defaultProps={classes:{},checked:null,disabled:false,onChange:null,name:null,value:null,attributes:null};export default hot(Radio);
@@ -6,4 +6,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
6
6
  * The RadioCard component
7
7
  * @param {Object} props The component props
8
8
  * @returns {JSX}
9
- */var RadioCard=function RadioCard(_ref2){var _classNames;var children=_ref2.children,nameProp=_ref2.name,onChange=_ref2.onChange,checked=_ref2.checked,disabledProp=_ref2.disabled,value=_ref2.value,attributes=_ref2.attributes,classes=_ref2.classes,RenderCard=_ref2.renderCard;var radioGroup=useRadioGroup();var name=nameProp;var disabled=disabledProp;if(radioGroup){if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.disabled!=='undefined'){disabled=radioGroup.disabled;}}return React.createElement(RenderCard,{className:classes.root},React.createElement(Radio,{name:name,value:value,onChange:onChange,disabled:disabled,checked:checked,attributes:attributes,classes:{root:styles.radio}}),React.createElement("label",{htmlFor:"".concat(name,"_").concat(value),className:classNames(styles.content,(_classNames={},_defineProperty(_classNames,styles.contentDisabled,disabled),_defineProperty(_classNames,classes.disabled,disabled),_classNames))},children));};RadioCard.defaultProps={children:null,checked:null,classes:{},disabled:false,onChange:null,name:null,value:null,attributes:null,renderCard:CardComponent};export default hot(RadioCard);
9
+ */var RadioCard=function RadioCard(_ref2){var children=_ref2.children,nameProp=_ref2.name,onChange=_ref2.onChange,checked=_ref2.checked,disabledProp=_ref2.disabled,value=_ref2.value,attributes=_ref2.attributes,classes=_ref2.classes,RenderCard=_ref2.renderCard;var radioGroup=useRadioGroup();var name=nameProp;var disabled=disabledProp;if(radioGroup){if(typeof radioGroup.name!=='undefined'){name=radioGroup.name;}if(typeof radioGroup.disabled!=='undefined'){disabled=radioGroup.disabled;}}return React.createElement(RenderCard,{className:classes.root},React.createElement(Radio,{name:name,value:value,onChange:onChange,disabled:disabled,checked:checked,attributes:attributes,classes:{root:styles.radio}}),React.createElement("label",{htmlFor:"".concat(name,"_").concat(value),className:classNames(styles.content,_defineProperty(_defineProperty({},styles.contentDisabled,disabled),classes.disabled,disabled))},children));};RadioCard.defaultProps={children:null,checked:null,classes:{},disabled:false,onChange:null,name:null,value:null,attributes:null,renderCard:CardComponent};export default hot(RadioCard);
@@ -6,4 +6,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
6
6
  * @param {Function} props.onTouchStart The touch start event callback.
7
7
  * @param {Object} props.classNames (Optional) An additional style classes for the handle.
8
8
  * @returns {JSX}
9
- */var RangeSliderHandle=function RangeSliderHandle(props){var active=props.active,index=props.index,onTouchStart=props.onTouchStart,classNames=props.classNames,useMouseEvents=props.useMouseEvents;var style={zIndex:Number(active)||0};var eventHandler=_defineProperty({},useMouseEvents?'onMouseDown':'onTouchStart',function(event){return onTouchStart(event,index);});return React.createElement("div",_extends({className:cxs(classNames.handleOuter,styles),style:style},eventHandler),React.createElement("div",{className:classNames.handleInner}));};RangeSliderHandle.defaultProps={active:false,classNames:{handleOuter:null,handleInner:null}};export default RangeSliderHandle;
9
+ */var RangeSliderHandle=function RangeSliderHandle(props){var active=props.active,index=props.index,onTouchStart=props.onTouchStart,classNames=props.classNames,useMouseEvents=props.useMouseEvents;var style={zIndex:Number(active)||0};var eventHandler=_defineProperty({},useMouseEvents?'onMouseDown':'onTouchStart',function(event){return onTouchStart(event,index);});return React.createElement("div",_extends({className:cxs(classNames.handleOuter,styles,'engage__range-slider__handle'),style:style},eventHandler),React.createElement("div",{className:classNames.handleInner}));};RangeSliderHandle.defaultProps={active:false,classNames:{handleOuter:null,handleInner:null}};export default RangeSliderHandle;