vviinn-widgets 2.1.0 → 2.2.2

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 (307) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/{vviinn-widgets/app-globals-e0943e34.js → cjs/app-globals-30781f30.js} +15 -925
  3. package/{www/build/cropper-handler.entry.js → dist/cjs/cropper-handler.cjs.entry.js} +11 -7
  4. package/dist/{vviinn-widgets/customized-slots-f3449695.js → cjs/customized-slots-5d904d8e.js} +6 -3
  5. package/dist/cjs/highlight-box_22.cjs.entry.js +737 -0
  6. package/{www/build/imageSearch.store-407f49f0.js → dist/cjs/imageSearch.store-128957a4.js} +11573 -11902
  7. package/dist/cjs/index-741a970d.js +1354 -0
  8. package/dist/cjs/index-c493804d.js +41 -0
  9. package/dist/cjs/index.cjs.js +2 -0
  10. package/dist/cjs/loader.cjs.js +23 -0
  11. package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
  12. package/dist/{vviinn-widgets/vviinn-error.entry.js → cjs/vviinn-error.cjs.entry.js} +8 -4
  13. package/{www/build/vviinn-preloader.entry.js → dist/cjs/vviinn-preloader.cjs.entry.js} +11 -10
  14. package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
  15. package/{www/build/vviinn-vps-widget.entry.js → dist/cjs/vviinn-vps-widget.cjs.entry.js} +31 -30
  16. package/dist/cjs/vviinn-widgets.cjs.js +21 -0
  17. package/dist/collection/Image/error.js +14 -0
  18. package/dist/collection/Image/form.js +5 -0
  19. package/dist/collection/Image/fromFile.js +18 -0
  20. package/dist/collection/Image/imageToB64.js +9 -0
  21. package/dist/collection/Image/index.js +0 -0
  22. package/dist/collection/Image/renderPromise.js +6 -0
  23. package/dist/collection/Image/resizeImage.js +28 -0
  24. package/dist/collection/Image/sizing.js +39 -0
  25. package/dist/collection/Image/toFile.js +17 -0
  26. package/dist/collection/analytics/GAnalytics.js +32 -0
  27. package/dist/collection/analytics/GeneralAnalytics.js +9 -0
  28. package/dist/collection/analytics/GtagAnalytics.js +35 -0
  29. package/dist/collection/analytics/ProductAnalytics.js +1 -0
  30. package/dist/collection/campaign/Campaign.js +8 -0
  31. package/dist/collection/campaign/CampaignService.js +5 -0
  32. package/dist/collection/campaign/VCSCampaign.js +1 -0
  33. package/dist/collection/campaign/VCSCampaignResponse.js +1 -0
  34. package/dist/collection/campaign/VCSCampaignService.js +5 -0
  35. package/dist/collection/campaign/VPRCampaignResponse.js +1 -0
  36. package/dist/collection/campaign/VPRCampaignService.js +5 -0
  37. package/dist/collection/collection-manifest.json +43 -0
  38. package/dist/collection/components/customized-slots.js +47 -0
  39. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +71 -0
  40. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +25 -0
  41. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +49 -0
  42. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +64 -0
  43. package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.css +33 -0
  44. package/dist/{vviinn-widgets/image-cropper.entry.js → collection/components/image-search/image-view/image-cropper/image-cropper.js} +54 -32
  45. package/dist/collection/components/image-search/search-filters/search-filters.css +120 -0
  46. package/dist/collection/components/image-search/search-filters/search-filters.js +102 -0
  47. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +138 -0
  48. package/{www/build/vviinn-carousel.entry.js → dist/collection/components/vviinn-carousel/vviinn-carousel.js} +115 -18
  49. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.css +7 -0
  50. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +36 -0
  51. package/dist/collection/components/vviinn-error/vviinn-error.css +38 -0
  52. package/dist/collection/components/vviinn-error/vviinn-error.js +18 -0
  53. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.css +3 -0
  54. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +34 -0
  55. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.css +3 -0
  56. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +34 -0
  57. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.css +34 -0
  58. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +129 -0
  59. package/dist/collection/components/vviinn-example-images/vviinn-example-images.css +19 -0
  60. package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +80 -0
  61. package/dist/{vviinn-widgets/index-c9483145.js → collection/components/vviinn-icons/index.js} +13 -12
  62. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +25 -0
  63. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +64 -0
  64. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +47 -0
  65. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +83 -0
  66. package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +31 -0
  67. package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +61 -0
  68. package/dist/collection/components/vviinn-modal/vviinn-modal.css +105 -0
  69. package/dist/collection/components/vviinn-modal/vviinn-modal.js +98 -0
  70. package/dist/collection/components/vviinn-onboarding/onboarding-cards/onboarding-card.css +41 -0
  71. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +26 -0
  72. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +26 -0
  73. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +26 -0
  74. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.css +58 -0
  75. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +28 -0
  76. package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +33 -0
  77. package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +15 -0
  78. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +29 -0
  79. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +71 -0
  80. package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +37 -0
  81. package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +20 -0
  82. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +19 -0
  83. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +27 -0
  84. package/dist/collection/components/vviinn-product-card/render-helpers.js +32 -0
  85. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +95 -0
  86. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +425 -0
  87. package/dist/collection/components/vviinn-slider/arrow.js +11 -0
  88. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.css +4 -0
  89. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +15 -0
  90. package/dist/collection/components/vviinn-slider/vviinn-slider.css +109 -0
  91. package/dist/collection/components/vviinn-slider/vviinn-slider.js +181 -0
  92. package/dist/collection/components/vviinn-teaser/vviinn-teaser.css +14 -0
  93. package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +29 -0
  94. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
  95. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
  96. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
  97. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
  98. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
  99. package/dist/collection/components/vviinn-vpr-widget/GridMode.js +1 -0
  100. package/dist/collection/components/vviinn-vpr-widget/token-helpers.js +11 -0
  101. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +441 -0
  102. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +74 -0
  103. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +0 -0
  104. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +177 -0
  105. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +350 -0
  106. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +247 -0
  107. package/dist/collection/cropper/Cropper.js +1 -0
  108. package/dist/collection/cropper/Handler.js +61 -0
  109. package/dist/collection/dom/index.js +3 -0
  110. package/dist/collection/error.js +14 -0
  111. package/dist/collection/file/index.js +4 -0
  112. package/dist/collection/geometry/Clip.js +14 -0
  113. package/dist/collection/geometry/Point.js +32 -0
  114. package/dist/collection/geometry/Rectangle.js +95 -0
  115. package/dist/collection/geometry/RectangleAlt.js +1 -0
  116. package/dist/collection/geometry/Sized.js +8 -0
  117. package/dist/collection/global.js +19 -0
  118. package/dist/collection/index.js +1 -0
  119. package/dist/collection/interfaces/generated.js +5 -0
  120. package/dist/collection/interfaces/recommendation.js +1 -0
  121. package/dist/collection/network/apiClient.js +9 -0
  122. package/dist/collection/network/ion/File.js +14 -0
  123. package/dist/collection/network/ion/Form.js +64 -0
  124. package/dist/collection/network/ion/Link.js +8 -0
  125. package/dist/collection/network/ion/ValueObject.js +23 -0
  126. package/dist/collection/network/request.js +19 -0
  127. package/dist/collection/network/utils.js +37 -0
  128. package/dist/collection/recommendation/recommendation.js +1 -0
  129. package/dist/collection/searchSession/searchSession.js +26 -0
  130. package/dist/collection/sentry.js +14 -0
  131. package/dist/collection/slider/GridMode.js +1 -0
  132. package/dist/collection/store/file-processing.js +13 -0
  133. package/dist/collection/store/imageSearch.store.js +138 -0
  134. package/dist/collection/store/store.js +11 -0
  135. package/dist/collection/stories/Button.js +21 -0
  136. package/dist/collection/stories/Button.stories.js +42 -0
  137. package/dist/collection/stories/Header.js +45 -0
  138. package/dist/collection/stories/Header.stories.js +15 -0
  139. package/dist/collection/stories/Page.js +61 -0
  140. package/dist/collection/stories/Page.stories.js +19 -0
  141. package/dist/collection/stories/assets/code-brackets.svg +1 -0
  142. package/dist/collection/stories/assets/colors.svg +1 -0
  143. package/dist/collection/stories/assets/comments.svg +1 -0
  144. package/dist/collection/stories/assets/direction.svg +1 -0
  145. package/dist/collection/stories/assets/flow.svg +1 -0
  146. package/dist/collection/stories/assets/plugin.svg +1 -0
  147. package/dist/collection/stories/assets/repo.svg +1 -0
  148. package/dist/collection/stories/assets/stackalt.svg +1 -0
  149. package/dist/collection/stories/image-selector.stories.js +6 -0
  150. package/dist/collection/stories/image-view.stories.js +6 -0
  151. package/dist/collection/stories/modal.stories.js +12 -0
  152. package/dist/collection/stories/onboarding.stories.js +11 -0
  153. package/dist/collection/stories/overlay.stories.js +5 -0
  154. package/dist/collection/stories/overlayedModal.stories.js +8 -0
  155. package/dist/collection/stories/privacy-badge.stories.js +11 -0
  156. package/dist/collection/stories/slider.stories.js +17 -0
  157. package/dist/collection/stories/teaser.stories.js +5 -0
  158. package/dist/collection/stories/vps-widget.stories.js +47 -0
  159. package/dist/collection/stories/vviinn-product.stories.js +19 -0
  160. package/dist/collection/utils/collections/collectionsUtils.js +5 -0
  161. package/dist/collection/utils/either.js +3 -0
  162. package/dist/collection/utils/enum/enumUtils.js +3 -0
  163. package/dist/collection/utils/event/Events.js +1 -0
  164. package/dist/collection/utils/number/index.js +4 -0
  165. package/dist/collection/utils/option/option.js +4 -0
  166. package/dist/collection/utils/semigroup/semigroupDiff.js +6 -0
  167. package/dist/collection/utils/token/tokenUtils.js +9 -0
  168. package/dist/esm/Handler-639a4cb3.js +308 -0
  169. package/{www/build/app-globals-e0943e34.js → dist/esm/app-globals-345e497d.js} +10 -922
  170. package/dist/{vviinn-widgets → esm}/cropper-handler.entry.js +2 -2
  171. package/{www/build/customized-slots-f3449695.js → dist/esm/customized-slots-a76a8d41.js} +1 -1
  172. package/dist/esm/highlight-box_22.entry.js +712 -0
  173. package/dist/{vviinn-widgets/imageSearch.store-407f49f0.js → esm/imageSearch.store-8eab0da1.js} +11510 -11872
  174. package/dist/esm/index-6fa21e24.js +1323 -0
  175. package/{www/build/index-c9483145.js → dist/esm/index-8cb063df.js} +6 -4
  176. package/dist/esm/index.js +1 -0
  177. package/dist/esm/loader.js +19 -0
  178. package/dist/esm/polyfills/core-js.js +11 -0
  179. package/dist/esm/polyfills/css-shim.js +1 -0
  180. package/dist/esm/polyfills/dom.js +79 -0
  181. package/dist/esm/polyfills/es5-html-element.js +1 -0
  182. package/dist/esm/polyfills/index.js +34 -0
  183. package/dist/esm/polyfills/system.js +6 -0
  184. package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
  185. package/{www/build → dist/esm}/vviinn-error.entry.js +1 -1
  186. package/dist/{vviinn-widgets → esm}/vviinn-preloader.entry.js +3 -6
  187. package/dist/{vviinn-widgets → esm}/vviinn-vps-button.entry.js +3 -3
  188. package/dist/{vviinn-widgets → esm}/vviinn-vps-widget.entry.js +4 -7
  189. package/dist/esm/vviinn-widgets.js +19 -0
  190. package/dist/index.cjs.js +1 -0
  191. package/dist/index.js +1 -0
  192. package/dist/loader/cdn.js +3 -0
  193. package/dist/loader/index.cjs.js +3 -0
  194. package/dist/loader/index.d.ts +12 -0
  195. package/dist/loader/index.es2017.js +3 -0
  196. package/dist/loader/index.js +4 -0
  197. package/dist/loader/package.json +10 -0
  198. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +1 -0
  199. package/dist/types/components/vviinn-icons/index.d.ts +2 -0
  200. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
  201. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
  202. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
  203. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
  204. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
  205. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +13 -3
  206. package/dist/types/components.d.ts +54 -0
  207. package/dist/vviinn-widgets/index.esm.js +0 -1
  208. package/dist/vviinn-widgets/p-04b06ea9.entry.js +1 -0
  209. package/dist/vviinn-widgets/p-400eb62f.entry.js +1 -0
  210. package/dist/vviinn-widgets/p-56fc949a.js +1 -0
  211. package/dist/vviinn-widgets/p-59edfbe2.js +1 -0
  212. package/dist/vviinn-widgets/p-78ccc9eb.js +15 -0
  213. package/dist/vviinn-widgets/p-9d24f51e.entry.js +1 -0
  214. package/dist/vviinn-widgets/p-d085199d.entry.js +1 -0
  215. package/dist/vviinn-widgets/p-e1ba8626.js +1 -0
  216. package/dist/vviinn-widgets/p-e38f4aa2.entry.js +1 -0
  217. package/dist/vviinn-widgets/p-e67cae57.js +1 -0
  218. package/dist/vviinn-widgets/p-f47e82b2.entry.js +1 -0
  219. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  220. package/dist/vviinn-widgets/p-fb14e3cc.entry.js +1 -0
  221. package/dist/vviinn-widgets/vviinn-widgets.css +1 -6
  222. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -125
  223. package/package.json +3 -1
  224. package/www/build/index.esm.js +0 -1
  225. package/www/build/p-04b06ea9.entry.js +1 -0
  226. package/www/build/p-400eb62f.entry.js +1 -0
  227. package/www/build/p-56fc949a.js +1 -0
  228. package/www/build/p-59edfbe2.js +1 -0
  229. package/www/build/p-78ccc9eb.js +15 -0
  230. package/www/build/p-7e4978d5.js +1 -0
  231. package/www/build/p-9d24f51e.entry.js +1 -0
  232. package/www/build/p-a67898be.css +1 -0
  233. package/www/build/p-d085199d.entry.js +1 -0
  234. package/www/build/p-e1ba8626.js +1 -0
  235. package/www/build/p-e38f4aa2.entry.js +1 -0
  236. package/www/build/p-e67cae57.js +1 -0
  237. package/www/build/p-f47e82b2.entry.js +1 -0
  238. package/www/build/p-f582db5c.js +1 -0
  239. package/www/build/p-fb14e3cc.entry.js +1 -0
  240. package/www/build/vviinn-widgets.css +1 -6
  241. package/www/build/vviinn-widgets.esm.js +1 -125
  242. package/www/index.html +6 -13
  243. package/dist/vviinn-widgets/Array-4b9f84cf.js +0 -4295
  244. package/dist/vviinn-widgets/Handler-47db9890.js +0 -1428
  245. package/dist/vviinn-widgets/NonEmptyArray-6ef0d207.js +0 -4370
  246. package/dist/vviinn-widgets/css-shim-f0027935.js +0 -4
  247. package/dist/vviinn-widgets/dom-db0073f0.js +0 -73
  248. package/dist/vviinn-widgets/highlight-box.entry.js +0 -41
  249. package/dist/vviinn-widgets/index-b6d739a9.js +0 -3010
  250. package/dist/vviinn-widgets/number-98d54dd6.js +0 -1533
  251. package/dist/vviinn-widgets/search-filters.entry.js +0 -73
  252. package/dist/vviinn-widgets/shadow-css-c1fdfa9f.js +0 -389
  253. package/dist/vviinn-widgets/vviinn-carousel.entry.js +0 -205
  254. package/dist/vviinn-widgets/vviinn-detected-object.entry.js +0 -52
  255. package/dist/vviinn-widgets/vviinn-empty-results.entry.js +0 -16
  256. package/dist/vviinn-widgets/vviinn-example-image.entry.js +0 -38
  257. package/dist/vviinn-widgets/vviinn-example-images.entry.js +0 -28
  258. package/dist/vviinn-widgets/vviinn-image-selector.entry.js +0 -31
  259. package/dist/vviinn-widgets/vviinn-image-view.entry.js +0 -55
  260. package/dist/vviinn-widgets/vviinn-modal.entry.js +0 -30
  261. package/dist/vviinn-widgets/vviinn-onboarding-card-1.entry.js +0 -21
  262. package/dist/vviinn-widgets/vviinn-onboarding-card-2.entry.js +0 -21
  263. package/dist/vviinn-widgets/vviinn-onboarding-card-3.entry.js +0 -21
  264. package/dist/vviinn-widgets/vviinn-onboarding.entry.js +0 -20
  265. package/dist/vviinn-widgets/vviinn-overlay.entry.js +0 -15
  266. package/dist/vviinn-widgets/vviinn-overlayed-modal.entry.js +0 -18
  267. package/dist/vviinn-widgets/vviinn-privacy-badge.entry.js +0 -20
  268. package/dist/vviinn-widgets/vviinn-product-card.entry.js +0 -176
  269. package/dist/vviinn-widgets/vviinn-server-error.entry.js +0 -16
  270. package/dist/vviinn-widgets/vviinn-slide.entry.js +0 -15
  271. package/dist/vviinn-widgets/vviinn-slider.entry.js +0 -120
  272. package/dist/vviinn-widgets/vviinn-teaser.entry.js +0 -20
  273. package/dist/vviinn-widgets/vviinn-vpr-widget.entry.js +0 -128
  274. package/dist/vviinn-widgets/vviinn-wrong-format.entry.js +0 -16
  275. package/www/build/Array-4b9f84cf.js +0 -4295
  276. package/www/build/Handler-47db9890.js +0 -1428
  277. package/www/build/NonEmptyArray-6ef0d207.js +0 -4370
  278. package/www/build/css-shim-f0027935.js +0 -4
  279. package/www/build/dom-db0073f0.js +0 -73
  280. package/www/build/highlight-box.entry.js +0 -41
  281. package/www/build/image-cropper.entry.js +0 -113
  282. package/www/build/index-b6d739a9.js +0 -3010
  283. package/www/build/number-98d54dd6.js +0 -1533
  284. package/www/build/search-filters.entry.js +0 -73
  285. package/www/build/shadow-css-c1fdfa9f.js +0 -389
  286. package/www/build/vviinn-detected-object.entry.js +0 -52
  287. package/www/build/vviinn-empty-results.entry.js +0 -16
  288. package/www/build/vviinn-example-image.entry.js +0 -38
  289. package/www/build/vviinn-example-images.entry.js +0 -28
  290. package/www/build/vviinn-image-selector.entry.js +0 -31
  291. package/www/build/vviinn-image-view.entry.js +0 -55
  292. package/www/build/vviinn-modal.entry.js +0 -30
  293. package/www/build/vviinn-onboarding-card-1.entry.js +0 -21
  294. package/www/build/vviinn-onboarding-card-2.entry.js +0 -21
  295. package/www/build/vviinn-onboarding-card-3.entry.js +0 -21
  296. package/www/build/vviinn-onboarding.entry.js +0 -20
  297. package/www/build/vviinn-overlay.entry.js +0 -15
  298. package/www/build/vviinn-overlayed-modal.entry.js +0 -18
  299. package/www/build/vviinn-privacy-badge.entry.js +0 -20
  300. package/www/build/vviinn-product-card.entry.js +0 -176
  301. package/www/build/vviinn-server-error.entry.js +0 -16
  302. package/www/build/vviinn-slide.entry.js +0 -15
  303. package/www/build/vviinn-slider.entry.js +0 -120
  304. package/www/build/vviinn-teaser.entry.js +0 -20
  305. package/www/build/vviinn-vpr-widget.entry.js +0 -128
  306. package/www/build/vviinn-vps-button.entry.js +0 -39
  307. package/www/build/vviinn-wrong-format.entry.js +0 -16
