@shopgate/engage 7.27.3-alpha.17 → 7.27.3-alpha.19

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 (1300) hide show
  1. package/a11y/action-creators/index.js +9 -0
  2. package/a11y/components/FocusTrap/index.js +1 -0
  3. package/a11y/components/LiveMessage/index.js +1 -1
  4. package/a11y/components/LiveMessenger/helpers.js +1 -1
  5. package/a11y/components/LiveMessenger/index.js +2 -2
  6. package/a11y/components/ModalStateTracker/index.js +14 -0
  7. package/a11y/components/Navigation/index.js +1 -1
  8. package/a11y/components/Section/index.js +3 -3
  9. package/a11y/components/VisuallyHidden/index.js +1 -1
  10. package/a11y/components/index.js +1 -1
  11. package/a11y/constants/index.js +1 -0
  12. package/a11y/helpers/index.js +1 -0
  13. package/a11y/hooks/index.js +37 -0
  14. package/a11y/index.js +1 -4
  15. package/a11y/reducers/index.js +6 -0
  16. package/a11y/selectors/index.js +8 -0
  17. package/a11y/styles.js +2 -0
  18. package/account/actions/addContacts.js +4 -0
  19. package/account/actions/deleteContact.js +5 -0
  20. package/account/actions/deleteCustomer.js +4 -0
  21. package/account/actions/fetchContacts.js +4 -0
  22. package/account/actions/fetchCustomer.js +4 -0
  23. package/account/actions/updateContact.js +4 -0
  24. package/account/actions/updateCustomer.js +4 -0
  25. package/account/components/Account/Account.connector.js +5 -0
  26. package/account/components/Account/Account.js +4 -0
  27. package/account/components/Account/Account.style.js +1 -0
  28. package/account/components/Account/index.js +1 -0
  29. package/account/components/Profile/Profile.config.js +11 -0
  30. package/account/components/Profile/Profile.constraints.js +1 -0
  31. package/account/components/Profile/Profile.js +1 -0
  32. package/account/components/Profile/Profile.provider.js +22 -0
  33. package/account/components/Profile/ProfileAddressBook.js +6 -0
  34. package/account/components/Profile/ProfileAddressCard.js +3 -0
  35. package/account/components/Profile/ProfileForm.js +3 -0
  36. package/account/components/Profile/ProfileHeader.js +3 -0
  37. package/account/components/Profile/index.js +1 -0
  38. package/account/components/ProfileContact/ProfileContact.config.js +11 -0
  39. package/account/components/ProfileContact/ProfileContact.constraints.js +5 -0
  40. package/account/components/ProfileContact/ProfileContact.js +13 -0
  41. package/account/components/ProfileContact/index.js +1 -0
  42. package/account/components/index.js +1 -0
  43. package/account/constants/actions.js +1 -0
  44. package/account/constants/index.js +1 -1
  45. package/account/constants/pipelines.js +1 -0
  46. package/account/helper/form.js +61 -0
  47. package/account/index.js +1 -1
  48. package/account/reducers/index.js +6 -0
  49. package/account/selectors/contacts.js +7 -0
  50. package/account/selectors/customer.js +7 -0
  51. package/app-rating/actions/showModal.js +3 -3
  52. package/app-rating/helpers/index.js +1 -1
  53. package/app-rating/subscriptions/index.js +11 -6
  54. package/back-in-stock/actions/index.js +1 -1
  55. package/back-in-stock/components/BackInStockButton/index.js +3 -3
  56. package/back-in-stock/components/CharacteristicsButton/index.js +1 -1
  57. package/back-in-stock/components/ProductInfoBackInStockButton/index.js +1 -1
  58. package/back-in-stock/components/Subscriptions/components/List/index.js +2 -2
  59. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -2
  60. package/back-in-stock/components/Subscriptions/index.js +1 -1
  61. package/back-in-stock/providers/BackInStockSubscriptionsProvider.context.js +1 -1
  62. package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +1 -1
  63. package/back-in-stock/selectors/index.js +5 -3
  64. package/back-in-stock/streams/index.js +1 -1
  65. package/back-in-stock/subscriptions/index.js +2 -2
  66. package/cart/cart.constants.js +1 -0
  67. package/cart/cart.context.js +1 -0
  68. package/cart/cart.helpers.js +15 -0
  69. package/cart/cart.hooks.js +4 -0
  70. package/cart/cart.selectors.js +34 -0
  71. package/cart/cart.types.js +1 -0
  72. package/cart/components/CartHeaderWide/CartHeaderWide.js +3 -0
  73. package/cart/components/CartHeaderWide/CartHeaderWide.style.js +1 -0
  74. package/cart/components/CartHeaderWide/index.js +1 -0
  75. package/cart/components/CartItem/CartItem.hooks.js +7 -0
  76. package/cart/components/CartItem/CartItem.js +7 -0
  77. package/cart/components/CartItem/CartItem.style.js +1 -0
  78. package/cart/components/CartItem/CartItemCoupon.connector.js +7 -0
  79. package/cart/components/CartItem/CartItemCoupon.js +20 -0
  80. package/cart/components/CartItem/CartItemCoupon.style.js +5 -0
  81. package/cart/components/CartItem/CartItemCoupon.types.js +0 -0
  82. package/cart/components/CartItem/CartItemCouponCode.js +5 -0
  83. package/cart/components/CartItem/CartItemCouponDelete.js +5 -0
  84. package/cart/components/CartItem/CartItemCouponDelete.style.js +1 -0
  85. package/cart/components/CartItem/CartItemCouponFreeShipping.js +5 -0
  86. package/cart/components/CartItem/CartItemCouponIcon.js +4 -0
  87. package/cart/components/CartItem/CartItemCouponLayout.js +6 -0
  88. package/cart/components/CartItem/CartItemCouponLayout.style.js +5 -0
  89. package/cart/components/CartItem/CartItemCouponPrice.js +5 -0
  90. package/cart/components/CartItem/CartItemCouponPrice.style.js +1 -0
  91. package/cart/components/CartItem/CartItemCouponTitle.js +5 -0
  92. package/cart/components/CartItem/CartItemCouponTitle.style.js +1 -0
  93. package/cart/components/CartItem/CartItemProduct.js +5 -0
  94. package/cart/components/CartItem/CartItemProduct.style.js +1 -0
  95. package/cart/components/CartItem/CartItemProductLayout.js +6 -0
  96. package/cart/components/CartItem/CartItemProductLayout.style.js +1 -0
  97. package/cart/components/CartItem/CartItemProductLayoutWide.js +4 -0
  98. package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -0
  99. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.js +4 -0
  100. package/cart/components/CartItem/CartItemProductLayoutWideFulfillmentLabel.style.js +1 -0
  101. package/cart/components/CartItem/CartItemProductLayoutWideOrderDetails.js +3 -0
  102. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +4 -0
  103. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.style.js +1 -0
  104. package/cart/components/CartItem/CartItemProductOrderDetails.js +3 -0
  105. package/cart/components/CartItem/CartItemProductOrderDetails.style.js +1 -0
  106. package/cart/components/CartItem/CartItemProductPriceCaption.js +4 -0
  107. package/cart/components/CartItem/CartItemProductPriceCaption.style.js +1 -0
  108. package/cart/components/CartItem/CartItemProductPriceList.js +5 -0
  109. package/cart/components/CartItem/CartItemProductPriceListPromotion.js +10 -0
  110. package/cart/components/CartItem/CartItemProductProvider.connector.js +9 -0
  111. package/cart/components/CartItem/CartItemProductProvider.context.js +1 -0
  112. package/cart/components/CartItem/CartItemProductProvider.js +12 -0
  113. package/cart/components/CartItem/CartItemProductProvider.types.js +1 -0
  114. package/cart/components/CartItem/CartItemProductProviderLegacy.js +22 -0
  115. package/cart/components/CartItem/CartItemProductTitle.js +7 -0
  116. package/cart/components/CartItem/CartItemProductTitle.style.js +1 -0
  117. package/cart/components/CartItem/CartItemProvider.connector.js +3 -0
  118. package/cart/components/CartItem/CartItemProvider.context.js +1 -0
  119. package/cart/components/CartItem/CartItemProvider.js +5 -0
  120. package/cart/components/CartItem/CartItemQuantityPicker.js +38 -0
  121. package/cart/components/CartItem/CartItemQuantityPicker.style.js +1 -0
  122. package/cart/components/CartItem/CartItemSubstitution.connector.js +5 -0
  123. package/cart/components/CartItem/CartItemSubstitution.js +5 -0
  124. package/cart/components/CartItem/CartItemSubstitution.style.js +1 -0
  125. package/cart/components/CartItem/index.js +1 -0
  126. package/cart/components/CartItems/CartItem.connector.js +4 -0
  127. package/cart/components/CartItems/CartItemCard.js +5 -0
  128. package/cart/components/CartItems/CartItemCard.style.js +1 -0
  129. package/cart/components/CartItems/CartItemCardReservation.js +5 -0
  130. package/cart/components/CartItems/CartItemCardReservationAccordion.js +4 -0
  131. package/cart/components/CartItems/CartItemCardReservationLabel.js +5 -0
  132. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +3 -0
  133. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.style.js +1 -0
  134. package/cart/components/CartItems/CartItemGroup.js +5 -0
  135. package/cart/components/CartItems/CartItemGroup.style.js +1 -0
  136. package/cart/components/CartItems/CartItemGroupReservation.js +5 -0
  137. package/cart/components/CartItems/CartItemGroupReservationLabel.js +5 -0
  138. package/cart/components/CartItems/CartItemGroupShipping.js +4 -0
  139. package/cart/components/CartItems/CartItems.js +5 -0
  140. package/cart/components/CartItems/CartItems.style.js +1 -0
  141. package/cart/components/CartItems/CartItemsHeaderWide.connector.js +3 -0
  142. package/cart/components/CartItems/CartItemsHeaderWide.js +3 -0
  143. package/cart/components/CartItems/CartItemsHeaderWide.style.js +1 -0
  144. package/cart/components/CartItems/CartItemsSubscription.connector.js +5 -0
  145. package/cart/components/CartItems/CartItemsSubstitution.js +5 -0
  146. package/cart/components/CartItems/index.js +1 -0
  147. package/cart/components/CartSummaryWide/CartSummaryWide.connector.js +4 -0
  148. package/cart/components/CartSummaryWide/CartSummaryWide.js +4 -0
  149. package/cart/components/CartSummaryWide/CartSummaryWide.style.js +1 -0
  150. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.connector.js +5 -0
  151. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +4 -0
  152. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -0
  153. package/cart/components/CartSummaryWide/CartSummaryWideFooter.js +3 -0
  154. package/cart/components/CartSummaryWide/index.js +1 -0
  155. package/cart/components/PaymentBar/PaymentBar.js +5 -0
  156. package/cart/components/PaymentBar/PaymentBarAppliedPromotions.connector.js +5 -0
  157. package/cart/components/PaymentBar/PaymentBarAppliedPromotions.js +3 -0
  158. package/cart/components/PaymentBar/PaymentBarCheckoutButton.connector.js +5 -0
  159. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +5 -0
  160. package/cart/components/PaymentBar/PaymentBarCheckoutButton.style.js +1 -0
  161. package/cart/components/PaymentBar/PaymentBarContent.js +4 -0
  162. package/cart/components/PaymentBar/PaymentBarContent.style.js +1 -0
  163. package/cart/components/PaymentBar/PaymentBarDiscounts.connector.js +5 -0
  164. package/cart/components/PaymentBar/PaymentBarDiscounts.js +4 -0
  165. package/cart/components/PaymentBar/PaymentBarGrandTotal.connector.js +5 -0
  166. package/cart/components/PaymentBar/PaymentBarGrandTotal.js +4 -0
  167. package/cart/components/PaymentBar/PaymentBarPromotionCouponMessages.js +4 -0
  168. package/cart/components/PaymentBar/PaymentBarPromotionCoupons.connector.js +8 -0
  169. package/cart/components/PaymentBar/PaymentBarPromotionCoupons.js +3 -0
  170. package/cart/components/PaymentBar/PaymentBarPromotionalText.js +4 -0
  171. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +1 -0
  172. package/cart/components/PaymentBar/PaymentBarReserveButton.js +7 -0
  173. package/cart/components/PaymentBar/PaymentBarShippingCost.connector.js +5 -0
  174. package/cart/components/PaymentBar/PaymentBarShippingCost.js +3 -0
  175. package/cart/components/PaymentBar/PaymentBarSubTotal.connector.js +5 -0
  176. package/cart/components/PaymentBar/PaymentBarSubTotal.js +3 -0
  177. package/cart/components/PaymentBar/PaymentBarTax.connector.js +5 -0
  178. package/cart/components/PaymentBar/PaymentBarTax.js +4 -0
  179. package/cart/components/PaymentBar/index.js +1 -0
  180. package/cart/components/Substitution/connector.js +5 -0
  181. package/cart/components/Substitution/index.js +9 -0
  182. package/cart/components/Substitution/style.js +1 -0
  183. package/cart/components/SupplementalContent/SupplementalContent.connector.js +4 -0
  184. package/cart/components/SupplementalContent/SupplementalContent.js +5 -0
  185. package/cart/components/SupplementalContent/SupplementalContent.styles.js +1 -0
  186. package/cart/components/SupplementalContent/index.js +1 -0
  187. package/cart/index.js +10 -5
  188. package/cart/streams/index.js +1 -0
  189. package/category/actions/index.js +1 -0
  190. package/category/components/CategoryImage/connector.js +5 -0
  191. package/category/components/CategoryImage/index.js +5 -0
  192. package/category/components/CategoryList/index.js +2 -2
  193. package/category/components/CategoryList/style.js +1 -1
  194. package/category/components/index.js +1 -0
  195. package/category/constants/index.js +1 -0
  196. package/category/helpers/index.js +1 -0
  197. package/category/index.js +1 -7
  198. package/category/selectors/index.js +2 -0
  199. package/category/streams/index.js +1 -0
  200. package/checkout/action-creators/addCheckoutCampaign.js +5 -0
  201. package/checkout/action-creators/clearCheckoutCampaign.js +5 -0
  202. package/checkout/action-creators/clearCheckoutOrder.js +4 -0
  203. package/checkout/action-creators/index.js +1 -0
  204. package/checkout/action-creators/validationErrorsCheckout.js +5 -0
  205. package/checkout/actions/errorCheckout.js +17 -0
  206. package/checkout/actions/fetchCheckoutOrder.js +4 -0
  207. package/checkout/actions/fetchPaymentMethods.js +4 -0
  208. package/checkout/actions/index.js +1 -0
  209. package/checkout/actions/initializeCheckout.js +4 -0
  210. package/checkout/actions/prepareCheckout.js +8 -0
  211. package/checkout/actions/submitCheckoutOrder.js +5 -0
  212. package/checkout/actions/updateCheckoutOrder.js +5 -0
  213. package/checkout/components/AddressBook/AddressBook.js +5 -0
  214. package/checkout/components/AddressBook/AddressList.js +9 -0
  215. package/checkout/components/AddressBook/index.js +1 -0
  216. package/checkout/components/AddressBookContact/AddressBookContact.js +5 -0
  217. package/checkout/components/AddressBookContact/index.js +1 -0
  218. package/checkout/components/Checkout/Checkout.js +4 -0
  219. package/checkout/components/Checkout/CheckoutActions.js +4 -0
  220. package/checkout/components/Checkout/CheckoutAddress.js +6 -0
  221. package/checkout/components/Checkout/CheckoutHeader.js +4 -0
  222. package/checkout/components/Checkout/CheckoutPickupContactForm.config.js +8 -0
  223. package/checkout/components/Checkout/CheckoutPickupContactForm.js +4 -0
  224. package/checkout/components/Checkout/CheckoutSection.js +4 -0
  225. package/checkout/components/Checkout/CheckoutSectionInfo.js +4 -0
  226. package/checkout/components/Checkout/CheckoutSectionMessages.js +4 -0
  227. package/checkout/components/Checkout/CheckoutSummary.js +4 -0
  228. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.connector.js +3 -0
  229. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +7 -0
  230. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationBilledTo.js +4 -0
  231. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationOrderContact.js +4 -0
  232. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationOrderSummary.js +4 -0
  233. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationPickUpContact.js +4 -0
  234. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationPickupNotes.js +4 -0
  235. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationSection.js +4 -0
  236. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationShippedTo.js +4 -0
  237. package/checkout/components/CheckoutConfirmation/index.js +1 -0
  238. package/checkout/components/GuestCheckout/GuestCheckout.js +4 -0
  239. package/checkout/components/GuestCheckout/GuestCheckoutOptIn.config.js +4 -0
  240. package/checkout/components/GuestCheckout/GuestCheckoutOptIn.js +3 -0
  241. package/checkout/components/GuestCheckout/GuestCheckoutPickup.js +4 -0
  242. package/checkout/components/GuestCheckout/GuestCheckoutPickupNotes.config.js +4 -0
  243. package/checkout/components/GuestCheckout/GuestCheckoutPickupNotes.js +4 -0
  244. package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +5 -0
  245. package/checkout/components/PaymentMethodButton/index.js +1 -0
  246. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +4 -0
  247. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.style.js +1 -0
  248. package/checkout/components/ResponsiveBackButton/index.js +1 -0
  249. package/checkout/components/ShippingMethods/ShippingMethod.js +5 -0
  250. package/checkout/components/ShippingMethods/ShippingMethods.js +23 -0
  251. package/checkout/components/ShippingMethods/connector.js +7 -0
  252. package/checkout/components/ShippingMethods/index.js +1 -0
  253. package/checkout/components/SupplementalContent/SupplementalContent.connector.js +4 -0
  254. package/checkout/components/SupplementalContent/SupplementalContent.js +5 -0
  255. package/checkout/components/SupplementalContent/SupplementalContent.styles.js +1 -0
  256. package/checkout/components/SupplementalContent/index.js +1 -0
  257. package/checkout/components/index.js +1 -0
  258. package/checkout/constants/actionTypes.js +1 -0
  259. package/checkout/constants/errorCodes.js +1 -0
  260. package/checkout/constants/index.js +1 -0
  261. package/checkout/constants/routes.js +1 -0
  262. package/checkout/helpers/index.js +34 -0
  263. package/checkout/hooks/common.js +7 -0
  264. package/checkout/index.js +6 -5
  265. package/checkout/paymentMethods/context.js +1 -0
  266. package/checkout/paymentMethods/index.js +28 -0
  267. package/checkout/paymentMethods/paypal/PaypalButton.js +5 -0
  268. package/checkout/paymentMethods/paypal/PaypalButtonApp.js +4 -0
  269. package/checkout/paymentMethods/paypal/PaypalButtonWeb.js +8 -0
  270. package/checkout/paymentMethods/paypal/PaypalPayButton.js +12 -0
  271. package/checkout/paymentMethods/paypal/PaypalProvider.js +6 -0
  272. package/checkout/paymentMethods/paypal/index.js +1 -0
  273. package/checkout/paymentMethods/paypal/paypal_logo.png +0 -0
  274. package/checkout/paymentMethods/paypal/sdk.js +9 -0
  275. package/checkout/paymentMethods/stripe/StripeButton.connector.js +6 -0
  276. package/checkout/paymentMethods/stripe/StripeButton.js +5 -0
  277. package/checkout/paymentMethods/stripe/StripeCreditCard.js +10 -0
  278. package/checkout/paymentMethods/stripe/StripePayButton.js +6 -0
  279. package/checkout/paymentMethods/stripe/StripeProvider.connector.js +6 -0
  280. package/checkout/paymentMethods/stripe/StripeProvider.context.js +1 -0
  281. package/checkout/paymentMethods/stripe/StripeProvider.js +33 -0
  282. package/checkout/paymentMethods/stripe/applepay.svg +84 -0
  283. package/checkout/paymentMethods/stripe/googlepay.png +0 -0
  284. package/checkout/paymentMethods/stripe/index.js +1 -0
  285. package/checkout/paymentMethods/stripe/sdk.js +9 -0
  286. package/checkout/providers/AddressBookProvider.context.js +1 -0
  287. package/checkout/providers/AddressBookProvider.js +11 -0
  288. package/checkout/providers/CheckoutProvider.connector.js +7 -0
  289. package/checkout/providers/CheckoutProvider.constraints.js +1 -0
  290. package/checkout/providers/CheckoutProvider.context.js +1 -0
  291. package/checkout/providers/CheckoutProvider.js +28 -0
  292. package/checkout/reducers/index.js +6 -0
  293. package/checkout/selectors/campaign.js +5 -0
  294. package/checkout/selectors/guestCheckout.js +5 -0
  295. package/checkout/selectors/order.js +59 -0
  296. package/checkout/selectors/payment.js +17 -0
  297. package/checkout/selectors/route.js +4 -0
  298. package/checkout/streams/index.js +1 -0
  299. package/checkout/subscriptions/index.js +3 -0
  300. package/components/BrandingColorBanner/BrandingColorBanner.js +5 -0
  301. package/components/BrandingColorBanner/index.js +1 -0
  302. package/components/ChipLayout/index.js +7 -7
  303. package/components/ChipLayout/spec.js +1 -1
  304. package/components/ChipLayout/style.js +2 -2
  305. package/components/ConditionalWrapper/ConditionalWrapper.js +10 -0
  306. package/components/ConditionalWrapper/index.js +1 -5
  307. package/components/ConnectedReactPortal/index.js +13 -0
  308. package/components/Footer/Footer.js +4 -23
  309. package/components/Footer/Footer.style.js +1 -7
  310. package/components/Footer/constants.js +1 -0
  311. package/components/Footer/helpers.js +75 -0
  312. package/components/Form/Builder/Builder.constants.js +1 -1
  313. package/components/Form/Builder/Builder.js +53 -37
  314. package/components/Form/Builder/ElementCheckbox.js +2 -2
  315. package/components/Form/Builder/ElementMultiSelect.js +6 -0
  316. package/components/Form/Builder/ElementPhoneNumber.js +20 -0
  317. package/components/Form/Builder/ElementRadio.js +2 -2
  318. package/components/Form/Builder/ElementSelect.js +3 -3
  319. package/components/Form/Builder/ElementText.js +4 -4
  320. package/components/Form/Builder/FormHelper.js +5 -0
  321. package/components/Form/Builder/classes/ActionListener.constants.js +2 -2
  322. package/components/Form/Builder/classes/ActionListener.js +72 -15
  323. package/components/Form/Builder/helpers/buildCountryList.js +3 -3
  324. package/components/Form/Builder/helpers/buildFormDefaults.js +1 -1
  325. package/components/Form/Builder/helpers/buildProvinceList.js +1 -1
  326. package/components/Form/Builder/helpers/common.js +6 -0
  327. package/components/Form/Builder/stylePresets.js +1 -0
  328. package/components/Form/Form.js +11 -8
  329. package/components/Form/index.js +1 -1
  330. package/components/IntersectionVisibility/index.js +13 -6
  331. package/components/Logo/connector.js +4 -0
  332. package/components/Logo/index.js +2 -2
  333. package/components/Logo/spec.js +1 -1
  334. package/components/Logo/style.js +1 -1
  335. package/components/Menu/components/Item/index.js +8 -0
  336. package/components/Menu/components/Item/style.js +4 -0
  337. package/components/Menu/components/Position/index.js +16 -0
  338. package/components/Menu/components/Position/style.js +1 -0
  339. package/components/Menu/index.js +12 -0
  340. package/components/Menu/style.js +1 -0
  341. package/components/MessageBar/MessageBar.js +9 -0
  342. package/components/MessageBar/MessageBar.style.js +11 -0
  343. package/components/MessageBar/index.js +1 -7
  344. package/components/NavigationHandler/connector.js +1 -1
  345. package/components/NavigationHandler/index.js +6 -6
  346. package/components/NavigationHandler/spec.js +1 -1
  347. package/components/Picker/components/Button/index.js +1 -1
  348. package/components/Picker/components/List/index.js +2 -2
  349. package/components/Picker/components/Modal/index.js +7 -7
  350. package/components/Picker/index.js +19 -10
  351. package/components/Picker/spec.js +2 -2
  352. package/components/PickerUtilize/components/Button/index.js +1 -1
  353. package/components/PickerUtilize/index.js +8 -6
  354. package/components/PickerUtilize/spec.js +2 -1
  355. package/components/QuantityInput/QuantityInput.js +5 -4
  356. package/components/QuantityLabel/QuantityLabel.js +4 -0
  357. package/components/QuantityLabel/index.js +1 -0
  358. package/components/Radio/Radio.js +5 -0
  359. package/components/Radio/index.js +1 -0
  360. package/components/RadioCard/RadioCard.js +9 -0
  361. package/components/RadioCard/index.js +1 -0
  362. package/components/RadioGroup/RadioGroup.context.js +1 -0
  363. package/components/RadioGroup/RadioGroup.js +4 -0
  364. package/components/RadioGroup/index.js +1 -0
  365. package/components/RadioGroup/useRadioGroup.js +4 -0
  366. package/components/RangeSlider/components/Handle/index.js +2 -2
  367. package/components/RangeSlider/components/Handle/style.js +1 -1
  368. package/components/RangeSlider/helper.js +3 -3
  369. package/components/RangeSlider/index.js +35 -23
  370. package/components/RangeSlider/spec.js +4 -4
  371. package/components/ResponsiveContainer/ResponsiveContainer.js +6 -0
  372. package/components/ResponsiveContainer/breakpoints.js +14 -0
  373. package/components/ResponsiveContainer/condition.js +6 -0
  374. package/components/ResponsiveContainer/hooks.js +20 -0
  375. package/components/ResponsiveContainer/index.js +1 -0
  376. package/components/ResponsiveContainer/listener.js +10 -0
  377. package/components/ResponsiveContainer/mediaQuery.js +8 -0
  378. package/components/ScrollHeader/index.js +22 -5
  379. package/components/ScrollHeader/style.js +1 -1
  380. package/components/SheetDrawer/index.js +4 -3
  381. package/components/SheetList/components/Item/index.js +5 -5
  382. package/components/SheetList/components/Item/spec.js +2 -2
  383. package/components/SheetList/components/Item/style.js +1 -1
  384. package/components/SheetList/index.js +4 -4
  385. package/components/SheetList/spec.js +1 -1
  386. package/components/SheetList/style.js +1 -1
  387. package/components/SideNavigation/SideNavigation.hooks.js +4 -0
  388. package/components/SideNavigation/SideNavigation.js +4 -0
  389. package/components/SideNavigation/SideNavigationCategories.connector.js +8 -0
  390. package/components/SideNavigation/SideNavigationCategories.js +4 -0
  391. package/components/SideNavigation/SideNavigationCategories.style.js +1 -0
  392. package/components/SideNavigation/SideNavigationCategoriesItem.connector.js +8 -0
  393. package/components/SideNavigation/SideNavigationCategoriesItem.js +5 -0
  394. package/components/SideNavigation/SideNavigationCategoriesItem.style.js +2 -0
  395. package/components/SideNavigation/SideNavigationCategoriesItemChildren.js +5 -0
  396. package/components/SideNavigation/SideNavigationContent.js +3 -0
  397. package/components/SideNavigation/SideNavigationContent.style.js +4 -0
  398. package/components/SideNavigation/SideNavigationItem.js +4 -0
  399. package/components/SideNavigation/SideNavigationItem.style.js +4 -0
  400. package/components/SideNavigation/SideNavigationLinks.js +4 -0
  401. package/components/SideNavigation/SideNavigationLinksLegal.connector.js +4 -0
  402. package/components/SideNavigation/SideNavigationLinksLegal.js +5 -0
  403. package/components/SideNavigation/SideNavigationLinksQuicklinks.connector.js +4 -0
  404. package/components/SideNavigation/SideNavigationLinksQuicklinks.js +5 -0
  405. package/components/SideNavigation/SideNavigationNestedItem.js +4 -0
  406. package/components/SideNavigation/SideNavigationProvider.connector.js +8 -0
  407. package/components/SideNavigation/SideNavigationProvider.context.js +1 -0
  408. package/components/SideNavigation/SideNavigationProvider.js +4 -0
  409. package/components/SideNavigation/index.js +1 -0
  410. package/components/SideNavigation/selectors.js +17 -0
  411. package/components/SnackBarContainer/index.js +1 -1
  412. package/components/Switch/index.js +1 -1
  413. package/components/Tabs/TabContext.js +7 -0
  414. package/components/Tabs/components/Tab.js +11 -0
  415. package/components/Tabs/components/Tab.style.js +1 -0
  416. package/components/Tabs/components/TabIndicator.js +5 -0
  417. package/components/Tabs/components/TabIndicator.style.js +1 -0
  418. package/components/Tabs/components/TabPanel.js +5 -0
  419. package/components/Tabs/components/Tabs.js +11 -0
  420. package/components/Tabs/components/Tabs.style.js +2 -0
  421. package/components/Tabs/debounce.js +11 -0
  422. package/components/Tabs/index.js +1 -0
  423. package/components/Tabs/ownerDocument.js +4 -0
  424. package/components/Tabs/ownerWindow.js +4 -0
  425. package/components/Tabs/useEventCallback.js +6 -0
  426. package/components/TextLink/TextLink.js +5 -0
  427. package/components/TextLink/TextLink.style.js +1 -0
  428. package/components/TimeBoundary/index.js +10 -8
  429. package/components/TimeBoundary/spec.js +3 -3
  430. package/components/Toggle/index.js +5 -0
  431. package/components/Toggle/style.js +1 -0
  432. package/components/VideoPlayer/index.js +9 -6
  433. package/components/View/components/Above/index.js +1 -1
  434. package/components/View/components/Below/index.js +1 -1
  435. package/components/View/components/Content/index.js +13 -13
  436. package/components/View/components/Content/style.js +1 -1
  437. package/components/View/context.js +1 -1
  438. package/components/View/index.js +5 -5
  439. package/components/View/provider.js +24 -7
  440. package/components/View/style.js +1 -6
  441. package/components/index.js +4 -4
  442. package/core/action-creators/appPermissions.js +1 -1
  443. package/core/action-creators/index.js +1 -1
  444. package/core/action-creators/merchantSettings.js +5 -0
  445. package/core/action-creators/optIns.js +37 -0
  446. package/core/action-creators/shopSettings.js +9 -0
  447. package/core/actions/getGeolocation.js +2 -2
  448. package/core/actions/grantAppTrackingTransparencyPermission.js +3 -1
  449. package/core/actions/grantGeolocationPermissions.js +6 -2
  450. package/core/actions/grantPermissions.js +16 -4
  451. package/core/actions/grantPushPermissions.js +4 -3
  452. package/core/actions/index.js +2 -2
  453. package/core/actions/requestAppPermission.js +7 -2
  454. package/core/actions/requestAppPermissionStatus.js +7 -2
  455. package/core/actions/updateStatusBarBackground.js +3 -3
  456. package/core/classes/GeolocationRequest.js +8 -4
  457. package/core/classes/GeolocationRequestApp.js +16 -0
  458. package/core/classes/GeolocationRequestBrowser.js +8 -0
  459. package/core/collections/AppInitialization.js +4 -6
  460. package/core/config/ThemeConfigResolver.js +3 -3
  461. package/core/config/config.action-creators.js +12 -0
  462. package/core/config/config.actions.js +3 -0
  463. package/core/config/config.constants.js +1 -0
  464. package/core/config/config.reducers.js +6 -0
  465. package/core/config/config.selectors.js +39 -0
  466. package/core/config/config.streams.js +1 -0
  467. package/core/config/config.subscriptions.js +4 -0
  468. package/core/config/config.types.js +0 -0
  469. package/core/config/index.js +1 -0
  470. package/core/constants/appFeatures.js +1 -1
  471. package/core/constants/deviceTypes.js +1 -0
  472. package/core/constants/geolocationRequest.js +1 -1
  473. package/core/constants/index.js +9 -3
  474. package/core/constants/merchantSettings.js +1 -0
  475. package/core/constants/optIns.js +1 -0
  476. package/core/constants/pipelines.js +1 -0
  477. package/core/constants/shopSettings.js +2 -0
  478. package/core/contexts/AppContext.js +1 -1
  479. package/core/contexts/ThemeResourcesContext.d.ts +69 -0
  480. package/core/contexts/ThemeResourcesContext.js +3 -0
  481. package/core/contexts/index.js +1 -0
  482. package/core/events/index.js +1 -0
  483. package/core/helpers/androidNavigationBar.js +12 -0
  484. package/core/helpers/appFeatures.js +21 -9
  485. package/core/helpers/appPermissions.js +58 -0
  486. package/core/helpers/baseUrl.js +1 -1
  487. package/core/helpers/bridge.js +4 -0
  488. package/core/helpers/deviceType.js +5 -0
  489. package/core/helpers/environment.js +4 -0
  490. package/core/helpers/errorBehavior.js +32 -0
  491. package/core/helpers/featureFlag.js +11 -0
  492. package/core/helpers/getFullImageSource.js +21 -2
  493. package/core/helpers/googleMaps.js +8 -0
  494. package/core/helpers/i18n.js +10 -5
  495. package/core/helpers/index.js +3 -3
  496. package/core/helpers/isIOSTheme.js +4 -0
  497. package/core/helpers/isTouchDevice.js +4 -0
  498. package/core/helpers/nl2br.js +1 -0
  499. package/core/helpers/scrollContainer.js +4 -0
  500. package/core/helpers/string.js +9 -0
  501. package/core/helpers/svgToDataUrl.js +9 -0
  502. package/core/helpers/updateLegacyNavigationBar.js +5 -2
  503. package/core/hocs/index.js +1 -0
  504. package/core/hocs/withApp.js +1 -1
  505. package/core/hocs/withCurrentProduct.js +3 -3
  506. package/core/hocs/withForwardedRef.js +1 -1
  507. package/core/hocs/withNavigation.js +1 -1
  508. package/core/hocs/withRoute.js +1 -1
  509. package/core/hocs/withTheme.js +42 -3
  510. package/core/hocs/withThemeResources.js +19 -0
  511. package/core/hocs/withWidgetSettings.js +1 -1
  512. package/core/hocs/withWidgetStyles.js +1 -1
  513. package/core/hooks/events/index.js +1 -0
  514. package/core/hooks/events/useLongPress.d.ts +68 -0
  515. package/core/hooks/events/useLongPress.js +13 -0
  516. package/core/hooks/events/usePressHandler.js +38 -0
  517. package/core/hooks/events/useScrollDirectionChange.d.ts +74 -0
  518. package/core/hooks/events/useScrollDirectionChange.js +18 -0
  519. package/core/hooks/html/useLoadImage.js +1 -1
  520. package/core/hooks/index.js +1 -0
  521. package/core/hooks/layout/index.js +1 -0
  522. package/core/hooks/layout/useElementSize.d.ts +46 -0
  523. package/core/hooks/layout/useElementSize.js +18 -0
  524. package/core/hooks/useAsyncMemo.js +12 -0
  525. package/core/hooks/useFormState.js +27 -0
  526. package/core/hooks/usePrevious.js +2 -0
  527. package/core/hooks/useScrollTo.js +5 -0
  528. package/core/hooks/useTheme.js +38 -2
  529. package/core/hooks/useThemeResources.js +22 -0
  530. package/core/hooks/useWidgetStyles.js +1 -1
  531. package/core/index.js +5 -11
  532. package/core/initialization/index.js +19 -4
  533. package/core/providers/AppProvider.js +9 -9
  534. package/core/providers/ThemeResourcesProvider.js +19 -0
  535. package/core/providers/index.js +1 -0
  536. package/core/reducers/index.js +1 -1
  537. package/core/reducers/merchantSettings.js +6 -0
  538. package/core/reducers/shopSettings.js +6 -0
  539. package/core/selectors/index.js +1 -1
  540. package/core/selectors/merchantSettings.js +10 -0
  541. package/core/selectors/shopSettings.js +25 -0
  542. package/core/streams/app.js +1 -1
  543. package/core/streams/index.js +1 -1
  544. package/core/streams/optIns.js +13 -0
  545. package/core/subscriptions/app.js +4 -3
  546. package/core/validation/index.js +1 -0
  547. package/core/validation/validation.hooks.js +4 -0
  548. package/core/validation/validation.js +12 -0
  549. package/development/action-creators/index.js +1 -0
  550. package/development/action-creators/settings.js +9 -0
  551. package/development/action-creators/storage.js +6 -0
  552. package/development/components/DevelopmentTools/DevelopmentTools.js +6 -0
  553. package/development/components/DevelopmentTools/Shortcuts.js +4 -0
  554. package/development/components/DevelopmentTools/hooks.js +8 -0
  555. package/development/components/DevelopmentTools/index.js +1 -0
  556. package/development/components/SimulatedInsets/SimulatedInsetBottom.js +7 -0
  557. package/development/components/SimulatedInsets/SimulatedInsetTop.js +12 -0
  558. package/development/components/SimulatedInsets/SimulatedInsets.js +6 -0
  559. package/development/components/SimulatedInsets/index.js +1 -0
  560. package/development/components/index.js +1 -0
  561. package/development/constants/actionTypes.js +1 -0
  562. package/development/constants/index.js +1 -0
  563. package/development/reducers/index.js +1 -0
  564. package/development/reducers/settings.js +10 -0
  565. package/development/reducers/storage.js +9 -0
  566. package/development/selectors/index.js +1 -0
  567. package/development/selectors/settings.js +21 -0
  568. package/development/selectors/storage.js +16 -0
  569. package/development/streams/index.js +1 -0
  570. package/development/streams/insets.js +4 -0
  571. package/development/subscriptions/index.js +6 -0
  572. package/favorites/components/CommentDialog/CommentDialog.js +12 -0
  573. package/favorites/components/CommentDialog/index.js +1 -0
  574. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +8 -0
  575. package/favorites/components/FavoriteButtonWide/index.js +1 -0
  576. package/favorites/components/Item/Item.js +13 -9
  577. package/favorites/components/Item/ItemCharacteristics.js +2 -2
  578. package/favorites/components/Item/ItemNotes.js +7 -0
  579. package/favorites/components/Item/ItemQuantity.js +7 -0
  580. package/favorites/components/ItemFulfillmentMethod/ItemFulfillmentMethod.js +4 -0
  581. package/favorites/components/ItemFulfillmentMethod/index.js +1 -0
  582. package/favorites/components/List/List.js +19 -15
  583. package/favorites/components/List/ListAccordionHeader.js +8 -0
  584. package/favorites/components/List/ListAccordionLabel.js +5 -0
  585. package/favorites/components/List/ListContent.js +8 -0
  586. package/favorites/components/List/ListItemWrapper.js +6 -0
  587. package/favorites/components/List/styles.js +1 -0
  588. package/favorites/components/ListChooser/ListChooser.js +2 -2
  589. package/favorites/components/ListChooser/ListChooserItem.js +4 -5
  590. package/favorites/components/Lists/Lists.js +17 -13
  591. package/favorites/components/Lists/ListsModal.js +3 -4
  592. package/favorites/components/RemoveButton/RemoveButton.js +2 -2
  593. package/favorites/constants/Portals.js +1 -2
  594. package/favorites/constants/index.js +1 -0
  595. package/favorites/index.js +2 -2
  596. package/filter/actions/index.js +1 -0
  597. package/filter/components/FilterItem/index.js +2 -2
  598. package/filter/components/FilterItem/spec.js +1 -1
  599. package/filter/components/FilterPageContent/components/ApplyButton/index.js +7 -0
  600. package/filter/components/FilterPageContent/components/ApplyButton/spec.js +1 -0
  601. package/filter/components/FilterPageContent/components/ApplyButton/style.js +1 -0
  602. package/filter/components/FilterPageContent/components/ResetButton/index.js +7 -0
  603. package/filter/components/FilterPageContent/components/ResetButton/spec.js +1 -0
  604. package/filter/components/FilterPageContent/components/ResetButton/style.js +1 -0
  605. package/filter/components/FilterPageContent/components/Selector/components/Selected/index.js +7 -0
  606. package/filter/components/FilterPageContent/components/Selector/components/Selected/spec.js +1 -0
  607. package/filter/components/FilterPageContent/components/Selector/components/Selected/style.js +1 -0
  608. package/filter/components/FilterPageContent/components/Selector/components/Toggle/index.js +7 -0
  609. package/filter/components/FilterPageContent/components/Selector/components/Toggle/spec.js +1 -0
  610. package/filter/components/FilterPageContent/components/Selector/components/Toggle/style.js +1 -0
  611. package/filter/components/FilterPageContent/components/Selector/components/ValueButton/index.js +7 -0
  612. package/filter/components/FilterPageContent/components/Selector/components/ValueButton/spec.js +1 -0
  613. package/filter/components/FilterPageContent/components/Selector/components/ValueButton/style.js +1 -0
  614. package/filter/components/FilterPageContent/components/Selector/index.js +19 -0
  615. package/filter/components/FilterPageContent/components/Selector/spec.js +1 -0
  616. package/filter/components/FilterPageContent/components/Selector/style.js +1 -0
  617. package/filter/components/FilterPageContent/index.js +6 -0
  618. package/filter/components/FilterPageContentWithProvider/index.js +16 -0
  619. package/filter/components/PriceSlider/components/Label/index.js +3 -3
  620. package/filter/components/PriceSlider/components/Label/spec.js +1 -1
  621. package/filter/components/PriceSlider/index.js +8 -8
  622. package/filter/components/PriceSlider/spec.js +1 -1
  623. package/filter/components/PriceSlider/style.js +1 -1
  624. package/filter/components/index.js +1 -0
  625. package/filter/constants/index.js +1 -0
  626. package/filter/constants/sort.js +11 -0
  627. package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +2 -2
  628. package/filter/helpers/buildInitialFilters.js +2 -2
  629. package/filter/helpers/buildUpdatedFilters.js +2 -2
  630. package/filter/helpers/index.js +1 -0
  631. package/filter/helpers/translateFilterLabel.js +3 -3
  632. package/filter/hocs/index.js +1 -0
  633. package/filter/hocs/withSort.js +16 -0
  634. package/filter/hooks/filterPage.js +5 -0
  635. package/filter/hooks/index.js +4 -0
  636. package/filter/index.js +2 -7
  637. package/filter/providers/FilterPageProvider.context.js +54 -0
  638. package/filter/providers/FilterPageProvider.js +98 -0
  639. package/filter/providers/SortProvider.connector.js +3 -0
  640. package/filter/providers/SortProvider.context.js +1 -0
  641. package/filter/providers/SortProvider.helpers.js +8 -0
  642. package/filter/providers/SortProvider.js +6 -0
  643. package/filter/providers/index.js +1 -0
  644. package/filter/selectors/index.js +17 -0
  645. package/filter/streams/index.js +1 -0
  646. package/i18n/countries.helpers.js +6 -0
  647. package/i18n/countries.hooks.js +6 -0
  648. package/i18n/index.js +1 -0
  649. package/i18n/locale/cs-cz/countries.json +255 -0
  650. package/i18n/locale/de-de/countries.json +255 -0
  651. package/i18n/locale/el-gr/countries.json +255 -0
  652. package/i18n/locale/en-us/countries.json +255 -0
  653. package/i18n/locale/es-es/countries.json +255 -0
  654. package/i18n/locale/fi-fi/countries.json +255 -0
  655. package/i18n/locale/fr-fr/countries.json +255 -0
  656. package/i18n/locale/hu-hu/countries.json +255 -0
  657. package/i18n/locale/it-it/countries.json +255 -0
  658. package/i18n/locale/nl-nl/countries.json +255 -0
  659. package/i18n/locale/pl-pl/countries.json +255 -0
  660. package/i18n/locale/pt-pt/countries.json +255 -0
  661. package/i18n/locale/ro-ro/countries.json +255 -0
  662. package/i18n/locale/sv-se/countries.json +255 -0
  663. package/locations/action-creators/errorInventories.js +7 -0
  664. package/locations/action-creators/errorLocations.js +6 -0
  665. package/locations/action-creators/errorProductInventories.js +7 -0
  666. package/locations/action-creators/errorProductLocations.js +6 -0
  667. package/locations/action-creators/index.js +1 -0
  668. package/locations/action-creators/provideProductAlternativeLocation.js +5 -0
  669. package/locations/action-creators/receiveInventories.js +5 -0
  670. package/locations/action-creators/receiveLocations.js +6 -0
  671. package/locations/action-creators/receiveProductInventories.js +7 -0
  672. package/locations/action-creators/receiveProductLocations.js +7 -0
  673. package/locations/action-creators/requestInventories.js +6 -0
  674. package/locations/action-creators/requestLocations.js +5 -0
  675. package/locations/action-creators/requestProductInventories.js +6 -0
  676. package/locations/action-creators/requestProductLocations.js +5 -0
  677. package/locations/action-creators/selectGlobalLocation.js +5 -0
  678. package/locations/action-creators/selectLocation.js +6 -0
  679. package/locations/action-creators/setStoreFinderSearchRadius.js +5 -0
  680. package/locations/action-creators/setUserGeolocation.js +5 -0
  681. package/locations/action-creators/setUserSearchCountryCode.js +7 -0
  682. package/locations/action-creators/setUserSearchGeolocation.js +8 -0
  683. package/locations/action-creators/setUserSearchPostalCode.js +7 -0
  684. package/locations/action-creators/storeFormInput.js +5 -0
  685. package/locations/action-creators/storeFulfillmentMethod.js +5 -0
  686. package/locations/action-creators/submitReservationError.js +5 -0
  687. package/locations/action-creators/submitReservationRequest.js +5 -0
  688. package/locations/action-creators/submitReservationSuccess.js +5 -0
  689. package/locations/actions/fetchDefaultLocation.js +4 -0
  690. package/locations/actions/fetchFulfillmentSlots.js +6 -0
  691. package/locations/actions/fetchInventories.js +6 -0
  692. package/locations/actions/fetchLocations.js +19 -0
  693. package/locations/actions/fetchProductInventories.js +7 -0
  694. package/locations/actions/fetchProductLocations.js +12 -0
  695. package/locations/actions/index.js +5 -0
  696. package/locations/actions/sendDefaultLocationCode.js +6 -0
  697. package/locations/actions/setUserGeolocation.js +1 -0
  698. package/locations/actions/setUserSearchGeolocation.js +1 -0
  699. package/locations/actions/submitReservation.js +5 -0
  700. package/locations/assets/leaflet.css +765 -0
  701. package/locations/components/Cart/CartChangeFulfillmentMethod.connector.js +4 -0
  702. package/locations/components/Cart/CartChangeFulfillmentMethod.js +8 -0
  703. package/locations/components/Cart/CartChangeFulfillmentMethod.types.js +0 -0
  704. package/locations/components/Cart/CartContextMenuChangeFulfillment.js +6 -0
  705. package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.js +5 -0
  706. package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.style.js +1 -0
  707. package/locations/components/Cart/CartContextMenuItemChangeFulfillment.connector.js +4 -0
  708. package/locations/components/Cart/CartContextMenuItemChangeFulfillment.js +6 -0
  709. package/locations/components/Cart/CartContextMenuItemChangeLocation.js +7 -0
  710. package/locations/components/Cart/CartItemProductChangeLocation.connector.js +5 -0
  711. package/locations/components/Cart/CartItemProductChangeLocation.js +11 -0
  712. package/locations/components/Cart/CartItemProductChangeLocation.types.js +0 -0
  713. package/locations/components/Cart/index.js +1 -0
  714. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +4 -0
  715. package/locations/components/ChangeLocationButton/ChangeLocationButton.style.js +2 -0
  716. package/locations/components/ChangeLocationButton/index.js +1 -0
  717. package/locations/components/FulfillmentPath/FulfillmentPath.js +4 -0
  718. package/locations/components/FulfillmentPath/FulfillmentPath.style.js +2 -0
  719. package/locations/components/FulfillmentPath/FulfillmentPathItem.js +6 -0
  720. package/locations/components/FulfillmentPath/index.js +1 -0
  721. package/locations/components/FulfillmentPathSelector/FulfillmentPathSelector.js +14 -0
  722. package/locations/components/FulfillmentPathSelector/FulfillmentPathSelector.style.js +1 -0
  723. package/locations/components/FulfillmentPathSelector/index.js +1 -0
  724. package/locations/components/FulfillmentSelector/FulfillmentSelector.connector.js +9 -0
  725. package/locations/components/FulfillmentSelector/FulfillmentSelector.context.js +1 -0
  726. package/locations/components/FulfillmentSelector/FulfillmentSelector.hooks.js +3 -0
  727. package/locations/components/FulfillmentSelector/FulfillmentSelector.js +20 -0
  728. package/locations/components/FulfillmentSelector/FulfillmentSelector.style.js +1 -0
  729. package/locations/components/FulfillmentSelector/FulfillmentSelector.types.js +1 -0
  730. package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +10 -0
  731. package/locations/components/FulfillmentSelector/FulfillmentSelectorAlternativeLocation.js +8 -0
  732. package/locations/components/FulfillmentSelector/FulfillmentSelectorBOPIS.js +4 -0
  733. package/locations/components/FulfillmentSelector/FulfillmentSelectorDirectShip.js +5 -0
  734. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.js +4 -0
  735. package/locations/components/FulfillmentSelector/FulfillmentSelectorHeader.style.js +1 -0
  736. package/locations/components/FulfillmentSelector/FulfillmentSelectorImpossibleError.js +4 -0
  737. package/locations/components/FulfillmentSelector/FulfillmentSelectorImpossibleError.style.js +1 -0
  738. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.js +8 -0
  739. package/locations/components/FulfillmentSelector/FulfillmentSelectorItem.style.js +1 -0
  740. package/locations/components/FulfillmentSelector/FulfillmentSelectorLocation.js +4 -0
  741. package/locations/components/FulfillmentSelector/FulfillmentSelectorLocation.style.js +1 -0
  742. package/locations/components/FulfillmentSelector/FulfillmentSelectorLocationMethodNotAvailable.js +3 -0
  743. package/locations/components/FulfillmentSelector/FulfillmentSelectorROPIS.js +4 -0
  744. package/locations/components/FulfillmentSelector/index.js +1 -0
  745. package/locations/components/FulfillmentSheet/FulfillmentSheet.js +6 -0
  746. package/locations/components/FulfillmentSheet/FulfillmentSheet.style.js +1 -0
  747. package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +6 -0
  748. package/locations/components/FulfillmentSheet/index.js +1 -0
  749. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +28 -0
  750. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotProvider.connector.js +8 -0
  751. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotProvider.context.js +1 -0
  752. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotProvider.js +9 -0
  753. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.connector.js +4 -0
  754. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +4 -0
  755. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +3 -0
  756. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.style.js +1 -0
  757. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +3 -0
  758. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.style.js +1 -0
  759. package/locations/components/FulfillmentSlotSwitcher/index.js +1 -0
  760. package/locations/components/FulfillmentSlotSwitcher/time.js +5 -0
  761. package/locations/components/GlobalLocationSelector/GlobalLocationSelector.js +16 -0
  762. package/locations/components/GlobalLocationSelector/index.js +1 -0
  763. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcher.connector.js +8 -0
  764. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcher.js +3 -0
  765. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +3 -0
  766. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.style.js +1 -0
  767. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +3 -0
  768. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.style.js +1 -0
  769. package/locations/components/GlobalLocationSwitcher/index.js +1 -0
  770. package/locations/components/ReservationResponses/ReservationError.js +4 -0
  771. package/locations/components/ReservationResponses/ReservationResponse.style.js +1 -0
  772. package/locations/components/ReservationResponses/ReservationSuccess.js +4 -0
  773. package/locations/components/ReservationResponses/index.js +1 -0
  774. package/locations/components/ReserveForm/ReserveForm.constraints.js +1 -0
  775. package/locations/components/ReserveForm/ReserveForm.js +10 -0
  776. package/locations/components/ReserveForm/ReserveForm.style.js +1 -0
  777. package/locations/components/ReserveForm/ReserveFormPhone.connector.js +3 -0
  778. package/locations/components/ReserveForm/ReserveFormPhone.js +5 -0
  779. package/locations/components/ReserveForm/ReserveFormPhone.types.js +0 -0
  780. package/locations/components/ReserveForm/index.js +1 -0
  781. package/locations/components/StockInfo/StockInfo.defaultSettings.js +1 -0
  782. package/locations/components/StockInfo/StockInfo.js +8 -0
  783. package/locations/components/StockInfo/StockInfoInventory.js +9 -0
  784. package/locations/components/StockInfo/index.js +1 -0
  785. package/locations/components/StockInfoLists/index.js +9 -0
  786. package/locations/components/StoreDetails/components/FindMoreStores.js +4 -0
  787. package/locations/components/StoreDetails/components/GetDirectionsButton.js +7 -0
  788. package/locations/components/StoreDetails/components/StoreDetails.js +5 -0
  789. package/locations/components/StoreDetails/components/StoreFinderMap.js +20 -0
  790. package/locations/components/StoreDetails/components/StoreFinderMap.style.js +1 -0
  791. package/locations/components/StoreDetails/components/StoreLocationMap.js +4 -0
  792. package/locations/components/StoreDetails/components/StoresNearby.js +4 -0
  793. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +9 -0
  794. package/locations/components/StoreDetails/index.js +4 -0
  795. package/locations/components/StoreFinder/Store.context.js +1 -0
  796. package/locations/components/StoreFinder/StoreFinder.js +3 -0
  797. package/locations/components/StoreFinder/StoreFinder.style.js +1 -0
  798. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +4 -0
  799. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +4 -0
  800. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.style.js +1 -0
  801. package/locations/components/StoreFinder/StoreFinderLocation.js +3 -0
  802. package/locations/components/StoreFinder/StoreFinderLocation.style.js +1 -0
  803. package/locations/components/StoreFinder/StoreFinderLocationDetails.js +3 -0
  804. package/locations/components/StoreFinder/StoreFinderLocationDetails.style.js +1 -0
  805. package/locations/components/StoreFinder/StoreFinderLocationHeader.js +3 -0
  806. package/locations/components/StoreFinder/StoreFinderLocationHeader.style.js +1 -0
  807. package/locations/components/StoreFinder/StoreFinderLocationHeaderPhoneNumber.js +4 -0
  808. package/locations/components/StoreFinder/StoreFinderLocations.js +5 -0
  809. package/locations/components/StoreFinder/StoreFinderLocations.style.js +1 -0
  810. package/locations/components/StoreFinder/StoreFinderSearch.js +3 -0
  811. package/locations/components/StoreFinder/StoreFinderSearch.style.js +1 -0
  812. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -0
  813. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +8 -0
  814. package/locations/components/StoreFinder/index.js +1 -0
  815. package/locations/components/StoreList/Store.context.js +1 -0
  816. package/locations/components/StoreList/Store.style.js +1 -0
  817. package/locations/components/StoreList/StoreAddress.js +7 -0
  818. package/locations/components/StoreList/StoreAddressShort.js +7 -0
  819. package/locations/components/StoreList/StoreCard.js +4 -0
  820. package/locations/components/StoreList/StoreDetails.js +4 -0
  821. package/locations/components/StoreList/StoreDetailsLine.js +8 -0
  822. package/locations/components/StoreList/StoreDistance.js +7 -0
  823. package/locations/components/StoreList/StoreHeader.js +4 -0
  824. package/locations/components/StoreList/StoreHoursToday.js +7 -0
  825. package/locations/components/StoreList/StoreList.js +4 -0
  826. package/locations/components/StoreList/StoreListLocations.js +4 -0
  827. package/locations/components/StoreList/StoreListProduct.js +4 -0
  828. package/locations/components/StoreList/StoreListProduct.style.js +1 -0
  829. package/locations/components/StoreList/StoreListProductInfo.js +4 -0
  830. package/locations/components/StoreList/StoreListProductName.js +4 -0
  831. package/locations/components/StoreList/StoreListSearch.connector.js +7 -0
  832. package/locations/components/StoreList/StoreListSearch.js +23 -0
  833. package/locations/components/StoreList/StoreListSearch.style.js +1 -0
  834. package/locations/components/StoreList/StoreListSearchRadius.connector.js +7 -0
  835. package/locations/components/StoreList/StoreListSearchRadius.js +4 -0
  836. package/locations/components/StoreList/StoreListSearchRadius.style.js +1 -0
  837. package/locations/components/StoreList/StoreOpeningHours.js +7 -0
  838. package/locations/components/StoreList/StoreOpeningHoursLine.js +7 -0
  839. package/locations/components/StoreList/StorePhoneNumber.js +6 -0
  840. package/locations/components/StoreList/StoreSelectLocationButton.js +4 -0
  841. package/locations/components/StoreList/index.js +1 -0
  842. package/locations/components/index.js +1 -0
  843. package/locations/constants/ActionTypes.js +10 -0
  844. package/locations/constants/Pipelines.js +1 -0
  845. package/locations/constants/Portals.js +2 -0
  846. package/locations/constants/Stages.js +1 -0
  847. package/locations/constants/index.js +7 -0
  848. package/locations/constants/routes.js +1 -0
  849. package/locations/helpers/createOrder.js +28 -0
  850. package/locations/helpers/formatDistance.js +9 -0
  851. package/locations/helpers/getAvailabilitySettings.js +12 -0
  852. package/locations/helpers/index.js +1 -0
  853. package/locations/helpers/productInventory.js +7 -0
  854. package/locations/helpers/showInventoryInLists.js +7 -0
  855. package/locations/index.js +9 -0
  856. package/locations/locations.context.js +1 -0
  857. package/locations/locations.hooks.js +4 -0
  858. package/locations/locations.streams.js +1 -0
  859. package/locations/locations.types.js +1 -0
  860. package/locations/providers/FulfillmentProvider.connector.js +10 -0
  861. package/locations/providers/FulfillmentProvider.js +49 -0
  862. package/locations/providers/FulfillmentProvider.types.js +1 -0
  863. package/locations/providers/StoreDetailsContext.js +1 -0
  864. package/locations/providers/StoreDetailsProvider.js +4 -0
  865. package/locations/providers/StoreFinder.connector.js +3 -0
  866. package/locations/providers/StoreFinderProvider.js +7 -0
  867. package/locations/providers/index.js +1 -0
  868. package/locations/reducers/index.js +1 -0
  869. package/locations/reducers/storage.js +24 -0
  870. package/locations/reducers/storeFinderSearch.js +6 -0
  871. package/locations/reducers/user.js +5 -0
  872. package/locations/reducers/userFormInput.js +8 -0
  873. package/locations/reducers/userSearch.js +6 -0
  874. package/locations/selectors/index.js +145 -0
  875. package/locations/subscriptions.js +27 -0
  876. package/login/action-creators/index.js +1 -0
  877. package/login/action-creators/resetPassword.js +14 -0
  878. package/login/actions/index.js +1 -0
  879. package/login/actions/resetPassword.js +5 -0
  880. package/login/components/ForgotPassword/ForgotPassword.connector.js +5 -0
  881. package/login/components/ForgotPassword/ForgotPassword.js +5 -0
  882. package/login/components/ForgotPassword/ForgotPassword.style.js +1 -0
  883. package/login/components/ForgotPassword/index.js +1 -0
  884. package/login/constants/actions.js +1 -0
  885. package/login/constants/index.js +1 -0
  886. package/login/constants/pipelines.js +1 -0
  887. package/login/constants/routes.js +1 -0
  888. package/login/index.js +1 -0
  889. package/orders/action-creators/index.js +1 -0
  890. package/orders/action-creators/orderDetails.js +22 -0
  891. package/orders/action-creators/orders.js +21 -0
  892. package/orders/actions/cancelOrder.js +8 -0
  893. package/orders/actions/fetchOrderDetails.js +10 -0
  894. package/orders/actions/fetchOrderHistory.js +7 -0
  895. package/orders/actions/index.js +1 -0
  896. package/orders/components/OrderDetails/OrderDetails.js +4 -0
  897. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +3 -0
  898. package/orders/components/OrderDetails/OrderDetailsAuthenticate.style.js +1 -0
  899. package/orders/components/OrderDetails/OrderDetailsAuthenticateForm.config.js +8 -0
  900. package/orders/components/OrderDetails/OrderDetailsContent.js +3 -0
  901. package/orders/components/OrderDetails/OrderDetailsContent.style.js +1 -0
  902. package/orders/components/OrderDetails/OrderDetailsOrder.js +4 -0
  903. package/orders/components/OrderDetails/OrderDetailsOrder.style.js +1 -0
  904. package/orders/components/OrderDetails/OrderDetailsOrderHeader.js +4 -0
  905. package/orders/components/OrderDetails/OrderDetailsOrderHeader.style.js +1 -0
  906. package/orders/components/OrderDetails/OrderDetailsOrderPickupLocation.connector.js +3 -0
  907. package/orders/components/OrderDetails/OrderDetailsOrderPickupLocation.js +4 -0
  908. package/orders/components/OrderDetails/OrderDetailsOrderPickupLocation.style.js +1 -0
  909. package/orders/components/OrderDetails/index.js +1 -0
  910. package/orders/components/OrderHistory/OrderHistory.js +4 -0
  911. package/orders/components/OrderHistory/OrderHistory.style.js +1 -0
  912. package/orders/components/OrderHistory/OrderHistoryList.js +9 -0
  913. package/orders/components/OrderHistory/OrderHistoryList.style.js +1 -0
  914. package/orders/components/OrderHistory/OrderHistoryLoader.js +4 -0
  915. package/orders/components/OrderHistory/OrderHistoryTable.js +9 -0
  916. package/orders/components/OrderHistory/OrderHistoryTable.style.js +1 -0
  917. package/orders/components/OrderHistory/index.js +1 -0
  918. package/orders/components/index.js +1 -0
  919. package/orders/constants/actionTypes.js +1 -0
  920. package/orders/constants/index.js +1 -0
  921. package/orders/constants/pipelines.js +1 -0
  922. package/orders/constants/routes.js +1 -0
  923. package/orders/constants/status.js +12 -0
  924. package/orders/helpers/index.js +1 -0
  925. package/orders/helpers/orderDetails.js +5 -0
  926. package/orders/helpers/orderStatus.js +15 -0
  927. package/orders/hooks/index.js +7 -0
  928. package/orders/index.js +1 -1
  929. package/orders/providers/OrderDetailsPrivateProvider.connector.js +11 -0
  930. package/orders/providers/OrderDetailsPrivateProvider.js +5 -0
  931. package/orders/providers/OrderDetailsProvider.connector.js +11 -0
  932. package/orders/providers/OrderDetailsProvider.constraints.js +1 -0
  933. package/orders/providers/OrderDetailsProvider.context.js +1 -0
  934. package/orders/providers/OrderDetailsProvider.js +11 -0
  935. package/orders/providers/OrderHistoryProvider.connector.js +9 -0
  936. package/orders/providers/OrderHistoryProvider.context.js +1 -0
  937. package/orders/providers/OrderHistoryProvider.js +4 -0
  938. package/orders/reducers/index.js +1 -0
  939. package/orders/reducers/orders.js +7 -0
  940. package/orders/reducers/ordersById.js +7 -0
  941. package/orders/reducers/ordersByNumber.js +7 -0
  942. package/orders/selectors/index.js +27 -0
  943. package/orders/subscriptions/index.js +4 -0
  944. package/package.json +28 -18
  945. package/page/action-creators/index.js +22 -0
  946. package/page/actions/index.js +1 -0
  947. package/page/components/NotFound.js +3 -0
  948. package/page/components/Widgets/Overlay.js +51 -0
  949. package/page/components/Widgets/Tooltip.js +22 -0
  950. package/page/components/Widgets/Widget.js +15 -0
  951. package/page/components/Widgets/WidgetContext.d.ts +42 -0
  952. package/page/components/Widgets/WidgetContext.js +9 -0
  953. package/page/components/Widgets/WidgetProvider.js +8 -0
  954. package/page/components/Widgets/Widgets.js +11 -0
  955. package/page/components/Widgets/WidgetsPreviewContext.js +9 -0
  956. package/page/components/Widgets/WidgetsPreviewProvider.js +8 -0
  957. package/page/components/Widgets/constants.js +4 -0
  958. package/page/components/Widgets/events.js +23 -0
  959. package/page/components/Widgets/helpers.js +23 -0
  960. package/page/components/Widgets/hooks.js +69 -0
  961. package/page/components/Widgets/index.js +1 -0
  962. package/page/components/Widgets/types.d.ts +127 -0
  963. package/page/components/index.js +1 -0
  964. package/page/constants/actionTypes.js +1 -0
  965. package/page/constants/index.js +5 -1
  966. package/page/hooks/index.d.ts +60 -0
  967. package/page/hooks/index.js +25 -0
  968. package/page/index.js +1 -4
  969. package/page/reducers/index.js +6 -0
  970. package/page/selectors/index.js +53 -0
  971. package/page/subscriptions/index.js +4 -0
  972. package/page/widgets/HTML/HTML.js +5 -0
  973. package/page/widgets/HTML/hooks.js +12 -0
  974. package/page/widgets/HTML/index.js +1 -0
  975. package/page/widgets/Placeholder/Placeholder.js +5 -0
  976. package/page/widgets/Placeholder/hooks.js +12 -0
  977. package/page/widgets/Placeholder/index.js +1 -0
  978. package/page/widgets/ProductList/ProductList.js +5 -0
  979. package/page/widgets/ProductList/hooks.js +25 -0
  980. package/page/widgets/ProductList/index.js +1 -0
  981. package/page/widgets/ProductSlider/ProductSlider.js +4 -0
  982. package/page/widgets/ProductSlider/hooks.js +27 -0
  983. package/page/widgets/ProductSlider/index.js +1 -0
  984. package/page/widgets/index.js +1 -0
  985. package/page/widgets/widgets.json +14 -0
  986. package/product/collections/index.js +1 -0
  987. package/product/components/Availability/Availability.connector.js +5 -0
  988. package/product/components/Availability/Availability.js +6 -0
  989. package/product/components/Availability/Availability.style.js +1 -0
  990. package/product/components/Availability/index.js +1 -0
  991. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +16 -4
  992. package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +8 -3
  993. package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -1
  994. package/product/components/Characteristics/Characteristic/index.js +15 -6
  995. package/product/components/Characteristics/Characteristic/style.js +1 -1
  996. package/product/components/Characteristics/Swatch/index.js +8 -6
  997. package/product/components/Characteristics/index.js +10 -3
  998. package/product/components/Characteristics/transition.js +1 -1
  999. package/product/components/Description/index.js +5 -6
  1000. package/product/components/Description/style.js +1 -1
  1001. package/product/components/EffectivityDates/helpers.js +5 -5
  1002. package/product/components/EffectivityDates/index.js +2 -2
  1003. package/product/components/EffectivityDates/style.js +1 -1
  1004. package/product/components/Header/PriceStriked/index.js +2 -5
  1005. package/product/components/Header/PriceStriked/style.js +1 -1
  1006. package/product/components/Header/Shipping/components/Label/index.js +3 -3
  1007. package/product/components/Header/Shipping/components/Label/style.js +1 -1
  1008. package/product/components/Header/Shipping/index.js +1 -1
  1009. package/product/components/Header/Shipping/spec.js +1 -1
  1010. package/product/components/Header/Tiers/components/Tier/index.js +2 -2
  1011. package/product/components/Header/Tiers/components/Tier/spec.js +1 -1
  1012. package/product/components/Header/Tiers/index.js +1 -1
  1013. package/product/components/Header/Tiers/spec.js +1 -1
  1014. package/product/components/Header/index.js +1 -0
  1015. package/product/components/MapPriceHint/index.js +1 -1
  1016. package/product/components/Media/FeaturedMedia.js +2 -2
  1017. package/product/components/Media/MediaImage.js +3 -3
  1018. package/product/components/Media/MediaPlaceholder.js +1 -1
  1019. package/product/components/MediaSlider/components/MediaImage/index.js +1 -1
  1020. package/product/components/MediaSlider/components/MediaVideo/index.js +1 -1
  1021. package/product/components/MediaSlider/index.js +4 -4
  1022. package/product/components/Options/components/Content/index.js +8 -8
  1023. package/product/components/Options/components/Content/spec.js +2 -2
  1024. package/product/components/Options/components/Option/index.js +2 -2
  1025. package/product/components/Options/components/TextOption/components/OptionInfo/index.js +3 -3
  1026. package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -1
  1027. package/product/components/Options/components/TextOption/components/OptionInfo/style.js +1 -1
  1028. package/product/components/Options/components/TextOption/index.js +19 -7
  1029. package/product/components/Options/components/TextOption/style.js +1 -1
  1030. package/product/components/Options/index.js +2 -2
  1031. package/product/components/OrderQuantityHint/index.js +3 -2
  1032. package/product/components/OrderQuantityHint/style.js +1 -1
  1033. package/product/components/PriceDifference/index.js +1 -1
  1034. package/product/components/PriceDifference/style.js +1 -1
  1035. package/product/components/PriceInfo/PriceInfo.connector.js +4 -0
  1036. package/product/components/PriceInfo/PriceInfo.js +4 -0
  1037. package/product/components/PriceInfo/index.js +1 -0
  1038. package/product/components/ProductBadges/index.js +2 -2
  1039. package/product/components/ProductCard/index.js +12 -3
  1040. package/product/components/ProductCard/style.js +1 -1
  1041. package/product/components/ProductCharacteristics/context.js +1 -1
  1042. package/product/components/ProductCharacteristics/helpers/index.js +1 -1
  1043. package/product/components/ProductCharacteristics/index.js +30 -16
  1044. package/product/components/ProductDiscountBadge/index.js +2 -2
  1045. package/product/components/ProductDiscountBadge/spec.js +2 -2
  1046. package/product/components/ProductDiscountBadge/style.js +1 -1
  1047. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +8 -0
  1048. package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +1 -0
  1049. package/product/components/ProductGrid/components/Item/components/ItemDiscount/index.js +5 -0
  1050. package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/index.js +5 -0
  1051. package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +1 -0
  1052. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +5 -0
  1053. package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +1 -0
  1054. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -0
  1055. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +1 -0
  1056. package/product/components/ProductGrid/components/Item/components/ItemPrice/index.js +5 -0
  1057. package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +1 -0
  1058. package/product/components/ProductGrid/components/Item/index.js +7 -0
  1059. package/product/components/ProductGrid/components/Iterator/index.js +5 -0
  1060. package/product/components/ProductGrid/components/Layout/index.js +5 -0
  1061. package/product/components/ProductGrid/index.js +22 -0
  1062. package/product/components/ProductGrid/spec.js +1 -0
  1063. package/product/components/ProductGridPrice/index.js +4 -4
  1064. package/product/components/ProductGridPrice/style.js +1 -1
  1065. package/product/components/ProductImage/ProductImagePlaceholder.js +5 -0
  1066. package/product/components/ProductImage/connector.js +5 -0
  1067. package/product/components/ProductImage/index.js +17 -13
  1068. package/product/components/ProductImage/spec.js +1 -1
  1069. package/product/components/ProductList/components/Item/index.js +2 -2
  1070. package/product/components/ProductList/components/Iterator/index.js +1 -1
  1071. package/product/components/ProductList/components/Layout/index.js +1 -1
  1072. package/product/components/ProductList/index.js +2 -2
  1073. package/product/components/ProductName/ProductName.js +4 -0
  1074. package/product/components/ProductName/ProductNameContent.js +4 -0
  1075. package/product/components/ProductName/index.js +1 -0
  1076. package/product/components/ProductProperties/Content.js +4 -4
  1077. package/product/components/ProductProperties/Group.js +1 -1
  1078. package/product/components/ProductProperties/GroupedProperties.js +2 -2
  1079. package/product/components/ProductProperties/Lists.js +1 -1
  1080. package/product/components/ProductProperties/ListsHTML.js +5 -0
  1081. package/product/components/ProductProperties/ProductProperties.js +2 -2
  1082. package/product/components/ProductProperties/Row.js +1 -1
  1083. package/product/components/ProductProperties/RowHTML.js +5 -0
  1084. package/product/components/ProductProperties/Rows.js +2 -2
  1085. package/product/components/ProductProperties/Wrapper.js +1 -1
  1086. package/product/components/ProductProperties/helpers/getGroupsFromProperties.js +7 -2
  1087. package/product/components/ProductProperties/style.js +1 -1
  1088. package/product/components/ProductSlider/index.js +4 -3
  1089. package/product/components/ProductSlider/spec.js +1 -1
  1090. package/product/components/ProductVariants/VariantAvailability.connector.js +5 -0
  1091. package/product/components/ProductVariants/VariantAvailability.js +5 -0
  1092. package/product/components/ProductVariants/index.js +1 -0
  1093. package/product/components/QuantityPicker/hooks.js +5 -0
  1094. package/product/components/QuantityPicker/index.js +4 -3
  1095. package/product/components/Rating/index.js +3 -3
  1096. package/product/components/Rating/spec.js +2 -2
  1097. package/product/components/RelationsSlider/RelationsSheet.js +2 -2
  1098. package/product/components/RelationsSlider/RelationsSlider.js +1 -1
  1099. package/product/components/RelationsSlider/RelationsSliderContent.js +1 -1
  1100. package/product/components/RelationsSlider/style.js +1 -1
  1101. package/product/components/Swatch/Swatch.js +1 -1
  1102. package/product/components/Swatch/SwatchContent.js +1 -1
  1103. package/product/components/Swatch/VariantSwatch.js +1 -1
  1104. package/product/components/Swatch/style.js +1 -1
  1105. package/product/components/Swatches/Swatches.js +1 -1
  1106. package/product/components/UnitQuantityPicker/CartUnitQuantityPicker.js +4 -0
  1107. package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +3 -6
  1108. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +11 -13
  1109. package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +5 -2
  1110. package/product/components/UnitQuantityPicker/index.js +1 -1
  1111. package/product/components/UnitQuantityPicker/styles.js +1 -0
  1112. package/product/components/context.js +1 -1
  1113. package/product/components/index.js +1 -0
  1114. package/product/constants/index.js +2 -1
  1115. package/product/contexts/index.js +1 -0
  1116. package/product/helpers/index.js +2 -2
  1117. package/product/helpers/redirects.js +2 -2
  1118. package/product/hocs/index.js +1 -0
  1119. package/product/hocs/withMapPricing.js +4 -4
  1120. package/product/hocs/withPriceCalculation.js +2 -2
  1121. package/product/hocs/withProduct.js +6 -0
  1122. package/product/hocs/withProductListEntry.js +1 -1
  1123. package/product/hocs/withProductListEntryProduct.js +12 -0
  1124. package/product/hocs/withProductListType.js +1 -1
  1125. package/product/hooks/index.js +1 -0
  1126. package/product/hooks/useLoadProductImage.js +1 -1
  1127. package/product/index.js +4 -11
  1128. package/product/product.types.js +0 -0
  1129. package/product/{components/ProductProvider → providers/Product}/index.js +1 -1
  1130. package/product/providers/ProductListEntry/context.js +1 -1
  1131. package/product/providers/ProductListEntry/index.js +1 -1
  1132. package/product/providers/ProductListType/context.js +2 -1
  1133. package/product/providers/ProductListType/index.js +2 -1
  1134. package/product/providers/index.js +1 -0
  1135. package/product/selectors/product.js +75 -6
  1136. package/product/selectors/variants.js +4 -1
  1137. package/product/streams/index.js +1 -0
  1138. package/push-opt-in/action-creators/pushOptIn.js +2 -1
  1139. package/push-opt-in/actions/pushOptInModal.js +3 -3
  1140. package/push-opt-in/components/PushOptInModal/index.js +3 -6
  1141. package/push-opt-in/components/PushOptInModal/push-opt-in.svg +58 -58
  1142. package/push-opt-in/reducers/optInModal.js +2 -2
  1143. package/push-opt-in/reducers/optInTrigger.js +2 -2
  1144. package/push-opt-in/selectors/optInModal.js +5 -2
  1145. package/push-opt-in/selectors/optInTrigger.js +4 -2
  1146. package/push-opt-in/subscriptions/index.js +1 -1
  1147. package/push-opt-in/subscriptions/optInTracking.js +4 -0
  1148. package/push-opt-in/subscriptions/optInTrigger.js +6 -6
  1149. package/registration/action-creators/index.js +18 -0
  1150. package/registration/actions/index.js +1 -0
  1151. package/registration/actions/submitRegistration.js +4 -0
  1152. package/registration/components/GuestRegistration/GuestRegistration.js +4 -0
  1153. package/registration/components/GuestRegistration/GuestRegistrationContent.js +4 -0
  1154. package/registration/components/GuestRegistration/GuestRegistrationFormPickup.config.js +8 -0
  1155. package/registration/components/GuestRegistration/GuestRegistrationFormPickup.js +4 -0
  1156. package/registration/components/Registration/Registration.js +4 -0
  1157. package/registration/components/Registration/RegistrationContent.js +4 -0
  1158. package/registration/components/Registration/RegistrationContent.style.js +2 -0
  1159. package/registration/components/Registration/RegistrationFormActions.js +5 -0
  1160. package/registration/components/Registration/RegistrationFormBase.config.js +4 -0
  1161. package/registration/components/Registration/RegistrationFormBase.js +4 -0
  1162. package/registration/components/Registration/RegistrationFormBilling.config.js +5 -0
  1163. package/registration/components/Registration/RegistrationFormBilling.js +5 -0
  1164. package/registration/components/Registration/RegistrationFormExtra.config.js +5 -0
  1165. package/registration/components/Registration/RegistrationFormExtra.js +5 -0
  1166. package/registration/components/Registration/RegistrationFormShipping.config.js +5 -0
  1167. package/registration/components/Registration/RegistrationFormShipping.js +5 -0
  1168. package/registration/components/Registration/RegistrationFormToggle.js +4 -0
  1169. package/registration/components/index.js +1 -0
  1170. package/registration/constants/actionTypes.js +1 -0
  1171. package/registration/constants/index.js +1 -0
  1172. package/registration/constants/pipelines.js +1 -0
  1173. package/registration/hooks/index.js +5 -0
  1174. package/registration/index.js +2 -0
  1175. package/registration/providers/GuestRegistrationProvider.actions.js +4 -0
  1176. package/registration/providers/GuestRegistrationProvider.connector.js +7 -0
  1177. package/registration/providers/GuestRegistrationProvider.constraints.js +18 -0
  1178. package/registration/providers/GuestRegistrationProvider.context.js +1 -0
  1179. package/registration/providers/GuestRegistrationProvider.js +22 -0
  1180. package/registration/providers/RegistrationProvider.actions.js +8 -0
  1181. package/registration/providers/RegistrationProvider.connector.js +6 -0
  1182. package/registration/providers/RegistrationProvider.constraints.js +27 -0
  1183. package/registration/providers/RegistrationProvider.context.js +1 -0
  1184. package/registration/providers/RegistrationProvider.js +17 -0
  1185. package/registration/streams/index.js +4 -0
  1186. package/registration/subscriptions/index.js +5 -0
  1187. package/reviews/actions/index.js +1 -0
  1188. package/reviews/components/Reviews/components/AllReviewsLink/index.js +1 -1
  1189. package/reviews/components/Reviews/components/Header/components/AverageRating/index.js +8 -6
  1190. package/reviews/components/Reviews/components/Header/components/NoReviews/index.js +3 -3
  1191. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +3 -3
  1192. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/style.js +1 -1
  1193. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +3 -3
  1194. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +2 -2
  1195. package/reviews/components/Reviews/components/Header/index.js +6 -4
  1196. package/reviews/components/Reviews/components/Header/spec.js +2 -2
  1197. package/reviews/components/Reviews/components/List/components/Info/components/Author/index.js +1 -1
  1198. package/reviews/components/Reviews/components/List/components/Info/components/ReviewDate/index.js +1 -1
  1199. package/reviews/components/Reviews/components/List/components/Info/index.js +2 -2
  1200. package/reviews/components/Reviews/components/List/components/Info/style.js +1 -1
  1201. package/reviews/components/Reviews/components/List/components/Rating/index.js +1 -1
  1202. package/reviews/components/Reviews/components/List/components/Review/index.js +1 -1
  1203. package/reviews/components/Reviews/components/List/components/Text/index.js +1 -1
  1204. package/reviews/components/Reviews/components/List/components/Title/index.js +1 -1
  1205. package/reviews/components/Reviews/components/List/index.js +3 -3
  1206. package/reviews/components/Reviews/components/List/spec.js +1 -1
  1207. package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
  1208. package/reviews/components/Reviews/components/RatingCount/spec.js +1 -1
  1209. package/reviews/components/Reviews/components/RatingCount/style.js +1 -1
  1210. package/reviews/components/Reviews/components/ReviewsInfo/index.js +3 -4
  1211. package/reviews/components/Reviews/connector.js +2 -6
  1212. package/reviews/components/Reviews/index.js +1 -1
  1213. package/reviews/components/Reviews/mock.js +2 -6
  1214. package/reviews/components/Reviews/spec.js +4 -3
  1215. package/reviews/components/index.js +1 -0
  1216. package/reviews/constants/index.js +1 -0
  1217. package/reviews/index.js +3 -6
  1218. package/reviews/selectors/index.js +1 -0
  1219. package/reviews/streams/index.js +1 -0
  1220. package/scanner/action-creators/index.js +1 -0
  1221. package/scanner/actions/index.js +1 -0
  1222. package/scanner/classes/index.js +1 -0
  1223. package/scanner/constants/index.js +1 -0
  1224. package/scanner/helpers/index.js +1 -0
  1225. package/scanner/index.js +1 -6
  1226. package/scanner/streams/index.js +1 -0
  1227. package/search/actions/index.js +1 -0
  1228. package/search/constants/index.js +1 -0
  1229. package/search/helpers/index.js +1 -0
  1230. package/search/index.js +1 -6
  1231. package/search/selectors/index.js +1 -0
  1232. package/search/streams/index.js +1 -0
  1233. package/styles/helpers/color.js +23 -0
  1234. package/styles/helpers/cssCustomProperties.js +16 -0
  1235. package/styles/helpers/index.js +1 -0
  1236. package/styles/helpers/initCSSCustomProperties.js +10 -0
  1237. package/styles/helpers/loadCustomStyles.js +6 -0
  1238. package/styles/helpers/setPageBackgroundColor.js +5 -0
  1239. package/styles/helpers/setPageContentWidth.js +5 -0
  1240. package/styles/helpers/setViewportHeight.js +3 -0
  1241. package/styles/helpers/toggleBodyScroll.js +5 -0
  1242. package/styles/helpers/updatePageInsets.js +15 -0
  1243. package/styles/index.d.ts +17 -0
  1244. package/styles/index.js +1 -0
  1245. package/styles/reset/form.js +8 -0
  1246. package/styles/reset/index.js +1 -0
  1247. package/styles/reset/media.js +1 -0
  1248. package/styles/reset/root.js +3 -0
  1249. package/styles/reset/table.js +1 -0
  1250. package/styles/reset/typography.js +1 -0
  1251. package/styles/theme/createTheme/createBreakpoints.d.ts +114 -0
  1252. package/styles/theme/createTheme/createBreakpoints.js +41 -0
  1253. package/styles/theme/createTheme/createSpacing.d.ts +23 -0
  1254. package/styles/theme/createTheme/createSpacing.js +14 -0
  1255. package/styles/theme/createTheme/index.d.ts +19 -0
  1256. package/styles/theme/createTheme/index.js +5 -0
  1257. package/styles/theme/createTheme/transitions.d.ts +100 -0
  1258. package/styles/theme/createTheme/transitions.js +26 -0
  1259. package/styles/theme/createTheme/zIndex.d.ts +12 -0
  1260. package/styles/theme/createTheme/zIndex.js +3 -0
  1261. package/styles/theme/hooks/index.d.ts +4 -0
  1262. package/styles/theme/hooks/index.js +1 -0
  1263. package/styles/theme/hooks/useActiveBreakpoint.d.ts +18 -0
  1264. package/styles/theme/hooks/useActiveBreakpoint.js +4 -0
  1265. package/styles/theme/hooks/useMediaQuery.d.ts +33 -0
  1266. package/styles/theme/hooks/useMediaQuery.js +20 -0
  1267. package/styles/theme/hooks/useResponsiveValue.d.ts +27 -0
  1268. package/styles/theme/hooks/useResponsiveValue.js +4 -0
  1269. package/styles/theme/hooks/useTheme.d.ts +8 -0
  1270. package/styles/theme/hooks/useTheme.js +4 -0
  1271. package/styles/theme/index.d.ts +8 -0
  1272. package/styles/theme/index.js +1 -0
  1273. package/styles/theme/providers/ActiveBreakpointProvider.d.ts +21 -0
  1274. package/styles/theme/providers/ActiveBreakpointProvider.js +13 -0
  1275. package/styles/theme/providers/ThemeProvider.d.ts +18 -0
  1276. package/styles/theme/providers/ThemeProvider.js +7 -0
  1277. package/styles/tss/index.js +3 -0
  1278. package/tracking/action-creators/cookieConsent.js +2 -2
  1279. package/tracking/actions/cookieConsent.js +17 -5
  1280. package/tracking/components/CookieConsentModal/connector.js +3 -5
  1281. package/tracking/components/CookieConsentModal/index.js +3 -6
  1282. package/tracking/components/CookieConsentModal/tracking-opt-in.svg +14 -14
  1283. package/tracking/components/PrivacySettings/connector.js +3 -5
  1284. package/tracking/components/PrivacySettings/index.js +2 -2
  1285. package/tracking/helpers/index.js +1 -0
  1286. package/tracking/selectors/cookieConsent.js +11 -6
  1287. package/tracking/streams/cookieConsent.js +10 -3
  1288. package/tracking/subscriptions/analytics.js +5 -4
  1289. package/tracking/subscriptions/cookieConsent.js +6 -10
  1290. package/types.js +0 -0
  1291. package/user/index.js +2 -2
  1292. package/user/selectors/data.js +10 -0
  1293. package/components/MessageBar/spec.js +0 -1
  1294. package/components/MessageBar/style.js +0 -2
  1295. package/favorites/constants/constants.js +0 -1
  1296. package/product/components/Characteristics/Characteristic/components/VariantAvailability/connector.js +0 -9
  1297. package/product/components/Characteristics/Characteristic/components/VariantAvailability/index.js +0 -5
  1298. package/product/components/QuantityPicker/helpers.js +0 -5
  1299. /package/product/components/{Characteristics/Characteristic/components/VariantAvailability/style.js → ProductVariants/VariantAvailability.style.js} +0 -0
  1300. /package/product/{components/ProductProvider → providers/Product}/connector.js +0 -0
