@shopgate/engage 7.12.7-beta.1 → 7.20.0-beta.10

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 (504) hide show
  1. package/a11y/components/Section/index.js +2 -2
  2. package/a11y/components/VisuallyHidden/index.js +8 -0
  3. package/a11y/components/index.js +1 -0
  4. package/a11y/constants/index.js +1 -0
  5. package/a11y/helpers/index.js +1 -0
  6. package/a11y/index.js +1 -4
  7. package/account/actions/addContacts.js +2 -2
  8. package/account/actions/deleteContact.js +2 -2
  9. package/account/actions/deleteCustomer.js +2 -2
  10. package/account/actions/fetchContacts.js +2 -2
  11. package/account/actions/fetchCustomer.js +2 -2
  12. package/account/actions/updateContact.js +2 -2
  13. package/account/actions/updateCustomer.js +2 -2
  14. package/account/components/Account/Account.js +1 -1
  15. package/account/components/Account/Account.style.js +1 -1
  16. package/account/components/Profile/Profile.provider.js +3 -3
  17. package/account/components/ProfileContact/ProfileContact.js +1 -1
  18. package/account/reducers/index.js +1 -1
  19. package/app-rating/action-creators/appStart.js +3 -3
  20. package/app-rating/action-creators/ordersPlaced.js +3 -3
  21. package/app-rating/action-creators/popup.js +4 -4
  22. package/app-rating/action-creators/timer.js +3 -3
  23. package/app-rating/actions/showModal.js +6 -6
  24. package/app-rating/constants/index.js +2 -2
  25. package/app-rating/reducers/index.js +2 -2
  26. package/app-rating/subscriptions/index.js +4 -4
  27. package/back-in-stock/actions/index.js +14 -0
  28. package/back-in-stock/components/BackInStockButton/connector.js +1 -0
  29. package/back-in-stock/components/BackInStockButton/index.js +14 -0
  30. package/back-in-stock/components/BackInStockButton/style.js +1 -0
  31. package/back-in-stock/components/CharacteristicsButton/connector.js +3 -0
  32. package/back-in-stock/components/CharacteristicsButton/index.js +8 -0
  33. package/back-in-stock/components/ProductInfoBackInStockButton/connector.js +3 -0
  34. package/back-in-stock/components/ProductInfoBackInStockButton/index.js +10 -0
  35. package/back-in-stock/components/Subscriptions/components/List/index.js +4 -0
  36. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +7 -0
  37. package/back-in-stock/components/Subscriptions/index.js +4 -0
  38. package/back-in-stock/components/index.js +1 -0
  39. package/back-in-stock/constants/Actions.js +1 -0
  40. package/back-in-stock/constants/Common.js +1 -0
  41. package/back-in-stock/constants/Pipelines.js +1 -0
  42. package/back-in-stock/constants/Portals.js +9 -0
  43. package/back-in-stock/constants/index.js +1 -0
  44. package/back-in-stock/hooks/index.js +4 -0
  45. package/back-in-stock/providers/BackInStockSubscriptionsProvider.connector.js +7 -0
  46. package/back-in-stock/providers/BackInStockSubscriptionsProvider.js +5 -0
  47. package/back-in-stock/providers/index.js +1 -0
  48. package/back-in-stock/reducers/index.js +5 -0
  49. package/back-in-stock/selectors/index.js +43 -0
  50. package/back-in-stock/streams/index.js +1 -0
  51. package/back-in-stock/subscriptions/index.js +11 -0
  52. package/cart/cart.helpers.js +9 -2
  53. package/cart/components/CartItem/CartItemCoupon.js +10 -6
  54. package/cart/components/CartItem/CartItemCouponCode.js +2 -2
  55. package/cart/components/CartItem/CartItemCouponDelete.js +1 -1
  56. package/cart/components/CartItem/CartItemCouponFreeShipping.js +1 -1
  57. package/cart/components/CartItem/CartItemCouponIcon.js +2 -2
  58. package/cart/components/CartItem/CartItemCouponLayout.style.js +5 -1
  59. package/cart/components/CartItem/CartItemCouponTitle.js +2 -2
  60. package/cart/components/CartItem/CartItemProductLayout.js +4 -2
  61. package/cart/components/CartItem/CartItemProductLayoutWide.style.js +1 -1
  62. package/cart/components/CartItem/CartItemProductTitle.js +2 -2
  63. package/cart/components/CartItem/CartItemQuantityPicker.js +26 -14
  64. package/cart/components/CartItem/CartItemSubstitution.js +1 -1
  65. package/cart/components/CartItems/CartItemCardReservation.js +1 -1
  66. package/cart/components/CartItems/CartItemGroupReservation.js +1 -1
  67. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.style.js +1 -1
  68. package/cart/components/PaymentBar/PaymentBar.js +1 -1
  69. package/cart/components/PaymentBar/PaymentBarCheckoutButton.style.js +1 -1
  70. package/cart/components/PaymentBar/PaymentBarPromotionCouponMessages.js +1 -1
  71. package/cart/index.js +3 -2
  72. package/cart/streams/index.js +1 -0
  73. package/category/actions/index.js +1 -0
  74. package/category/components/CategoryList/index.js +7 -0
  75. package/category/components/CategoryList/style.js +1 -0
  76. package/category/components/index.js +1 -1
  77. package/category/constants/index.js +1 -0
  78. package/category/helpers/index.js +1 -0
  79. package/category/index.js +1 -6
  80. package/category/selectors/index.js +2 -0
  81. package/category/streams/index.js +1 -1
  82. package/checkout/actions/errorCheckout.js +1 -1
  83. package/checkout/actions/fetchCheckoutOrder.js +1 -1
  84. package/checkout/actions/fetchPaymentMethods.js +1 -1
  85. package/checkout/actions/initializeCheckout.js +1 -1
  86. package/checkout/actions/prepareCheckout.js +2 -2
  87. package/checkout/actions/submitCheckoutOrder.js +1 -1
  88. package/checkout/actions/updateCheckoutOrder.js +1 -1
  89. package/checkout/components/Checkout/CheckoutPickupContactForm.config.js +1 -1
  90. package/checkout/components/Checkout/CheckoutSectionMessages.js +1 -1
  91. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +1 -1
  92. package/checkout/components/CheckoutConfirmation/CheckoutConfirmationBilledTo.js +1 -1
  93. package/checkout/components/GuestCheckout/GuestCheckoutPickupNotes.config.js +1 -1
  94. package/checkout/components/PaymentMethodButton/PaymentMethodButton.js +1 -1
  95. package/checkout/components/ShippingMethods/ShippingMethods.js +4 -4
  96. package/checkout/components/index.js +1 -1
  97. package/checkout/constants/index.js +1 -1
  98. package/checkout/index.js +3 -4
  99. package/checkout/paymentMethods/index.js +2 -2
  100. package/checkout/paymentMethods/paypal/PaypalButtonApp.js +1 -1
  101. package/checkout/paymentMethods/paypal/PaypalButtonWeb.js +1 -1
  102. package/checkout/paymentMethods/paypal/PaypalPayButton.js +1 -1
  103. package/checkout/paymentMethods/paypal/PaypalProvider.js +1 -1
  104. package/checkout/paymentMethods/stripe/StripeButton.js +2 -2
  105. package/checkout/paymentMethods/stripe/StripeCreditCard.js +3 -3
  106. package/checkout/paymentMethods/stripe/StripeProvider.js +8 -8
  107. package/checkout/paymentMethods/stripe/sdk.js +3 -2
  108. package/checkout/providers/AddressBookProvider.js +1 -1
  109. package/checkout/providers/CheckoutProvider.js +8 -8
  110. package/components/ChipLayout/index.js +38 -0
  111. package/components/ChipLayout/spec.js +5 -0
  112. package/components/ChipLayout/style.js +5 -0
  113. package/components/ConditionalWrapper/ConditionalWrapper.js +7 -2
  114. package/components/Footer/Footer.js +7 -7
  115. package/components/Form/Builder/Builder.js +50 -29
  116. package/components/Form/Builder/ElementCheckbox.js +1 -1
  117. package/components/Form/Builder/ElementMultiSelect.js +1 -1
  118. package/components/Form/Builder/ElementPhoneNumber.js +3 -3
  119. package/components/Form/Builder/ElementRadio.js +1 -1
  120. package/components/Form/Builder/ElementSelect.js +1 -1
  121. package/components/Form/Builder/ElementText.js +3 -3
  122. package/components/Form/Builder/classes/ActionListener.constants.js +2 -2
  123. package/components/Form/Builder/classes/ActionListener.js +73 -16
  124. package/components/Form/Builder/helpers/buildFormElements.js +2 -2
  125. package/components/Form/Form.js +8 -5
  126. package/components/IntersectionVisibility/index.js +14 -7
  127. package/components/Logo/connector.js +4 -0
  128. package/components/Logo/index.js +4 -0
  129. package/components/Logo/spec.js +1 -0
  130. package/components/Logo/style.js +1 -0
  131. package/components/Menu/components/Position/index.js +5 -5
  132. package/components/Menu/index.js +9 -9
  133. package/components/MessageBar/MessageBar.js +1 -1
  134. package/components/MessageBar/index.js +1 -1
  135. package/components/NavigationHandler/index.js +4 -4
  136. package/components/NavigationHandler/spec.js +1 -1
  137. package/components/Picker/components/Button/index.js +1 -1
  138. package/components/Picker/components/List/index.js +2 -2
  139. package/components/Picker/components/Modal/index.js +7 -7
  140. package/components/Picker/index.js +18 -9
  141. package/components/PickerUtilize/components/Button/index.js +5 -0
  142. package/components/PickerUtilize/components/Button/style.js +1 -0
  143. package/components/PickerUtilize/index.js +17 -0
  144. package/components/PickerUtilize/spec.js +1 -0
  145. package/components/PickerUtilize/style.js +1 -0
  146. package/components/QuantityInput/QuantityInput.js +5 -4
  147. package/components/Radio/Radio.js +1 -1
  148. package/components/RadioCard/RadioCard.js +1 -1
  149. package/components/RangeSlider/components/Handle/index.js +1 -1
  150. package/components/RangeSlider/index.js +36 -24
  151. package/components/ResponsiveContainer/ResponsiveContainer.js +2 -6
  152. package/components/ResponsiveContainer/breakpoints.js +2 -1
  153. package/components/ResponsiveContainer/hooks.js +20 -0
  154. package/components/ScrollHeader/index.js +2 -2
  155. package/components/ScrollHeader/style.js +1 -1
  156. package/components/SheetList/components/Item/index.js +5 -5
  157. package/components/SheetList/index.js +4 -4
  158. package/components/SideNavigation/SideNavigationCategories.connector.js +2 -2
  159. package/components/SnackBarContainer/index.js +5 -0
  160. package/components/Switch/index.js +12 -0
  161. package/components/Switch/style.js +1 -0
  162. package/components/Tabs/components/TabIndicator.js +2 -2
  163. package/components/Tabs/components/Tabs.js +1 -1
  164. package/components/TimeBoundary/index.js +8 -6
  165. package/components/VideoPlayer/index.js +9 -6
  166. package/components/View/components/Above/index.js +1 -1
  167. package/components/View/components/Below/index.js +1 -1
  168. package/components/View/components/Content/index.js +18 -11
  169. package/components/View/index.js +1 -1
  170. package/components/View/provider.js +22 -5
  171. package/components/index.js +2 -2
  172. package/core/action-creators/app.js +5 -0
  173. package/core/action-creators/appPermissions.js +9 -0
  174. package/core/action-creators/index.js +1 -1
  175. package/core/actions/getGeolocation.js +2 -2
  176. package/core/actions/grantAppTrackingTransparencyPermission.js +6 -0
  177. package/core/actions/grantCameraPermissions.js +1 -1
  178. package/core/actions/grantGeolocationPermissions.js +1 -1
  179. package/core/actions/grantPermissions.js +13 -6
  180. package/core/actions/grantPushPermissions.js +22 -0
  181. package/core/actions/index.js +7 -0
  182. package/core/actions/requestAppPermission.js +12 -0
  183. package/core/actions/requestAppPermissionStatus.js +12 -0
  184. package/core/classes/GeolocationRequest.js +2 -3
  185. package/core/classes/GeolocationRequestApp.js +6 -6
  186. package/core/classes/GeolocationRequestBrowser.js +2 -2
  187. package/core/classes/index.js +1 -0
  188. package/core/collections/AppInitialization.js +49 -0
  189. package/core/collections/index.js +1 -0
  190. package/core/commands/analyticsSetConsent.js +11 -0
  191. package/core/commands/index.js +1 -0
  192. package/core/config/ThemeConfigResolver.js +2 -2
  193. package/core/config/config.action-creators.js +1 -1
  194. package/core/config/config.actions.js +1 -1
  195. package/core/config/config.reducers.js +1 -1
  196. package/core/config/config.subscriptions.js +2 -2
  197. package/core/config/index.js +1 -1
  198. package/core/constants/actionTypes.js +1 -0
  199. package/core/constants/appFeatures.js +1 -0
  200. package/core/constants/index.js +6 -1
  201. package/core/contexts/index.js +1 -0
  202. package/core/helpers/appFeatures.js +15 -0
  203. package/core/helpers/appPermissions.js +43 -6
  204. package/core/helpers/baseUrl.js +14 -0
  205. package/core/helpers/environment.js +4 -0
  206. package/core/helpers/getFullImageSource.js +1 -1
  207. package/core/helpers/i18n.js +5 -3
  208. package/core/helpers/index.js +7 -0
  209. package/core/hocs/index.js +1 -0
  210. package/core/hocs/withCurrentProduct.js +6 -6
  211. package/core/hocs/withTheme.js +2 -2
  212. package/core/hooks/index.js +1 -0
  213. package/core/hooks/useAsyncMemo.js +1 -1
  214. package/core/hooks/useFormState.js +1 -1
  215. package/core/hooks/useScrollTo.js +1 -1
  216. package/core/hooks/useTheme.js +2 -2
  217. package/core/index.js +5 -52
  218. package/core/initialization/index.js +4 -2
  219. package/core/providers/AppProvider.js +10 -8
  220. package/core/providers/index.js +1 -0
  221. package/core/reducers/app.js +6 -0
  222. package/core/reducers/index.js +1 -1
  223. package/core/reducers/merchantSettings.js +1 -1
  224. package/core/reducers/shopSettings.js +1 -1
  225. package/core/selectors/app.js +9 -0
  226. package/core/selectors/index.js +6 -1
  227. package/core/streams/app.js +8 -0
  228. package/core/streams/appPermissions.js +19 -0
  229. package/core/streams/index.js +4 -0
  230. package/core/subscriptions/app.js +7 -0
  231. package/favorites/components/Item/Item.js +7 -7
  232. package/favorites/components/List/List.js +18 -7
  233. package/favorites/components/List/ListAccordionLabel.js +4 -0
  234. package/favorites/components/List/ListContent.js +8 -0
  235. package/favorites/components/List/ListItemWrapper.js +6 -0
  236. package/favorites/components/List/styles.js +1 -0
  237. package/favorites/components/Lists/Lists.js +5 -5
  238. package/favorites/components/Lists/ListsModal.js +3 -2
  239. package/favorites/constants/index.js +1 -0
  240. package/filter/actions/index.js +1 -0
  241. package/filter/components/PriceSlider/index.js +9 -9
  242. package/filter/components/PriceSlider/style.js +1 -3
  243. package/filter/components/index.js +1 -0
  244. package/filter/constants/index.js +1 -1
  245. package/filter/helpers/buildFilterParamsForFetchFiltersRequest.js +9 -0
  246. package/filter/helpers/buildInitialFilters.js +1 -1
  247. package/filter/helpers/buildUpdatedFilters.js +1 -1
  248. package/filter/helpers/index.js +1 -0
  249. package/filter/helpers/translateFilterLabel.js +6 -0
  250. package/filter/index.js +2 -7
  251. package/filter/providers/SortProvider.helpers.js +1 -1
  252. package/filter/selectors/index.js +1 -1
  253. package/filter/streams/index.js +1 -0
  254. package/i18n/locale/cs-cz/countries.json +255 -0
  255. package/i18n/locale/de-de/countries.json +26 -28
  256. package/i18n/locale/el-gr/countries.json +255 -0
  257. package/i18n/locale/en-us/countries.json +12 -14
  258. package/i18n/locale/es-es/countries.json +65 -67
  259. package/i18n/locale/fi-fi/countries.json +255 -0
  260. package/i18n/locale/fr-fr/countries.json +85 -87
  261. package/i18n/locale/hu-hu/countries.json +255 -0
  262. package/i18n/locale/it-it/countries.json +11 -13
  263. package/i18n/locale/nl-nl/countries.json +42 -44
  264. package/i18n/locale/pl-pl/countries.json +255 -0
  265. package/i18n/locale/pt-pt/countries.json +128 -130
  266. package/i18n/locale/ro-ro/countries.json +255 -0
  267. package/i18n/locale/sv-se/countries.json +255 -0
  268. package/locations/action-creators/receiveInventories.js +3 -5
  269. package/locations/actions/fetchFulfillmentSlots.js +1 -1
  270. package/locations/actions/fetchProductLocations.js +2 -2
  271. package/locations/actions/setUserGeolocation.js +1 -1
  272. package/locations/actions/setUserSearchGeolocation.js +1 -1
  273. package/locations/components/Cart/CartContextMenuChangeFulfillmentContent.js +1 -1
  274. package/locations/components/FulfillmentPath/FulfillmentPath.js +1 -1
  275. package/locations/components/FulfillmentPath/FulfillmentPathItem.js +2 -2
  276. package/locations/components/FulfillmentSelector/FulfillmentSelectorAddToCart.js +2 -2
  277. package/locations/components/FulfillmentSelector/FulfillmentSelectorAlternativeLocation.js +1 -1
  278. package/locations/components/FulfillmentSheet/FulfillmentSheet.js +2 -2
  279. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +1 -1
  280. package/locations/components/ReserveForm/ReserveForm.js +1 -1
  281. package/locations/components/ReserveForm/ReserveFormPhone.js +1 -1
  282. package/locations/components/StockInfo/StockInfo.defaultSettings.js +1 -1
  283. package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -2
  284. package/locations/components/StoreList/StoreListSearch.js +5 -3
  285. package/locations/locations.streams.js +1 -1
  286. package/locations/providers/FulfillmentProvider.js +4 -4
  287. package/locations/providers/StoreFinderProvider.js +1 -1
  288. package/locations/reducers/storage.js +3 -3
  289. package/locations/selectors/index.js +2 -2
  290. package/locations/subscriptions.js +13 -13
  291. package/login/components/ForgotPassword/ForgotPassword.js +1 -1
  292. package/orders/actions/cancelOrder.js +1 -1
  293. package/orders/actions/fetchOrderDetails.js +1 -1
  294. package/orders/constants/status.js +2 -2
  295. package/orders/index.js +1 -1
  296. package/orders/providers/OrderDetailsPrivateProvider.js +1 -1
  297. package/orders/providers/OrderDetailsProvider.js +3 -3
  298. package/package.json +8 -8
  299. package/page/actions/index.js +1 -0
  300. package/page/components/index.js +1 -0
  301. package/page/constants/index.js +1 -0
  302. package/page/index.js +2 -4
  303. package/page/selectors/index.js +7 -0
  304. package/product/collections/index.js +1 -0
  305. package/product/components/Availability/Availability.connector.js +4 -5
  306. package/product/components/Availability/Availability.js +3 -3
  307. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +20 -0
  308. package/product/components/Characteristics/Characteristic/components/SheetItem/index.js +10 -0
  309. package/product/components/Characteristics/Characteristic/components/SheetItem/style.js +1 -0
  310. package/product/components/Characteristics/Characteristic/index.js +18 -0
  311. package/product/components/Characteristics/Characteristic/style.js +1 -0
  312. package/product/components/Characteristics/Swatch/index.js +12 -0
  313. package/product/components/Characteristics/Swatch/style.js +1 -0
  314. package/product/components/Characteristics/index.js +12 -0
  315. package/product/components/Characteristics/transition.js +1 -0
  316. package/product/components/Description/index.js +2 -2
  317. package/product/components/EffectivityDates/helpers.js +3 -3
  318. package/product/components/EffectivityDates/index.js +1 -1
  319. package/product/components/Header/PriceStriked/connector.js +9 -0
  320. package/product/components/Header/PriceStriked/index.js +5 -0
  321. package/product/components/Header/PriceStriked/style.js +1 -0
  322. package/product/components/Header/Shipping/components/Label/index.js +6 -0
  323. package/product/components/Header/Shipping/components/Label/style.js +1 -0
  324. package/product/components/Header/Shipping/connector.js +9 -0
  325. package/product/components/Header/Shipping/index.js +5 -0
  326. package/product/components/Header/Shipping/mock.js +1 -0
  327. package/product/components/Header/Shipping/spec.js +5 -0
  328. package/product/components/Header/Shipping/style.js +1 -0
  329. package/product/components/Header/Tiers/components/Tier/index.js +6 -0
  330. package/product/components/Header/Tiers/components/Tier/spec.js +1 -0
  331. package/product/components/Header/Tiers/connector.js +10 -0
  332. package/product/components/Header/Tiers/index.js +5 -0
  333. package/product/components/Header/Tiers/spec.js +1 -0
  334. package/product/components/Header/Tiers/style.js +1 -0
  335. package/product/components/Header/index.js +1 -0
  336. package/product/components/MapPriceHint/index.js +1 -1
  337. package/product/components/Media/FeaturedMedia.js +1 -1
  338. package/product/components/MediaSlider/index.js +1 -1
  339. package/product/components/Options/components/Content/connector.js +10 -0
  340. package/product/components/Options/components/Content/index.js +16 -0
  341. package/product/components/Options/components/Content/spec.js +2 -0
  342. package/product/components/Options/components/Option/index.js +4 -0
  343. package/product/components/Options/components/TextOption/components/OptionInfo/index.js +9 -0
  344. package/product/components/Options/components/TextOption/components/OptionInfo/spec.js +1 -0
  345. package/product/components/Options/components/TextOption/components/OptionInfo/style.js +1 -0
  346. package/product/components/Options/components/TextOption/index.js +22 -0
  347. package/product/components/Options/components/TextOption/style.js +1 -0
  348. package/product/components/Options/index.js +5 -0
  349. package/product/components/OrderQuantityHint/index.js +3 -2
  350. package/product/components/OrderQuantityHint/style.js +1 -1
  351. package/product/components/PriceDifference/index.js +1 -1
  352. package/product/components/ProductCard/index.js +2 -2
  353. package/product/components/ProductCharacteristics/helpers/index.js +1 -1
  354. package/product/components/ProductCharacteristics/index.js +28 -12
  355. package/product/components/ProductDiscountBadge/spec.js +1 -1
  356. package/product/components/ProductGridPrice/index.js +2 -2
  357. package/product/components/ProductImage/index.js +15 -12
  358. package/product/components/ProductList/components/Item/index.js +5 -0
  359. package/product/components/ProductList/components/Item/style.js +2 -0
  360. package/product/components/ProductList/components/Iterator/index.js +5 -0
  361. package/product/components/ProductList/components/Iterator/style.js +1 -0
  362. package/product/components/ProductList/components/Layout/index.js +5 -0
  363. package/product/components/ProductList/components/Layout/style.js +1 -0
  364. package/product/components/ProductList/index.js +5 -0
  365. package/product/components/ProductProperties/Content.js +1 -1
  366. package/product/components/ProductProperties/GroupedProperties.js +1 -1
  367. package/product/components/ProductProperties/ListsHTML.js +1 -1
  368. package/product/components/ProductProperties/ProductProperties.js +1 -1
  369. package/product/components/ProductProperties/RowHTML.js +1 -1
  370. package/product/components/ProductProperties/Wrapper.js +1 -1
  371. package/product/components/ProductProperties/style.js +1 -1
  372. package/product/components/ProductSlider/index.js +4 -0
  373. package/product/components/ProductSlider/spec.js +1 -0
  374. package/product/components/ProductSlider/style.js +1 -0
  375. package/product/components/QuantityPicker/hooks.js +5 -0
  376. package/product/components/QuantityPicker/index.js +2 -2
  377. package/product/components/Rating/connector.js +9 -0
  378. package/product/components/Rating/index.js +7 -0
  379. package/product/components/Rating/mock.js +5 -0
  380. package/product/components/Rating/spec.js +5 -0
  381. package/product/components/Rating/style.js +1 -0
  382. package/product/components/Swatch/SwatchContent.js +1 -1
  383. package/product/components/UnitQuantityPicker/CartUnitQuantityPicker.js +2 -2
  384. package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +3 -2
  385. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +6 -3
  386. package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +7 -0
  387. package/product/components/UnitQuantityPicker/index.js +1 -1
  388. package/product/components/index.js +1 -0
  389. package/product/constants/index.js +1 -1
  390. package/product/contexts/index.js +1 -0
  391. package/product/helpers/index.js +2 -2
  392. package/product/helpers/redirects.js +1 -1
  393. package/product/hocs/index.js +1 -0
  394. package/product/hooks/index.js +1 -0
  395. package/product/index.js +4 -11
  396. package/product/providers/Product/connector.js +5 -0
  397. package/product/providers/Product/index.js +4 -0
  398. package/product/providers/index.js +1 -0
  399. package/product/selectors/product.js +24 -3
  400. package/product/selectors/variants.js +2 -2
  401. package/product/streams/index.js +1 -0
  402. package/push-opt-in/action-creators/index.js +1 -0
  403. package/push-opt-in/action-creators/optInTrigger.js +23 -0
  404. package/push-opt-in/action-creators/pushOptIn.js +7 -0
  405. package/push-opt-in/actions/index.js +1 -0
  406. package/push-opt-in/actions/pushOptInModal.js +8 -0
  407. package/push-opt-in/components/PushOptInModal/connector.js +9 -0
  408. package/push-opt-in/components/PushOptInModal/index.js +9 -0
  409. package/push-opt-in/components/PushOptInModal/push-opt-in.svg +62 -0
  410. package/push-opt-in/components/PushOptInModal/style.js +1 -0
  411. package/push-opt-in/components/index.js +1 -0
  412. package/push-opt-in/constants/index.js +1 -0
  413. package/push-opt-in/constants/optInModal.js +1 -0
  414. package/push-opt-in/constants/optInTrigger.js +1 -0
  415. package/push-opt-in/reducers/index.js +1 -0
  416. package/push-opt-in/reducers/optInModal.js +6 -0
  417. package/push-opt-in/reducers/optInTrigger.js +6 -0
  418. package/push-opt-in/selectors/index.js +1 -0
  419. package/push-opt-in/selectors/optInModal.js +8 -0
  420. package/push-opt-in/selectors/optInTrigger.js +5 -0
  421. package/push-opt-in/subscriptions/index.js +1 -0
  422. package/push-opt-in/subscriptions/optInTrigger.js +12 -0
  423. package/registration/components/index.js +1 -0
  424. package/registration/index.js +1 -1
  425. package/registration/providers/GuestRegistrationProvider.actions.js +2 -2
  426. package/registration/providers/GuestRegistrationProvider.js +3 -3
  427. package/registration/providers/RegistrationProvider.actions.js +3 -3
  428. package/registration/providers/RegistrationProvider.js +2 -2
  429. package/registration/subscriptions/index.js +1 -1
  430. package/reviews/actions/index.js +1 -0
  431. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +1 -1
  432. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/style.js +1 -2
  433. package/reviews/components/Reviews/components/List/index.js +3 -3
  434. package/reviews/components/Reviews/components/List/spec.js +1 -1
  435. package/reviews/components/Reviews/components/RatingCount/index.js +1 -1
  436. package/reviews/components/Reviews/components/RatingCount/style.js +1 -2
  437. package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
  438. package/reviews/components/Reviews/spec.js +1 -1
  439. package/reviews/components/index.js +1 -0
  440. package/reviews/constants/index.js +1 -0
  441. package/reviews/index.js +3 -7
  442. package/reviews/selectors/index.js +1 -0
  443. package/reviews/streams/index.js +1 -0
  444. package/scanner/action-creators/index.js +1 -0
  445. package/scanner/actions/index.js +1 -0
  446. package/scanner/classes/index.js +1 -0
  447. package/scanner/constants/index.js +1 -0
  448. package/scanner/helpers/index.js +1 -0
  449. package/scanner/index.js +1 -6
  450. package/scanner/streams/index.js +1 -0
  451. package/search/actions/index.js +1 -0
  452. package/search/constants/index.js +1 -0
  453. package/search/helpers/index.js +1 -0
  454. package/search/index.js +1 -6
  455. package/search/selectors/index.js +1 -0
  456. package/search/streams/index.js +1 -0
  457. package/styles/helpers/index.js +1 -0
  458. package/styles/helpers/initCSSCustomProperties.js +3 -3
  459. package/styles/helpers/loadCustomStyles.js +2 -2
  460. package/styles/helpers/setPageBackgroundColor.js +2 -1
  461. package/styles/helpers/setPageContentWidth.js +2 -1
  462. package/styles/index.js +1 -1
  463. package/tracking/action-creators/cookieConsent.js +24 -0
  464. package/tracking/action-creators/index.js +1 -4
  465. package/tracking/actions/cookieConsent.js +21 -0
  466. package/tracking/actions/index.js +1 -0
  467. package/tracking/components/CookieConsentModal/connector.js +6 -0
  468. package/tracking/components/CookieConsentModal/index.js +9 -0
  469. package/tracking/components/CookieConsentModal/style.js +1 -0
  470. package/tracking/components/CookieConsentModal/tracking-opt-in.svg +18 -0
  471. package/tracking/components/PrivacySettings/connector.js +6 -0
  472. package/tracking/components/PrivacySettings/index.js +4 -0
  473. package/tracking/components/PrivacySettings/style.js +1 -0
  474. package/tracking/components/index.js +1 -1
  475. package/tracking/constants/index.js +1 -1
  476. package/tracking/reducers/cookieConsentModal.js +6 -0
  477. package/tracking/reducers/cookieSettings.js +6 -0
  478. package/tracking/reducers/index.js +1 -0
  479. package/tracking/selectors/cookieConsent.js +35 -0
  480. package/tracking/selectors/index.js +1 -4
  481. package/tracking/streams/cookieConsent.js +46 -0
  482. package/tracking/streams/index.js +1 -1
  483. package/tracking/subscriptions/analytics.js +11 -0
  484. package/tracking/subscriptions/cookieConsent.js +13 -0
  485. package/tracking/subscriptions/index.js +1 -4
  486. package/components/MessageBar/MessageBar.types.js +0 -0
  487. package/components/MessageBar/style.js +0 -1
  488. package/i18n/locale/ru-ru/countries.json +0 -251
  489. package/product/components/Availability/Availability.types.js +0 -1
  490. package/product/components/QuantityPicker/helpers.js +0 -5
  491. package/tracking/components/CookieConsent/CookieConsent.connector.js +0 -4
  492. package/tracking/components/CookieConsent/CookieConsent.js +0 -4
  493. package/tracking/components/CookieConsent/CookieConsentButtons.js +0 -3
  494. package/tracking/components/CookieConsent/CookieConsentCheckboxes.js +0 -3
  495. package/tracking/components/CookieConsent/CookieConsentContent.js +0 -4
  496. package/tracking/components/CookieConsent/CookieConsentMessage.js +0 -4
  497. package/tracking/components/CookieConsent/index.js +0 -1
  498. package/tracking/helpers/index.js +0 -7
  499. package/tracking/hooks/index.js +0 -4
  500. package/tracking/index.js +0 -1
  501. package/tracking/providers/CookieConsentProvider.connector.js +0 -4
  502. package/tracking/providers/CookieConsentProvider.js +0 -8
  503. /package/{tracking/providers/CookieConsentProvider.context.js → back-in-stock/providers/BackInStockSubscriptionsProvider.context.js} +0 -0
  504. /package/page/{NotFound.js → components/NotFound.js} +0 -0
