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