@@ -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 List=function List(props){var items=props.items,onClose=props.onClose,onSelect=props.onSelect,selectedIndex=props.selectedIndex,query=props.query;var filteredItems=items;if(query&&query.length){filteredItems=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);});}return/*#__PURE__*/React.createElement("ul",{className:"engage__picker_list"},filteredItems.map(function(item,currentIndex){return/*#__PURE__*/React.createElement("li",{key:item.value,className:classNames(_defineProperty({},styles.active,currentIndex===selectedIndex))},/*#__PURE__*/React.createElement("button",{className:styles.button,disabled:item.disabled,onClick:function onClick(){onSelect(item.value);onClose();},type:"button"},item.label));}));};List.defaultProps={onClose:function onClose(){},selectedIndex:null,query:''};export default List;
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){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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 Modal=/*#__PURE__*/function(_Component){_inherits(Modal,_Component);var _super=_createSuper(Modal);/**
3
+ */var PickerModal=/*#__PURE__*/function(_Component){/**
4
4
  * The constructor.
5
5
  * @param {Object} props The props.
6
- */function Modal(props){var _this;_classCallCheck(this,Modal);_this=_super.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(Modal,[{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",value:/**
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
- */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/*#__PURE__*/React.createElement("div",{className:"".concat(styles.wrapper," engage__picker_modal")},/*#__PURE__*/React.createElement("div",{"aria-hidden":true,className:backgroundClassName,onClick:this.closeModal}),/*#__PURE__*/React.createElement("div",{className:containerClassName},/*#__PURE__*/React.cloneElement(this.props.children,{onClose:this.closeModal})));}}]);return Modal;}(Component);export default Modal;
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,28 +1,37 @@
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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_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{ConnectedReactPortal}from'@shopgate/engage/components';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.
5
5
  * @returns {Object} An object representation of the item.
6
- */var normalizeItem=function normalizeItem(item){if(item!==null&&typeof item!=='undefined'){var itemDefaults={value:item.value||item,label:item.label||item.value||item,disabled:item.disabled||false};if(_typeof(item)==='object'){return _extends({},itemDefaults,item);}return itemDefaults;}return null;};/**
6
+ */var normalizeItem=function normalizeItem(item){if(item!==null&&typeof item!=='undefined'){var itemDefaults={value:item.value||item,label:item.label||item.value||item,disabled:item.disabled||false};if(_typeof(item)==='object'){return _extends({},itemDefaults,{},item);}return itemDefaults;}return null;};/**
7
7
  * Finds an item index in a list of items by value.
8
8
  * @param {Array} items - The list of items.
9
9
  * @param {*} value - The value to look for.
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);var _super=_createSuper(Picker);/**
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=_super.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:"selectedItem",get:function get(){return normalizeItem(this.props.items[this.state.selectedIndex]);}/**
23
- * Triggers the onChange callback if the selected value has changed.
24
- * @param {Object} nextValue - The value the user picked.
25
- */},{key:"render",value:/**
34
+ */},{key:"selectedItem",get:function get(){return normalizeItem(this.props.items[this.state.selectedIndex]);}},{key:"render",value:/**
26
35
  * Renders the component.
27
36
  * @returns {JSX}
28
- */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?function(){}: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/*#__PURE__*/React.createElement("div",{role:"button",className:"".concat(this.props.className," engage__picker"),ref:this.props.forwardedRef,tabIndex:0,"aria-haspopup":true},/*#__PURE__*/React.createElement(this.props.buttonComponent,buttonProps),/*#__PURE__*/React.createElement(Portal,{onClose:function onClose(){return _this2.toggleOpenState(false);},isOpened:true},/*#__PURE__*/React.createElement(this.props.modalComponent,modalProps,/*#__PURE__*/React.createElement(this.props.listComponent,listProps))));}}]);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(ConnectedReactPortal,{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);
@@ -1,4 +1,4 @@
1
- import React from'react';import{mount}from'enzyme';import Picker from"./index";import PickerList from"./components/List";jest.mock('react-portal',function(){return function(_ref){var isOpened=_ref.isOpened,children=_ref.children;return isOpened?children:null;};});describe('<Picker />',function(){var renderedElement;var renderedInstance;var mockItems=['String only',{value:'Value only'},{value:'value',label:'Value and label'}];var mockOnChange=jest.fn();var mockOnSelect=jest.fn();/**
1
+ import React from'react';import{mount}from'enzyme';import Picker from"./index";import PickerList from"./components/List";jest.mock('@shopgate/engage/components');describe('<Picker />',function(){var renderedElement;var renderedInstance;var mockItems=['String only',{value:'Value only'},{value:'value',label:'Value and label'}];var mockOnChange=jest.fn();var mockOnSelect=jest.fn();/**
2
2
  * The view component
3
3
  * @param {Object} props The component props.
4
- */var renderComponent=function renderComponent(props){renderedElement=mount(/*#__PURE__*/React.createElement(Picker,props));renderedInstance=renderedElement.find('Picker').instance();};beforeEach(function(){renderComponent({items:mockItems,onChange:mockOnChange,onSelect:mockOnSelect});renderedElement.update();});describe('Given the component was mounted to the DOM',function(){it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should have no selected value',function(){expect(renderedInstance.selectedItem).toBe(null);});describe('Given picker component gets opened',function(){beforeEach(function(){renderedInstance.toggleOpenState(true);renderedElement.update();});it('should have isOpen state',function(){expect(renderedInstance.state.isOpen).toBe(true);});it('should render the picker list',function(){expect(renderedElement.find(PickerList).length).toBe(1);});it('should render the picker items',function(){expect(renderedElement.find('li button').length).toBe(mockItems.length);});describe('Given a item gets selected',function(){jest.useFakeTimers();beforeEach(function(){jest.clearAllMocks();renderedElement.find('li button').first().simulate('click');jest.runAllTimers();});afterEach(function(){jest.clearAllTimers();});it('should trigger onChange when the value changed',function(){expect(mockOnChange).toHaveBeenCalledTimes(1);});it('should trigger onSelect when the value changed',function(){expect(mockOnSelect).toHaveBeenCalledTimes(1);});it('should not trigger onChange when the value did not change, but trigger onSelect',function(){renderedInstance.setState({selectedIndex:0});renderedInstance.toggleOpenState(true);renderedElement.find('li button').first().simulate('click');jest.runAllTimers();expect(mockOnChange).toHaveBeenCalledTimes(1);expect(mockOnSelect).toHaveBeenCalledTimes(2);});});});});});
4
+ */var renderComponent=function renderComponent(props){renderedElement=mount(React.createElement(Picker,props));renderedInstance=renderedElement.find('Picker').instance();};beforeEach(function(){renderComponent({items:mockItems,onChange:mockOnChange,onSelect:mockOnSelect});renderedElement.update();});describe('Given the component was mounted to the DOM',function(){it('should match snapshot',function(){expect(renderedElement).toMatchSnapshot();});it('should have no selected value',function(){expect(renderedInstance.selectedItem).toBe(null);});describe('Given picker component gets opened',function(){beforeEach(function(){renderedInstance.toggleOpenState(true);renderedElement.update();});it('should have isOpen state',function(){expect(renderedInstance.state.isOpen).toBe(true);});it('should render the picker list',function(){expect(renderedElement.find(PickerList).length).toBe(1);});it('should render the picker items',function(){expect(renderedElement.find('li button').length).toBe(mockItems.length);});describe('Given a item gets selected',function(){jest.useFakeTimers();beforeEach(function(){jest.clearAllMocks();renderedElement.find('li button').first().simulate('click');jest.runAllTimers();});afterEach(function(){jest.clearAllTimers();});it('should trigger onChange when the value changed',function(){expect(mockOnChange).toHaveBeenCalledTimes(1);});it('should trigger onSelect when the value changed',function(){expect(mockOnSelect).toHaveBeenCalledTimes(1);});it('should not trigger onChange when the value did not change, but trigger onSelect',function(){renderedInstance.setState({selectedIndex:0});renderedInstance.toggleOpenState(true);renderedElement.find('li button').first().simulate('click');jest.runAllTimers();expect(mockOnChange).toHaveBeenCalledTimes(1);expect(mockOnSelect).toHaveBeenCalledTimes(2);});});});});});
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import styles from"./
2
2
  * The Picker Button component.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX}
5
- */var Button=function Button(_ref){var disabled=_ref.disabled,label=_ref.label,openList=_ref.openList,value=_ref.value;return/*#__PURE__*/React.createElement("button",{className:"".concat(disabled?styles.buttonDisabled:styles.button),onClick:openList,type:"button"},/*#__PURE__*/React.createElement("span",{className:styles.label},label),value&&/*#__PURE__*/React.createElement("span",{className:styles.value},value));};Button.defaultProps={disabled:false,openList:function openList(){}};export default Button;
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;
@@ -1,15 +1,17 @@
1
- function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}var _excluded=["hasButton","sheetProps"];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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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";/**
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
2
  * The template version of the Picker component.
3
3
  * @param {Object} props The same component props as in the base Picker component.
4
- */var PickerUtilize=/*#__PURE__*/function(_Component){_inherits(PickerUtilize,_Component);var _super=_createSuper(PickerUtilize);/**
4
+ */var PickerUtilize=/*#__PURE__*/function(_Component){/**
5
5
  * Constructor
6
6
  * @param {Object} props Props of the component
7
- */function PickerUtilize(props){var _this;_classCallCheck(this,PickerUtilize);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"onDidOpen",function(){_this.props.setViewAriaHidden(true);if(_this.firstSelectableItemRef.current){_this.firstSelectableItemRef.current.focus();}});_defineProperty(_assertThisInitialized(_this),"onClose",function(){_this.props.setViewAriaHidden(false);if(_this.pickerRef.current){_this.pickerRef.current.focus();}});_this.modalComponent=function(sheetProps){return/*#__PURE__*/React.createElement(Sheet,_extends({},_extends({},_this.props.sheetProps,sheetProps),{title:_this.props.label,onDidOpen:_this.onDidOpen}));};_this.pickerRef=/*#__PURE__*/React.createRef();_this.firstSelectableItemRef=/*#__PURE__*/React.createRef();_this.listComponent=function(prps){return/*#__PURE__*/React.createElement(SheetList,null,prps.items.map(function(item,index){return/*#__PURE__*/React.createElement(SheetList.Item,{key:item.value,title:item.label,onClick:function onClick(){setTimeout(function(){prps.onSelect(item.value);prps.onClose();},_this.props.clickDelay);},isDisabled:item.disabled,isSelected:index===prps.selectedIndex,rightComponent:item.rightComponent,testId:item.label,ref:index===prps.selectedIndex?_this.firstSelectableItemRef:null});}));};return _this;}/**
7
+ */function PickerUtilize(props){var _this2;_classCallCheck(this,PickerUtilize);_this2=_callSuper(this,PickerUtilize,[props]);/**
8
8
  * Focuses the picker button for screen readers.
9
- */_createClass(PickerUtilize,[{key:"render",value:/**
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:/**
10
12
  * Render
11
13
  * @returns {JSX}
12
- */function render(){var _this$props=this.props,hasButton=_this$props.hasButton,ignore=_this$props.sheetProps,restProps=_objectWithoutProperties(_this$props,_excluded);return/*#__PURE__*/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}));}}]);return PickerUtilize;}(Component);_defineProperty(PickerUtilize,"defaultProps",{buttonComponent:null,buttonProps:{},/**
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:{},/**
13
15
  * Time in ms that delays picker interaction in order
14
16
  * to let animations complete first.
15
- */clickDelay:150,hasButton:true,sheetProps:{}});export default(function(props){return/*#__PURE__*/React.createElement(ViewContext.Consumer,null,function(_ref){var setAriaHidden=_ref.setAriaHidden;return/*#__PURE__*/React.createElement(PickerUtilize,_extends({},props,{setViewAriaHidden:setAriaHidden}));});});
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}));});});
@@ -1 +1,2 @@
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(/*#__PURE__*/React.createElement(Picker,{label:label}));expect(wrapper).toMatchSnapshot();});});
1
+ import React from'react';import{mount}from'enzyme';import Picker from"./index";jest.mock('@shopgate/engage/components/View');jest.mock('@shopgate/engage/components',function(){// eslint-disable-next-line require-jsdoc
2
+ function SheetList(_ref){var children=_ref.children;return children;}SheetList.Item=function Item(){return null;};return{SheetList:SheetList,Sheet:function Sheet(_ref2){var children=_ref2.children;return children;},Picker:jest.requireActual('@shopgate/engage/components/Picker')["default"],ConnectedReactPortal:jest.requireActual('@shopgate/engage/components/ConnectedReactPortal/__mocks__')["default"]};});describe('<Picker />',function(){it('should render the picker',function(){var label='Picker label';var wrapper=mount(React.createElement(Picker,{label:label}));expect(wrapper).toMatchSnapshot();});});
@@ -1,8 +1,9 @@
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)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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","onKeyDown"];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 noop from'lodash/noop';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=/*#__PURE__*/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
- if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}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.
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,onKeyDown=_ref.onKeyDown,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
+ if(Number.isNaN(parseFloat(inputValue))){setInputValue(formatFloat(value,maxDecimals));return;}if(minValue&&newValue<minValue){newValue=minValue;}if(maxValue&&newValue>maxValue){newValue=maxValue;}setInputValue("".concat(newValue));if(newValue!==value){onChange(newValue);}customOnBlur(event,newValue);},[customOnBlur,inputValue,maxDecimals,maxValue,minValue,onChange,value]);var handleChange=useCallback(function(event){var newValue=event.target.value;setInputValue(newValue);},[]);var handleKeyDown=useCallback(function(event){if(event.key==='Enter'){// Prevents false positive validation error when enter key is pressed inside input
6
+ event.preventDefault();if(inputRef.current){inputRef.current.blur();}}if(typeof onKeyDown==='function'){onKeyDown(event);}},[inputRef,onKeyDown]);// Select the current input value after focus.
6
7
  useLayoutEffect(function(){if(isFocused&&isIOs){inputRef.current.select();}},[inputRef,isFocused]);// Sync actual float value with displayed content.
