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