@@ -1,6 +1,6 @@
1
- import React,{Fragment}from'react';import PropTypes from'prop-types';import{Grid,Price,PriceStriked}from'@shopgate/engage/components';import{PriceInfo}from'@shopgate/engage/product';import withPriceCalculation from"../../hocs/withPriceCalculation";import styles from"./style";/**
1
+ import React,{Fragment}from'react';import PropTypes from'prop-types';import{Grid,Price,PriceStriked}from'@shopgate/engage/components';import{PriceInfo}from'@shopgate/engage/product/components';import{withPriceCalculation}from'@shopgate/engage/product/hocs';import styles from"./style";/**
2
2
  * The ProductGridPrice component is supposed to be used to display prices at product grids. It
3
3
  * renders a row with the current price and a strike price when present. As same as the price info.
4
4
  * @param {Object} product A product entity.
5
5
  * @return {JSX}
6
- */var ProductGridPrice=function ProductGridPrice(_ref){var product=_ref.product;var price=product.price;return React.createElement(Fragment,null,React.createElement(Grid,{className:styles.priceWrapper,wrap:true},React.createElement(Grid.Item,{grow:1},React.createElement(Price,{currency:price.currency,discounted:!!price.discount,unitPrice:price.unitPrice,unitPriceMin:price.unitPriceMin})),price.msrp>0&&price.unitPrice!==price.msrp&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.msrp,currency:price.currency})),!price.msrp&&price.unitPriceStriked>0&&price.unitPrice!==price.unitPriceStriked&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.unitPriceStriked,currency:price.currency}))),React.createElement(PriceInfo,{product:product,className:styles.basicPrice,wrapper:function wrapper(children){return React.createElement(Grid,null,React.createElement(Grid.Item,null,children));}}));};export default withPriceCalculation(ProductGridPrice);
6
+ */var ProductGridPrice=function ProductGridPrice(_ref){var product=_ref.product;var price=product.price;return React.createElement(Fragment,null,React.createElement(Grid,{className:"".concat(styles.priceWrapper," engage__product__product-grid-price"),wrap:true},React.createElement(Grid.Item,{grow:1},React.createElement(Price,{currency:price.currency,discounted:!!price.discount,unitPrice:price.unitPrice,unitPriceMin:price.unitPriceMin})),price.msrp>0&&price.unitPrice!==price.msrp&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.msrp,currency:price.currency})),!price.msrp&&price.unitPriceStriked>0&&price.unitPrice!==price.unitPriceStriked&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.unitPriceStriked,currency:price.currency}))),React.createElement(PriceInfo,{product:product,className:styles.basicPrice,wrapper:function wrapper(children){return React.createElement(Grid,null,React.createElement(Grid.Item,null,children));}}));};export default withPriceCalculation(ProductGridPrice);
@@ -1,28 +1,31 @@
1
- function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import isEqual from'lodash/isEqual';import classnames from'classnames';import{logger}from'@shopgate/pwa-core';import appConfig,{themeConfig}from'@shopgate/pwa-common/helpers/config';import Image from'@shopgate/pwa-common/components/Image';import PlaceholderIcon from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';import SurroundPortals from'@shopgate/pwa-common/components/SurroundPortals';import{withWidgetSettings}from"../../../core/hocs/withWidgetSettings";import{PORTAL_PRODUCT_IMAGE}from"../../../components/constants";import ProductImagePlaceholder from"./ProductImagePlaceholder";import styles from"./style";import connect from"./connector";var colors=themeConfig.colors;/**
1
+ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _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 isEqual from'lodash/isEqual';import classnames from'classnames';import{logger}from'@shopgate/pwa-core';import appConfig,{themeConfig}from'@shopgate/pwa-common/helpers/config';import Image from'@shopgate/pwa-common/components/Image';import PlaceholderIcon from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';import SurroundPortals from'@shopgate/pwa-common/components/SurroundPortals';import{withWidgetSettings}from"../../../core/hocs/withWidgetSettings";import{PORTAL_PRODUCT_IMAGE}from"../../../components/constants";import ProductImagePlaceholder from"./ProductImagePlaceholder";import styles from"./style";import connect from"./connector";var colors=themeConfig.colors;/**
2
2
  * The product image component.