7
8
  useEffect(function(){setInputValue(formatFloat(value,maxDecimals));},[maxDecimals,value]);// Stop the context menu from opening.
8
- useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return/*#__PURE__*/React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:"decimal"/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:"[0-9.,]*",onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:function onFocus(){},onChange:function onChange(){},onBlur:function onBlur(){}};export default QuantityInput;
9
+ useLayoutEffect(function(){inputRef.current.addEventListener('contextmenu',function(event){event.preventDefault();event.stopPropagation();return false;});},[inputRef]);var displayedValue=!isFocused&&unit?"".concat(inputValue," ").concat(unit):inputValue;return React.createElement("input",_extends({ref:inputRef},inputProps,{inputMode:maxDecimals>0?'decimal':'numeric'/* Pattern signals some browsers to use specialized keyboard (if inputmode not supported */,pattern:maxDecimals>0?'[0-9.,]*':'[0–9]*',onFocus:onFocus,onBlur:onBlur,className:className,value:displayedValue,onChange:handleChange,onKeyDown:handleKeyDown,onClick:function onClick(event){event.preventDefault();event.stopPropagation();if(inputRef.current){inputRef.current.focus();}}}));});QuantityInput.defaultProps={className:'',maxDecimals:2,unit:null,minValue:null,maxValue:null,onFocus:noop,onChange:noop,onBlur:noop,onKeyDown:noop};export default QuantityInput;
@@ -0,0 +1,4 @@
1
+ import React,{useMemo}from'react';import PropTypes from'prop-types';import{formatFloat}from"../QuantityInput/helper";/**
2
+ * @param {Object} props The component props.
3
+ * @returns {JSX}
4
+ */var QuantityLabel=function QuantityLabel(_ref){var value=_ref.value,maxDecimals=_ref.maxDecimals,unit=_ref.unit,className=_ref.className;var output=useMemo(function(){var formatted=formatFloat(value,maxDecimals);return unit?"".concat(formatted," ").concat(unit):formatted;},[maxDecimals,unit,value]);return React.createElement("span",{className:className},output);};QuantityLabel.defaultProps={className:'',maxDecimals:2,unit:null};export default QuantityLabel;
@@ -0,0 +1 @@
1
+ export{default}from"./QuantityLabel";
@@ -0,0 +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;}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{hot}from'react-hot-loader/root';import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{css}from'glamor';import CheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';import UncheckedIcon from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';import{Ripple}from'@shopgate/engage/components';import{useRadioGroup}from"../RadioGroup";var styles={root:css({display:'inline-flex',alignItems:'inherit',justifyContent:'inherit',position:'relative',borderRadius:'50%'}).toString(),input:css({top:0,left:0,margin:0,opacity:0,padding:0,position:'absolute',zIndex:1,width:'100%',height:'100%'}).toString(),radioContainer:css({display:'flex',position:'relative',width:24,height:24}).toString(),radio:css({height:'100%',width:'100%'}).toString(),radioChecked:css({color:'var(--color-primary)'}).toString(),radioDisabled:css({opacity:0.5,pointerEvents:'none'}).toString(),ripple:css({padding:12}).toString()};/**
2
+ * The Radio component
3
+ * @param {Object} props The component props
4
+ * @returns {JSX}
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);
@@ -0,0 +1 @@
1
+ export{default}from"./Radio";
@@ -0,0 +1,9 @@
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{hot}from'react-hot-loader/root';import React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';import classNames from'classnames';import Card from'@shopgate/pwa-ui-shared/Card';import{useRadioGroup}from"../RadioGroup";import Radio from"../Radio";var variables=themeConfig.variables;var styles={card:css({borderRadius:4,padding:'8px 8px 8px 4px',display:'flex',alignItems:'center'}).toString(),content:css({padding:"".concat(variables.gap.small,"px ").concat(variables.gap.small,"px ").concat(variables.gap.small,"px 0"),width:'100%'}).toString(),contentDisabled:css({opacity:0.5,pointerEvents:'none'}).toString(),radio:css({alignItems:'center'}).toString()};/**
2
+ * The default card component
3
+ * @param {Object} props The component props
4
+ * @returns {JSX}
5
+ */var CardComponent=function CardComponent(_ref){var children=_ref.children,className=_ref.className;return React.createElement(Card,{className:classNames(styles.card,className)},children);};CardComponent.defaultProps={children:null,className:null};/**
6
+ * The RadioCard component
7
+ * @param {Object} props The component props
8
+ * @returns {JSX}
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);
@@ -0,0 +1 @@
1
+ export{default}from"./RadioCard";
@@ -0,0 +1 @@
1
+ import React from'react';var initialContext={};export default React.createContext(initialContext);
@@ -0,0 +1,4 @@
1
+ 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;}import{hot}from'react-hot-loader/root';import React,{useState,useCallback,useEffect}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import RadioGroupContext from"./RadioGroup.context";var styles={root:css({display:'flex',flexDirection:'column'}).toString()};/**
2
+ * @param {Object} props The component props
3
+ * @returns {JSX}
4
+ */var RadioGroup=function RadioGroup(_ref){var classes=_ref.classes,children=_ref.children,name=_ref.name,disabled=_ref.disabled,valueProp=_ref.value,defaultValue=_ref.defaultValue,onChange=_ref.onChange,Component=_ref.component;var _useState=useState(valueProp||defaultValue),_useState2=_slicedToArray(_useState,2),value=_useState2[0],setValue=_useState2[1];useEffect(function(){setValue(valueProp||defaultValue);},[defaultValue,valueProp]);var handleChange=useCallback(function(event){setValue(event.target.value);if(onChange){onChange(event,event.target.value);}},[onChange]);return React.createElement(RadioGroupContext.Provider,{value:{name:name,onChange:handleChange,value:value,disabled:disabled}},React.createElement(Component,{role:"radiogroup",className:classNames(styles.root,classes.root)},children));};RadioGroup.defaultProps={classes:{},children:null,defaultValue:null,disabled:false,value:null,onChange:null,component:'div'};export default hot(RadioGroup);
@@ -0,0 +1 @@
1
+ export{default}from"./RadioGroup";export{default as useRadioGroup}from"./useRadioGroup";
@@ -0,0 +1,4 @@
1
+ import{useContext}from'react';import RadioGroupContext from"./RadioGroup.context";/**
2
+ * Provides a radio group context
3
+ * @returns {Object}
4
+ */export default function useRadioGroup(){return useContext(RadioGroupContext);}
@@ -1,4 +1,4 @@
1
- import React from'react';import PropTypes from'prop-types';import cxs from'classnames';import styles from"./style";/**
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 _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 cxs from'classnames';import styles from"./style";/**
2
2
  * The range slider handle component.
3
3
  * @param {Object} props The component properties
4
4
  * @param {boolean} props.active Whether this handle is currently touched or was recently touched.
@@ -6,4 +6,4 @@ import React from'react';import PropTypes from'prop-types';import cxs from'class
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;var style={zIndex:Number(active)||0};return/*#__PURE__*/React.createElement("div",{className:cxs(classNames.handleOuter,styles,'engage__range-slider__handle'),style:style,onTouchStart:function onTouchStart(event){return _onTouchStart(event,index);}},/*#__PURE__*/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;
@@ -1 +1 @@
1
- import{css}from'glamor';export default css({top:'50%',position:'absolute',':first-child':{left:0,transform:'translate(-50%, -50%)'},':last-child':{left:'auto',right:0,transform:'translate(50%, -50%)'}}).toString();
1
+ import{css}from'glamor';export default css({top:'50%',position:'absolute',cursor:'pointer',':first-child':{left:0,transform:'translate(-50%, -50%)'},':last-child':{left:'auto',right:0,transform:'translate(50%, -50%)'}}).toString();
@@ -23,10 +23,10 @@
23
23
  * @param {number} transitionDuration The duration of the transition.
24
24
  * @returns {Object} The generated style object
25
25
  */export var getRangeStyle=function getRangeStyle(min,max,transitionDuration){return{left:"".concat(Math.min(1,Math.max(0,min))*100,"%"),right:"".concat((1-Math.min(1,Math.max(0,max)))*100,"%"),transition:transitionDuration>0?"left ".concat(transitionDuration,"ms, right ").concat(transitionDuration,"ms"):null};};/**
26
- * Shortcut for retrieving x position of a touch event.
27
- * @param {TouchEvent} event The TouchEvent
26
+ * Shortcut for retrieving x position of a touch or mouse event.
27
+ * @param {Event} event The event
28
28
  * @returns {number} The x position
29
- */export var getTouchPositionX=function getTouchPositionX(event){return event.touches[0].pageX;};/**
29
+ */export var getTouchPositionX=function getTouchPositionX(event){if(event.touches){return event.touches[0].pageX;}return event.pageX;};/**
30
30
  * Converts a relative slider value into an absolute value.
31
31
  * A relative value is a value between [0...1] indicating the position
32
32
  * on the slider given its absolute width.
@@ -1,42 +1,54 @@
1
- function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_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);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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}});Object.defineProperty(subClass,"prototype",{writable:false});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 _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}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 _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}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,{PureComponent}from'react';import PropTypes from'prop-types';import cxs from'classnames';import styles from"./style";import Handle from"./components/Handle";import{generateLinearEasingCallback,generateExponentialEasingCallback,getRangeStyle,getTouchPositionX,getAbsoluteValue,getRelativeValue}from"./helper";/**
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,{PureComponent}from'react';import PropTypes from'prop-types';import cxs from'classnames';import styles from"./style";import Handle from"./components/Handle";import{isTouchDevice}from"../../core";import{generateLinearEasingCallback,generateExponentialEasingCallback,getRangeStyle,getTouchPositionX,getAbsoluteValue,getRelativeValue}from"./helper";/**
2
2
  * The range slider component.
3
- */var RangeSlider=/*#__PURE__*/function(_PureComponent){_inherits(RangeSlider,_PureComponent);var _super=_createSuper(RangeSlider);/**
3
+ */var RangeSlider=/*#__PURE__*/function(_PureComponent){/**
4
4
  * Constructor
5
5
  * @param {Object} props The component properties
6
- */function RangeSlider(props){var _this;_classCallCheck(this,RangeSlider);_this=_super.call(this,props);_defineProperty(_assertThisInitialized(_this),"handleTouchStart",function(event,index){_this.draggedHandle=index;// Calculate the relative offset to the handles center
6
+ */function RangeSlider(props){var _this2;_classCallCheck(this,RangeSlider);_this2=_callSuper(this,RangeSlider,[props]);/**
7
+ * Processes touch start events on handles.
8
+ * @param {Object} event The touch event
9
+ * @param {number} index The index of the touched handle.
10
+ */_defineProperty(_this2,"handleTouchStart",function(event,index){_this2.addEventListeners();_this2.draggedHandle=index;// Calculate the relative offset to the handles center
7
11
  var handleDOMElement=event.target;// Get the handles bounding rectangle ...
8
12
  var handleRect=handleDOMElement.getBoundingClientRect();// ... and calculate its absolute center.
9
13
  var handleCenterX=handleRect.left+handleDOMElement.offsetWidth/2;// Store the signed distanced between the current touch offset and the handle center.
10
- _this.touchOffset=getTouchPositionX(event)-handleCenterX;});_defineProperty(_assertThisInitialized(_this),"handleTouchMove",function(event){if(_this.props.min===_this.props.max){return;}if(_this.draggedHandle===null){return;}var _this$domElement$curr=_this.domElement.current,offsetWidth=_this$domElement$curr.offsetWidth,offsetLeft=_this$domElement$curr.offsetLeft;// Calculate the absolute offset where the element was touched...
11
- var deltaX=getTouchPositionX(event)-offsetLeft-_this.touchOffset;// ...and convert it into a relative value between [0...1].
12
- deltaX=Math.max(0,Math.min(1,deltaX/offsetWidth));var stateUpdate={};if(_this.draggedHandle===1){// Right handle dragged
13
- if(_this.state.rangeMin<deltaX){stateUpdate.rangeMax=Math.min(1,deltaX);_this.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this.state.rangeMax);}else{// Not in valid range, swap handles
14
- _this.draggedHandle=0;stateUpdate.rangeMax=_this.state.rangeMin;stateUpdate.rangeMin=deltaX;_this.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this.state.rangeMin);}}else if(_this.draggedHandle===0){// Left handle dragged
15
- if(_this.state.rangeMax>deltaX){stateUpdate.rangeMin=Math.max(0,deltaX);_this.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this.state.rangeMin);}else{// Not in valid range, swap handles
16
- _this.draggedHandle=1;stateUpdate.rangeMin=_this.state.rangeMax;stateUpdate.rangeMax=deltaX;_this.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this.state.rangeMax);}}_this.draggedHandlePixelOffset*=_this.domElement.current.offsetWidth;_this.setState(stateUpdate,_this.triggerChangeCallback);});_defineProperty(_assertThisInitialized(_this),"handleTouchEnd",function(){_this.touchOffset=0;_this.draggedHandle=null;});_defineProperty(_assertThisInitialized(_this),"handleRangeTouch",function(event){var _this$domElement$curr2=_this.domElement.current,offsetWidth=_this$domElement$curr2.offsetWidth,offsetLeft=_this$domElement$curr2.offsetLeft;var dx=(getTouchPositionX(event)-offsetLeft)/offsetWidth;var d0=Math.abs(_this.state.rangeMin-dx);var d1=Math.abs(_this.state.rangeMax-dx);if(d0<d1){_this.draggedHandle=0;}else{_this.draggedHandle=1;}_this.handleTouchMove(event);});_defineProperty(_assertThisInitialized(_this),"handleInputChange",function(event){var max=_this.props.max;var _event$target=event.target,value=_event$target.value,id=_event$target.id;var delta=Math.max(0,Math.min(1,value/(max/100)));var state=id==='price_from'?{rangeMin:delta}:{rangeMax:delta};_this.setState(state);});_this.draggedHandle=null;// 0 for left handle, 1 for right handle or null
17
- _this.domElement=/*#__PURE__*/React.createRef();_this.touchOffset=0;_this.draggedHandlePixelOffset=0;// The absolute pixel delta of the last handle move event.
18
- _this.state=_this.getRange(props);return _this;}/**
19
- * Sets the global event listeners when component mounts.
20
- */_createClass(RangeSlider,[{key:"componentDidMount",value:function componentDidMount(){document.addEventListener('touchend',this.handleTouchEnd);document.addEventListener('touchmove',this.handleTouchMove);}/**
14
+ _this2.touchOffset=getTouchPositionX(event)-handleCenterX;});/**
15
+ * Processes move events on handles.
16
+ * @param {Object} event The touch event
17
+ */_defineProperty(_this2,"handleTouchMove",function(event){if(_this2.props.min===_this2.props.max){return;}if(_this2.draggedHandle===null){return;}var _this2$domElement$cur=_this2.domElement.current.getBoundingClientRect(),offsetWidth=_this2$domElement$cur.width,offsetLeft=_this2$domElement$cur.left;// Calculate the absolute offset where the element was touched...
18
+ var deltaX=getTouchPositionX(event)-offsetLeft-_this2.touchOffset;// ...and convert it into a relative value between [0...1].
19
+ deltaX=Math.max(0,Math.min(1,deltaX/offsetWidth));var stateUpdate={};if(_this2.draggedHandle===1){// Right handle dragged
20
+ if(_this2.state.rangeMin<deltaX){stateUpdate.rangeMax=Math.min(1,deltaX);_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this2.state.rangeMax);}else{// Not in valid range, swap handles
21
+ _this2.draggedHandle=0;stateUpdate.rangeMax=_this2.state.rangeMin;stateUpdate.rangeMin=deltaX;_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this2.state.rangeMin);}}else if(_this2.draggedHandle===0){// Left handle dragged
22
+ if(_this2.state.rangeMax>deltaX){stateUpdate.rangeMin=Math.max(0,deltaX);_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMin-_this2.state.rangeMin);}else{// Not in valid range, swap handles
23
+ _this2.draggedHandle=1;stateUpdate.rangeMin=_this2.state.rangeMax;stateUpdate.rangeMax=deltaX;_this2.draggedHandlePixelOffset=Math.abs(stateUpdate.rangeMax-_this2.state.rangeMax);}}_this2.draggedHandlePixelOffset*=offsetWidth;_this2.setState(stateUpdate,_this2.triggerChangeCallback);});/**
24
+ * Processes global touch end events for handles.
25
+ * @param {Object} e The touch event
26
+ */_defineProperty(_this2,"handleTouchEnd",function(){_this2.removeEventListeners();_this2.touchOffset=0;_this2.draggedHandle=null;});/**
27
+ * Processes outer range touch end events.
28
+ * @param {Object} event The touch event
29
+ */_defineProperty(_this2,"handleRangeTouch",function(event){var _this2$domElement$cur2=_this2.domElement.current.getBoundingClientRect(),offsetWidth=_this2$domElement$cur2.width,offsetLeft=_this2$domElement$cur2.left;var dx=(getTouchPositionX(event)-offsetLeft)/offsetWidth;var d0=Math.abs(_this2.state.rangeMin-dx);var d1=Math.abs(_this2.state.rangeMax-dx);if(d0<d1){_this2.draggedHandle=0;}else{_this2.draggedHandle=1;}_this2.handleTouchMove(event);});/**
30
+ * Processes the input field values.
31
+ * @param {Object} event The change event.
32
+ */_defineProperty(_this2,"handleInputChange",function(event){var max=_this2.props.max;var _event$target=event.target,value=_event$target.value,id=_event$target.id;var delta=Math.max(0,Math.min(1,value/(max/100)));var state=id==='price_from'?{rangeMin:delta}:{rangeMax:delta};_this2.setState(state);});_this2.draggedHandle=null;// 0 for left handle, 1 for right handle or null
33
+ _this2.domElement=React.createRef();_this2.touchOffset=0;_this2.draggedHandlePixelOffset=0;// The absolute pixel delta of the last handle move event.
34
+ _this2.state=_this2.getRange(props);_this2.useMouseEvents=!isTouchDevice();return _this2;}/**
21
35
  * Updates the component properties.
22
36
  * @param {Object} newProps The new component properties.
23
- */},{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(newProps){this.setState(this.getRange(newProps));}/**
24
- * Removes the global event listeners when component unmounts.
25
- */},{key:"componentWillUnmount",value:function componentWillUnmount(){document.removeEventListener('touchend',this.handleTouchEnd);document.removeEventListener('touchmove',this.handleTouchMove);}/**
37
+ */_inherits(RangeSlider,_PureComponent);return _createClass(RangeSlider,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(newProps){this.setState(this.getRange(newProps));}/**
26
38
  * Get the easing function.
27
39
  */},{key:"ease",get:function get(){return{linear:generateLinearEasingCallback(this.props.resolution),exponential:generateExponentialEasingCallback(this.props.factor)}[this.props.easing];}/**
28
40
  * Get the function to invert an eased value to it's original value.
29
41
  */},{key:"invertedEase",get:function get(){return{linear:generateLinearEasingCallback(this.props.resolution),exponential:generateExponentialEasingCallback(1/this.props.factor)}[this.props.easing];}/**
42
+ * Adds event listeners
43
+ */},{key:"addEventListeners",value:function addEventListeners(){if(this.useMouseEvents){document.addEventListener('mouseup',this.handleTouchEnd);document.addEventListener('mousemove',this.handleTouchMove);}else{document.addEventListener('touchend',this.handleTouchEnd);document.addEventListener('touchmove',this.handleTouchMove);}}/**
44
+ * Removes event listeners
45
+ */},{key:"removeEventListeners",value:function removeEventListeners(){if(this.useMouseEvents){document.removeEventListener('mouseup',this.handleTouchEnd);document.removeEventListener('mousemove',this.handleTouchMove);}else{document.removeEventListener('touchend',this.handleTouchEnd);document.removeEventListener('touchmove',this.handleTouchMove);}}/**
30
46
  * Get range min and max from props.
31
47
  * @param {Object} props The component props.
32
48
  * @returns {Object} The new state
33
- */},{key:"getRange",value:function getRange(props){var value=props.value,min=props.min,max=props.max;return{rangeMin:this.invertedEase(getRelativeValue(value[0],min,max)),rangeMax:this.invertedEase(getRelativeValue(value[1],min,max))};}/**
34
- * Processes touch start events on handles.
35
- * @param {Object} event The touch event
36
- * @param {number} index The index of the touched handle.
37
- */},{key:"triggerChangeCallback",value:/**
49
+ */},{key:"getRange",value:function getRange(props){var value=props.value,min=props.min,max=props.max;return{rangeMin:this.invertedEase(getRelativeValue(value[0],min,max)),rangeMax:this.invertedEase(getRelativeValue(value[1],min,max))};}},{key:"triggerChangeCallback",value:/**
38
50
  * Calls the change callback in case of a state update.
39
51
  */function triggerChangeCallback(){var _this$props=this.props,value=_this$props.value,onChange=_this$props.onChange,min=_this$props.min,max=_this$props.max;if(!onChange){return;}var newRange=[getAbsoluteValue(this.ease(this.state.rangeMin),min,max,true),getAbsoluteValue(this.ease(this.state.rangeMax),min,max,true)];if(newRange!==value){onChange(newRange);}}/**
40
52
  * Renders the component.
41
53
  * @returns {JSX}
42
- */},{key:"render",value:function render(){var _this$props2=this.props,classNames=_this$props2.classNames,animationSpeed=_this$props2.animationSpeed;var speed=Math.round(1000/animationSpeed*this.draggedHandlePixelOffset);var rangeStyle=getRangeStyle(this.state.rangeMin,this.state.rangeMax,speed>10?speed:0);return/*#__PURE__*/React.createElement("div",{className:cxs(classNames.container,'engage__range-slider'),onTouchStart:this.handleRangeTouch,"aria-hidden":true},/*#__PURE__*/React.createElement("div",{className:cxs(classNames.outerRange,styles.outerRange),ref:this.domElement},/*#__PURE__*/React.createElement("div",{className:cxs(classNames.range,styles.range),style:rangeStyle},/*#__PURE__*/React.createElement(Handle,{index:0,onTouchStart:this.handleTouchStart,active:this.draggedHandle===0,classNames:classNames}),/*#__PURE__*/React.createElement(Handle,{index:1,onTouchStart:this.handleTouchStart,active:this.draggedHandle===1,classNames:classNames}))));}}]);return RangeSlider;}(PureComponent);_defineProperty(RangeSlider,"defaultProps",{animationSpeed:500,classNames:{},easing:'linear',factor:2,max:100,min:0,resolution:1,value:[0,100],onChange:null});export default RangeSlider;
54
+ */},{key:"render",value:function render(){var _this$props2=this.props,classNames=_this$props2.classNames,animationSpeed=_this$props2.animationSpeed;var speed=Math.round(1000/animationSpeed*this.draggedHandlePixelOffset);var rangeStyle=getRangeStyle(this.state.rangeMin,this.state.rangeMax,speed>10?speed:0);return React.createElement("div",{className:cxs(classNames.container,'engage__range-slider'),onMouseDown:this.handleRangeTouch,"aria-hidden":true},React.createElement("div",{className:cxs(classNames.outerRange,styles.outerRange),ref:this.domElement},React.createElement("div",{className:cxs(classNames.range,styles.range),style:rangeStyle},React.createElement(Handle,{index:0,onTouchStart:this.handleTouchStart,active:this.draggedHandle===0,classNames:classNames,useMouseEvents:this.useMouseEvents}),React.createElement(Handle,{index:1,onTouchStart:this.handleTouchStart,active:this.draggedHandle===1,classNames:classNames,useMouseEvents:this.useMouseEvents}))));}}]);}(PureComponent);_defineProperty(RangeSlider,"defaultProps",{animationSpeed:500,classNames:{},easing:'linear',factor:2,max:100,min:0,resolution:1,value:[0,100],onChange:null});export default RangeSlider;
@@ -1,4 +1,4 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_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;}import React from'react';import{shallow,mount}from'enzyme';import RangeSlider from"./index";import RangeSliderHandle from"./components/Handle";import{generateLinearEasingCallback,generateExponentialEasingCallback,getAbsoluteValue,getRelativeValue}from"./helper";/**
1
+ 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;}import React from'react';import{shallow,mount}from'enzyme';import RangeSlider from"./index";import RangeSliderHandle from"./components/Handle";import{generateLinearEasingCallback,generateExponentialEasingCallback,getAbsoluteValue,getRelativeValue}from"./helper";/**
2
2
  * Creates a (fake) touch event.
3
3
  * @param {number} pageX the x page offset of the simulated touch event
4
4
  * @returns {Object} the new fake event containing only the properties required for testing.
@@ -19,10 +19,10 @@ left:pageX-simulatedHandleHalfWidth};}},touches:[{pageX:pageX}]};return touchEve
19
19
  * @param {Array} simulateSteps A set of relative horizontal pixel movements to simulate.
20
20
  * @param {Function} testCallback An optional callback for the onChange event of the slider.
21
21
  */var simulateInputTest=function simulateInputTest(pxWidth,pxOffset,min,max,value,easing,resolutionOrFactor,simulateSteps,testCallback){var config={totalPixelWidth:pxWidth,leftPixelOffset:pxOffset,min:min,max:max,easing:easing,resolution:resolutionOrFactor,factor:resolutionOrFactor,initialValue:value,valuePixelSize:pxWidth/(max-min),currentTouchDeltaX:0};config.currentTouchDeltaX=config.valuePixelSize*value[1];var ease={linear:generateLinearEasingCallback(config.resolution),exponential:generateExponentialEasingCallback(config.factor)}[config.easing];// eslint-disable-next-line require-jsdoc
22
- var callback=function callback(_ref){var _ref2=_slicedToArray(_ref,2),from=_ref2[0],to=_ref2[1];var currentTouchDeltaX=config.currentTouchDeltaX,valuePixelSize=config.valuePixelSize;var relativeValue=getRelativeValue(currentTouchDeltaX/valuePixelSize,min,max);var expected=getAbsoluteValue(ease(relativeValue),config.min,config.max,true);expect(expected===from||expected===to).toBe(true);if(testCallback){testCallback(config,from,to);}};var wrapper=mount(/*#__PURE__*/React.createElement(RangeSlider,{min:config.min,max:config.max,value:config.initialValue,easing:easing,resolution:config.resolution,factor:config.factor,onChange:callback}));expect(wrapper).toMatchSnapshot();// Create a simulated touch event.
22
+ var callback=function callback(_ref){var _ref2=_slicedToArray(_ref,2),from=_ref2[0],to=_ref2[1];var currentTouchDeltaX=config.currentTouchDeltaX,valuePixelSize=config.valuePixelSize;var relativeValue=getRelativeValue(currentTouchDeltaX/valuePixelSize,min,max);var expected=getAbsoluteValue(ease(relativeValue),config.min,config.max,true);expect(expected===from||expected===to).toBe(true);if(testCallback){testCallback(config,from,to);}};var wrapper=mount(React.createElement(RangeSlider,{min:config.min,max:config.max,value:config.initialValue,easing:easing,resolution:config.resolution,factor:config.factor,onChange:callback}));expect(wrapper).toMatchSnapshot();// Create a simulated touch event.
23
23
  var pageX=config.leftPixelOffset+config.currentTouchDeltaX;var touchEvent=createTouchEvent(pageX);var inst=wrapper.instance();inst.handleTouchStart(touchEvent,1);simulateSteps.forEach(function(deltaX){config.currentTouchDeltaX+=deltaX;touchEvent.touches[0].pageX=config.leftPixelOffset+config.currentTouchDeltaX;Object.defineProperty(inst.domElement,'offsetLeft',{get:function get(){return config.leftPixelOffset;},configurable:true});Object.defineProperty(inst.domElement,'offsetWidth',{get:function get(){return config.totalPixelWidth;},configurable:true});inst.handleTouchMove(touchEvent);});inst.handleTouchEnd();};describe.skip('<RangeSlider />',function(){/**
24
24
  * Simple attribute tests
25
- */it('renders with boundaries',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(RangeSlider,{min:0,max:100}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});it('renders without boundaries',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(RangeSlider,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});it('renders without a value pair',function(){var wrapper=shallow(/*#__PURE__*/React.createElement(RangeSlider,{value:[10,50]}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});/**
25
+ */it('renders with boundaries',function(){var wrapper=shallow(React.createElement(RangeSlider,{min:0,max:100}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});it('renders without boundaries',function(){var wrapper=shallow(React.createElement(RangeSlider,null));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});it('renders without a value pair',function(){var wrapper=shallow(React.createElement(RangeSlider,{value:[10,50]}));expect(wrapper).toMatchSnapshot();expect(wrapper.find(RangeSliderHandle).length).toBe(2);});/**
26
26
  * Callback tests
27
27
  */it('emits onChange if handle was touched (linear)',function(){simulateInputTest(100,73,// Range slider pixel width and offset.
28
28
  0,100,// Range slider minimum and maximum value.
@@ -37,5 +37,5 @@ var pageX=config.leftPixelOffset+config.currentTouchDeltaX;var touchEvent=create
37
37
  0.01,// Resolution.
38
38
  [// A series of pixel offsets to move the slider handle.
39
39
  +10,+10,+10,+10,+10,+10,+10,+10,-10,-10,-10,-10,-10,-10,-10,-10,+3,-15,+17,-80,+104,-23,-12,+67]);});it('emits onChange if the outer range was touched',function(){// eslint-disable-next-line require-jsdoc
40
- var callback=function callback(value){return expect(value).toEqual([-80,0]);};var wrapper=mount(/*#__PURE__*/React.createElement(RangeSlider,{min:-100,max:100,value:[0,0],onChange:callback}));// Create a simulated touch event at a page x offset of 20px.
40
+ var callback=function callback(value){return expect(value).toEqual([-80,0]);};var wrapper=mount(React.createElement(RangeSlider,{min:-100,max:100,value:[0,0],onChange:callback}));// Create a simulated touch event at a page x offset of 20px.
41
41
  var touchEvent=createTouchEvent(20);var inst=wrapper.instance();Object.defineProperty(inst.domElement,'offsetLeft',{get:function get(){return 0;},configurable:true});Object.defineProperty(inst.domElement,'offsetWidth',{get:function get(){return 200;},configurable:true});inst.handleRangeTouch(touchEvent);});});
@@ -0,0 +1,6 @@
1
+ import PropTypes from'prop-types';import{useResponsiveValue}from"./hooks";/**
2
+ * Renders a responsive container that allows to render based on width.
3
+ * @param {Object} props Component props.
4
+ * @returns {React.Node}
5
+ */var ResponsiveContainer=function ResponsiveContainer(_ref){var breakpoint=_ref.breakpoint,webOnly=_ref.webOnly,webAlways=_ref.webAlways,appOnly=_ref.appOnly,appAlways=_ref.appAlways,children=_ref.children;var render=useResponsiveValue(breakpoint,{webOnly:webOnly,webAlways:webAlways,appOnly:appOnly,appAlways:appAlways});if(!render){return null;}return children;};ResponsiveContainer.propTypes={appAlways:PropTypes.bool,appOnly:PropTypes.bool,breakpoint:PropTypes.string,// eslint-disable-next-line react/forbid-prop-types
6
+ children:PropTypes.any,webAlways:PropTypes.bool,webOnly:PropTypes.bool};ResponsiveContainer.defaultProps={children:null,breakpoint:'>=xs',appAlways:false,webAlways:false,webOnly:false,appOnly:false};export default ResponsiveContainer;
@@ -0,0 +1,14 @@
1
+ // Ugly imports to avoid breaking tests due to circular dependencies
2
+ import{isIOSTheme}from'@shopgate/engage/core/helpers/isIOSTheme';import{hasWebBridge}from'@shopgate/engage/core/helpers/bridge';import{IS_PAGE_PREVIEW_ACTIVE}from'@shopgate/engage/page/constants';var iosThemeActive=isIOSTheme();/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
3
+ * Generates a media query for different breakpoints and platform.
4
+ * @param {Object} comparators Comparators.
5
+ * @param {string} breakpoint Breakpoint rule.
6
+ * @param {Object} params Parameters needed to generation.
7
+ * @returns {string}
8
+ */export var parser=function parser(comparators,breakpoint){var _ref=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},_ref$appAlways=_ref.appAlways,appAlways=_ref$appAlways===void 0?false:_ref$appAlways,_ref$appOnly=_ref.appOnly,appOnly=_ref$appOnly===void 0?false:_ref$appOnly,_ref$webOnly=_ref.webOnly,webOnly=_ref$webOnly===void 0?false:_ref$webOnly,_ref$webAlways=_ref.webAlways,webAlways=_ref$webAlways===void 0?false:_ref$webAlways;// Parse breakpoint prop into the comparator and the breakpoint name.
9
+ var breakpointStart=breakpoint.search(/[a-zA-Z]/);var comparatorString=breakpoint.substring(0,breakpointStart===-1?0:breakpointStart);var breakpointString=breakpoint.substring(breakpointStart===-1?0:breakpointStart);// Get configuration.
10
+ var comparator=comparators[comparatorString];var config=breakpoints.find(function(b){return b.name===breakpointString;});// Web / App config.
11
+ // Handle iOS theme as app for now so that media queries in shared components only work for app
12
+ var isWeb=hasWebBridge()&&!iosThemeActive&&!IS_PAGE_PREVIEW_ACTIVE;// Always mode.
13
+ if(webAlways&&isWeb||appAlways&&!isWeb){return true;}// Return media query that never evaluates for now.
14
+ if(appOnly&&isWeb||webOnly&&!isWeb){return false;}return comparator(config.from,config.to,window.innerWidth);};export default breakpoints;
@@ -0,0 +1,6 @@
1
+ import{parser}from"./breakpoints";var comparators={'>=':function _(from,to,width){return width>=from;},'>':function _(from,to,width){return width>=to;},'<':function _(from,to,width){return width<from;},'<=':function _(from,to,width){return width<to;},'':function _(from,to,width){return width>=from&&width<to;}};/**
2
+ * Tests if responsive condition applies.
3
+ * @param {string} breakpoint Breakpoint rule.
4
+ * @param {Object} params Parameters needed to generation.
5
+ * @returns {string}
6
+ */export var responsiveCondition=function responsiveCondition(breakpoint){var params=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var parsed=parser(comparators,breakpoint,params);return parsed;};