@@ -0,0 +1,1224 @@
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-6fa21e24.js';
2
+ import { _ as _Array, O as Option, S as Semigroup, a as _function, E as Either, i as imageSearchState, s as state, c as chainW, m as makeRequest, f as fromEither, g as getApiPath, b as createInitGetRequest, d as sequenceT, A as Apply, e as state$1, T as TaskEither } from './imageSearch.store-8eab0da1.js';
3
+ import { C as ChevronIcon, a as CrossIcon, V as VisualSearchIcon } from './index-8cb063df.js';
4
+ import { p as pipe } from './Handler-639a4cb3.js';
5
+
6
+ const vviinnCarouselCss = ":host{--vviinn-progressbar-width:0;--vviinn-carousel-item-width:150px;--vviinn-carousel-columns-internal:var(--vviinn-carousel-columns, 4);--vviinn-carousel-image-width-system:140px}.body{display:flex;position:relative;width:var(--vviinn-carousel-content-width);flex-direction:column}.content-wrapper *{box-sizing:border-box}.content-wrapper{overflow-y:hidden;overflow-x:auto;flex-grow:1}.bullets{margin-top:16px;display:flex;flex-direction:row;grid-gap:24px;justify-content:center}.bullet{width:10px;height:10px;background:#E0E0E0;border-radius:50%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) button{border-radius:2px}:host(.grid) button{border-radius:50%}button{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}button.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";
7
+
8
+ const COLUMNS_NUMBER_CSS_VAR = "--vviinn-carousel-columns-internal";
9
+ const CAROUSEL_WIDTH_CSS_VAR = "--vviinn-carousel-content-width";
10
+ const CAROUSEL_IMAGE_WIDTH_CSS_VAR = "--vviinn-carousel-image-width";
11
+ const CONTENT_GROUP_CSS_CLASS = "items-group";
12
+ let VviinnCarousel = class {
13
+ constructor(hostRef) {
14
+ registerInstance(this, hostRef);
15
+ this.moveDirection = "right";
16
+ this.contentGroups = [];
17
+ this.activeContentGroup = 0;
18
+ this.mode = "continuity";
19
+ this.imageWidth = 140;
20
+ this.showScroll = true;
21
+ this.recommendations = [];
22
+ this.columns = 0;
23
+ this.resizeObserver = new ResizeObserver(() => this.handleResize());
24
+ this.mutationObserver = new MutationObserver(() => this.cloneSlottedContent());
25
+ }
26
+ connectedCallback() {
27
+ this.setItemWidth();
28
+ }
29
+ disconnectedCallback() {
30
+ this.resizeObserver.disconnect();
31
+ }
32
+ componentDidLoad() {
33
+ this.setWidth();
34
+ this.processScrollbarWidth();
35
+ this.columns = this.getColumnsNumber();
36
+ const slot = this.el.querySelector(".content");
37
+ this.mutationObserver.observe(slot, { subtree: true, childList: true });
38
+ this.resizeObserver.observe(this.getHostParent());
39
+ }
40
+ getItemWidthFromDocument() {
41
+ return parseInt(getComputedStyle(document.body).getPropertyValue(CAROUSEL_IMAGE_WIDTH_CSS_VAR));
42
+ }
43
+ setItemWidth() {
44
+ const widthInDocument = this.getItemWidthFromDocument();
45
+ const itemWidth = isNaN(widthInDocument)
46
+ ? this.imageWidth
47
+ : widthInDocument;
48
+ this.el.style.setProperty(CAROUSEL_IMAGE_WIDTH_CSS_VAR, `${itemWidth}px`);
49
+ }
50
+ getContentClassMap() {
51
+ return {
52
+ content: true,
53
+ [this.moveDirection]: true,
54
+ [this.mode]: true,
55
+ "show-scrollbar": this.showScroll
56
+ };
57
+ }
58
+ handleResize() {
59
+ this.setWidth();
60
+ this.processScrollbarWidth();
61
+ this.setItemWidth();
62
+ const newColumns = this.getColumnsNumber();
63
+ if (newColumns !== this.columns) {
64
+ this.columns = newColumns;
65
+ }
66
+ }
67
+ calculateMoveStep() {
68
+ const contentWidths = this.getContent().map((el) => el.getBoundingClientRect().width);
69
+ const sum = contentWidths.reduce((acc, val) => acc + val, 0);
70
+ return sum / contentWidths.length;
71
+ }
72
+ getHostParent() {
73
+ const parent = this.el.parentNode;
74
+ return parent.host.parentElement;
75
+ }
76
+ setWidth() {
77
+ const parent = this.getHostParent();
78
+ if (!parent)
79
+ return;
80
+ const parentStyles = getComputedStyle(parent);
81
+ const parentWidth = parent.getBoundingClientRect().width;
82
+ const width = parentWidth -
83
+ (parseInt(parentStyles["padding-right"]) +
84
+ parseInt(parentStyles["padding-left"]));
85
+ this.el.style.setProperty(CAROUSEL_WIDTH_CSS_VAR, `${width}px`);
86
+ }
87
+ getParent() {
88
+ const parentNode = this.el.parentNode;
89
+ const host = parentNode.host;
90
+ return host.parentElement;
91
+ }
92
+ cloneSlottedContent() {
93
+ this.setWidth();
94
+ }
95
+ getActiveGroupIndex() {
96
+ var _a, _b;
97
+ const contentNodeLeft = (_b = (_a = this.getContentNode()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.left;
98
+ if (!contentNodeLeft)
99
+ return 0;
100
+ const groups = this.getContentGroups();
101
+ const groupsPositions = groups.map((g) => g.getBoundingClientRect().left);
102
+ const indexedPositions = groupsPositions
103
+ .map((value, index) => [value, index])
104
+ .filter((x) => x[0] >= 0);
105
+ return indexedPositions.length > 0 ? indexedPositions[0][1] : 0;
106
+ }
107
+ getContentNode() {
108
+ return this.el.querySelector(".content");
109
+ }
110
+ getContent() {
111
+ const children = this.getContentNode().children;
112
+ return Array.from(children).map((c) => c);
113
+ }
114
+ getColumnsNumber() {
115
+ const styleSheet = getComputedStyle(this.el);
116
+ const columnsInCss = styleSheet.getPropertyValue(COLUMNS_NUMBER_CSS_VAR);
117
+ return parseInt(columnsInCss);
118
+ }
119
+ getContentGroups() {
120
+ return Array.from(this.el.querySelectorAll(`.${CONTENT_GROUP_CSS_CLASS}`));
121
+ }
122
+ showNext() {
123
+ this.moveDirection = "right";
124
+ const contentContainer = this.getContentNode();
125
+ requestAnimationFrame(() => {
126
+ contentContainer.scrollTo({
127
+ top: 0,
128
+ left: contentContainer.scrollLeft + this.calculateMoveStep(),
129
+ behavior: "smooth",
130
+ });
131
+ });
132
+ }
133
+ showPrev() {
134
+ this.moveDirection = "left";
135
+ const contentContainer = this.getContentNode();
136
+ requestAnimationFrame(() => {
137
+ contentContainer.scrollTo({
138
+ top: 0,
139
+ left: contentContainer.scrollLeft - this.calculateMoveStep(),
140
+ behavior: "smooth",
141
+ });
142
+ });
143
+ }
144
+ scroll(index) {
145
+ const contentContainer = this.getContentNode();
146
+ requestAnimationFrame(() => {
147
+ contentContainer.scrollTo({
148
+ top: 0,
149
+ left: this.calculateMoveStep() * index,
150
+ behavior: "smooth",
151
+ });
152
+ });
153
+ }
154
+ processScrollbarWidth() {
155
+ const target = this.getContentNode();
156
+ const scrollRatio = (target.scrollLeft + target.clientWidth) / target.scrollWidth;
157
+ const scrolledWidth = target.clientWidth * scrollRatio;
158
+ this.el.style.setProperty("--vviinn-progressbar-width", `${scrolledWidth}px`);
159
+ this.activeContentGroup = this.getActiveGroupIndex();
160
+ }
161
+ showBullets() {
162
+ return this.mode === "grid" && this.showScroll;
163
+ }
164
+ showScrollbar() {
165
+ return this.mode === "continuity" && this.showScroll;
166
+ }
167
+ getClassMap() {
168
+ return {
169
+ [this.mode]: true,
170
+ "show-scrollbar": this.showScrollbar(),
171
+ };
172
+ }
173
+ renderRecommendation(recommendation) {
174
+ return (h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.mode === "continuity" }));
175
+ }
176
+ renderRecommendationGroup(elements) {
177
+ return h("div", { class: CONTENT_GROUP_CSS_CLASS }, elements);
178
+ }
179
+ renderRecommendationGroups(elements) {
180
+ return elements.map((el) => this.renderRecommendationGroup(el));
181
+ }
182
+ renderRecommendations() {
183
+ return this.mode === "grid"
184
+ ? this.renderGrid()
185
+ : this.renderRecommendationsElements();
186
+ }
187
+ renderRecommendationsElements() {
188
+ return this.recommendations.map((r) => this.renderRecommendation(r));
189
+ }
190
+ renderGrid() {
191
+ const recommendations = this.renderRecommendationsElements();
192
+ const grouppedContent = _Array.chunksOf(this.getColumnsNumber())(recommendations);
193
+ return this.renderRecommendationGroups(grouppedContent);
194
+ }
195
+ renderBullets() {
196
+ const numberOfBullets = Math.ceil(this.recommendations.length / this.getColumnsNumber());
197
+ const bulletsArray = Array.from(Array(numberOfBullets).keys());
198
+ return bulletsArray.map((index) => (h("div", { class: {
199
+ bullet: true,
200
+ active: this.activeContentGroup === index,
201
+ }, onClick: () => this.scroll(index) })));
202
+ }
203
+ render() {
204
+ return (h(Host, { class: this.getClassMap() }, h("div", { class: Object.assign({ body: true }, this.getClassMap()) }, h("button", { class: "prev", onClick: () => this.showPrev() }, h(ChevronIcon, null)), h("div", { class: this.getContentClassMap(), onScroll: () => this.processScrollbarWidth() }, this.renderRecommendations()), h("button", { class: "next", onClick: () => this.showNext() }, h(ChevronIcon, null))), this.showBullets() ? (h("div", { class: "bullets" }, this.renderBullets())) : ("")));
205
+ }
206
+ get el() { return getElement(this); }
207
+ };
208
+ VviinnCarousel.style = vviinnCarouselCss;
209
+
210
+ class GtagAnalytics {
211
+ sendImpression(product) {
212
+ var _a, _b, _c;
213
+ gtag('event', 'view_item_list', {
214
+ items: [
215
+ {
216
+ id: product.productId,
217
+ name: product.title,
218
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
219
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
220
+ list_name: 'VI VPR View',
221
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
222
+ }
223
+ ]
224
+ });
225
+ return undefined;
226
+ }
227
+ sendClick(product) {
228
+ var _a, _b, _c;
229
+ gtag('event', 'select_content', {
230
+ content_type: 'product',
231
+ items: [
232
+ {
233
+ id: product.productId,
234
+ name: product.title,
235
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
236
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
237
+ list_name: 'VI VPR View',
238
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
239
+ }
240
+ ]
241
+ });
242
+ return undefined;
243
+ }
244
+ }
245
+
246
+ class GAnalytics {
247
+ constructor() {
248
+ ga('require', 'ec');
249
+ }
250
+ convertProduct(product) {
251
+ var _a, _b, _c;
252
+ return {
253
+ id: product.productId,
254
+ name: product.title,
255
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
256
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
257
+ list: 'VI VPR View',
258
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
259
+ };
260
+ }
261
+ sendImpression(product) {
262
+ ga('ec:addImpression', this.convertProduct(product));
263
+ return undefined;
264
+ }
265
+ sendClick(product) {
266
+ var _a, _b, _c;
267
+ ga('ec:addProduct', {
268
+ id: product.productId,
269
+ name: product.title,
270
+ brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
271
+ category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
272
+ price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
273
+ });
274
+ ga('ec:setAction', 'click', { list: 'VI VPR View' });
275
+ return undefined;
276
+ }
277
+ }
278
+
279
+ const getGtagAnalytics = () => _function.pipe(Option.fromNullable(window.gtag), Option.map(() => new GtagAnalytics()));
280
+ const getCommonAnalytics = () => _function.pipe(Option.fromNullable(window.ga), Option.map(() => new GAnalytics()));
281
+ const analyticsMonoid = Option.getMonoid(Semigroup.first());
282
+ const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
283
+
284
+ const FIT_EXPR = /fit\/\d+\//;
285
+ const containsFit = (url) => {
286
+ return _function.pipe(url.match(FIT_EXPR), Either.fromNullable(url), Either.map(() => url));
287
+ };
288
+ const processWidth = (url, size) => {
289
+ return _function.pipe(containsFit(url), Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), Either.getOrElse(() => url));
290
+ };
291
+ const Linked = (props, child) => props.deeplink ? (h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
292
+ const FormattedPrice = (props) => {
293
+ var _a;
294
+ const locale = props.locale;
295
+ const formattedPrice = new Intl.NumberFormat(locale, {
296
+ minimumFractionDigits: 2,
297
+ }).format(props.price);
298
+ const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
299
+ return (h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
300
+ };
301
+ const Price = (props) => {
302
+ const priceEl = (h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
303
+ return (h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
304
+ h("span", { class: "price-sale", part: "price-sale" },
305
+ h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
306
+ h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
307
+ ]) : (h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
308
+ };
309
+ const Image = (props, onLoadEnd = () => undefined) => (h("picture", null,
310
+ h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image", width: props.width, height: props.height, src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
311
+ const ResponsiveImage = (props, onLoadEnd = () => undefined) => (h("picture", null,
312
+ h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
313
+
314
+ const vviinnProductCardCss = ":host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:\"\";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}";
315
+
316
+ let VviinnProductCard = class {
317
+ constructor(hostRef) {
318
+ registerInstance(this, hostRef);
319
+ this.recommendationLoad = createEvent(this, "recommendationLoad", 7);
320
+ this.recommendationView = createEvent(this, "recommendationView", 7);
321
+ this.recommendationClick = createEvent(this, "recommendationClick", 7);
322
+ this.productImageLoaded = createEvent(this, "productImageLoaded", 7);
323
+ this.currency = undefined;
324
+ this.imageRatio = 1;
325
+ this.imageWidth = 200;
326
+ this.locale = undefined;
327
+ this.pricePrefix = undefined;
328
+ this.responsive = false;
329
+ this.dimmedBackground = false;
330
+ this.imageLoaded = false;
331
+ this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
332
+ }
333
+ intersectionCallback(data) {
334
+ if (data.some((entry) => entry.isIntersecting)) {
335
+ _function.pipe(getAnalyticsModule, Option.map((analytics) => analytics.sendImpression(this.getProduct())));
336
+ this.recommendationView.emit(this.productId);
337
+ this.intersectionObserver.disconnect();
338
+ }
339
+ }
340
+ componentDidLoad() {
341
+ this.recommendationLoad.emit(this.productId);
342
+ this.intersectionObserver.observe(this.el);
343
+ const links = this.el.shadowRoot.querySelectorAll("a");
344
+ links.forEach((link) => link.addEventListener("mousedown", (event) => {
345
+ this.recommendationClick.emit(this.productId);
346
+ if (window.ga) {
347
+ event.preventDefault();
348
+ }
349
+ _function.pipe(getAnalyticsModule, Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
350
+ if (window.ga) {
351
+ ga("send", "event", "UX", "click", "Results", {
352
+ hitCallback: function () {
353
+ document.location.href = this.deeplink;
354
+ },
355
+ });
356
+ }
357
+ }));
358
+ }
359
+ getProduct() {
360
+ return imageSearchState.results.find((r) => r.productId === this.productId);
361
+ }
362
+ renderImage() {
363
+ const props = {
364
+ width: this.imageWidth,
365
+ height: this.imageWidth * this.imageRatio,
366
+ src: this.image,
367
+ title: this.productTitle,
368
+ lazy: false,
369
+ };
370
+ return this.responsive
371
+ ? ResponsiveImage(props, () => this.kek())
372
+ : Image(props, () => this.kek());
373
+ }
374
+ kek() {
375
+ this.productImageLoaded.emit(this.productId);
376
+ }
377
+ render() {
378
+ var _a, _b, _c;
379
+ return (h(Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title" }, h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), h(Linked, { deeplink: this.deeplink, part: "deeplink" }, h("span", { class: "title", part: "title" }, this.productTitle)), h("span", { class: "brand", part: "brand" }, this.brand), h("span", { class: "type", part: "type" }, this.productType), h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : state.locale })));
380
+ }
381
+ get el() { return getElement(this); }
382
+ };
383
+ VviinnProductCard.style = vviinnProductCardCss;
384
+
385
+ const recommendationsSidebarCss = ":host{--vviinn-carousel-columns:0;box-sizing:border-box;display:block;display:flex;height:100vh;left:0;position:fixed;top:0;transition:background 0.1s ease-in-out;width:100vw}:host(.open){background:rgba(0, 0, 0, 0.2)}:host(.bottom){flex-direction:column;justify-content:end}:host(.right){flex-direction:row;justify-content:flex-end}header{position:relative;text-align:center;padding:32px}header.contains-source-img{display:grid;justify-items:center;grid-gap:12px}img.source-image{width:64px;height:64px;border-radius:50%;box-shadow:0px 2px 4px rgba(0, 0, 0, 0.15);padding:8px}:host(.right) header{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.1)}main{padding:0 24px}:host(.right) main{overflow:auto}.sidebar{background:white;box-sizing:border-box;display:flex;flex-direction:column}:host(.bottom.idle) .sidebar,:host(.bottom.closed) .sidebar{transform:translateY(100%)}:host(.bottom.closed) .sidebar{-webkit-animation-name:slideOutFromBottom;animation-name:slideOutFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.bottom.open) .sidebar{-webkit-animation-name:slideInFromBottom;animation-name:slideInFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.idle) .sidebar{transform:translateX(100%)}:host(.right.closed) .sidebar{-webkit-animation-name:slideOutFromRight;animation-name:slideOutFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.open) .sidebar{-webkit-animation-name:slideInFromRight;animation-name:slideInFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right) .sidebar{max-width:480px}:host(.right) vviinn-vpr-widget::part(recommendations-grid){display:grid;grid-template-columns:repeat(2, 1fr);grid-gap:24px}:host(.right) vviinn-vpr-widget{overflow:auto}:host(.right) vviinn-vpr-widget::part(image){border:none}.title{font-style:normal;font-weight:500;font-size:28px;line-height:40px;text-align:center;color:#000000}vviinn-vpr-widget::part(title),vviinn-vpr-widget::part(brand),vviinn-vpr-widget::part(type){text-align:left}vviinn-vpr-widget::part(price-container){align-self:start}.close-sidebar{background:transparent;border:none;cursor:pointer;margin:0;padding:0;position:absolute;right:24px;top:24px}@-webkit-keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@-webkit-keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@-webkit-keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@-webkit-keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}";
386
+
387
+ let RecommendationsSidebar = class {
388
+ constructor(hostRef) {
389
+ registerInstance(this, hostRef);
390
+ this.modalClosed = createEvent(this, "modalClosed", 7);
391
+ this.position = "bottom";
392
+ this.sourceImage = null;
393
+ this.widgetScrollbar = false;
394
+ this.state = "idle";
395
+ }
396
+ bodyClickListener(event) {
397
+ const { clientX, clientY } = event;
398
+ const sidebarRect = this.getSidebarRectangle();
399
+ if (!sidebarRect)
400
+ return;
401
+ const inLeftBound = clientX >= sidebarRect.left;
402
+ const inRightBound = clientX <= sidebarRect.right;
403
+ const inTopBound = clientY >= sidebarRect.top;
404
+ const inBottomBound = clientY <= sidebarRect.bottom;
405
+ const inBound = inLeftBound && inRightBound && inTopBound && inBottomBound;
406
+ if (!inBound) {
407
+ this.state = "closed";
408
+ }
409
+ }
410
+ getClassMap() {
411
+ return {
412
+ [this.position]: true,
413
+ [this.state]: true,
414
+ };
415
+ }
416
+ getSidebarRectangle() {
417
+ var _a;
418
+ return (_a = this.el.shadowRoot.querySelector("aside")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
419
+ }
420
+ render() {
421
+ return (h(Host, { class: this.getClassMap() }, h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) }, h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" }, this.isSourceImageValid() ? this.renderSourceImage() : null, h("span", { class: "title", part: "title" }, this.sidebarTitle), h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") }, h(CrossIcon, null))), h("main", { part: "sidebar-content" }, h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar })))));
422
+ }
423
+ renderSourceImage() {
424
+ return (h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
425
+ }
426
+ isSourceImageValid() {
427
+ var _a;
428
+ return ((_a = this.sourceImage) === null || _a === void 0 ? void 0 : _a.length) > 0;
429
+ }
430
+ handleAnimationEnd({ animationName }) {
431
+ const isClosingAnimation = animationName.includes("slideOut");
432
+ if (!isClosingAnimation)
433
+ return;
434
+ this.modalClosed.emit();
435
+ }
436
+ get el() { return getElement(this); }
437
+ };
438
+ RecommendationsSidebar.style = recommendationsSidebarCss;
439
+
440
+ const vviinnVprButtonCss = ":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#F4F4F4;outline:none}";
441
+
442
+ let VviinnVprButton = class {
443
+ constructor(hostRef) {
444
+ registerInstance(this, hostRef);
445
+ this.position = "bottom";
446
+ this.sourceImage = null;
447
+ this.sidebarTitle = "Visually similar products";
448
+ this.modalScrollbar = false;
449
+ }
450
+ render() {
451
+ return (h(Host, null, h("button", { class: "open-button", part: "button", onClick: () => this.handleClick() }, h("slot", null, h(VisualSearchIcon, null)))));
452
+ }
453
+ handleClick() {
454
+ const sidebar = document.createElement("vviinn-recommendations-sidebar");
455
+ sidebar.sidebarTitle = this.sidebarTitle;
456
+ sidebar.productId = this.productId;
457
+ sidebar.token = this.token;
458
+ sidebar.position = this.position;
459
+ sidebar.sourceImage = this.sourceImage;
460
+ sidebar.widgetScrollbar = this.modalScrollbar;
461
+ sidebar.addEventListener("modalClosed", () => {
462
+ document.body.removeChild(sidebar);
463
+ });
464
+ document.body.append(sidebar);
465
+ }
466
+ };
467
+ VviinnVprButton.style = vviinnVprButtonCss;
468
+
469
+ const createBearerString = (x) => `Bearer ${x}`;
470
+ const createAuthedHeader = (x) => new Headers({
471
+ Authorization: x,
472
+ });
473
+ const createFetchAuthOptions = (x) => {
474
+ return {
475
+ headers: x,
476
+ };
477
+ };
478
+ const createBearAuthedHeader = _function.flow(createBearerString, createAuthedHeader, createFetchAuthOptions);
479
+
480
+ const isVPR = (c) => c._tag === "VPR";
481
+ function fold(onVPR, onVCS) {
482
+ return (c) => (isVPR(c) ? onVPR() : onVCS());
483
+ }
484
+ function fromString(s) {
485
+ return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
486
+ }
487
+
488
+ const sequenceToEither = sequenceT(Apply);
489
+ const apiGet = (path, data = {}) => pipe(sequenceToEither(getApiPath(), createInitGetRequest), fromEither, chainW(makeRequest(path, data)));
490
+
491
+ const getVPRRecommendations = (productId) => (options) => {
492
+ const url = `product/${productId}/similar-products`;
493
+ return apiGet(url, options);
494
+ };
495
+
496
+ const getVCSRecommendations = (productId) => (options) => {
497
+ const url = `product/${productId}/cross-selling-products`;
498
+ return apiGet(url, options);
499
+ };
500
+
501
+ const getRecommendationsService = (campaignType) => _function.pipe(fromString(campaignType), fold(() => getVPRRecommendations, () => getVCSRecommendations));
502
+
503
+ function isFunction(value) {
504
+ return typeof value === 'function';
505
+ }
506
+
507
+ function createErrorClass(createImpl) {
508
+ const _super = (instance) => {
509
+ Error.call(instance);
510
+ instance.stack = new Error().stack;
511
+ };
512
+ const ctorFunc = createImpl(_super);
513
+ ctorFunc.prototype = Object.create(Error.prototype);
514
+ ctorFunc.prototype.constructor = ctorFunc;
515
+ return ctorFunc;
516
+ }
517
+
518
+ const UnsubscriptionError = createErrorClass((_super) => function UnsubscriptionErrorImpl(errors) {
519
+ _super(this);
520
+ this.message = errors
521
+ ? `${errors.length} errors occurred during unsubscription:
522
+ ${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\n ')}`
523
+ : '';
524
+ this.name = 'UnsubscriptionError';
525
+ this.errors = errors;
526
+ });
527
+
528
+ function arrRemove(arr, item) {
529
+ if (arr) {
530
+ const index = arr.indexOf(item);
531
+ 0 <= index && arr.splice(index, 1);
532
+ }
533
+ }
534
+
535
+ class Subscription {
536
+ constructor(initialTeardown) {
537
+ this.initialTeardown = initialTeardown;
538
+ this.closed = false;
539
+ this._parentage = null;
540
+ this._finalizers = null;
541
+ }
542
+ unsubscribe() {
543
+ let errors;
544
+ if (!this.closed) {
545
+ this.closed = true;
546
+ const { _parentage } = this;
547
+ if (_parentage) {
548
+ this._parentage = null;
549
+ if (Array.isArray(_parentage)) {
550
+ for (const parent of _parentage) {
551
+ parent.remove(this);
552
+ }
553
+ }
554
+ else {
555
+ _parentage.remove(this);
556
+ }
557
+ }
558
+ const { initialTeardown: initialFinalizer } = this;
559
+ if (isFunction(initialFinalizer)) {
560
+ try {
561
+ initialFinalizer();
562
+ }
563
+ catch (e) {
564
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
565
+ }
566
+ }
567
+ const { _finalizers } = this;
568
+ if (_finalizers) {
569
+ this._finalizers = null;
570
+ for (const finalizer of _finalizers) {
571
+ try {
572
+ execFinalizer(finalizer);
573
+ }
574
+ catch (err) {
575
+ errors = errors !== null && errors !== void 0 ? errors : [];
576
+ if (err instanceof UnsubscriptionError) {
577
+ errors = [...errors, ...err.errors];
578
+ }
579
+ else {
580
+ errors.push(err);
581
+ }
582
+ }
583
+ }
584
+ }
585
+ if (errors) {
586
+ throw new UnsubscriptionError(errors);
587
+ }
588
+ }
589
+ }
590
+ add(teardown) {
591
+ var _a;
592
+ if (teardown && teardown !== this) {
593
+ if (this.closed) {
594
+ execFinalizer(teardown);
595
+ }
596
+ else {
597
+ if (teardown instanceof Subscription) {
598
+ if (teardown.closed || teardown._hasParent(this)) {
599
+ return;
600
+ }
601
+ teardown._addParent(this);
602
+ }
603
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
604
+ }
605
+ }
606
+ }
607
+ _hasParent(parent) {
608
+ const { _parentage } = this;
609
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
610
+ }
611
+ _addParent(parent) {
612
+ const { _parentage } = this;
613
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
614
+ }
615
+ _removeParent(parent) {
616
+ const { _parentage } = this;
617
+ if (_parentage === parent) {
618
+ this._parentage = null;
619
+ }
620
+ else if (Array.isArray(_parentage)) {
621
+ arrRemove(_parentage, parent);
622
+ }
623
+ }
624
+ remove(teardown) {
625
+ const { _finalizers } = this;
626
+ _finalizers && arrRemove(_finalizers, teardown);
627
+ if (teardown instanceof Subscription) {
628
+ teardown._removeParent(this);
629
+ }
630
+ }
631
+ }
632
+ Subscription.EMPTY = (() => {
633
+ const empty = new Subscription();
634
+ empty.closed = true;
635
+ return empty;
636
+ })();
637
+ const EMPTY_SUBSCRIPTION = Subscription.EMPTY;
638
+ function isSubscription(value) {
639
+ return (value instanceof Subscription ||
640
+ (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
641
+ }
642
+ function execFinalizer(finalizer) {
643
+ if (isFunction(finalizer)) {
644
+ finalizer();
645
+ }
646
+ else {
647
+ finalizer.unsubscribe();
648
+ }
649
+ }
650
+
651
+ const config = {
652
+ onUnhandledError: null,
653
+ onStoppedNotification: null,
654
+ Promise: undefined,
655
+ useDeprecatedSynchronousErrorHandling: false,
656
+ useDeprecatedNextContext: false,
657
+ };
658
+
659
+ const timeoutProvider = {
660
+ setTimeout(handler, timeout, ...args) {
661
+ const { delegate } = timeoutProvider;
662
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
663
+ return delegate.setTimeout(handler, timeout, ...args);
664
+ }
665
+ return setTimeout(handler, timeout, ...args);
666
+ },
667
+ clearTimeout(handle) {
668
+ const { delegate } = timeoutProvider;
669
+ return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);
670
+ },
671
+ delegate: undefined,
672
+ };
673
+
674
+ function reportUnhandledError(err) {
675
+ timeoutProvider.setTimeout(() => {
676
+ const { onUnhandledError } = config;
677
+ if (onUnhandledError) {
678
+ onUnhandledError(err);
679
+ }
680
+ else {
681
+ throw err;
682
+ }
683
+ });
684
+ }
685
+
686
+ function noop() { }
687
+
688
+ const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();
689
+ function errorNotification(error) {
690
+ return createNotification('E', undefined, error);
691
+ }
692
+ function nextNotification(value) {
693
+ return createNotification('N', value, undefined);
694
+ }
695
+ function createNotification(kind, value, error) {
696
+ return {
697
+ kind,
698
+ value,
699
+ error,
700
+ };
701
+ }
702
+
703
+ function errorContext(cb) {
704
+ {
705
+ cb();
706
+ }
707
+ }
708
+
709
+ class Subscriber extends Subscription {
710
+ constructor(destination) {
711
+ super();
712
+ this.isStopped = false;
713
+ if (destination) {
714
+ this.destination = destination;
715
+ if (isSubscription(destination)) {
716
+ destination.add(this);
717
+ }
718
+ }
719
+ else {
720
+ this.destination = EMPTY_OBSERVER;
721
+ }
722
+ }
723
+ static create(next, error, complete) {
724
+ return new SafeSubscriber(next, error, complete);
725
+ }
726
+ next(value) {
727
+ if (this.isStopped) {
728
+ handleStoppedNotification(nextNotification(value), this);
729
+ }
730
+ else {
731
+ this._next(value);
732
+ }
733
+ }
734
+ error(err) {
735
+ if (this.isStopped) {
736
+ handleStoppedNotification(errorNotification(err), this);
737
+ }
738
+ else {
739
+ this.isStopped = true;
740
+ this._error(err);
741
+ }
742
+ }
743
+ complete() {
744
+ if (this.isStopped) {
745
+ handleStoppedNotification(COMPLETE_NOTIFICATION, this);
746
+ }
747
+ else {
748
+ this.isStopped = true;
749
+ this._complete();
750
+ }
751
+ }
752
+ unsubscribe() {
753
+ if (!this.closed) {
754
+ this.isStopped = true;
755
+ super.unsubscribe();
756
+ this.destination = null;
757
+ }
758
+ }
759
+ _next(value) {
760
+ this.destination.next(value);
761
+ }
762
+ _error(err) {
763
+ try {
764
+ this.destination.error(err);
765
+ }
766
+ finally {
767
+ this.unsubscribe();
768
+ }
769
+ }
770
+ _complete() {
771
+ try {
772
+ this.destination.complete();
773
+ }
774
+ finally {
775
+ this.unsubscribe();
776
+ }
777
+ }
778
+ }
779
+ const _bind = Function.prototype.bind;
780
+ function bind(fn, thisArg) {
781
+ return _bind.call(fn, thisArg);
782
+ }
783
+ class ConsumerObserver {
784
+ constructor(partialObserver) {
785
+ this.partialObserver = partialObserver;
786
+ }
787
+ next(value) {
788
+ const { partialObserver } = this;
789
+ if (partialObserver.next) {
790
+ try {
791
+ partialObserver.next(value);
792
+ }
793
+ catch (error) {
794
+ handleUnhandledError(error);
795
+ }
796
+ }
797
+ }
798
+ error(err) {
799
+ const { partialObserver } = this;
800
+ if (partialObserver.error) {
801
+ try {
802
+ partialObserver.error(err);
803
+ }
804
+ catch (error) {
805
+ handleUnhandledError(error);
806
+ }
807
+ }
808
+ else {
809
+ handleUnhandledError(err);
810
+ }
811
+ }
812
+ complete() {
813
+ const { partialObserver } = this;
814
+ if (partialObserver.complete) {
815
+ try {
816
+ partialObserver.complete();
817
+ }
818
+ catch (error) {
819
+ handleUnhandledError(error);
820
+ }
821
+ }
822
+ }
823
+ }
824
+ class SafeSubscriber extends Subscriber {
825
+ constructor(observerOrNext, error, complete) {
826
+ super();
827
+ let partialObserver;
828
+ if (isFunction(observerOrNext) || !observerOrNext) {
829
+ partialObserver = {
830
+ next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
831
+ error: error !== null && error !== void 0 ? error : undefined,
832
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
833
+ };
834
+ }
835
+ else {
836
+ let context;
837
+ if (this && config.useDeprecatedNextContext) {
838
+ context = Object.create(observerOrNext);
839
+ context.unsubscribe = () => this.unsubscribe();
840
+ partialObserver = {
841
+ next: observerOrNext.next && bind(observerOrNext.next, context),
842
+ error: observerOrNext.error && bind(observerOrNext.error, context),
843
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context),
844
+ };
845
+ }
846
+ else {
847
+ partialObserver = observerOrNext;
848
+ }
849
+ }
850
+ this.destination = new ConsumerObserver(partialObserver);
851
+ }
852
+ }
853
+ function handleUnhandledError(error) {
854
+ {
855
+ reportUnhandledError(error);
856
+ }
857
+ }
858
+ function defaultErrorHandler(err) {
859
+ throw err;
860
+ }
861
+ function handleStoppedNotification(notification, subscriber) {
862
+ const { onStoppedNotification } = config;
863
+ onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));
864
+ }
865
+ const EMPTY_OBSERVER = {
866
+ closed: true,
867
+ next: noop,
868
+ error: defaultErrorHandler,
869
+ complete: noop,
870
+ };
871
+
872
+ const observable = (() => (typeof Symbol === 'function' && Symbol.observable) || '@@observable')();
873
+
874
+ function identity(x) {
875
+ return x;
876
+ }
877
+
878
+ function pipeFromArray(fns) {
879
+ if (fns.length === 0) {
880
+ return identity;
881
+ }
882
+ if (fns.length === 1) {
883
+ return fns[0];
884
+ }
885
+ return function piped(input) {
886
+ return fns.reduce((prev, fn) => fn(prev), input);
887
+ };
888
+ }
889
+
890
+ class Observable {
891
+ constructor(subscribe) {
892
+ if (subscribe) {
893
+ this._subscribe = subscribe;
894
+ }
895
+ }
896
+ lift(operator) {
897
+ const observable = new Observable();
898
+ observable.source = this;
899
+ observable.operator = operator;
900
+ return observable;
901
+ }
902
+ subscribe(observerOrNext, error, complete) {
903
+ const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
904
+ errorContext(() => {
905
+ const { operator, source } = this;
906
+ subscriber.add(operator
907
+ ?
908
+ operator.call(subscriber, source)
909
+ : source
910
+ ?
911
+ this._subscribe(subscriber)
912
+ :
913
+ this._trySubscribe(subscriber));
914
+ });
915
+ return subscriber;
916
+ }
917
+ _trySubscribe(sink) {
918
+ try {
919
+ return this._subscribe(sink);
920
+ }
921
+ catch (err) {
922
+ sink.error(err);
923
+ }
924
+ }
925
+ forEach(next, promiseCtor) {
926
+ promiseCtor = getPromiseCtor(promiseCtor);
927
+ return new promiseCtor((resolve, reject) => {
928
+ const subscriber = new SafeSubscriber({
929
+ next: (value) => {
930
+ try {
931
+ next(value);
932
+ }
933
+ catch (err) {
934
+ reject(err);
935
+ subscriber.unsubscribe();
936
+ }
937
+ },
938
+ error: reject,
939
+ complete: resolve,
940
+ });
941
+ this.subscribe(subscriber);
942
+ });
943
+ }
944
+ _subscribe(subscriber) {
945
+ var _a;
946
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
947
+ }
948
+ [observable]() {
949
+ return this;
950
+ }
951
+ pipe(...operations) {
952
+ return pipeFromArray(operations)(this);
953
+ }
954
+ toPromise(promiseCtor) {
955
+ promiseCtor = getPromiseCtor(promiseCtor);
956
+ return new promiseCtor((resolve, reject) => {
957
+ let value;
958
+ this.subscribe((x) => (value = x), (err) => reject(err), () => resolve(value));
959
+ });
960
+ }
961
+ }
962
+ Observable.create = (subscribe) => {
963
+ return new Observable(subscribe);
964
+ };
965
+ function getPromiseCtor(promiseCtor) {
966
+ var _a;
967
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
968
+ }
969
+ function isObserver(value) {
970
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
971
+ }
972
+ function isSubscriber(value) {
973
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
974
+ }
975
+
976
+ const ObjectUnsubscribedError = createErrorClass((_super) => function ObjectUnsubscribedErrorImpl() {
977
+ _super(this);
978
+ this.name = 'ObjectUnsubscribedError';
979
+ this.message = 'object unsubscribed';
980
+ });
981
+
982
+ class Subject extends Observable {
983
+ constructor() {
984
+ super();
985
+ this.closed = false;
986
+ this.currentObservers = null;
987
+ this.observers = [];
988
+ this.isStopped = false;
989
+ this.hasError = false;
990
+ this.thrownError = null;
991
+ }
992
+ lift(operator) {
993
+ const subject = new AnonymousSubject(this, this);
994
+ subject.operator = operator;
995
+ return subject;
996
+ }
997
+ _throwIfClosed() {
998
+ if (this.closed) {
999
+ throw new ObjectUnsubscribedError();
1000
+ }
1001
+ }
1002
+ next(value) {
1003
+ errorContext(() => {
1004
+ this._throwIfClosed();
1005
+ if (!this.isStopped) {
1006
+ if (!this.currentObservers) {
1007
+ this.currentObservers = Array.from(this.observers);
1008
+ }
1009
+ for (const observer of this.currentObservers) {
1010
+ observer.next(value);
1011
+ }
1012
+ }
1013
+ });
1014
+ }
1015
+ error(err) {
1016
+ errorContext(() => {
1017
+ this._throwIfClosed();
1018
+ if (!this.isStopped) {
1019
+ this.hasError = this.isStopped = true;
1020
+ this.thrownError = err;
1021
+ const { observers } = this;
1022
+ while (observers.length) {
1023
+ observers.shift().error(err);
1024
+ }
1025
+ }
1026
+ });
1027
+ }
1028
+ complete() {
1029
+ errorContext(() => {
1030
+ this._throwIfClosed();
1031
+ if (!this.isStopped) {
1032
+ this.isStopped = true;
1033
+ const { observers } = this;
1034
+ while (observers.length) {
1035
+ observers.shift().complete();
1036
+ }
1037
+ }
1038
+ });
1039
+ }
1040
+ unsubscribe() {
1041
+ this.isStopped = this.closed = true;
1042
+ this.observers = this.currentObservers = null;
1043
+ }
1044
+ get observed() {
1045
+ var _a;
1046
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
1047
+ }
1048
+ _trySubscribe(subscriber) {
1049
+ this._throwIfClosed();
1050
+ return super._trySubscribe(subscriber);
1051
+ }
1052
+ _subscribe(subscriber) {
1053
+ this._throwIfClosed();
1054
+ this._checkFinalizedStatuses(subscriber);
1055
+ return this._innerSubscribe(subscriber);
1056
+ }
1057
+ _innerSubscribe(subscriber) {
1058
+ const { hasError, isStopped, observers } = this;
1059
+ if (hasError || isStopped) {
1060
+ return EMPTY_SUBSCRIPTION;
1061
+ }
1062
+ this.currentObservers = null;
1063
+ observers.push(subscriber);
1064
+ return new Subscription(() => {
1065
+ this.currentObservers = null;
1066
+ arrRemove(observers, subscriber);
1067
+ });
1068
+ }
1069
+ _checkFinalizedStatuses(subscriber) {
1070
+ const { hasError, thrownError, isStopped } = this;
1071
+ if (hasError) {
1072
+ subscriber.error(thrownError);
1073
+ }
1074
+ else if (isStopped) {
1075
+ subscriber.complete();
1076
+ }
1077
+ }
1078
+ asObservable() {
1079
+ const observable = new Observable();
1080
+ observable.source = this;
1081
+ return observable;
1082
+ }
1083
+ }
1084
+ Subject.create = (destination, source) => {
1085
+ return new AnonymousSubject(destination, source);
1086
+ };
1087
+ class AnonymousSubject extends Subject {
1088
+ constructor(destination, source) {
1089
+ super();
1090
+ this.destination = destination;
1091
+ this.source = source;
1092
+ }
1093
+ next(value) {
1094
+ var _a, _b;
1095
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
1096
+ }
1097
+ error(err) {
1098
+ var _a, _b;
1099
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
1100
+ }
1101
+ complete() {
1102
+ var _a, _b;
1103
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
1104
+ }
1105
+ _subscribe(subscriber) {
1106
+ var _a, _b;
1107
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
1108
+ }
1109
+ }
1110
+
1111
+ const vviinnVprWidgetCss = ":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.grid) vviinn-product-card::part(image){border:1px solid #DDDDDD;width:100%}h2{margin:0}vviinn-product-card::part(price-container){align-self:flex-start;text-align:left;display:flex}.results{display:grid;grid-gap:1rem}.visually-hidden{position:absolute;top:0;left:0;z-index:-1;height:0;width:0}h2{margin:0}:host(.grid) h2{justify-content:center}:host(.grid) vviinn-product-card::part(image){min-width:100%}:host(.grid) vviinn-product-card::part(image-link){width:100%}:host(.grid) vviinn-product-card::part(title),:host(.grid) vviinn-product-card::part(brand),:host(.grid) vviinn-product-card::part(type){text-align:center}:host(.grid) vviinn-product-card::part(price-container){align-self:center}:host(.continuity) vviinn-product-card::part(title),:host(.continuity) vviinn-product-card::part(brand),:host(.continuity) vviinn-product-card::part(type),:host(.continuity) vviinn-product-card::part(deeplink){text-align:left;max-width:unset;align-self:start}";
1112
+
1113
+ let VviinnVprWidget = class {
1114
+ constructor(hostRef) {
1115
+ registerInstance(this, hostRef);
1116
+ this.recommendationsLoaded = createEvent(this, "recommendationsLoaded", 7);
1117
+ /** Title for recommendations widget */
1118
+ this.blockTitle = "Recommended products";
1119
+ /** Ratio of each recommended product image */
1120
+ this.imageRatio = 1;
1121
+ /** Width of each recommended product image */
1122
+ this.imageWidth = 300;
1123
+ /** Currency sign will shown after price */
1124
+ this.currencySign = "€";
1125
+ /** Use slider or grid view */
1126
+ this.mode = "continuity";
1127
+ /** Campaign type */
1128
+ this.campaignType = "VPR";
1129
+ /** Locale for currency formatting */
1130
+ this.locale = "de-DE";
1131
+ /** @internal */
1132
+ this.apiPath = "https://api.vviinn.com";
1133
+ /** @internal */
1134
+ this.useCarousel = true;
1135
+ this.showScroll = true;
1136
+ this.cssUrl = null;
1137
+ this.recommendations = [];
1138
+ this.loaded = false;
1139
+ this.productImageLoadedSubject = new Subject();
1140
+ }
1141
+ handleProductIdChange() {
1142
+ this.getRecommendations();
1143
+ }
1144
+ handleCampaignTypeChange() {
1145
+ this.getRecommendations();
1146
+ }
1147
+ handleApiPathChange(newPath) {
1148
+ state$1.apiPath = newPath;
1149
+ this.getRecommendations();
1150
+ }
1151
+ lol({ detail }) {
1152
+ this.productImageLoadedSubject.next(detail);
1153
+ }
1154
+ connectedCallback() {
1155
+ state$1.apiPath = this.apiPath;
1156
+ state$1.currencySign = this.currencySign;
1157
+ state$1.locale = this.locale;
1158
+ }
1159
+ async componentWillLoad() {
1160
+ state$1.pricePrefix = this.pricePrefix;
1161
+ state$1.currencySign = this.currencySign;
1162
+ this.getRecommendations();
1163
+ }
1164
+ async getRecommendations() {
1165
+ if (this.productId === undefined || this.token === undefined)
1166
+ return;
1167
+ const campaignType = this.campaignType.length > 0 ? this.campaignType : "VPR";
1168
+ const headers = createBearAuthedHeader(this.token);
1169
+ const request = _function.pipe(TaskEither.of(getRecommendationsService(campaignType)), TaskEither.ap(TaskEither.of(this.productId)), TaskEither.ap(TaskEither.of(headers)), TaskEither.flatten);
1170
+ const runRequest = await request();
1171
+ _function.pipe(runRequest, Either.fold((error) => this.handleError(error), (data) => this.handleRecommendationsSucces(data)));
1172
+ }
1173
+ handleError(error) {
1174
+ console.log("ERROR:", error);
1175
+ }
1176
+ handleRecommendationsSucces(data) {
1177
+ var _a;
1178
+ this.recommendations = (_a = data === null || data === void 0 ? void 0 : data.extended) !== null && _a !== void 0 ? _a : data;
1179
+ imageSearchState.results = this.recommendations;
1180
+ this.loaded = true;
1181
+ //this.recommendationsLoaded.emit();
1182
+ this.productIds = this.recommendations.map(r => r.productId);
1183
+ this.productImageLoadedSubject.subscribe((id) => {
1184
+ this.productIds = this.productIds.filter(x => x !== id);
1185
+ if (this.productIds.length === 0) {
1186
+ this.recommendationsLoaded.emit();
1187
+ }
1188
+ });
1189
+ }
1190
+ isExternalCSS() {
1191
+ return this.cssUrl && this.cssUrl.length > 0;
1192
+ }
1193
+ renderExternalCSS() {
1194
+ return this.isExternalCSS() ? (h("link", { href: this.cssUrl, rel: "stylesheet" })) : ("");
1195
+ }
1196
+ render() {
1197
+ return (h(Host, { class: {
1198
+ loaded: this.loaded,
1199
+ empty: this.recommendations.length == 0,
1200
+ [this.mode]: true,
1201
+ }, "aria-hidden": this.loaded ? "false" : "true" }, this.renderExternalCSS(), h("style", null, state$1.fallbackStyles), h("h2", { part: "recommendations-title" }, this.blockTitle), this.useCarousel ? this.renderCarousel() : this.renderResults()));
1202
+ }
1203
+ renderRecommendation(recommendation) {
1204
+ return (h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.useDimmedBackgroundInCard() }));
1205
+ }
1206
+ useDimmedBackgroundInCard() {
1207
+ return this.mode === "continuity" || !this.useCarousel;
1208
+ }
1209
+ renderResults() {
1210
+ return (h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r) => this.renderRecommendation(r))));
1211
+ }
1212
+ renderCarousel() {
1213
+ return (h("vviinn-carousel", { mode: this.mode, imageWidth: this.imageWidth, showScroll: this.showScroll, recommendations: this.recommendations }));
1214
+ }
1215
+ get el() { return getElement(this); }
1216
+ static get watchers() { return {
1217
+ "productId": ["handleProductIdChange"],
1218
+ "campaignType": ["handleCampaignTypeChange"],
1219
+ "apiPath": ["handleApiPathChange"]
1220
+ }; }
1221
+ };
1222
+ VviinnVprWidget.style = vviinnVprWidgetCss;
1223
+
1224
+ export { VviinnCarousel as vviinn_carousel, VviinnProductCard as vviinn_product_card, RecommendationsSidebar as vviinn_recommendations_sidebar, VviinnVprButton as vviinn_vpr_button, VviinnVprWidget as vviinn_vpr_widget };