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