vviinn-widgets 2.5.2 → 2.6.0

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 (339) hide show
  1. package/dist/types/campaign/CampaignService.d.ts +1 -1
  2. package/dist/types/campaign/VCSCampaignService.d.ts +2 -1
  3. package/dist/types/campaign/VPRCampaignService.d.ts +2 -1
  4. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +2 -0
  5. package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +6 -0
  6. package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +6 -0
  7. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +2 -0
  8. package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +6 -0
  9. package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +6 -0
  10. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +3 -0
  11. package/dist/types/components.d.ts +24 -0
  12. package/dist/vviinn-widgets/Array-bdfc75db.js +4870 -0
  13. package/dist/vviinn-widgets/Handler-edcb46f4.js +1422 -0
  14. package/dist/vviinn-widgets/NonEmptyArray-947ab7b3.js +4411 -0
  15. package/dist/{esm/app-globals-6f6aa89e.js → vviinn-widgets/app-globals-26a61baa.js} +922 -10
  16. package/dist/{esm → vviinn-widgets}/cropper-handler.entry.js +2 -2
  17. package/dist/vviinn-widgets/css-shim-f0027935.js +4 -0
  18. package/dist/{esm/customized-slots-6b427dda.js → vviinn-widgets/customized-slots-fb9b3e5f.js} +1 -1
  19. package/dist/vviinn-widgets/dom-db0073f0.js +73 -0
  20. package/dist/vviinn-widgets/highlight-box.entry.js +41 -0
  21. package/dist/{collection/components/image-search/image-view/image-cropper/image-cropper.js → vviinn-widgets/image-cropper.entry.js} +33 -70
  22. package/dist/{esm/imageSearch.store-0ae87235.js → vviinn-widgets/imageSearch.store-15bda6de.js} +12106 -11817
  23. package/dist/{esm/index-ac05c460.js → vviinn-widgets/index-533f9255.js} +4 -2
  24. package/dist/{esm/index-2e296af4.js → vviinn-widgets/index-6c6de682.js} +639 -6
  25. package/dist/vviinn-widgets/index-89051fa8.js +3010 -0
  26. package/dist/vviinn-widgets/index.esm.js +1 -0
  27. package/dist/vviinn-widgets/number-171db649.js +1499 -0
  28. package/dist/vviinn-widgets/search-filters.entry.js +76 -0
  29. package/dist/vviinn-widgets/shadow-css-c1fdfa9f.js +389 -0
  30. package/dist/{collection/components/vviinn-carousel/vviinn-carousel.js → vviinn-widgets/vviinn-carousel.entry.js} +18 -113
  31. package/dist/vviinn-widgets/vviinn-detected-object.entry.js +54 -0
  32. package/dist/vviinn-widgets/vviinn-empty-results.entry.js +16 -0
  33. package/dist/{esm → vviinn-widgets}/vviinn-error.entry.js +1 -1
  34. package/dist/vviinn-widgets/vviinn-example-image.entry.js +38 -0
  35. package/dist/vviinn-widgets/vviinn-example-images.entry.js +28 -0
  36. package/dist/vviinn-widgets/vviinn-image-selector.entry.js +31 -0
  37. package/dist/vviinn-widgets/vviinn-image-view.entry.js +55 -0
  38. package/dist/vviinn-widgets/vviinn-modal.entry.js +30 -0
  39. package/dist/vviinn-widgets/vviinn-onboarding-card-1.entry.js +21 -0
  40. package/dist/vviinn-widgets/vviinn-onboarding-card-2.entry.js +21 -0
  41. package/dist/vviinn-widgets/vviinn-onboarding-card-3.entry.js +21 -0
  42. package/dist/vviinn-widgets/vviinn-onboarding.entry.js +20 -0
  43. package/dist/vviinn-widgets/vviinn-overlay.entry.js +15 -0
  44. package/dist/vviinn-widgets/vviinn-overlayed-modal.entry.js +18 -0
  45. package/dist/{esm → vviinn-widgets}/vviinn-preloader.entry.js +6 -3
  46. package/dist/vviinn-widgets/vviinn-privacy-badge.entry.js +20 -0
  47. package/dist/vviinn-widgets/vviinn-product-card.entry.js +184 -0
  48. package/dist/{esm → vviinn-widgets}/vviinn-recommendations-sidebar.entry.js +5 -3
  49. package/dist/vviinn-widgets/vviinn-server-error.entry.js +16 -0
  50. package/dist/vviinn-widgets/vviinn-slide.entry.js +15 -0
  51. package/dist/vviinn-widgets/vviinn-slider.entry.js +120 -0
  52. package/dist/vviinn-widgets/vviinn-teaser.entry.js +20 -0
  53. package/dist/{esm → vviinn-widgets}/vviinn-vpr-button.entry.js +7 -2
  54. package/dist/vviinn-widgets/vviinn-vpr-widget.entry.js +4588 -0
  55. package/dist/{esm → vviinn-widgets}/vviinn-vps-button.entry.js +3 -3
  56. package/dist/{esm → vviinn-widgets}/vviinn-vps-widget.entry.js +8 -5
  57. package/dist/vviinn-widgets/vviinn-widgets.css +6 -1
  58. package/dist/vviinn-widgets/vviinn-widgets.esm.js +125 -1
  59. package/dist/vviinn-widgets/vviinn-wrong-format.entry.js +16 -0
  60. package/package.json +3 -3
  61. package/www/build/Array-bdfc75db.js +4870 -0
  62. package/www/build/Handler-edcb46f4.js +1422 -0
  63. package/www/build/NonEmptyArray-947ab7b3.js +4411 -0
  64. package/{dist/cjs/app-globals-d15b4c2c.js → www/build/app-globals-26a61baa.js} +925 -15
  65. package/{dist/cjs/cropper-handler.cjs.entry.js → www/build/cropper-handler.entry.js} +7 -11
  66. package/www/build/css-shim-f0027935.js +4 -0
  67. package/{dist/cjs/customized-slots-0c0d0665.js → www/build/customized-slots-fb9b3e5f.js} +3 -6
  68. package/www/build/dom-db0073f0.js +73 -0
  69. package/www/build/highlight-box.entry.js +41 -0
  70. package/www/build/image-cropper.entry.js +118 -0
  71. package/{dist/cjs/imageSearch.store-865c23f4.js → www/build/imageSearch.store-15bda6de.js} +11902 -11647
  72. package/{dist/collection/components/vviinn-icons/index.js → www/build/index-533f9255.js} +14 -11
  73. package/{dist/cjs/index-0eb3036a.js → www/build/index-6c6de682.js} +698 -76
  74. package/www/build/index-89051fa8.js +3010 -0
  75. package/www/build/index.esm.js +1 -0
  76. package/www/build/number-171db649.js +1499 -0
  77. package/www/build/search-filters.entry.js +76 -0
  78. package/www/build/shadow-css-c1fdfa9f.js +389 -0
  79. package/www/build/vviinn-carousel.entry.js +210 -0
  80. package/www/build/vviinn-detected-object.entry.js +54 -0
  81. package/www/build/vviinn-empty-results.entry.js +16 -0
  82. package/{dist/cjs/vviinn-error.cjs.entry.js → www/build/vviinn-error.entry.js} +4 -8
  83. package/www/build/vviinn-example-image.entry.js +38 -0
  84. package/www/build/vviinn-example-images.entry.js +28 -0
  85. package/www/build/vviinn-image-selector.entry.js +31 -0
  86. package/www/build/vviinn-image-view.entry.js +55 -0
  87. package/www/build/vviinn-modal.entry.js +30 -0
  88. package/www/build/vviinn-onboarding-card-1.entry.js +21 -0
  89. package/www/build/vviinn-onboarding-card-2.entry.js +21 -0
  90. package/www/build/vviinn-onboarding-card-3.entry.js +21 -0
  91. package/www/build/vviinn-onboarding.entry.js +20 -0
  92. package/www/build/vviinn-overlay.entry.js +15 -0
  93. package/www/build/vviinn-overlayed-modal.entry.js +18 -0
  94. package/{dist/cjs/vviinn-preloader.cjs.entry.js → www/build/vviinn-preloader.entry.js} +10 -11
  95. package/www/build/vviinn-privacy-badge.entry.js +20 -0
  96. package/www/build/vviinn-product-card.entry.js +184 -0
  97. package/{dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js → www/build/vviinn-recommendations-sidebar.entry.js} +10 -12
  98. package/www/build/vviinn-server-error.entry.js +16 -0
  99. package/www/build/vviinn-slide.entry.js +15 -0
  100. package/www/build/vviinn-slider.entry.js +120 -0
  101. package/www/build/vviinn-teaser.entry.js +20 -0
  102. package/{dist/cjs/vviinn-vpr-button.cjs.entry.js → www/build/vviinn-vpr-button.entry.js} +10 -9
  103. package/www/build/vviinn-vpr-widget.entry.js +4588 -0
  104. package/www/build/vviinn-vps-button.entry.js +39 -0
  105. package/{dist/cjs/vviinn-vps-widget.cjs.entry.js → www/build/vviinn-vps-widget.entry.js} +44 -45
  106. package/www/build/vviinn-widgets.css +6 -1
  107. package/www/build/vviinn-widgets.esm.js +125 -1
  108. package/www/build/vviinn-wrong-format.entry.js +16 -0
  109. package/www/index.html +10 -1
  110. package/dist/cjs/Handler-176539c8.js +0 -331
  111. package/dist/cjs/highlight-box_22.cjs.entry.js +0 -747
  112. package/dist/cjs/index-0f5516a6.js +0 -1354
  113. package/dist/cjs/index-31b9cb7a.js +0 -39
  114. package/dist/cjs/index.cjs.js +0 -2
  115. package/dist/cjs/loader.cjs.js +0 -23
  116. package/dist/cjs/vviinn-carousel_3.cjs.entry.js +0 -1174
  117. package/dist/cjs/vviinn-vps-button.cjs.entry.js +0 -43
  118. package/dist/cjs/vviinn-widgets.cjs.js +0 -21
  119. package/dist/collection/Image/error.js +0 -14
  120. package/dist/collection/Image/form.js +0 -5
  121. package/dist/collection/Image/fromFile.js +0 -18
  122. package/dist/collection/Image/imageToB64.js +0 -9
  123. package/dist/collection/Image/index.js +0 -0
  124. package/dist/collection/Image/renderPromise.js +0 -6
  125. package/dist/collection/Image/resizeImage.js +0 -28
  126. package/dist/collection/Image/sizing.js +0 -39
  127. package/dist/collection/Image/toFile.js +0 -17
  128. package/dist/collection/analytics/GAnalytics.js +0 -32
  129. package/dist/collection/analytics/GeneralAnalytics.js +0 -9
  130. package/dist/collection/analytics/GtagAnalytics.js +0 -35
  131. package/dist/collection/analytics/ProductAnalytics.js +0 -1
  132. package/dist/collection/campaign/Campaign.js +0 -8
  133. package/dist/collection/campaign/CampaignService.js +0 -5
  134. package/dist/collection/campaign/VCSCampaign.js +0 -1
  135. package/dist/collection/campaign/VCSCampaignResponse.js +0 -1
  136. package/dist/collection/campaign/VCSCampaignService.js +0 -5
  137. package/dist/collection/campaign/VPRCampaignResponse.js +0 -1
  138. package/dist/collection/campaign/VPRCampaignService.js +0 -5
  139. package/dist/collection/collection-manifest.json +0 -43
  140. package/dist/collection/components/customized-slots.js +0 -47
  141. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +0 -71
  142. package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +0 -25
  143. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +0 -49
  144. package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +0 -64
  145. package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.css +0 -33
  146. package/dist/collection/components/image-search/search-filters/search-filters.css +0 -120
  147. package/dist/collection/components/image-search/search-filters/search-filters.js +0 -125
  148. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +0 -142
  149. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.css +0 -7
  150. package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +0 -36
  151. package/dist/collection/components/vviinn-error/vviinn-error.css +0 -38
  152. package/dist/collection/components/vviinn-error/vviinn-error.js +0 -18
  153. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.css +0 -3
  154. package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +0 -34
  155. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.css +0 -3
  156. package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +0 -34
  157. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.css +0 -34
  158. package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +0 -129
  159. package/dist/collection/components/vviinn-example-images/vviinn-example-images.css +0 -19
  160. package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +0 -80
  161. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +0 -25
  162. package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +0 -64
  163. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.css +0 -47
  164. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +0 -100
  165. package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +0 -31
  166. package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +0 -61
  167. package/dist/collection/components/vviinn-modal/vviinn-modal.css +0 -105
  168. package/dist/collection/components/vviinn-modal/vviinn-modal.js +0 -98
  169. package/dist/collection/components/vviinn-onboarding/onboarding-cards/onboarding-card.css +0 -41
  170. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +0 -26
  171. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +0 -26
  172. package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +0 -26
  173. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.css +0 -58
  174. package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +0 -28
  175. package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +0 -33
  176. package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +0 -15
  177. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +0 -29
  178. package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +0 -71
  179. package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +0 -37
  180. package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +0 -20
  181. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +0 -19
  182. package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +0 -27
  183. package/dist/collection/components/vviinn-product-card/render-helpers.js +0 -32
  184. package/dist/collection/components/vviinn-product-card/stories/args.js +0 -73
  185. package/dist/collection/components/vviinn-product-card/stories/decorators.js +0 -51
  186. package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +0 -105
  187. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +0 -95
  188. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +0 -462
  189. package/dist/collection/components/vviinn-slider/arrow.js +0 -11
  190. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.css +0 -4
  191. package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +0 -15
  192. package/dist/collection/components/vviinn-slider/vviinn-slider.css +0 -109
  193. package/dist/collection/components/vviinn-slider/vviinn-slider.js +0 -181
  194. package/dist/collection/components/vviinn-teaser/vviinn-teaser.css +0 -14
  195. package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +0 -29
  196. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +0 -238
  197. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +0 -200
  198. package/dist/collection/components/vviinn-vpr-button/stories/args.js +0 -207
  199. package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +0 -89
  200. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +0 -35
  201. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +0 -156
  202. package/dist/collection/components/vviinn-vpr-widget/stories/args.js +0 -190
  203. package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +0 -29
  204. package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +0 -212
  205. package/dist/collection/components/vviinn-vpr-widget/token-helpers.js +0 -11
  206. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +0 -483
  207. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +0 -79
  208. package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +0 -31
  209. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +0 -3
  210. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +0 -178
  211. package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +0 -33
  212. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +0 -350
  213. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +0 -352
  214. package/dist/collection/cropper/Cropper.js +0 -1
  215. package/dist/collection/cropper/Handler.js +0 -61
  216. package/dist/collection/dom/index.js +0 -3
  217. package/dist/collection/error.js +0 -14
  218. package/dist/collection/file/index.js +0 -4
  219. package/dist/collection/geometry/Clip.js +0 -14
  220. package/dist/collection/geometry/Point.js +0 -32
  221. package/dist/collection/geometry/Rectangle.js +0 -95
  222. package/dist/collection/geometry/RectangleAlt.js +0 -1
  223. package/dist/collection/geometry/Sized.js +0 -8
  224. package/dist/collection/global.js +0 -19
  225. package/dist/collection/index.js +0 -1
  226. package/dist/collection/interfaces/generated.js +0 -5
  227. package/dist/collection/interfaces/recommendation.js +0 -1
  228. package/dist/collection/network/apiClient.js +0 -9
  229. package/dist/collection/network/ion/File.js +0 -14
  230. package/dist/collection/network/ion/Form.js +0 -64
  231. package/dist/collection/network/ion/Link.js +0 -8
  232. package/dist/collection/network/ion/ValueObject.js +0 -23
  233. package/dist/collection/network/request.js +0 -19
  234. package/dist/collection/network/utils.js +0 -37
  235. package/dist/collection/openApi/index.js +0 -27
  236. package/dist/collection/recommendation/events.js +0 -1
  237. package/dist/collection/recommendation/recommendation.js +0 -1
  238. package/dist/collection/searchSession/searchSession.js +0 -26
  239. package/dist/collection/sentry.js +0 -14
  240. package/dist/collection/slider/GridMode.js +0 -1
  241. package/dist/collection/store/file-processing.js +0 -13
  242. package/dist/collection/store/imageSearch.store.js +0 -138
  243. package/dist/collection/store/store.js +0 -3
  244. package/dist/collection/store/tracking.store.js +0 -3
  245. package/dist/collection/stories/Button.js +0 -21
  246. package/dist/collection/stories/Button.stories.js +0 -42
  247. package/dist/collection/stories/Header.js +0 -45
  248. package/dist/collection/stories/Header.stories.js +0 -15
  249. package/dist/collection/stories/Page.js +0 -61
  250. package/dist/collection/stories/Page.stories.js +0 -19
  251. package/dist/collection/stories/assets/code-brackets.svg +0 -1
  252. package/dist/collection/stories/assets/colors.svg +0 -1
  253. package/dist/collection/stories/assets/comments.svg +0 -1
  254. package/dist/collection/stories/assets/direction.svg +0 -1
  255. package/dist/collection/stories/assets/flow.svg +0 -1
  256. package/dist/collection/stories/assets/plugin.svg +0 -1
  257. package/dist/collection/stories/assets/repo.svg +0 -1
  258. package/dist/collection/stories/assets/stackalt.svg +0 -1
  259. package/dist/collection/stories/image-selector.stories.js +0 -6
  260. package/dist/collection/stories/image-view.stories.js +0 -6
  261. package/dist/collection/stories/modal.stories.js +0 -12
  262. package/dist/collection/stories/onboarding.stories.js +0 -11
  263. package/dist/collection/stories/overlay.stories.js +0 -5
  264. package/dist/collection/stories/overlayedModal.stories.js +0 -8
  265. package/dist/collection/stories/privacy-badge.stories.js +0 -11
  266. package/dist/collection/stories/slider.stories.js +0 -17
  267. package/dist/collection/stories/teaser.stories.js +0 -5
  268. package/dist/collection/stories/vps-widget.stories.js +0 -47
  269. package/dist/collection/stories/vviinn-product.stories.js +0 -19
  270. package/dist/collection/tracking/event.js +0 -3
  271. package/dist/collection/tracking/filter.js +0 -5
  272. package/dist/collection/tracking/index.js +0 -13
  273. package/dist/collection/tracking/models.js +0 -6
  274. package/dist/collection/tracking/product.js +0 -18
  275. package/dist/collection/tracking/search.js +0 -5
  276. package/dist/collection/tracking/widget.js +0 -10
  277. package/dist/collection/utils/collections/collectionsUtils.js +0 -5
  278. package/dist/collection/utils/either.js +0 -3
  279. package/dist/collection/utils/enum/enumUtils.js +0 -3
  280. package/dist/collection/utils/event/Events.js +0 -1
  281. package/dist/collection/utils/number/index.js +0 -4
  282. package/dist/collection/utils/option/option.js +0 -4
  283. package/dist/collection/utils/semigroup/semigroupDiff.js +0 -6
  284. package/dist/collection/utils/token/tokenUtils.js +0 -9
  285. package/dist/esm/Handler-f9b8735c.js +0 -309
  286. package/dist/esm/highlight-box_22.entry.js +0 -722
  287. package/dist/esm/index-59f44eaa.js +0 -1323
  288. package/dist/esm/index.js +0 -1
  289. package/dist/esm/loader.js +0 -19
  290. package/dist/esm/polyfills/core-js.js +0 -11
  291. package/dist/esm/polyfills/css-shim.js +0 -1
  292. package/dist/esm/polyfills/dom.js +0 -79
  293. package/dist/esm/polyfills/es5-html-element.js +0 -1
  294. package/dist/esm/polyfills/index.js +0 -34
  295. package/dist/esm/polyfills/system.js +0 -6
  296. package/dist/esm/vviinn-carousel_3.entry.js +0 -1168
  297. package/dist/esm/vviinn-widgets.js +0 -19
  298. package/dist/index.cjs.js +0 -1
  299. package/dist/index.js +0 -1
  300. package/dist/loader/cdn.js +0 -3
  301. package/dist/loader/index.cjs.js +0 -3
  302. package/dist/loader/index.d.ts +0 -12
  303. package/dist/loader/index.es2017.js +0 -3
  304. package/dist/loader/index.js +0 -4
  305. package/dist/loader/package.json +0 -10
  306. package/dist/vviinn-widgets/p-118ac907.js +0 -1
  307. package/dist/vviinn-widgets/p-11f61564.js +0 -1
  308. package/dist/vviinn-widgets/p-39fdc5c9.entry.js +0 -1
  309. package/dist/vviinn-widgets/p-762dc067.entry.js +0 -1
  310. package/dist/vviinn-widgets/p-7e2f542c.js +0 -1
  311. package/dist/vviinn-widgets/p-8d56e795.entry.js +0 -1
  312. package/dist/vviinn-widgets/p-8f955b15.entry.js +0 -1
  313. package/dist/vviinn-widgets/p-9654fe35.entry.js +0 -1
  314. package/dist/vviinn-widgets/p-9e5adc42.js +0 -1
  315. package/dist/vviinn-widgets/p-b3731705.entry.js +0 -1
  316. package/dist/vviinn-widgets/p-bad1809f.js +0 -1
  317. package/dist/vviinn-widgets/p-c36546fa.js +0 -15
  318. package/dist/vviinn-widgets/p-d991330b.entry.js +0 -1
  319. package/dist/vviinn-widgets/p-da9c933b.entry.js +0 -1
  320. package/dist/vviinn-widgets/p-ee46fc83.js +0 -1
  321. package/dist/vviinn-widgets/p-f41e25f0.entry.js +0 -1
  322. package/www/build/p-118ac907.js +0 -1
  323. package/www/build/p-11f61564.js +0 -1
  324. package/www/build/p-39fdc5c9.entry.js +0 -1
  325. package/www/build/p-762dc067.entry.js +0 -1
  326. package/www/build/p-7e2f542c.js +0 -1
  327. package/www/build/p-8d56e795.entry.js +0 -1
  328. package/www/build/p-8f955b15.entry.js +0 -1
  329. package/www/build/p-9654fe35.entry.js +0 -1
  330. package/www/build/p-9e5adc42.js +0 -1
  331. package/www/build/p-a67898be.css +0 -1
  332. package/www/build/p-b3731705.entry.js +0 -1
  333. package/www/build/p-bad1809f.js +0 -1
  334. package/www/build/p-c36546fa.js +0 -15
  335. package/www/build/p-cfd998c1.js +0 -1
  336. package/www/build/p-d991330b.entry.js +0 -1
  337. package/www/build/p-da9c933b.entry.js +0 -1
  338. package/www/build/p-ee46fc83.js +0 -1
  339. package/www/build/p-f41e25f0.entry.js +0 -1
@@ -1,1174 +0,0 @@
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;