3
3
  * This component will behave like the core Image component with the additional
4
4
  * feature of showing a placeholder in case no src property has been passed
5
5
  * or the given source image cannot be loaded.
6
- */var ProductImage=/*#__PURE__*/function(_Component){_inherits(ProductImage,_Component);/**
7
- * See Image component manual for detailed description about the component property types.
8
- */ /**
6
+ */var ProductImage=/*#__PURE__*/function(_Component){/**
9
7
  * Component constructor
10
8
  * @param {Object} props The component properties
11
- */function ProductImage(props){var _this;_classCallCheck(this,ProductImage);_this=_possibleConstructorReturn(this,_getPrototypeOf(ProductImage).call(this,props));_defineProperty(_assertThisInitialized(_this),"imageLoadingFailed",function(){_this.setState({showPlaceholder:true,imageLoadingFailed:true});});_defineProperty(_assertThisInitialized(_this),"getImageRatio",function(){if(_this.props.ratio){var _this$props$ratio=_slicedToArray(_this.props.ratio,2),x=_this$props$ratio[0],y=_this$props$ratio[1];return(y/x).toFixed(3);}var _this$props$resolutio=_this.props.resolutions[_this.props.resolutions.length-1],width=_this$props$resolutio.width,height=_this$props$resolutio.height;return(height/width).toFixed(3);});logger.assert(!props.srcmap,'Use of srcmap prop is deprecated. Use resolutions instead');var showPlaceholder=!props.src&&(props.srcmap===null||props.srcmap.length===0);_this.state={showPlaceholder:showPlaceholder,imageLoadingFailed:false};return _this;}/**
9
+ */function ProductImage(props){var _this2;_classCallCheck(this,ProductImage);_this2=_callSuper(this,ProductImage,[props]);/**
10
+ * Triggered when the image could not be loaded for some reason.
11
+ */_defineProperty(_this2,"imageLoadingFailed",function(){_this2.setState({showPlaceholder:true,imageLoadingFailed:true});});/**
12
+ * Sets the image ratio based on width and height.
13
+ * @return {number} The image ratio.
14
+ */_defineProperty(_this2,"getImageRatio",function(){if(_this2.props.ratio){var _this2$props$ratio2=_slicedToArray(_this2.props.ratio,2),x=_this2$props$ratio2[0],y=_this2$props$ratio2[1];return(y/x).toFixed(3);}var _this2$props$resoluti=_this2.props.resolutions[_this2.props.resolutions.length-1],width=_this2$props$resoluti.width,height=_this2$props$resoluti.height;return(height/width).toFixed(3);});logger.assert(!props.srcmap,'Use of srcmap prop is deprecated. Use resolutions instead');var showPlaceholder=!props.src&&(props.srcmap===null||props.srcmap.length===0);_this2.state={showPlaceholder:showPlaceholder,imageLoadingFailed:false};return _this2;}/**
12
15
  * Called when the component props change.
13
16
  * @param {Object} nextProps The new component properties
14
- */_createClass(ProductImage,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Disable the placeholder to give the real image a new chance to load.
17
+ */_inherits(ProductImage,_Component);return _createClass(ProductImage,[{key:"UNSAFE_componentWillReceiveProps",value:function UNSAFE_componentWillReceiveProps(nextProps){// Disable the placeholder to give the real image a new chance to load.
15
18
  // If we do not have a src property set then just show the placeholder instead.
16
19
  var showPlaceholder=!nextProps.src&&(!nextProps.srcmap||nextProps.srcmap.length===0);this.setState({showPlaceholder:showPlaceholder});}/**
17
20
  * Should component update given the new props?
18
21
  * @param {Object} nextProps The next component props.
19
22
  * @param {Object} nextState The next state.
20
23
  * @return {boolean} Update or not.
21
- */},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps,nextState){return!isEqual(this.props,nextProps)||!isEqual(this.state,nextState);}/**
22
- * Triggered when the image could not be loaded for some reason.
23
- */},{key:"render",/**
24
+ */},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps,nextState){return!isEqual(this.props,nextProps)||!isEqual(this.state,nextState);}},{key:"render",value:/**
24
25
  * Renders the component.
25
26
  * @returns {JSX}
26
- */value:function render(){var _this$props=this.props,noBackground=_this$props.noBackground,className=_this$props.className,placeholderSrc=_this$props.placeholderSrc;var showInnerShadow=this.props.widgetSettings.showInnerShadow;if(typeof showInnerShadow==='undefined'){showInnerShadow=!appConfig.hideProductImageShadow;}if(this.state.imageLoadingFailed||this.state.showPlaceholder){var _classnames;// Image is not present or could not be loaded, show a placeholder.
27
- return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),(_classnames={},_defineProperty(_classnames,styles.innerShadow,showInnerShadow),_defineProperty(_classnames,className,!!className),_classnames)),"aria-hidden":this.props['aria-hidden']},placeholderSrc?React.createElement(ProductImagePlaceholder,{src:placeholderSrc,showInnerShadow:showInnerShadow,noBackground:noBackground}):React.createElement("div",{className:styles.placeholderContent,"data-test-id":"placeHolder"},React.createElement(PlaceholderIcon,{className:styles.placeholder}))));}// Return the actual image.
28
- return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{"aria-hidden":this.props['aria-hidden'],className:className,"aria-label":this.props.alt},React.createElement(Image,_extends({},this.props,{className:showInnerShadow?styles.innerShadow:'',backgroundColor:noBackground?'transparent':colors.light,onError:this.imageLoadingFailed}))));}}]);return ProductImage;}(Component);_defineProperty(ProductImage,"defaultProps",{alt:null,animating:true,'aria-hidden':false,className:null,forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},noBackground:false,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,placeholderSrc:null,widgetSettings:{}});export{ProductImage as UnwrappedProductImage};export default connect(withWidgetSettings(ProductImage,'@shopgate/engage/product/ProductImage'));
27
+ */function render(){var _this$props=this.props,noBackground=_this$props.noBackground,className=_this$props.className,placeholderSrc=_this$props.placeholderSrc;var showInnerShadow=this.props.widgetSettings.showInnerShadow;if(typeof showInnerShadow==='undefined'){showInnerShadow=!appConfig.hideProductImageShadow;}if(this.state.imageLoadingFailed||this.state.showPlaceholder){// Image is not present or could not be loaded, show a placeholder.
28
+ return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),_defineProperty(_defineProperty({},styles.innerShadow,showInnerShadow),className,!!className)),"aria-hidden":this.props['aria-hidden']},placeholderSrc?React.createElement(ProductImagePlaceholder,{src:placeholderSrc,showInnerShadow:showInnerShadow,noBackground:noBackground}):React.createElement("div",{className:styles.placeholderContent,"data-test-id":"placeHolder"},React.createElement(PlaceholderIcon,{className:styles.placeholder}))));}// Return the actual image.
29
+ return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{"aria-hidden":this.props['aria-hidden'],className:"".concat(className," engage__product__product-image"),"aria-label":this.props.alt},React.createElement(Image,_extends({},this.props,{className:showInnerShadow?styles.innerShadow:'',backgroundColor:noBackground?'transparent':colors.light,onError:this.imageLoadingFailed}))));}}]);}(Component);/**
30
+ * See Image component manual for detailed description about the component property types.
31
+ */_defineProperty(ProductImage,"defaultProps",{alt:null,animating:true,'aria-hidden':false,className:null,forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},noBackground:false,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,placeholderSrc:null,widgetSettings:{}});export{ProductImage as UnwrappedProductImage};export default connect(withWidgetSettings(ProductImage,'@shopgate/engage/product/ProductImage'));
@@ -0,0 +1,5 @@
1
+ import React,{Fragment}from'react';import PropTypes from'prop-types';import Grid from'@shopgate/pwa-common/components/Grid';import Image from'@shopgate/pwa-common/components/Image';import Link from'@shopgate/pwa-common/components/Link';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import Portal from'@shopgate/pwa-common/components/Portal';import*as portals from'@shopgate/pwa-common-commerce/category/constants/Portals';import{ITEM_PATH,AVAILABILITY_STATE_OK,AVAILABILITY_STATE_ALERT}from'@shopgate/pwa-common-commerce/product/constants/index';import DiscountBadge from'@shopgate/pwa-ui-shared/DiscountBadge';import Price from'@shopgate/pwa-ui-shared/Price';import PriceStriked from'@shopgate/pwa-ui-shared/PriceStriked';import Manufacturer from'@shopgate/pwa-ui-shared/Manufacturer';import{Availability}from'@shopgate/engage/components';import{PriceInfo,ProductName,ProductBadges}from'@shopgate/engage/product';import{i18n}from'@shopgate/engage/core';import styles from"./style";/**
2
+ * The Product List Item component.
3
+ * @param {Object} props The component props.
4
+ * @return {JSX}
5
+ */var Item=function Item(_ref){var display=_ref.display,product=_ref.product;return React.createElement(Link,{tagName:"a",href:"".concat(ITEM_PATH,"/").concat(bin2hex(product.id)),className:"".concat(styles.container," engage__product__product-list__item"),itemProp:"item",itemScope:true,itemType:"http://schema.org/Product"},React.createElement(Grid,{className:styles.listItemContainer},React.createElement(Grid.Item,{shrink:0,className:styles.imageContainer},React.createElement(Portal,{name:portals.PRODUCT_ITEM_IMAGE_BEFORE,props:{productId:product.id}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_IMAGE,props:{productId:product.id}},React.createElement(Image,{itemProp:"image",src:product.featuredImageBaseUrl,alt:product.name})),React.createElement(Portal,{name:portals.PRODUCT_ITEM_IMAGE_AFTER,props:{productId:product.id}}),React.createElement(ProductBadges,{location:"productList",productId:product.id},!!product.price.discount&&React.createElement(Fragment,null,React.createElement(Portal,{name:portals.PRODUCT_ITEM_DISCOUNT_BEFORE,props:{productId:product.id}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_DISCOUNT,props:{productId:product.id}},React.createElement(DiscountBadge,{className:styles.discount,text:"-".concat(product.price.discount,"%")})),React.createElement(Portal,{name:portals.PRODUCT_ITEM_DISCOUNT_AFTER,props:{productId:product.id}})))),React.createElement(Grid.Item,{grow:4,className:styles.titleContainer},React.createElement(ProductName,{name:product.name,portalName:portals.PRODUCT_ITEM_NAME,portalProps:{productId:product.id},itemProp:"name",testId:"Productname: ".concat(product.name)}),(!display||display.manufacturer&&product.manufacturer)&&React.createElement(Fragment,null,React.createElement(Portal,{name:portals.PRODUCT_ITEM_MANUFACTURER_BEFORE,props:{productId:product.id}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_MANUFACTURER,props:{productId:product.id}},React.createElement(Manufacturer,{text:product.manufacturer,className:styles.manufacturer})),React.createElement(Portal,{name:portals.PRODUCT_ITEM_MANUFACTURER_AFTER,props:{productId:product.id}})),product.availability&&React.createElement(Fragment,null,React.createElement(Portal,{name:portals.PRODUCT_ITEM_AVAILABILITY_BEFORE,props:{productId:product.id}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_AVAILABILITY,props:{productId:product.id}},React.createElement(Availability,{className:styles.availability,text:product.availability.text,state:product.availability.state})),React.createElement(Portal,{name:portals.PRODUCT_ITEM_AVAILABILITY_AFTER,props:{productId:product.id}})),(!product.availability||product.availability.state===AVAILABILITY_STATE_OK)&&React.createElement(Availability,{state:!product.stock||product.stock.orderable?AVAILABILITY_STATE_OK:AVAILABILITY_STATE_ALERT,text:i18n.text('product.available.not'),showWhenAvailable:false})),(!display||display.price)&&React.createElement(Fragment,null,React.createElement(Portal,{name:portals.PRODUCT_ITEM_PRICE_BEFORE,props:{productId:product.id,location:'productList'}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_PRICE,props:{productId:product.id,location:'productList'}},React.createElement(Grid.Item,{grow:1,className:styles.priceContainer},React.createElement(Portal,{name:portals.PRODUCT_ITEM_PRICE_INSIDE_BEFORE,props:{productId:product.id}}),React.createElement(Price,{className:styles.price,currency:product.price.currency,discounted:!!product.price.discount,unitPrice:product.price.unitPrice,unitPriceMin:product.price.unitPriceMin}),product.price.msrp>0&&product.price.unitPrice!==product.price.msrp&&React.createElement(PriceStriked,{value:product.price.msrp,currency:product.price.currency,className:styles.priceStriked}),!product.price.msrp&&product.price.unitPriceStriked>0&&React.createElement(PriceStriked,{value:product.price.unitPriceStriked,currency:product.price.currency,className:styles.priceStriked}),React.createElement(PriceInfo,{product:product,className:styles.priceInfo}),React.createElement(Portal,{name:portals.PRODUCT_ITEM_PRICE_INSIDE_AFTER,props:{productId:product.id}}))),React.createElement(Portal,{name:portals.PRODUCT_ITEM_PRICE_AFTER,props:{productId:product.id,location:'productList'}})),React.createElement(Grid.Item,{shrink:0,className:styles.favouriteContainer})));};Item.defaultProps={display:null};export default Item;
@@ -0,0 +1,2 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var elementPadding=variables.gap.big/2;var containerPaddingSidewards={padding:elementPadding};var listItemContainer=css({padding:elementPadding,background:colors.light}).toString();var imageContainer=css(_extends({},containerPaddingSidewards,{width:40,minHeight:40,boxSizing:'content-box'})).toString();var titleContainer=css(_extends({},containerPaddingSidewards,{lineHeight:1.35,width:'50%'})).toString();var priceContainer=css(_extends({},containerPaddingSidewards,{lineHeight:1.35,textAlign:'right'})).toString();var favouriteContainer=css({display:'none',// Hidden for now
2
+ width:40}).toString();var availability=css({fontSize:'0.75rem'}).toString();var manufacturer=css({fontSize:'0.875rem'}).toString();var price=css({justifyContent:'flex-end'}).toString();var priceStriked=css({fontSize:'0.875rem'}).toString();var priceInfo=css({fontSize:'0.75rem'}).toString();var discount=css({minWidth:40}).toString();export default{listItemContainer:listItemContainer,imageContainer:imageContainer,titleContainer:titleContainer,priceContainer:priceContainer,favouriteContainer:favouriteContainer,manufacturer:manufacturer,availability:availability,price:price,priceStriked:priceStriked,priceInfo:priceInfo,discount:discount};
@@ -0,0 +1,5 @@
1
+ import React from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import Portal from'@shopgate/pwa-common/components/Portal';import*as portals from'@shopgate/pwa-common-commerce/category/constants/Portals';import{ProductListEntryProvider}from'@shopgate/engage/product';import Item from"../Item";import styles from"./style";/**
2
+ * The Product List Iterator component.
3
+ * @param {Object} props The component props.
4
+ * @return {JSX}
5
+ */var Iterator=function Iterator(props){return React.createElement(List.Item,{key:props.id,itemProp:"itemListElement",itemScope:true,itemType:"http://schema.org/ListItem",className:styles.item},React.createElement(ProductListEntryProvider,{productId:props.id},React.createElement(Portal,{name:portals.PRODUCT_ITEM_BEFORE,props:{productId:props.id}}),React.createElement(Portal,{name:portals.PRODUCT_ITEM,props:{productId:props.id}},React.createElement(Item,{product:props,display:props.display})),React.createElement(Portal,{name:portals.PRODUCT_ITEM_AFTER,props:{productId:props.id}})));};Iterator.defaultProps={display:null};export default Iterator;
@@ -0,0 +1 @@
1
+ import{css}from'glamor';var item=css({':first-child':{paddingTop:0},':last-child':{paddingBottom:4},paddingTop:2,paddingBottom:2,position:'relative'}).toString();export default{item:item};
@@ -0,0 +1,5 @@
1
+ import React from'react';import PropTypes from'prop-types';import List from'@shopgate/pwa-common/components/List';import styles from"./style";/**
2
+ * The Product List Layout component.
3
+ * @param {Object} props The component props.
4
+ * @return {JSX}
5
+ */var Layout=function Layout(_ref){var children=_ref.children;return React.createElement(List,{className:"".concat(styles.list," engage__product__product-list"),itemScope:true,itemType:"http://schema.org/ItemList","data-test-id":"productList"},children);};Layout.defaultProps={children:null};export default Layout;
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var list=css({background:colors.background}).toString();export default{list:list};
@@ -0,0 +1,5 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React from'react';import PropTypes from'prop-types';import{ITEMS_PER_LOAD}from'@shopgate/pwa-common/constants/DisplayOptions';import InfiniteContainer from'@shopgate/pwa-common/components/InfiniteContainer';import LoadingIndicator from'@shopgate/pwa-ui-shared/LoadingIndicator';import{ViewContext}from'@shopgate/engage/components/View';import{ProductListTypeProvider}from'@shopgate/engage/product';import Iterator from"./components/Iterator";import Layout from"./components/Layout";/**
2
+ * The Product List component.
3
+ * @param {Object} props The component props.
4
+ * @returns {JSX}
5
+ */var ProductList=function ProductList(_ref){var flags=_ref.flags,infiniteLoad=_ref.infiniteLoad,handleGetProducts=_ref.handleGetProducts,products=_ref.products,totalProductCount=_ref.totalProductCount,requestHash=_ref.requestHash,scope=_ref.scope;if(!infiniteLoad){return React.createElement(Layout,null,React.createElement(ProductListTypeProvider,{type:"productList",subType:scope},products.map(function(product){return React.createElement(Iterator,_extends({display:flags,id:product.id,key:product.id},product));})));}return React.createElement(ViewContext.Consumer,null,function(_ref2){var getContentRef=_ref2.getContentRef;return React.createElement(ProductListTypeProvider,{type:"productList",subType:scope},React.createElement(InfiniteContainer,{containerRef:getContentRef(),wrapper:Layout,iterator:Iterator,loader:handleGetProducts,items:products,loadingIndicator:React.createElement(LoadingIndicator,null),totalItems:totalProductCount,initialLimit:10,limit:ITEMS_PER_LOAD,requestHash:requestHash,enablePromiseBasedLoading:true}));});};ProductList.defaultProps={flags:null,handleGetProducts:function handleGetProducts(){},infiniteLoad:true,products:null,requestHash:null,totalProductCount:null,scope:null};export default ProductList;
@@ -1,4 +1,4 @@
1
- import React,{useMemo}from'react';import PropTypes from'prop-types';import{isBeta}from"../../../core";import{getGroupsFromProperties}from"./helpers/getGroupsFromProperties";import GroupedProperties from"./GroupedProperties";import Wrapper from"./Wrapper";import Rows from"./Rows";import{groupsContainer}from"./style";/**
1
+ import React,{useMemo}from'react';import PropTypes from'prop-types';import{isBeta}from'@shopgate/engage/core/helpers';import{getGroupsFromProperties}from"./helpers/getGroupsFromProperties";import GroupedProperties from"./GroupedProperties";import Wrapper from"./Wrapper";import Rows from"./Rows";import{groupsContainer}from"./style";/**
2
2
  * @param {Object} props The component props.
3
3
  * @returns {JSX}
4
4
  */var Content=function Content(_ref){var properties=_ref.properties;var groups=useMemo(function(){return getGroupsFromProperties(properties);},[properties]);if(!properties){return null;}// Display the simple properties if no groups exist or if not in beta mode.
@@ -1,4 +1,4 @@
1
- import React from'react';import PropTypes from'prop-types';import{Accordion}from'@shopgate/pwa-ui-material';import{i18n}from'@shopgate/engage/core';import Lists from"./Lists";import ListsHTML from"./ListsHTML";import Wrapper from"./Wrapper";import{accordion}from"./style";/**
1
+ import React from'react';import PropTypes from'prop-types';import{Accordion}from'@shopgate/pwa-ui-material';import{i18n}from'@shopgate/engage/core/helpers';import Lists from"./Lists";import ListsHTML from"./ListsHTML";import Wrapper from"./Wrapper";import{accordion}from"./style";/**
2
2
  * Renders the properties as groups.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
@@ -1,4 +1,4 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useCallback}from'react';import PropTypes from'prop-types';import{useNavigation}from'@shopgate/engage/core';import{HtmlSanitizer}from'@shopgate/engage/components';/**
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useCallback}from'react';import PropTypes from'prop-types';import{useNavigation}from'@shopgate/engage/core/hooks';import{HtmlSanitizer}from'@shopgate/engage/components';/**
2
2
  * Renders a single properties row with HTML content.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX.Element}
@@ -1,4 +1,4 @@
1
- import React from'react';import PropTypes from'prop-types';import{PRODUCT_PROPERTIES}from'@shopgate/pwa-common-commerce/product/constants/Portals';import SurroundPortals from'@shopgate/pwa-common/components/SurroundPortals';import Content from"./Content";import connect from"./connector";/**
1
+ import React from'react';import PropTypes from'prop-types';import{PRODUCT_PROPERTIES}from'@shopgate/engage/product/constants';import{SurroundPortals}from'@shopgate/engage/components';import Content from"./Content";import connect from"./connector";/**
2
2
  * Renders the product properties.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX.Element}
@@ -1,4 +1,4 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useCallback}from'react';import PropTypes from'prop-types';import{useNavigation}from'@shopgate/engage/core';import{HtmlSanitizer}from'@shopgate/engage/components';/**
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useCallback}from'react';import PropTypes from'prop-types';import{useNavigation}from'@shopgate/engage/core/hooks';import{HtmlSanitizer}from'@shopgate/engage/components';/**
2
2
  * Renders a single properties row with HTML content.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX.Element}
@@ -2,4 +2,4 @@ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj
2
2
  * Renders the general properties wrapper table.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX.Element}
5
- */var Wrapper=function Wrapper(_ref){var _cxs;var children=_ref.children,dense=_ref.dense,groupName=_ref.groupName,htmlOnly=_ref.htmlOnly;return React.createElement("div",{className:cxs('engage__product__product-property-group',(_cxs={},_defineProperty(_cxs,container,!dense),_defineProperty(_cxs,containerDense,dense),_cxs)),"data-group-name":groupName.toLowerCase()},htmlOnly?children:React.createElement("table",null,React.createElement("thead",null),React.createElement("tbody",null,children)));};Wrapper.defaultProps={dense:false,htmlOnly:false,groupName:''};export default React.memo(Wrapper);
5
+ */var Wrapper=function Wrapper(_ref){var children=_ref.children,dense=_ref.dense,groupName=_ref.groupName,htmlOnly=_ref.htmlOnly;return React.createElement("div",{className:cxs('engage__product__product-property-group',_defineProperty(_defineProperty({},container,!dense),containerDense,dense)),"data-group-name":groupName.toLowerCase()},htmlOnly?children:React.createElement("table",null,React.createElement("thead",null),React.createElement("tbody",null,children)));};Wrapper.defaultProps={dense:false,htmlOnly:false,groupName:''};export default React.memo(Wrapper);
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var _themeConfig$variable=themeConfig.variables;_themeConfig$variable=_themeConfig$variable===void 0?{}:_themeConfig$variable;var gap=_themeConfig$variable.gap,_themeConfig$colors=themeConfig.colors,colors=_themeConfig$colors===void 0?{}:_themeConfig$colors;export var container=css({fontSize:'0.875rem',padding:"0 ".concat(gap.big,"px ").concat(gap.big,"px"),marginBottom:gap.small*1.5});export var containerDense=css(container,{padding:0,marginBottom:0});export var groupsContainer=css({borderBottom:"3px solid ".concat(colors.background),marginBottom:gap.small*1.5});export var label=css({paddingBottom:gap.small*1.5});export var tableCell=css({maxWidth:100,padding:"".concat(gap.xsmall*0.5,"px ").concat(gap.small,"px"),overflowWrap:'break-word',':first-of-type':{paddingLeft:0},':last-of-type':{paddingRight:0}});export var accordion=css({borderTop:"3px solid ".concat(colors.background)});export var subgroup=css({paddingTop:gap.small,fontWeight:600,textTransform:'uppercase',fontSize:'0.75rem'});
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var _themeConfig$variable=themeConfig.variables,_themeConfig$variable2=_themeConfig$variable===void 0?{}:_themeConfig$variable,gap=_themeConfig$variable2.gap,_themeConfig$colors=themeConfig.colors,colors=_themeConfig$colors===void 0?{}:_themeConfig$colors;export var container=css({fontSize:'0.875rem',padding:"0 ".concat(gap.big,"px ").concat(gap.big,"px"),marginBottom:gap.small*1.5});export var containerDense=css(container,{padding:0,marginBottom:0});export var groupsContainer=css({borderBottom:"3px solid ".concat(colors.background),marginBottom:gap.small*1.5});export var label=css({paddingBottom:gap.small*1.5});export var tableCell=css({maxWidth:100,padding:"".concat(gap.xsmall*0.5,"px ").concat(gap.small,"px"),overflowWrap:'break-word',':first-of-type':{paddingLeft:0},':last-of-type':{paddingRight:0}});export var accordion=css({borderTop:"3px solid ".concat(colors.background)});export var subgroup=css({paddingTop:gap.small,fontWeight:600,textTransform:'uppercase',fontSize:'0.75rem'});
@@ -0,0 +1,4 @@
1
+ import React from'react';import PropTypes from'prop-types';import{useWidgetSettings}from'@shopgate/engage/core';import{Swiper}from'@shopgate/engage/components';import{Theme}from'@shopgate/engage/core/contexts';import{ProductListTypeProvider,ProductListEntryProvider}from'@shopgate/engage/product/providers';import{container,items}from"./style";export var WIDGET_ID='@shopgate/engage/product/ProductSlider';/**
2
+ * @param {Object} props The component props.
3
+ * @returns {JSX}
4
+ */function ProductSlider(props){var autoplay=props.autoplay,className=props.className,delay=props.delay,productIds=props.productIds,snap=props.snap,scope=props.scope,meta=props.meta;var widgetSettings=useWidgetSettings(WIDGET_ID)||{};var _ref=props.slidesPerView?props:widgetSettings,_ref$slidesPerView=_ref.slidesPerView,slidesPerView=_ref$slidesPerView===void 0?2.3:_ref$slidesPerView;return React.createElement(Theme,null,function(_ref2){var ProductCard=_ref2.ProductCard;var Item=props.item||ProductCard;return React.createElement(ProductListTypeProvider,{type:"productSlider",subType:scope,meta:meta},React.createElement(Swiper,{autoPlay:autoplay,className:"".concat(className," engage__product__product-slider"),controls:false,indicators:false,interval:delay,loop:false,freeMode:!snap,slidesPerView:slidesPerView},productIds.map(function(id){return React.createElement(Swiper.Item,{key:id,className:container},React.createElement(ProductListEntryProvider,{productId:id},React.createElement(Item,{productId:id,style:items})));})));});}ProductSlider.WIDGET_ID=WIDGET_ID;ProductSlider.defaultProps={autoplay:false,className:null,delay:10,item:null,slidesPerView:null,snap:false,scope:null,meta:null};export default ProductSlider;
@@ -0,0 +1 @@
1
+ /* eslint-disable require-jsdoc */import React from'react';import{shallow}from'enzyme';import ProductSlider from"./index";jest.mock('@shopgate/engage/core',function(){return{useWidgetSettings:jest.fn()};});jest.mock('@shopgate/engage/components',function(){var Swiper=function Swiper(_ref){var children=_ref.children;return children;};Swiper.Item=function(_ref2){var children=_ref2.children;return children;};Swiper.Item.displayName='Swiper.Item';return{Swiper:Swiper};});jest.mock('@shopgate/engage/product',function(){return{ProductListTypeProvider:function ProductListTypeProvider(_ref3){var children=_ref3.children;return children;},ProductListEntryProvider:function ProductListEntryProvider(_ref4){var children=_ref4.children;return children;}};});jest.mock('@shopgate/pwa-common/context',function(){var ProductCard=function ProductCard(props){return React.createElement(ProductCard,props);};return{Theme:function Theme(_ref5){var children=_ref5.children;return children({ProductCard:ProductCard});}};});describe('<ProductSlider />',function(){it('should match snapshot',function(){var wrapper=shallow(React.createElement(ProductSlider,{productIds:['prod1']})).dive();expect(wrapper).toMatchSnapshot();});});/* eslint-enable require-jsdoc */
@@ -0,0 +1 @@
1
+ import{css}from'glamor';export var container=css({paddingBottom:10}).toString();export var items={margin:'0 8px',height:'100%'};
@@ -0,0 +1,5 @@
1
+ import{useWidgetSettings}from"../../../core";/**
2
+ * @param {Object} [productStock={}] product.stock object
3
+ * @returns {Object}
4
+ */export var useQuantityRange=function useQuantityRange(){var _ref,_ref2;var productStock=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var settings=useWidgetSettings('@shopgate/engage/product/QuantityPicker');if(!productStock){return null;}var min=(_ref=settings===null||settings===void 0?void 0:settings.minOrderQuantity)!==null&&_ref!==void 0?_ref:1;if(productStock.minOrderQuantity>0){min=productStock.minOrderQuantity;}var max=(_ref2=settings===null||settings===void 0?void 0:settings.maxOrderQuantity)!==null&&_ref2!==void 0?_ref2:50;if(productStock.maxOrderQuantity>0){max=Math.min(Math.max(min,max),productStock.maxOrderQuantity);}// Normalize min if max is finally less then min
5
+ min=Math.min(min,max);return{min:min,max:max};};
@@ -1,4 +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 React,{useState,useEffect}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{useWidgetStyles,logger}from"../../../core";import{I18n,SheetDrawer,SheetList}from"../../../components";import{getQuantityRange}from"./helpers";var deprecationWarning='QuantityPicker is deprecated in favor of the UnitQuantityPicker component.\nUnitQuantityPicker now additionally supports units and floating point values.';/** */function triggerDeprecation(){if(deprecationWarning){logger.warn(deprecationWarning);deprecationWarning=null;}}/**
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,{useState,useEffect}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{logger}from"../../../core/helpers";import{useWidgetStyles}from"../../../core/hooks";import{I18n,SheetDrawer,SheetList}from"../../../components";import{useQuantityRange}from"./hooks";var deprecationWarning='QuantityPicker is deprecated in favor of the UnitQuantityPicker component.\nUnitQuantityPicker now additionally supports units and floating point values.';/** */function triggerDeprecation(){if(deprecationWarning){logger.warn(deprecationWarning);deprecationWarning=null;}}/**
2
2
  * The QuantityPicker component.
3
3
  * @deprecated Use UnitQuantityPicker to also support different units for quantity.
4
4
  * @returns {JSX}
@@ -16,4 +16,4 @@ setPromiseResolve(function(){return resolve;});// Open sheet
16
16
  setOpened(true);});};// Mount effect
17
17
  useEffect(function(){// Add most late conditioner
18
18
  conditioner.addConditioner('product-quantity',checkQuantity,100);},[conditioner]);// Update resolveValue effect
19
- useEffect(function(){if(resolveValue===null){return;}if(promiseResolve){promiseResolve(resolveValue);}setResolveValue(null);},[promiseResolve,resolveValue]);var styles=useWidgetStyles('@shopgate/engage/product/QuantityPicker');if(!stock){return null;}var _getQuantityRange=getQuantityRange(stock),min=_getQuantityRange.min,max=_getQuantityRange.max;var items=Array(max-min+1).fill(min).map(function(v,index){return String(v+index);});return React.createElement(SheetDrawer,{title:React.createElement(I18n.Text,{string:"product.quantity"}),isOpen:opened,onClose:handleCloseSheet,contentClassName:css(styles.sheet).toString()},React.createElement(SheetList,null,items.map(function(item){return React.createElement(SheetList.Item,{title:item,key:item,onClick:function onClick(){return handleSelectQuantity(parseInt(item,10));}});})));};QuantityPicker.defaultProps={stock:null};export default QuantityPicker;
19
+ useEffect(function(){if(resolveValue===null){return;}if(promiseResolve){promiseResolve(resolveValue);}setResolveValue(null);},[promiseResolve,resolveValue]);var styles=useWidgetStyles('@shopgate/engage/product/QuantityPicker');var quantityRange=useQuantityRange(stock);if(!stock){return null;}var min=quantityRange.min,max=quantityRange.max;var items=Array(max-min+1).fill(min).map(function(v,index){return String(v+index);});return React.createElement(SheetDrawer,{title:React.createElement(I18n.Text,{string:"product.quantity"}),isOpen:opened,onClose:handleCloseSheet,contentClassName:css(styles.sheet).toString()},React.createElement(SheetList,null,items.map(function(item){return React.createElement(SheetList.Item,{title:item,key:item,onClick:function onClick(){return handleSelectQuantity(parseInt(item,10));}});})));};QuantityPicker.defaultProps={stock:null};export default QuantityPicker;
@@ -0,0 +1,9 @@
1
+ import{connect}from'react-redux';import{getProductRating}from'@shopgate/pwa-common-commerce/product/selectors/product';/**
2
+ * @param {Object} state The current application state.
3
+ * @param {Object} props The component props.
4
+ * @return {Object} The extended component props.
5
+ */var mapStateToProps=function mapStateToProps(state,props){return{rating:getProductRating(state,props)};};/**
6
+ * @param {Object} next The next component props.
7
+ * @param {Object} prev The previous component props.
8
+ * @return {boolean}
9
+ */var areStatePropsEqual=function areStatePropsEqual(next,prev){if(!prev.rating&&next.rating){return false;}return true;};export default connect(mapStateToProps,null,null,{areStatePropsEqual:areStatePropsEqual});
@@ -0,0 +1,7 @@
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);}import React,{memo,useMemo}from'react';import PropTypes from'prop-types';import appConfig from'@shopgate/pwa-common/helpers/config';import{RatingStars,SurroundPortals}from'@shopgate/engage/components';import{PRODUCT_RATING}from'@shopgate/engage/product/constants';import RatingCount from'@shopgate/engage/reviews/components/Reviews/components/RatingCount';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{container}from"./style";import connect from"./connector";var hasReviews=appConfig.hasReviews;/**
2
+ * Scrolls page to reviews excerpt.
3
+ */var scrollToRating=function scrollToRating(){var reviewsExcerpt=document.getElementById('reviewsExcerpt');if(_typeof(reviewsExcerpt)!=='object'||!reviewsExcerpt||!reviewsExcerpt.offsetTop||!reviewsExcerpt.closest||!reviewsExcerpt.closest('article')){return;}reviewsExcerpt.closest('article').scroll(0,reviewsExcerpt.offsetTop-30);};/**
4
+ * The Rating component.
5
+ * @param {Object} props The component props.
6
+ * @return {JSX}
7
+ */var Rating=function Rating(_ref){var rating=_ref.rating;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){if(hasReviews&&(rating===null||rating===void 0?void 0:rating.average)>0){return true;}if(hasReviews&&showEmptyRatingStars&&rating){return true;}return false;},[rating,showEmptyRatingStars]);return React.createElement(SurroundPortals,{portalName:PRODUCT_RATING},showRatings&&React.createElement("div",{className:container,onClick:scrollToRating,role:"link","aria-hidden":true},React.createElement(RatingStars,{value:rating.average,display:"big"}),React.createElement(RatingCount,{count:rating.count,prominent:true})));};Rating.defaultProps={rating:null};export default connect(memo(Rating));
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Mock for getElementById
3
+ * @param {Function} scrollSpy Element.scroll spy function.
4
+ * @returns {Function}
5
+ */var getElementById=function getElementById(scrollSpy){return function(){return{offsetTop:100,closest:function closest(){return{scroll:scrollSpy};}};};};export{getElementById};
@@ -0,0 +1,5 @@
1
+ import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{setMocks,mockedStateWithTwoReviews,mockedStateWithoutReview}from'@shopgate/pwa-common-commerce/reviews/mock';import Rating from"./index";import{getElementById}from"./mock";setMocks();jest.mock('@shopgate/engage/components');describe('Rating (product header)',function(){var mockedStore=configureStore();/**
2
+ * Makes component.
3
+ * @param {Object} state State
4
+ * @returns {Object}
5
+ */var getComponent=function getComponent(state){return mount(React.createElement(Provider,{store:mockedStore(state)},React.createElement(Rating,{productId:"foo"})),mockRenderOptions);};describe('Rendering',function(){it('should render rating when data is available',function(){var component=getComponent(mockedStateWithTwoReviews);expect(component).toMatchSnapshot();});it('should render nothing when data is not available',function(){var component=getComponent(mockedStateWithoutReview);expect(component.html()).toBe(null);});});describe('Scroll on click',function(){var scrollSpy=jest.fn();it('should scroll to reviews when clicked',function(){jest.spyOn(document,'getElementById').mockImplementation(getElementById(scrollSpy));var component=getComponent(mockedStateWithTwoReviews);component.simulate('click');expect(scrollSpy.mock.calls[0][0]).toBe(0);expect(scrollSpy.mock.calls[0][1]).toBe(70);expect(scrollSpy).toHaveBeenCalled();document.getElementById.mockReset();document.getElementById.mockRestore();});it('should do nothing when clicked but no reviews excerpt element',function(){jest.spyOn(document,'getElementById').mockImplementation(function(){return null;});var component=getComponent(mockedStateWithTwoReviews);component.simulate('click');expect(scrollSpy.mock.calls.length).toBe(1);document.getElementById.mockReset();document.getElementById.mockRestore();});});});
@@ -0,0 +1 @@
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;var container=css({display:'flex',alignItems:'center',lineHeight:'12px',marginBottom:variables.gap.small}).toString();export{container};
@@ -2,4 +2,4 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
2
2
  * The swatch content component.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */var SwatchContent=function SwatchContent(_ref){var swatch=_ref.swatch,classNames=_ref.classNames,_onClick=_ref.onClick;if(!swatch){return null;}return React.createElement(SurroundPortals,{portalName:PRODUCT_SWATCH,portalProps:{swatch:swatch}},React.createElement("ul",{className:cls(swatchClass,_defineProperty({},classNames.swatch,!!classNames.swatch))},swatch.values.map(function(value){var _cls2;return React.createElement("li",{"aria-hidden":true,key:value.id,onClick:function onClick(){return _onClick(value.id);},className:cls(itemClass,(_cls2={},_defineProperty(_cls2,classNames.item,!!classNames.item),_defineProperty(_cls2,itemSelectedClass,!!value.selected),_defineProperty(_cls2,classNames.itemSelected,!!value.selected),_cls2)),style:_extends({},value.swatch.color&&{backgroundColor:value.swatch.color},{},value.swatch.imageUrl&&{backgroundImage:"url(".concat(value.swatch.imageUrl,")")})});})));};SwatchContent.defaultProps={classNames:{},swatch:null,onClick:noop};export default memo(SwatchContent);
5
+ */var SwatchContent=function SwatchContent(_ref){var swatch=_ref.swatch,classNames=_ref.classNames,_onClick=_ref.onClick;if(!swatch){return null;}return React.createElement(SurroundPortals,{portalName:PRODUCT_SWATCH,portalProps:{swatch:swatch}},React.createElement("ul",{className:cls(swatchClass,_defineProperty({},classNames.swatch,!!classNames.swatch))},swatch.values.map(function(value){return React.createElement("li",{"aria-hidden":true,key:value.id,onClick:function onClick(){return _onClick(value.id);},className:cls(itemClass,_defineProperty(_defineProperty(_defineProperty({},classNames.item,!!classNames.item),itemSelectedClass,!!value.selected),classNames.itemSelected,!!value.selected)),style:_extends({},value.swatch.color&&{backgroundColor:value.swatch.color},{},value.swatch.imageUrl&&{backgroundImage:"url(".concat(value.swatch.imageUrl,")")})});})));};SwatchContent.defaultProps={classNames:{},swatch:null,onClick:noop};export default memo(SwatchContent);
@@ -1,4 +1,4 @@
1
- import React from'react';import UnitQuantityPicker from"./UnitQuantityPicker";import{small,big}from"./styles";/**
1
+ import React from'react';import PropTypes from'prop-types';import noop from'lodash/noop';import UnitQuantityPicker from"./UnitQuantityPicker";import{small,big}from"./styles";/**
2
2
  * @param {Object} props The component props.
3
3
  * @returns {JSX}
4
- */var CartUnitQuantityPicker=function CartUnitQuantityPicker(_ref){var unit=_ref.unit,value=_ref.value,onChange=_ref.onChange,classNames=_ref.classNames,hasCatchWeight=_ref.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;var withDecimals=classNames.withDecimals,withoutDecimals=classNames.withoutDecimals;return React.createElement(UnitQuantityPicker,{className:hasUnitWithDecimals?withDecimals:withoutDecimals,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:onChange,value:value});};CartUnitQuantityPicker.defaultProps={classNames:{withDecimals:big,withoutDecimals:small},hasCatchWeight:false};export default CartUnitQuantityPicker;
4
+ */var CartUnitQuantityPicker=function CartUnitQuantityPicker(_ref){var unit=_ref.unit,value=_ref.value,onChange=_ref.onChange,classNames=_ref.classNames,hasCatchWeight=_ref.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;var withDecimals=classNames.withDecimals,withoutDecimals=classNames.withoutDecimals;return React.createElement(UnitQuantityPicker,{className:!hasUnitWithDecimals?withDecimals:withoutDecimals,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:onChange,value:value});};CartUnitQuantityPicker.defaultProps={unit:null,onChange:noop,classNames:{withDecimals:big,withoutDecimals:small},hasCatchWeight:false};export default CartUnitQuantityPicker;
@@ -1,5 +1,6 @@
1
- import React,{useContext,useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import{I18n,SurroundPortals}from'@shopgate/engage/components';import{themeConfig}from'@shopgate/engage';import{PRODUCT_UNIT_QUANTITY_PICKER,ProductContext}from'@shopgate/engage/product';import{withCurrentProduct}from'@shopgate/engage/core';import UnitQuantityPicker from"./UnitQuantityPicker";import connect from"./ProductUnitQuantityPicker.connector";import{small,big}from"./styles";var variables=themeConfig.variables;var styles={root:css({margin:variables.gap.big}).toString(),title:css({fontSize:'1rem',fontWeight:500,marginBottom:'0.5rem'}).toString()};/**
1
+ import React,{useContext,useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import{I18n,SurroundPortals}from'@shopgate/engage/components';import{themeConfig}from'@shopgate/engage';import{PRODUCT_UNIT_QUANTITY_PICKER,ProductContext}from'@shopgate/engage/product';import{hasNewServices}from'@shopgate/engage/core/helpers';import{withCurrentProduct}from'@shopgate/engage/core/hocs';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import UnitQuantityPicker from"./UnitQuantityPicker";import connect from"./ProductUnitQuantityPicker.connector";import{small,big}from"./styles";var variables=themeConfig.variables;var styles={root:css({padding:variables.gap.big}),title:css({fontSize:'1rem',fontWeight:500,marginBottom:'0.5rem'}).toString()};/**
2
2
  * Renders the quantity picker enriched with current product data.
3
3
  * @param {Object} props Props
4
4
  * @returns {JSX}
5
- */var ProductUnitQuantityPicker=function ProductUnitQuantityPicker(_ref){var children=_ref.children,className=_ref.className,product=_ref.product,disabled=_ref.disabled,stockInfo=_ref.stockInfo;var _useContext=useContext(ProductContext),quantity=_useContext.quantity,setQuantity=_useContext.setQuantity;var _useMemo=useMemo(function(){var min;var max;if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.minOrderQuantity)>0){min=stockInfo.minOrderQuantity;}if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.maxOrderQuantity)>0){max=stockInfo.maxOrderQuantity;}return{minValue:min,maxValue:max};},[stockInfo]),minValue=_useMemo.minValue,maxValue=_useMemo.maxValue;if(!product){return null;}var unit=product.unit,hasCatchWeight=product.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;return React.createElement(SurroundPortals,{portalName:PRODUCT_UNIT_QUANTITY_PICKER},React.createElement("div",{className:classNames(styles.root,className)},React.createElement("div",null,React.createElement("div",{className:styles.title},React.createElement(I18n.Text,{string:"product.sections.quantity"})),React.createElement(UnitQuantityPicker,{className:hasUnitWithDecimals?big:small,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:setQuantity,value:quantity,disabled:disabled,minValue:minValue,maxValue:maxValue})),children&&React.createElement("div",null,children)));};ProductUnitQuantityPicker.defaultProps={disabled:false,product:null,stockInfo:null,children:null,className:null};export default withCurrentProduct(connect(ProductUnitQuantityPicker));
5
+ */var ProductUnitQuantityPicker=function ProductUnitQuantityPicker(_ref){var children=_ref.children,className=_ref.className,classes=_ref.classes,product=_ref.product,disabled=_ref.disabled,stockInfo=_ref.stockInfo,size=_ref.size,quantityLabel=_ref.quantityLabel,hideHeadline=_ref.hideHeadline;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$sh=_useWidgetSettings.show,show=_useWidgetSettings$sh===void 0?hasNewServices():_useWidgetSettings$sh;var _useContext=useContext(ProductContext),quantity=_useContext.quantity,setQuantity=_useContext.setQuantity;var _useMemo=useMemo(function(){var min;var max;if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.minOrderQuantity)>0){min=stockInfo.minOrderQuantity;}if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.maxOrderQuantity)>0){max=stockInfo.maxOrderQuantity;}return{minValue:min,maxValue:max};},[stockInfo]),minValue=_useMemo.minValue,maxValue=_useMemo.maxValue;if(!product||!show){return null;}var unit=product.unit,hasCatchWeight=product.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;return React.createElement(SurroundPortals,{portalName:PRODUCT_UNIT_QUANTITY_PICKER},React.createElement("div",{className:classNames(styles.root,className)},React.createElement("div",null,!hideHeadline&&React.createElement("div",{className:styles.title},React.createElement(I18n.Text,{string:"product.sections.quantity"})),React.createElement(UnitQuantityPicker// eslint-disable-next-line no-nested-ternary
6
+ ,{className:(classes===null||classes===void 0?void 0:classes.picker)?classes.picker:hasUnitWithDecimals?big:small,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:setQuantity,value:quantity,disabled:disabled,minValue:minValue,maxValue:maxValue,size:size,quantityLabel:quantityLabel})),children&&React.createElement("div",null,children)));};ProductUnitQuantityPicker.defaultProps={disabled:false,product:null,size:undefined,stockInfo:null,children:null,className:null,quantityLabel:null,classes:{picker:null},hideHeadline:false};export default withCurrentProduct(connect(ProductUnitQuantityPicker));
@@ -1,9 +1,12 @@
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 _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,{useCallback,useEffect,useState,useRef}from'react';import PropTypes from'prop-types';import{i18n,UIEvents}from'@shopgate/engage/core';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';import{broadcastLiveMessage}from'@shopgate/engage/a11y';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row',position:'relative',zIndex:5}).toString(),backdrop:css({zIndex:4,top:0,left:0,height:'100%',width:'100%',position:'fixed'}),input:css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',flex:1,fontSize:15,height:28,width:'100%',backgroundColor:"var(--color-background-accent, ".concat(colors.shade8,")")}).toString(),inputWrapper:css({width:'100%'}),button:css({width:28,' &&':{minWidth:28,padding:0},height:28}).toString(),buttonRipple:css({padding:0}).toString(),buttonNoRadiusLeft:css({' &&':{borderTopLeftRadius:0,borderBottomLeftRadius:0}}).toString(),buttonNoRadiusRight:css({' &&':{borderTopRightRadius:0,borderBottomRightRadius:0}}).toString(),disabled:css({' > div':{padding:0}}).toString()};/**
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 _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 _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 React,{useCallback,useEffect,useState,useRef,useMemo}from'react';import PropTypes from'prop-types';import{i18n,hasNewServices}from'@shopgate/engage/core/helpers';import{UIEvents}from'@shopgate/engage/core';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';import{broadcastLiveMessage}from'@shopgate/engage/a11y/helpers';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row',position:'relative',zIndex:5}).toString(),backdrop:css({zIndex:4,top:0,left:0,height:'100%',width:'100%',position:'fixed'}),inputWrapper:function inputWrapper(_ref){var inputColor=_ref.inputColor,inputBgColor=_ref.inputBgColor;return css(_extends({display:'flex',alignItems:'center',width:'100%',fontSize:16,backgroundColor:"var(--color-background-accent, ".concat(colors.shade8,")")},inputColor&&{color:"".concat(inputColor," !important")},{},inputBgColor&&{backgroundColor:"".concat(inputBgColor," !important")},{' .quantity-label':{paddingLeft:variables.gap.small,paddingRight:4,textAlign:'center',width:'calc(100% - 32px)',textOverflow:'ellipsis',overflow:'hidden',whiteSpace:'nowrap'}}));},input:function input(_ref2){var inputColor=_ref2.inputColor,inputBgColor=_ref2.inputBgColor,hasLabel=_ref2.hasLabel,size=_ref2.size;var fontWeight=size==='large'?600:'normal';return css(_extends({padding:"0 ".concat(variables.gap.small,"px"),textAlign:hasLabel?'left':'center',fontWeight:fontWeight,height:'100%',width:'100%'},inputColor&&{color:"".concat(inputColor)},{},inputBgColor&&{backgroundColor:"".concat(inputBgColor," !important")},{},hasLabel&&{paddingLeft:0},{outline:'none','&:focus:not(:focus-visible)':{outline:'none'}})).toString();},button:function button(_ref3){var _ref3$size=_ref3.size,size=_ref3$size===void 0?'default':_ref3$size,buttonColor=_ref3.buttonColor,buttonBgColor=_ref3.buttonBgColor;var sizeValue=size==='large'?36:28;return css({width:sizeValue,' &&':{minWidth:sizeValue,padding:0},height:sizeValue,fontSize:"".concat(Math.floor(sizeValue/28*100),"% !important"),'&:not(:disabled)':_extends({},buttonColor&&{color:"".concat(buttonColor," !important")},{},buttonBgColor&&{backgroundColor:"".concat(buttonBgColor," !important")})});},buttonRipple:css({padding:0}).toString(),buttonNoRadiusLeft:css({' &&':{borderTopLeftRadius:0,borderBottomLeftRadius:0}}).toString(),buttonNoRadiusRight:css({' &&':{borderTopRightRadius:0,borderBottomRightRadius:0}}).toString(),disabled:css({' > div':{padding:0}}).toString()};/**
2
2
  * A Quantity Picker with unit support.
3
3
  * @returns {JSX.Element}
4
- */var UnitQuantityPicker=function UnitQuantityPicker(_ref){var className=_ref.className,onChange=_ref.onChange,value=_ref.value,allowDecrement=_ref.allowDecrement,allowIncrement=_ref.allowIncrement,allowZero=_ref.allowZero,decrementStep=_ref.decrementStep,incrementStep=_ref.incrementStep,maxDecimals=_ref.maxDecimals,unit=_ref.unit,disabled=_ref.disabled,minValue=_ref.minValue,maxValue=_ref.maxValue,toggleTabBarOnFocus=_ref.toggleTabBarOnFocus;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var inputRef=useRef(null);var handleOnFocus=useCallback(function(){setIsFocused(true);if(toggleTabBarOnFocus){UIEvents.emit('HIDE_TAB_BAR');}},[toggleTabBarOnFocus]);var handleOnBlur=useCallback(function(){setIsFocused(false);if(toggleTabBarOnFocus){UIEvents.emit('SHOW_TAB_BAR');}},[toggleTabBarOnFocus]);var handleManualChange=useCallback(function(newValue){onChange(newValue);var message;if(newValue<value){message='product.decreased_quantity_to';}if(newValue>value){message='product.increased_quantity_to';}if(message){broadcastLiveMessage(message,{params:{quantity:newValue}});}},[onChange,value]);var handleDecrement=useCallback(function(event){var newValue=value-decrementStep;if(newValue<=0&&!allowZero||minValue&&newValue<minValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[allowZero,decrementStep,handleManualChange,minValue,value]);var handleIncrement=useCallback(function(event){var newValue=value+incrementStep;if(maxValue&&newValue>maxValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[handleManualChange,incrementStep,maxValue,value]);useEffect(function(){if(minValue&&value<minValue){onChange(minValue);}if(maxValue&&value>maxValue){onChange(maxValue);}/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */ /**
4
+ */var UnitQuantityPicker=function UnitQuantityPicker(_ref4){var className=_ref4.className,onChange=_ref4.onChange,value=_ref4.value,allowDecrement=_ref4.allowDecrement,allowIncrement=_ref4.allowIncrement,allowZero=_ref4.allowZero,decrementStep=_ref4.decrementStep,incrementStep=_ref4.incrementStep,maxDecimals=_ref4.maxDecimals,unit=_ref4.unit,disabled=_ref4.disabled,minValue=_ref4.minValue,maxValue=_ref4.maxValue,size=_ref4.size,toggleTabBarOnFocus=_ref4.toggleTabBarOnFocus,quantityLabel=_ref4.quantityLabel;var widgetDefaults=useMemo(function(){if(hasNewServices()){// The widget configuration was introduced with CCP-2449 in PWA6. It's inactive for now
5
+ // when running on new services, since for those shops it never existed and the default
6
+ // values would introduce breaking changes.
7
+ return{};}return{buttonColor:colors.shade8,buttonBgColor:colors.primary,inputColor:colors.dark,inputBgColor:colors.shade8,showLabel:true};},[]);var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$bu=_useWidgetSettings.buttonColor,buttonColor=_useWidgetSettings$bu===void 0?widgetDefaults.buttonColor:_useWidgetSettings$bu,_useWidgetSettings$bu2=_useWidgetSettings.buttonBgColor,buttonBgColor=_useWidgetSettings$bu2===void 0?widgetDefaults.buttonBgColor:_useWidgetSettings$bu2,_useWidgetSettings$in=_useWidgetSettings.inputColor,inputColor=_useWidgetSettings$in===void 0?widgetDefaults.inputColor:_useWidgetSettings$in,_useWidgetSettings$in2=_useWidgetSettings.inputBgColor,inputBgColor=_useWidgetSettings$in2===void 0?widgetDefaults.inputBgColor:_useWidgetSettings$in2,_useWidgetSettings$sh=_useWidgetSettings.showLabel,showLabel=_useWidgetSettings$sh===void 0?widgetDefaults.showLabel:_useWidgetSettings$sh;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var inputRef=useRef(null);var handleOnFocus=useCallback(function(){setIsFocused(true);if(toggleTabBarOnFocus){UIEvents.emit('HIDE_TAB_BAR');}},[toggleTabBarOnFocus]);var handleOnBlur=useCallback(function(){setIsFocused(false);if(toggleTabBarOnFocus){UIEvents.emit('SHOW_TAB_BAR');}},[toggleTabBarOnFocus]);var handleManualChange=useCallback(function(newValue){onChange(newValue);var message;if(newValue<value){message='product.decreased_quantity_to';}if(newValue>value){message='product.increased_quantity_to';}if(message){broadcastLiveMessage(message,{params:{quantity:newValue}});}},[onChange,value]);var handleDecrement=useCallback(function(event){var newValue=value-decrementStep;if(newValue<=0&&!allowZero||minValue&&newValue<minValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[allowZero,decrementStep,handleManualChange,minValue,value]);var handleIncrement=useCallback(function(event){var newValue=value+incrementStep;if(maxValue&&newValue>maxValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[handleManualChange,incrementStep,maxValue,value]);useEffect(function(){if(minValue&&value<minValue){onChange(minValue);}if(maxValue&&value>maxValue){onChange(maxValue);}/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */ /**
5
8
  * Handler for pressing "enter" on Android
6
9
  */var handleKeyDown=useCallback(function(event){if(event.key==='Enter'&&inputRef.current!==null){try{inputRef.current.blur();}catch(e){// nothing to do here
7
10
  }}},[]);return React.createElement(React.Fragment,null,isFocused&&// Show hidden backdrop when focused to avoid side effects when user blurs the input
8
11
  // e.g. opening links unintended
9
- React.createElement("div",{className:styles.backdrop}),React.createElement("div",{className:"".concat(styles.root," ").concat(className)},React.createElement(RippleButton,{rippleClassName:styles.buttonRipple,className:classNames(styles.button,styles.buttonNoRadiusRight,_defineProperty({},styles.disabled,disabled)),type:"secondary",disabled:!allowDecrement||disabled,onClick:handleDecrement,"aria-label":i18n.text('product.decrease_quantity')},"-"),React.createElement("span",null,React.createElement(QuantityInput,{className:styles.input,value:value,onChange:onChange,maxDecimals:maxDecimals,unit:unit,disabled:disabled,minValue:minValue,maxValue:maxValue,"aria-label":i18n.text('product.quantity'),onFocus:handleOnFocus,onBlur:handleOnBlur,onKeyDown:handleKeyDown,ref:inputRef})),React.createElement(RippleButton,{type:"secondary",disabled:!allowIncrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button,styles.buttonNoRadiusLeft,_defineProperty({},styles.disabled,disabled)),onClick:handleIncrement,"aria-label":i18n.text('product.increase_quantity')},"+")));};UnitQuantityPicker.defaultProps={className:'',allowZero:false,allowIncrement:true,allowDecrement:true,incrementStep:0.25,decrementStep:0.25,maxDecimals:2,unit:null,disabled:false,minValue:null,maxValue:null,toggleTabBarOnFocus:false};export default UnitQuantityPicker;
12
+ React.createElement("div",{className:styles.backdrop}),React.createElement("div",{className:"".concat(styles.root," ").concat(className)},React.createElement(RippleButton,{type:"secondary",disabled:!allowDecrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button({size:size,buttonColor:buttonColor,buttonBgColor:buttonBgColor}),styles.buttonNoRadiusRight,_defineProperty({},styles.disabled,!allowDecrement||disabled)),onClick:handleDecrement,"aria-label":i18n.text('product.decrease_quantity')},"-"),React.createElement("span",{className:styles.inputWrapper({inputColor:inputColor,inputBgColor:inputBgColor})},quantityLabel&&showLabel&&React.createElement("span",{"aria-hidden":true,className:"quantity-label"},quantityLabel),React.createElement(QuantityInput,{className:styles.input({inputColor:inputColor,inputBgColor:inputBgColor,hasLabel:showLabel&&!!quantityLabel,size:size}),value:value,onChange:onChange,maxDecimals:maxDecimals,unit:unit,disabled:disabled,minValue:minValue,maxValue:maxValue,"aria-label":i18n.text('product.quantity'),onFocus:handleOnFocus,onBlur:handleOnBlur,onKeyDown:handleKeyDown,ref:inputRef})),React.createElement(RippleButton,{type:"secondary",disabled:!allowIncrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button({size:size,buttonColor:buttonColor,buttonBgColor:buttonBgColor}),styles.buttonNoRadiusLeft,_defineProperty({},styles.disabled,!allowIncrement||disabled)),onClick:handleIncrement,"aria-label":i18n.text('product.increase_quantity')},"+")));};UnitQuantityPicker.defaultProps={className:'',allowZero:false,allowIncrement:true,allowDecrement:true,incrementStep:0.25,decrementStep:0.25,maxDecimals:2,unit:null,disabled:false,minValue:null,size:'default',maxValue:null,quantityLabel:null,toggleTabBarOnFocus:false};export default UnitQuantityPicker;
@@ -0,0 +1,7 @@
1
+ import React,{useMemo}from'react';import{css}from'glamor';import PropTypes from'prop-types';import{connect}from'react-redux';import{hasNewServices,i18n}from'@shopgate/engage/core/helpers';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{withCurrentProduct,withWidgetSettings}from'@shopgate/engage/core/hocs';import{Section}from'@shopgate/engage/a11y/components';import{makeGetCurrentProductPropertyByLabel}from'@shopgate/engage/product/selectors/product';import ProductUnitQuantityPicker from"./ProductUnitQuantityPicker";import OrderQuantityHint from"../OrderQuantityHint";var styles={quantityPicker:css({display:'flex',flexDirection:'column'}).toString(),quantityPickerPicker:css({width:'100%'}).toString(),quantityHint:css({'&:not(:empty)':{paddingTop:8,marginBottom:-4}}).toString()};/**
2
+ * A Quantity Picker with unit support.
3
+ * @returns {JSX.Element}
4
+ */var UnitQuantityPickerWithSection=function UnitQuantityPickerWithSection(_ref){var productId=_ref.productId,variantId=_ref.variantId,productProperty=_ref.productProperty;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$sh=_useWidgetSettings.show,show=_useWidgetSettings$sh===void 0?hasNewServices():_useWidgetSettings$sh;var quantityLabel=useMemo(function(){var _ref2;if(!show){return null;}var label=i18n.text('product.sections.quantity');if(((_ref2=productProperty===null||productProperty===void 0?void 0:productProperty.value)!==null&&_ref2!==void 0?_ref2:'')!==''){label=productProperty.value;}return label;},[productProperty,show]);if(!show){return null;}return React.createElement(Section,{title:"product.sections.quantity"},React.createElement(ProductUnitQuantityPicker,{className:styles.quantityPicker,classes:{picker:styles.quantityPickerPicker},size:"large",quantityLabel:quantityLabel,hideHeadline:true},React.createElement(OrderQuantityHint,{productId:variantId||productId,className:styles.quantityHint})));};UnitQuantityPickerWithSection.defaultProps={productId:null,variantId:null,productProperty:null};/**
5
+ * Creates the mapStateToProps connector function.
6
+ * @returns {Function}
7
+ */var makeMapStateToProps=function makeMapStateToProps(){var getCurrentProductPropertyByLabel=makeGetCurrentProductPropertyByLabel();return function(state,props){return{productProperty:getCurrentProductPropertyByLabel(state,props)};};};export default withWidgetSettings(withCurrentProduct(connect(makeMapStateToProps)(UnitQuantityPickerWithSection)),'@shopgate/engage/product/components/UnitQuantityPicker');
@@ -1 +1 @@
1
- export{default as UnitQuantityPicker}from"./UnitQuantityPicker";export{default as ProductUnitQuantityPicker}from"./ProductUnitQuantityPicker";export{default as CartUnitQuantityPicker}from"./CartUnitQuantityPicker";
1
+ export{default as CartUnitQuantityPicker}from"./CartUnitQuantityPicker";export{default as ProductUnitQuantityPicker}from"./ProductUnitQuantityPicker";export{default as UnitQuantityPicker}from"./UnitQuantityPicker";export{default as UnitQuantityPickerWithSection}from"./UnitQuantityPickerWithSection";
@@ -0,0 +1 @@
1
+ export*from"./Availability";export{default as Characteristics}from"./Characteristics";export{default as Description}from"./Description";export{default as EffectivityDates}from"./EffectivityDates";export{default as MapPriceHint}from"./MapPriceHint";export*from"./Media";export{default as MediaSlider}from"./MediaSlider";export{default as Options}from"./Options";export{default as OrderQuantityHint}from"./OrderQuantityHint";export{default as PriceDifference}from"./PriceDifference";export*from"./PriceInfo";export{default as ProductBadges}from"./ProductBadges";export{default as ProductCard}from"./ProductCard";export{default as ProductCharacteristics}from"./ProductCharacteristics";export{default as ProductDiscountBadge}from"./ProductDiscountBadge";export{default as ProductGridPrice}from"./ProductGridPrice";export{default as ProductImage}from"./ProductImage";export{default as ProductList}from"./ProductList";export*from"./ProductName";export{default as ProductProperties}from"./ProductProperties/ProductProperties";export{default as ProductSlider}from"./ProductSlider";export*from"./ProductVariants";export{default as QuantityPicker}from"./QuantityPicker";export{default as Rating}from"./Rating";export*from"./RelationsSlider";export*from"./Swatch";export*from"./Swatches";export*from"./UnitQuantityPicker";
@@ -1,3 +1,3 @@
1
1
  // MEDIA TYPES
2
2
  export var MEDIA_TYPE_IMAGE='image';export var MEDIA_TYPE_VIDEO='video';// AVAILABILITY TYPES
3
- export var AVAILABILITY_TYPE_COMING_SOON='comingSoon';export var AVAILABILITY_TYPE_AVAILABLE='available';export var AVAILABILITY_TYPE_LIMITED_AVAILABILITY='limitedAvailability';export var AVAILABILITY_TYPE_NOT_AVAILABLE='notAvailable';export var AVAILABILITY_TYPE_CUSTOM_AVAILABILITY='customAvailability';export var availabilityTypes=[AVAILABILITY_TYPE_AVAILABLE,AVAILABILITY_TYPE_LIMITED_AVAILABILITY,AVAILABILITY_TYPE_NOT_AVAILABLE,AVAILABILITY_TYPE_CUSTOM_AVAILABILITY];
3
+ export var AVAILABILITY_TYPE_COMING_SOON='comingSoon';export var AVAILABILITY_TYPE_AVAILABLE='available';export var AVAILABILITY_TYPE_LIMITED_AVAILABILITY='limitedAvailability';export var AVAILABILITY_TYPE_NOT_AVAILABLE='notAvailable';export var AVAILABILITY_TYPE_CUSTOM_AVAILABILITY='customAvailability';export var availabilityTypes=[AVAILABILITY_TYPE_AVAILABLE,AVAILABILITY_TYPE_LIMITED_AVAILABILITY,AVAILABILITY_TYPE_NOT_AVAILABLE,AVAILABILITY_TYPE_CUSTOM_AVAILABILITY];export*from'@shopgate/pwa-common-commerce/product/constants/index';export*from'@shopgate/pwa-common-commerce/product/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/product/constants/Portals';
@@ -0,0 +1 @@
1
+ export{ProductContext,VariantContext}from"../components/context";
@@ -1,4 +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;}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 configuration from'@shopgate/pwa-common/collections/Configuration';import{DEFAULT_PRODUCTS_FETCH_PARAMS}from'@shopgate/pwa-common/constants/Configuration';import{getFullImageSource,getThemeSettings,isBeta,loadImage}from'@shopgate/engage/core';import{buildShowScheduledParams}from"../components/EffectivityDates/helpers";/**
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;}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 configuration from'@shopgate/pwa-common/collections/Configuration';import{DEFAULT_PRODUCTS_FETCH_PARAMS}from'@shopgate/pwa-common/constants/Configuration';import{getFullImageSource,getThemeSettings,isBeta,loadImage}from'@shopgate/engage/core';import{buildShowScheduledParams}from"../components/EffectivityDates/helpers";export*from'@shopgate/pwa-common-commerce/product/helpers';export*from"../components/Media/helpers";export*from"./redirects";/**
2
2
  * Build params to fetch category products
3
3
  * @returns {undefined|{params: Object}}
4
4
  */export var buildFetchCategoryProductsParams=function buildFetchCategoryProductsParams(){if(!isBeta()){return{params:{}};}var scheduled=buildShowScheduledParams();return _extends({params:_extends({characteristics:true},scheduled.params)},scheduled.cachedTime&&{cachedTime:scheduled.cachedTime});};/**
@@ -14,4 +14,4 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
14
14
  * @param {string} src .
15
15
  * @param {Object} resolution .
16
16
  * @returns {Promise}
17
- */export var loadProductImage=function loadProductImage(src){var resolution=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var res=resolution;if(!res){var _getProductImageSetti=getProductImageSettings(),resolutions=_getProductImageSetti.HeroImage;var _resolutions=_slicedToArray(resolutions,1);res=_resolutions[0];}return loadImage(getFullImageSource(src,res));};
17
+ */export var loadProductImage=function loadProductImage(src){var resolution=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var res=resolution;if(!res){var _getProductImageSetti2=getProductImageSettings(),resolutions=_getProductImageSetti2.HeroImage;var _resolutions=_slicedToArray(resolutions,1);res=_resolutions[0];}return loadImage(getFullImageSource(src,res));};
@@ -1,5 +1,5 @@
1
1
  import{isBeta,redirects,getThemeSettings,isAfter}from'@shopgate/engage/core';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{makeGetProductEffectivityDates}from"../selectors/product";/**
2
2
  * Enable redirect handler for effectivity dates and more
3
3
  * @returns {void}
4
- */export var enableRedirectHandler=function enableRedirectHandler(){if(!isBeta()){return;}/** Effectivity dates */var _ref=getThemeSettings('product')||{},_ref$effectivityDates=_ref.effectivityDates;_ref$effectivityDates=_ref$effectivityDates===void 0?{}:_ref$effectivityDates;var accessExpired=_ref$effectivityDates.accessExpired;if(accessExpired){return;}var getProductEffectivityDates=makeGetProductEffectivityDates();redirects.set(ITEM_PATTERN,function(_ref2){var action=_ref2.action,getState=_ref2.getState;var pathname=action.params.pathname,productId=action.route.state.productId;var effectivityDates=getProductEffectivityDates(getState(),{productId:productId});if(effectivityDates){// Forbid redirect if endDate is expired
4
+ */export var enableRedirectHandler=function enableRedirectHandler(){if(!isBeta()){return;}/** Effectivity dates */var _ref=getThemeSettings('product')||{},_ref$effectivityDates=_ref.effectivityDates,_ref$effectivityDates2=_ref$effectivityDates===void 0?{}:_ref$effectivityDates,accessExpired=_ref$effectivityDates2.accessExpired;if(accessExpired){return;}var getProductEffectivityDates=makeGetProductEffectivityDates();redirects.set(ITEM_PATTERN,function(_ref2){var action=_ref2.action,getState=_ref2.getState;var pathname=action.params.pathname,productId=action.route.state.productId;var effectivityDates=getProductEffectivityDates(getState(),{productId:productId});if(effectivityDates){// Forbid redirect if endDate is expired
5
5
  if(effectivityDates.endDate&&isAfter(new Date(),new Date(effectivityDates.endDate))){return null;}}return pathname;});};
@@ -0,0 +1 @@
1
+ export{default as withMapPricing}from"./withMapPricing";export{default as withPriceCalculation}from"./withPriceCalculation";export{default as withProductListEntry}from"./withProductListEntry";export{default as withProductListEntryProduct}from"./withProductListEntryProduct";export{default as withProductListType}from"./withProductListType";export{default as withProductStock}from"./withProductStock";
@@ -0,0 +1 @@
1
+ export{useLoadProductImage}from"./useLoadProductImage";export{default as useProductListEntry}from"./useProductListEntry";export{default as useProductListType}from"./useProductListType";
package/product/index.js CHANGED
@@ -1,13 +1,6 @@
1
1
  /** @module product */ // ACTION-CREATORS
2
2
  export{default as productNotAvailable}from'@shopgate/pwa-common-commerce/product/action-creators/productNotAvailable';// ACTIONS
3
- export{default as changeSortOrder}from'@shopgate/pwa-common-commerce/product/actions/changeSortOrder';export{default as fetchHighlightProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchHighlightProducts';export{default as fetchLiveshoppingProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchLiveshoppingProducts';export{default as fetchProduct}from'@shopgate/pwa-common-commerce/product/actions/fetchProduct';export{default as fetchProductDescription}from'@shopgate/pwa-common-commerce/product/actions/fetchProductDescription';export{default as fetchProductImages}from'@shopgate/pwa-common-commerce/product/actions/fetchProductImages';export{default as fetchProductOptions}from'@shopgate/pwa-common-commerce/product/actions/fetchProductOptions';export{default as fetchProductProperties}from'@shopgate/pwa-common-commerce/product/actions/fetchProductProperties';export{default as fetchProductRelations}from'@shopgate/pwa-common-commerce/product/actions/fetchProductRelations';export{default as fetchProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchProducts';export{default as fetchProductsById}from'@shopgate/pwa-common-commerce/product/actions/fetchProductsById';export{default as fetchProductsByQuery}from'@shopgate/pwa-common-commerce/product/actions/fetchProductsByQuery';export{default as fetchProductShipping}from'@shopgate/pwa-common-commerce/product/actions/fetchProductShipping';export{default as fetchProductVariants}from'@shopgate/pwa-common-commerce/product/actions/fetchProductVariants';// COLLECTIONS
4
- export{default as productImageFormats}from'@shopgate/pwa-common-commerce/product/collections/ProductImageFormats';// CONSTANTS
5
- export*from'@shopgate/pwa-common-commerce/product/constants/index';export*from'@shopgate/pwa-common-commerce/product/constants/Pipelines';export*from'@shopgate/pwa-common-commerce/product/constants/Portals';export*from"./constants";// HELPERS
6
- export*from'@shopgate/pwa-common-commerce/product/helpers';export*from"./helpers/index";export*from"./helpers/redirects";export*from"./components/Media/helpers";// SELECTORS
7
- export*from'@shopgate/pwa-common-commerce/product/selectors/options';export*from'@shopgate/pwa-common-commerce/product/selectors/page';export*from'@shopgate/pwa-common-commerce/product/selectors/price';export*from'@shopgate/pwa-common-commerce/product/selectors/product';export*from'@shopgate/pwa-common-commerce/product/selectors/relations';export*from'@shopgate/pwa-common-commerce/product/selectors/variants';export*from"./selectors/media";export{getProductIsFetching,makeGetProductProperties,makeGetProductEffectivityDates,makeGetProductCharacteristics,makeGetProductFeaturedMedia,makeIsProductActive,makeIsBaseProductActive}from"./selectors/product";export*from"./selectors/price";export*from"./selectors/variants";export*from"./selectors/relations";// STREAMS
8
- export*from'@shopgate/pwa-common-commerce/product/streams';// COMPONENTS
9
- export{default as ProductProperties}from"./components/ProductProperties/ProductProperties";export{default as MapPriceHint}from"./components/MapPriceHint";export{default as OrderQuantityHint}from"./components/OrderQuantityHint";export{default as ProductImage}from"./components/ProductImage";export{default as MediaSlider}from"./components/MediaSlider";export{default as QuantityPicker}from"./components/QuantityPicker";export{default as EffectivityDates}from"./components/EffectivityDates";export{Availability}from"./components/Availability";export{default as PriceDifference}from"./components/PriceDifference";export{FeaturedMedia,MediaImage}from"./components/Media";export{VariantSwatch}from"./components/Swatch";export{Swatches}from"./components/Swatches";export{RelationsSlider}from"./components/RelationsSlider";export{default as ProductCard}from"./components/ProductCard";export{default as ProductGridPrice}from"./components/ProductGridPrice";export{default as ProductCharacteristics}from"./components/ProductCharacteristics";export{default as Description}from"./components/Description";export{VariantAvailability}from"./components/ProductVariants";export{PriceInfo}from"./components/PriceInfo";export{ProductName}from"./components/ProductName";export{default as ProductBadges}from"./components/ProductBadges";export{default as ProductDiscountBadge}from"./components/ProductDiscountBadge";export{ProductUnitQuantityPicker,UnitQuantityPicker,CartUnitQuantityPicker}from"./components/UnitQuantityPicker";// HOCs
10
- export{default as withPriceCalculation}from"./hocs/withPriceCalculation";export{default as withProductStock}from"./hocs/withProductStock";export{default as withProduct}from"./hocs/withProduct";export{default as withProductListType}from"./hocs/withProductListType";export{default as withProductListEntry}from"./hocs/withProductListEntry";export{default as withProductListEntryProduct}from"./hocs/withProductListEntryProduct";// HOOKs
11
- export{useLoadProductImage}from"./hooks/useLoadProductImage";export{default as useProductListType}from"./hooks/useProductListType";export{default as useProductListEntry}from"./hooks/useProductListEntry";// CONTEXTS
12
- export{ProductContext,VariantContext}from"./components/context";export{default as ProductListTypeContext}from"./providers/ProductListType/context";export{default as ProductListEntryContext}from"./providers/ProductListEntry/context";// PROVIDERS
13
- export{default as ProductListTypeProvider}from"./providers/ProductListType";export{default as ProductListEntryProvider}from"./providers/ProductListEntry";// TYPES
3
+ export{default as changeSortOrder}from'@shopgate/pwa-common-commerce/product/actions/changeSortOrder';export{default as fetchHighlightProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchHighlightProducts';export{default as fetchLiveshoppingProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchLiveshoppingProducts';export{default as fetchProduct}from'@shopgate/pwa-common-commerce/product/actions/fetchProduct';export{default as fetchProductDescription}from'@shopgate/pwa-common-commerce/product/actions/fetchProductDescription';export{default as fetchProductImages}from'@shopgate/pwa-common-commerce/product/actions/fetchProductImages';export{default as fetchProductOptions}from'@shopgate/pwa-common-commerce/product/actions/fetchProductOptions';export{default as fetchProductProperties}from'@shopgate/pwa-common-commerce/product/actions/fetchProductProperties';export{default as fetchProductRelations}from'@shopgate/pwa-common-commerce/product/actions/fetchProductRelations';export{default as fetchProducts}from'@shopgate/pwa-common-commerce/product/actions/fetchProducts';export{default as fetchProductsById}from'@shopgate/pwa-common-commerce/product/actions/fetchProductsById';export{default as fetchProductsByQuery}from'@shopgate/pwa-common-commerce/product/actions/fetchProductsByQuery';export{default as fetchProductShipping}from'@shopgate/pwa-common-commerce/product/actions/fetchProductShipping';export{default as fetchProductVariants}from'@shopgate/pwa-common-commerce/product/actions/fetchProductVariants';// SELECTORS
4
+ export*from'@shopgate/pwa-common-commerce/product/selectors/options';export*from'@shopgate/pwa-common-commerce/product/selectors/page';export*from'@shopgate/pwa-common-commerce/product/selectors/price';export*from'@shopgate/pwa-common-commerce/product/selectors/product';export*from'@shopgate/pwa-common-commerce/product/selectors/relations';export*from'@shopgate/pwa-common-commerce/product/selectors/variants';export*from"./selectors/media";export{getProductIsFetching,makeGetProductProperties,makeGetProductEffectivityDates,makeGetProductCharacteristics,makeGetProductFeaturedMedia,makeIsProductActive,makeIsBaseProductActive,makeGetProductType}from"./selectors/product";export*from"./selectors/price";export*from"./selectors/variants";export*from"./selectors/relations";// CONTEXTS
5
+ export{ProductContext,VariantContext}from"./components/context";export{default as ProductListTypeContext}from"./providers/ProductListType/context";export{default as ProductListEntryContext}from"./providers/ProductListEntry/context";export*from"./collections";export*from"./constants";export*from"./helpers";export*from"./components";export*from"./hocs";export*from"./hooks";export*from"./providers";// eslint-disable-next-line import/export
6
+ export*from"./streams";
@@ -0,0 +1,5 @@
1
+ import{connect}from'react-redux';import provideProduct from'@shopgate/pwa-common-commerce/product/action-creators/provideProduct';import{getProduct}from'@shopgate/pwa-common-commerce/product/selectors/product';/**
2
+ * @param {Object} state .
3
+ * @param {Object} props .
4
+ * @return {Object}
5
+ */var mapStateToProps=function mapStateToProps(state,props){return{product:getProduct(state,props)};};var mapDispatchToProps={provideProduct:provideProduct};export default connect(mapStateToProps,mapDispatchToProps);
@@ -0,0 +1,4 @@
1
+ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useEffect}from'react';import PropTypes from'prop-types';import connect from"./connector";/**
2
+ * The ProductProvider component.
3
+ * @return {JSX}
4
+ */var ProductProvider=function ProductProvider(_ref){var children=_ref.children,productId=_ref.productId,provideProduct=_ref.provideProduct,product=_ref.product;useEffect(function(){if(!product){provideProduct(productId);}},[provideProduct,product,productId]);var props={productId:productId,product:product};if(typeof children==='function'){return children(props);}return React.cloneElement(children,_extends({},props,{},children.props));};ProductProvider.defaultProps={product:null};export default connect(ProductProvider);
@@ -0,0 +1 @@
1
+ export{default as ProductProvider}from"./Product";export{default as ProductListTypeProvider}from"./ProductListType";export{default as ProductListEntryProvider}from"./ProductListEntry";