vviinn-widgets 2.2.2 → 2.4.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 (240) hide show
  1. package/dist/cjs/{app-globals-30781f30.js → app-globals-2bcc74df.js} +1 -1
  2. package/dist/cjs/cropper-handler.cjs.entry.js +1 -1
  3. package/dist/cjs/{customized-slots-5d904d8e.js → customized-slots-4202eaf5.js} +1 -1
  4. package/dist/cjs/highlight-box_22.cjs.entry.js +20 -10
  5. package/dist/cjs/{imageSearch.store-128957a4.js → imageSearch.store-cb2b2cc8.js} +14 -11
  6. package/dist/cjs/{index-c493804d.js → index-44fc16ad.js} +7 -9
  7. package/dist/cjs/{index-741a970d.js → index-6771ae25.js} +1 -1
  8. package/dist/cjs/index-e9439500.js +3943 -0
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/{vviinn-carousel_5.cjs.entry.js → vviinn-carousel_3.cjs.entry.js} +54 -108
  11. package/dist/cjs/vviinn-error.cjs.entry.js +1 -1
  12. package/dist/cjs/vviinn-preloader.cjs.entry.js +2 -2
  13. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +63 -0
  14. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +44 -0
  15. package/dist/cjs/vviinn-vps-button.cjs.entry.js +4 -4
  16. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +74 -10
  17. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  18. package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.js +27 -7
  19. package/dist/collection/components/image-search/search-filters/search-filters.js +24 -1
  20. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +4 -0
  21. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +6 -3
  22. package/dist/collection/components/vviinn-icons/index.js +6 -8
  23. package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +18 -1
  24. package/dist/collection/components/vviinn-product-card/stories/args.js +73 -0
  25. package/dist/collection/components/vviinn-product-card/stories/decorators.js +51 -0
  26. package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +105 -0
  27. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +57 -12
  28. package/dist/collection/components/vviinn-vpr-button/stories/args.js +207 -0
  29. package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +89 -0
  30. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +11 -4
  31. package/dist/collection/components/vviinn-vpr-widget/stories/args.js +190 -0
  32. package/dist/collection/components/vviinn-vpr-widget/stories/decorators.js +29 -0
  33. package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +212 -0
  34. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +47 -9
  35. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +5 -0
  36. package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +31 -0
  37. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.css +3 -0
  38. package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +33 -0
  39. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +108 -10
  40. package/dist/collection/network/utils.js +1 -1
  41. package/dist/collection/openApi/index.js +27 -0
  42. package/dist/collection/{components/vviinn-vpr-widget/GridMode.js → recommendation/events.js} +0 -0
  43. package/dist/collection/store/store.js +7 -9
  44. package/dist/collection/store/tracking.store.js +3 -0
  45. package/dist/collection/tracking/event.js +3 -0
  46. package/dist/collection/tracking/filter.js +5 -0
  47. package/dist/collection/tracking/index.js +13 -0
  48. package/dist/collection/tracking/models.js +6 -0
  49. package/dist/collection/tracking/product.js +18 -0
  50. package/dist/collection/tracking/search.js +5 -0
  51. package/dist/collection/tracking/widget.js +10 -0
  52. package/dist/esm/{app-globals-345e497d.js → app-globals-550daa9b.js} +1 -1
  53. package/dist/esm/cropper-handler.entry.js +1 -1
  54. package/dist/esm/{customized-slots-a76a8d41.js → customized-slots-80625933.js} +1 -1
  55. package/dist/esm/highlight-box_22.entry.js +20 -10
  56. package/dist/esm/{imageSearch.store-8eab0da1.js → imageSearch.store-1268786d.js} +12 -10
  57. package/dist/esm/{index-8cb063df.js → index-1cf740a8.js} +8 -10
  58. package/dist/esm/{index-6fa21e24.js → index-c09e56b6.js} +1 -1
  59. package/dist/esm/index-fa27f1df.js +3934 -0
  60. package/dist/esm/loader.js +3 -3
  61. package/dist/esm/{vviinn-carousel_5.entry.js → vviinn-carousel_3.entry.js} +55 -107
  62. package/dist/esm/vviinn-error.entry.js +1 -1
  63. package/dist/esm/vviinn-preloader.entry.js +2 -2
  64. package/dist/esm/vviinn-recommendations-sidebar.entry.js +59 -0
  65. package/dist/esm/vviinn-vpr-button.entry.js +40 -0
  66. package/dist/esm/vviinn-vps-button.entry.js +4 -4
  67. package/dist/esm/vviinn-vps-widget.entry.js +71 -7
  68. package/dist/esm/vviinn-widgets.js +3 -3
  69. package/dist/types/Image/error.d.ts +1 -0
  70. package/dist/types/Image/form.d.ts +1 -0
  71. package/dist/types/Image/fromFile.d.ts +1 -0
  72. package/dist/types/Image/imageToB64.d.ts +1 -0
  73. package/dist/types/Image/index.d.ts +1 -0
  74. package/dist/types/Image/renderPromise.d.ts +1 -0
  75. package/dist/types/Image/resizeImage.d.ts +1 -0
  76. package/dist/types/Image/sizing.d.ts +1 -0
  77. package/dist/types/Image/toFile.d.ts +1 -0
  78. package/dist/types/analytics/GAnalytics.d.ts +1 -0
  79. package/dist/types/analytics/GeneralAnalytics.d.ts +1 -0
  80. package/dist/types/analytics/GtagAnalytics.d.ts +1 -0
  81. package/dist/types/analytics/ProductAnalytics.d.ts +1 -0
  82. package/dist/types/campaign/Campaign.d.ts +1 -0
  83. package/dist/types/campaign/CampaignService.d.ts +1 -0
  84. package/dist/types/campaign/VCSCampaign.d.ts +1 -0
  85. package/dist/types/campaign/VCSCampaignResponse.d.ts +1 -0
  86. package/dist/types/campaign/VCSCampaignService.d.ts +1 -0
  87. package/dist/types/campaign/VPRCampaignResponse.d.ts +1 -0
  88. package/dist/types/campaign/VPRCampaignService.d.ts +1 -0
  89. package/dist/types/components/customized-slots.d.ts +1 -0
  90. package/dist/types/components/image-search/image-view/highlight-box/highlight-box.d.ts +1 -0
  91. package/dist/types/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.d.ts +1 -0
  92. package/dist/types/components/image-search/image-view/image-cropper/image-cropper.d.ts +4 -0
  93. package/dist/types/components/image-search/search-filters/search-filters.d.ts +4 -0
  94. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +4 -0
  95. package/dist/types/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.d.ts +1 -0
  96. package/dist/types/components/vviinn-error/vviinn-error.d.ts +1 -0
  97. package/dist/types/components/vviinn-error/vviinn-server-error/vviinn-server-error.d.ts +1 -0
  98. package/dist/types/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.d.ts +1 -0
  99. package/dist/types/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.d.ts +1 -0
  100. package/dist/types/components/vviinn-example-images/vviinn-example-images.d.ts +1 -0
  101. package/dist/types/components/vviinn-icons/index.d.ts +1 -0
  102. package/dist/types/components/vviinn-image-selector/vviinn-image-selector.d.ts +1 -0
  103. package/dist/types/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.d.ts +3 -0
  104. package/dist/types/components/vviinn-image-view/vviinn-image-view.d.ts +1 -0
  105. package/dist/types/components/vviinn-modal/vviinn-modal.d.ts +1 -0
  106. package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.d.ts +1 -0
  107. package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.d.ts +1 -0
  108. package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.d.ts +1 -0
  109. package/dist/types/components/vviinn-onboarding/vviinn-onboarding.d.ts +1 -0
  110. package/dist/types/components/vviinn-overlay/vviinn-overlay.d.ts +1 -0
  111. package/dist/types/components/vviinn-overlayed-modal/vviinn-overlayed-modal.d.ts +1 -0
  112. package/dist/types/components/vviinn-preloader/vviinn-preloader.d.ts +1 -0
  113. package/dist/types/components/vviinn-privacy-badge/vviinn-privacy-badge.d.ts +1 -0
  114. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +1 -0
  115. package/dist/types/components/vviinn-product-card/stories/args.d.ts +74 -0
  116. package/dist/types/components/vviinn-product-card/stories/decorators.d.ts +2 -0
  117. package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +81 -0
  118. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +9 -3
  119. package/dist/types/components/vviinn-slider/arrow.d.ts +1 -0
  120. package/dist/types/components/vviinn-slider/vviinn-slide/vviinn-slide.d.ts +1 -0
  121. package/dist/types/components/vviinn-slider/vviinn-slider.d.ts +1 -0
  122. package/dist/types/components/vviinn-teaser/vviinn-teaser.d.ts +1 -0
  123. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +1 -0
  124. package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +208 -0
  125. package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +215 -0
  126. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +4 -0
  127. package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +199 -0
  128. package/dist/types/components/vviinn-vpr-widget/stories/decorators.d.ts +3 -0
  129. package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +142 -0
  130. package/dist/types/components/vviinn-vpr-widget/token-helpers.d.ts +1 -0
  131. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +10 -1
  132. package/dist/types/components/vviinn-vps-button/stories/vviinn-vps-button.stories.d.ts +13 -0
  133. package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +1 -0
  134. package/dist/types/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.d.ts +11 -0
  135. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +14 -1
  136. package/dist/types/components.d.ts +10 -4
  137. package/dist/types/cropper/Cropper.d.ts +1 -0
  138. package/dist/types/cropper/Handler.d.ts +1 -0
  139. package/dist/types/dom/index.d.ts +1 -0
  140. package/dist/types/error.d.ts +1 -0
  141. package/dist/types/file/index.d.ts +1 -0
  142. package/dist/types/geometry/Clip.d.ts +1 -0
  143. package/dist/types/geometry/Point.d.ts +1 -0
  144. package/dist/types/geometry/Rectangle.d.ts +1 -0
  145. package/dist/types/geometry/RectangleAlt.d.ts +1 -0
  146. package/dist/types/geometry/Sized.d.ts +1 -0
  147. package/dist/types/global.d.ts +1 -0
  148. package/dist/types/index.d.ts +1 -0
  149. package/dist/types/interfaces/generated.d.ts +1 -0
  150. package/dist/types/interfaces/recommendation.d.ts +1 -0
  151. package/dist/types/network/apiClient.d.ts +1 -0
  152. package/dist/types/network/ion/File.d.ts +1 -0
  153. package/dist/types/network/ion/Form.d.ts +1 -0
  154. package/dist/types/network/ion/Link.d.ts +1 -0
  155. package/dist/types/network/ion/ValueObject.d.ts +1 -0
  156. package/dist/types/network/request.d.ts +1 -0
  157. package/dist/types/network/utils.d.ts +1 -0
  158. package/dist/types/openApi/index.d.ts +6 -0
  159. package/dist/types/recommendation/events.d.ts +6 -0
  160. package/dist/types/recommendation/recommendation.d.ts +1 -0
  161. package/dist/types/searchSession/searchSession.d.ts +1 -0
  162. package/dist/types/sentry.d.ts +1 -0
  163. package/dist/types/slider/GridMode.d.ts +1 -0
  164. package/dist/types/store/file-processing.d.ts +1 -0
  165. package/dist/types/store/imageSearch.store.d.ts +1 -0
  166. package/dist/types/store/store.d.ts +8 -6
  167. package/dist/types/store/tracking.store.d.ts +4 -0
  168. package/dist/types/stories/image-selector.stories.d.ts +1 -0
  169. package/dist/types/stories/image-view.stories.d.ts +1 -0
  170. package/dist/types/stories/modal.stories.d.ts +1 -0
  171. package/dist/types/stories/onboarding.stories.d.ts +1 -0
  172. package/dist/types/stories/overlay.stories.d.ts +1 -0
  173. package/dist/types/stories/overlayedModal.stories.d.ts +1 -0
  174. package/dist/types/stories/privacy-badge.stories.d.ts +1 -0
  175. package/dist/types/stories/slider.stories.d.ts +1 -0
  176. package/dist/types/stories/teaser.stories.d.ts +1 -0
  177. package/dist/types/stories/vps-widget.stories.d.ts +1 -0
  178. package/dist/types/stories/vviinn-product.stories.d.ts +1 -0
  179. package/dist/types/tracking/event.d.ts +4 -0
  180. package/dist/types/tracking/filter.d.ts +3 -0
  181. package/dist/types/tracking/index.d.ts +9 -0
  182. package/dist/types/tracking/models.d.ts +13 -0
  183. package/dist/types/tracking/product.d.ts +7 -0
  184. package/dist/types/tracking/search.d.ts +3 -0
  185. package/dist/types/tracking/widget.d.ts +5 -0
  186. package/dist/types/utils/collections/collectionsUtils.d.ts +1 -0
  187. package/dist/types/utils/either.d.ts +1 -0
  188. package/dist/types/utils/enum/enumUtils.d.ts +1 -0
  189. package/dist/types/utils/event/Events.d.ts +1 -0
  190. package/dist/types/utils/number/index.d.ts +1 -0
  191. package/dist/types/utils/option/option.d.ts +1 -0
  192. package/dist/types/utils/semigroup/semigroupDiff.d.ts +1 -0
  193. package/dist/types/utils/token/tokenUtils.d.ts +1 -0
  194. package/dist/vviinn-widgets/{p-78ccc9eb.js → p-07125f64.js} +1 -1
  195. package/dist/vviinn-widgets/{p-f47e82b2.entry.js → p-27ede517.entry.js} +1 -1
  196. package/dist/vviinn-widgets/{p-9d24f51e.entry.js → p-314e40b3.entry.js} +1 -1
  197. package/dist/vviinn-widgets/p-316abc01.js +1 -0
  198. package/dist/vviinn-widgets/{p-fb14e3cc.entry.js → p-4bdb3027.entry.js} +1 -1
  199. package/dist/vviinn-widgets/p-5535163a.entry.js +1 -0
  200. package/dist/vviinn-widgets/{p-59edfbe2.js → p-78b65f70.js} +1 -1
  201. package/dist/vviinn-widgets/{p-400eb62f.entry.js → p-86ae782f.entry.js} +1 -1
  202. package/dist/vviinn-widgets/p-89f2c19a.entry.js +1 -0
  203. package/dist/vviinn-widgets/{p-e1ba8626.js → p-8e25b838.js} +1 -1
  204. package/dist/vviinn-widgets/p-94aa8705.entry.js +1 -0
  205. package/dist/vviinn-widgets/{p-e67cae57.js → p-97af45f0.js} +1 -1
  206. package/dist/vviinn-widgets/p-c5e6ec4f.js +1 -0
  207. package/dist/vviinn-widgets/p-c63fb46b.entry.js +1 -0
  208. package/{www/build/p-d085199d.entry.js → dist/vviinn-widgets/p-dd7cac6e.entry.js} +1 -1
  209. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  210. package/package.json +11 -3
  211. package/www/build/{p-78ccc9eb.js → p-07125f64.js} +1 -1
  212. package/www/build/{p-f47e82b2.entry.js → p-27ede517.entry.js} +1 -1
  213. package/www/build/{p-9d24f51e.entry.js → p-314e40b3.entry.js} +1 -1
  214. package/www/build/p-316abc01.js +1 -0
  215. package/www/build/{p-fb14e3cc.entry.js → p-4bdb3027.entry.js} +1 -1
  216. package/www/build/p-5535163a.entry.js +1 -0
  217. package/www/build/{p-59edfbe2.js → p-78b65f70.js} +1 -1
  218. package/www/build/{p-400eb62f.entry.js → p-86ae782f.entry.js} +1 -1
  219. package/www/build/p-89f2c19a.entry.js +1 -0
  220. package/www/build/{p-e1ba8626.js → p-8e25b838.js} +1 -1
  221. package/www/build/p-94aa8705.entry.js +1 -0
  222. package/www/build/p-961822d3.js +125 -0
  223. package/www/build/{p-e67cae57.js → p-97af45f0.js} +1 -1
  224. package/www/build/p-c5e6ec4f.js +1 -0
  225. package/www/build/p-c63fb46b.entry.js +1 -0
  226. package/{dist/vviinn-widgets/p-d085199d.entry.js → www/build/p-dd7cac6e.entry.js} +1 -1
  227. package/www/build/p-e0153ae2.css +6 -0
  228. package/www/build/vviinn-widgets.esm.js +1 -1
  229. package/www/index.html +1 -177
  230. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +0 -18
  231. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +0 -7
  232. package/dist/types/components/vviinn-vpr-widget/GridMode.d.ts +0 -1
  233. package/dist/vviinn-widgets/p-04b06ea9.entry.js +0 -1
  234. package/dist/vviinn-widgets/p-56fc949a.js +0 -1
  235. package/dist/vviinn-widgets/p-e38f4aa2.entry.js +0 -1
  236. package/www/build/p-04b06ea9.entry.js +0 -1
  237. package/www/build/p-56fc949a.js +0 -1
  238. package/www/build/p-7e4978d5.js +0 -1
  239. package/www/build/p-a67898be.css +0 -1
  240. package/www/build/p-e38f4aa2.entry.js +0 -1
@@ -0,0 +1,212 @@
1
+ import { argTypes, continuityLayoutArgs, gridLayoutArgs } from "./args";
2
+ import { gridDecorator, continuityDecorator } from "./decorators";
3
+ const excludeControls = [
4
+ "blockTitle",
5
+ "currencySign",
6
+ "imageRatio",
7
+ "imageWidth",
8
+ "locale",
9
+ "pricePrefix",
10
+ "showScroll",
11
+ ];
12
+ export default {
13
+ title: "Widgets/Visual Recommendations/Widget",
14
+ component: "vviinn-vpr-widget",
15
+ argTypes: Object.assign(Object.assign({}, argTypes), { mode: {
16
+ table: {
17
+ disable: true
18
+ }
19
+ } }),
20
+ parameters: {
21
+ controls: {
22
+ exclude: excludeControls
23
+ }
24
+ }
25
+ };
26
+ const allignementLeft = `
27
+ vviinn-vpr-widget::part(title),
28
+ vviinn-vpr-widget::part(brand),
29
+ vviinn-vpr-widget::part(type),
30
+ vviinn-vpr-widget::part(deeplink),
31
+ vviinn-vpr-widget::part(price-container) {
32
+ align-self: start;
33
+ text-align: left;
34
+ }`;
35
+ const allignementCenter = `
36
+ vviinn-vpr-widget::part(title),
37
+ vviinn-vpr-widget::part(brand),
38
+ vviinn-vpr-widget::part(type),
39
+ vviinn-vpr-widget::part(deeplink),
40
+ vviinn-vpr-widget::part(price-container) {
41
+ align-self: center;
42
+ text-align: center;
43
+ }`;
44
+ const allignementRight = `
45
+ vviinn-vpr-widget::part(title),
46
+ vviinn-vpr-widget::part(brand),
47
+ vviinn-vpr-widget::part(type),
48
+ vviinn-vpr-widget::part(deeplink),
49
+ vviinn-vpr-widget::part(price-container) {
50
+ align-self: end;
51
+ text-align: right;
52
+ }`;
53
+ const allignement = new Map([
54
+ [0, allignementLeft],
55
+ [1, allignementCenter],
56
+ [2, allignementRight],
57
+ ]);
58
+ const Template = (args) => `
59
+ <script>
60
+ window.dataLayer = window.dataLayer || [];
61
+ function gtag() {
62
+ dataLayer.push(arguments);
63
+ }
64
+ gtag("js", new Date());
65
+
66
+ gtag("config", "${args.analyticsId}");
67
+ gtag("require", "ec");
68
+ </script>
69
+ <style>
70
+ ${allignement.get(args.contentAlignment)}
71
+ vviinn-vpr-widget::part(title),
72
+ vviinn-vpr-widget::part(brand),
73
+ vviinn-vpr-widget::part(type),
74
+ vviinn-vpr-widget::part(price-sale),
75
+ vviinn-vpr-widget::part(price-regular) {
76
+ color: ${args.primaryTextColor};
77
+ }
78
+
79
+ vviinn-vpr-widget::part(price-outdated) {
80
+ color: ${args.secondaryTextColor};
81
+ }
82
+
83
+ vviinn-vpr-widget::part(recommendations-title) {
84
+ display: ${args.showTitle ? "flex" : "none"};
85
+ font-size: ${args.titleFontSize}px;
86
+ }
87
+
88
+ @media(min-width: 1024px) {
89
+ * {
90
+ --vviinn-carousel-columns: ${args.recommendationsGridProductsDesktop};
91
+ }
92
+ }
93
+
94
+ @media(max-width: 1024px) and (min-width: 768px) {
95
+ * {
96
+ --vviinn-carousel-columns: ${args.recommendationsGridProductsTablet};
97
+ }
98
+ }
99
+
100
+ @media(max-width: 768px) and (min-width: 460px) {
101
+ * {
102
+ --vviinn-carousel-columns: ${args.recommendationsGridProductsMobile};
103
+ }
104
+
105
+ vviinn-product-card::part(title) {
106
+ font-size: 14px;
107
+ }
108
+ }
109
+
110
+ @media(min-width: 1024px) {
111
+ vviinn-product-card,
112
+ vviinn-vpr-widget::part(image) {
113
+ width: ${args.recommendationsContinuityProductsDesktop}px;
114
+ max-width: ${args.recommendationsContinuityProductsDesktop}px;
115
+ }
116
+
117
+ vviinn-vpr-widget::part(image) {
118
+ height: 100%;
119
+ aspect-ratio: 1;
120
+ }
121
+ }
122
+
123
+ @media(max-width: 1024px) and (min-width: 768px) {
124
+ vviinn-product-card,
125
+ vviinn-vpr-widget::part(image) {
126
+ width: ${args.recommendationsContinuityProductsTablet}px;
127
+ max-width: ${args.recommendationsContinuityProductsTablet}px;
128
+ }
129
+
130
+ vviinn-vpr-widget::part(image) {
131
+ height: 100%;
132
+ aspect-ratio: 1;
133
+ }
134
+ }
135
+
136
+ @media(max-width: 768px) and (min-width: 460px) {
137
+ vviinn-product-card,
138
+ vviinn-vpr-widget::part(image) {
139
+ width: ${args.recommendationsContinuityProductsMobile}px;
140
+ max-width: ${args.recommendationsContinuityProductsMobile}px;
141
+ }
142
+
143
+ vviinn-vpr-widget::part(image) {
144
+ height: 100%;
145
+ aspect-ratio: 1;
146
+ }
147
+
148
+ vviinn-vpr-widget::part(title) {
149
+ font-size: 14px;
150
+ }
151
+ }
152
+ </style>
153
+ <vviinn-vpr-widget
154
+ block-title="${args.titleName}"
155
+ api-path="${args.apiPath}"
156
+ product-id="${args.productId}"
157
+ token="${args.token}"
158
+ mode="${args.mode}"
159
+ show-scroll="${args.showScrollbars}"
160
+ image-width="${args.imageWidth}"
161
+ campaign-type="${args.campaignType}"
162
+ >
163
+ </vviinn-vpr-widget>
164
+ `;
165
+ export const Grid = Template.bind({});
166
+ Grid.args = {
167
+ analyticsId: "UA-34442043-5",
168
+ apiPath: "https://api.vviinn.com",
169
+ campaignType: "VPR",
170
+ contentAlignment: "Centered",
171
+ imageWidth: 420,
172
+ mode: "grid",
173
+ primaryTextColor: "#161616",
174
+ productId: "4114460310",
175
+ recommendationsGridProductsDesktop: 4,
176
+ recommendationsGridProductsMobile: 4,
177
+ recommendationsGridProductsTablet: 4,
178
+ secondaryTextColor: "#757575",
179
+ showScrollbars: true,
180
+ showTitle: true,
181
+ titleFontSize: 28,
182
+ titleName: "Recommended products",
183
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4"
184
+ };
185
+ Grid.argTypes = Object.assign({}, gridLayoutArgs);
186
+ Grid.decorators = [
187
+ gridDecorator
188
+ ];
189
+ export const Continuity = Template.bind({});
190
+ Continuity.args = {
191
+ analyticsId: "UA-34442043-5",
192
+ apiPath: "https://api.vviinn.com",
193
+ campaignType: "VPR",
194
+ contentAlignment: "Left",
195
+ imageWidth: 300,
196
+ mode: "continuity",
197
+ primaryTextColor: "#161616",
198
+ productId: "4114460310",
199
+ recommendationsContinuityProductsDesktop: 200,
200
+ recommendationsContinuityProductsMobile: 160,
201
+ recommendationsContinuityProductsTablet: 150,
202
+ secondaryTextColor: "#757575",
203
+ showScrollbars: false,
204
+ showTitle: true,
205
+ titleFontSize: 28,
206
+ titleName: "Recommended products",
207
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4"
208
+ };
209
+ Continuity.decorators = [
210
+ continuityDecorator
211
+ ];
212
+ Continuity.argTypes = Object.assign({}, continuityLayoutArgs);
@@ -1,12 +1,15 @@
1
- import { Component, Host, h, Prop, State, Element, Watch, Event, Listen } from "@stencil/core";
1
+ import { Component, Host, h, Prop, State, Element, Watch, Event, Listen, } from "@stencil/core";
2
2
  import { pipe } from "fp-ts/lib/function";
3
3
  import * as TE from "fp-ts/lib/TaskEither";
4
4
  import * as E from "fp-ts/lib/Either";
5
5
  import { createBearAuthedHeader } from "./token-helpers";
6
- import state from "../../store/store";
6
+ import { state } from "../../store/store";
7
7
  import { getRecommendationsService } from "../../campaign/CampaignService";
8
8
  import { imageSearchState } from "../../store/imageSearch.store";
9
9
  import { Subject } from "rxjs";
10
+ import { v4 as uuidv4 } from "uuid";
11
+ import { createTrackingApi } from "../../openApi";
12
+ import { createProductViewVprEvent, createWidgetVprEvent, } from "../../tracking";
10
13
  /**
11
14
  * @part product-card - product card itself
12
15
  * @part title - title inside product card
@@ -20,6 +23,7 @@ import { Subject } from "rxjs";
20
23
  * @part price-prefix - block rendered before each price element (for ex. "from")
21
24
  * @part price-regular - block for price if no sale price presented
22
25
  * @part price-sale - block for sale price. rendered only if sale price presented
26
+ * @part carousel-button
23
27
  */
24
28
  export class VviinnVprWidget {
25
29
  constructor() {
@@ -57,13 +61,35 @@ export class VviinnVprWidget {
57
61
  state.apiPath = newPath;
58
62
  this.getRecommendations();
59
63
  }
60
- lol({ detail }) {
64
+ handleImageLoading({ detail }) {
61
65
  this.productImageLoadedSubject.next(detail);
62
66
  }
67
+ trackRecommendationView({ detail }) {
68
+ const recommendationViewEvent = createProductViewVprEvent(Object.assign({ session_id: this.uiSessionId }, detail));
69
+ this.trackingApi.trackEvent(recommendationViewEvent);
70
+ }
71
+ trackRecommendationClick({ detail }) {
72
+ const recommendationClickEvent = createProductViewVprEvent(Object.assign({ session_id: this.uiSessionId }, detail));
73
+ this.trackingApi.trackEvent(recommendationClickEvent);
74
+ }
63
75
  connectedCallback() {
64
76
  state.apiPath = this.apiPath;
65
77
  state.currencySign = this.currencySign;
66
78
  state.locale = this.locale;
79
+ this.uiSessionId = uuidv4();
80
+ this.trackingApi = createTrackingApi(this.apiPath, this.token);
81
+ const widgetOpenEvent = createWidgetVprEvent({
82
+ action: "open",
83
+ sessionId: this.uiSessionId,
84
+ });
85
+ this.trackingApi.trackEvent(widgetOpenEvent);
86
+ }
87
+ disconnectedCallback() {
88
+ const widgetCloseEvent = createWidgetVprEvent({
89
+ action: "close",
90
+ sessionId: this.uiSessionId,
91
+ });
92
+ this.trackingApi.trackEvent(widgetCloseEvent);
67
93
  }
68
94
  async componentWillLoad() {
69
95
  state.pricePrefix = this.pricePrefix;
@@ -88,9 +114,9 @@ export class VviinnVprWidget {
88
114
  imageSearchState.results = this.recommendations;
89
115
  this.loaded = true;
90
116
  //this.recommendationsLoaded.emit();
91
- this.productIds = this.recommendations.map(r => r.productId);
117
+ this.productIds = this.recommendations.map((r) => r.productId);
92
118
  this.productImageLoadedSubject.subscribe((id) => {
93
- this.productIds = this.productIds.filter(x => x !== id);
119
+ this.productIds = this.productIds.filter((x) => x !== id);
94
120
  if (this.productIds.length === 0) {
95
121
  this.recommendationsLoaded.emit();
96
122
  }
@@ -113,14 +139,14 @@ export class VviinnVprWidget {
113
139
  h("h2", { part: "recommendations-title" }, this.blockTitle),
114
140
  this.useCarousel ? this.renderCarousel() : this.renderResults()));
115
141
  }
116
- renderRecommendation(recommendation) {
117
- 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() }));
142
+ renderRecommendation(recommendation, index) {
143
+ 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 }));
118
144
  }
119
145
  useDimmedBackgroundInCard() {
120
146
  return this.mode === "continuity" || !this.useCarousel;
121
147
  }
122
148
  renderResults() {
123
- return (h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r) => this.renderRecommendation(r))));
149
+ return (h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r, i) => this.renderRecommendation(r, i))));
124
150
  }
125
151
  renderCarousel() {
126
152
  return (h("vviinn-carousel", { mode: this.mode, imageWidth: this.imageWidth, showScroll: this.showScroll, recommendations: this.recommendations }));
@@ -433,7 +459,19 @@ export class VviinnVprWidget {
433
459
  }]; }
434
460
  static get listeners() { return [{
435
461
  "name": "productImageLoaded",
436
- "method": "lol",
462
+ "method": "handleImageLoading",
463
+ "target": undefined,
464
+ "capture": false,
465
+ "passive": false
466
+ }, {
467
+ "name": "recommendationView",
468
+ "method": "trackRecommendationView",
469
+ "target": undefined,
470
+ "capture": false,
471
+ "passive": false
472
+ }, {
473
+ "name": "recommendationClick",
474
+ "method": "trackRecommendationClick",
437
475
  "target": undefined,
438
476
  "capture": false,
439
477
  "passive": false
@@ -1,4 +1,9 @@
1
1
  :host {
2
+ /**
3
+ * @prop --vviinn-carousel-columns: control number of items in grid mode
4
+ * @prop --vviinn-carousel-image-width: control image width in continuity mode
5
+ */
6
+
2
7
  display: grid;
3
8
  grid-gap: 1rem;
4
9
  width: 100%;
@@ -0,0 +1,31 @@
1
+ export default {
2
+ title: "Widgets/Visual Search/Button",
3
+ component: "vviinn-vps-button",
4
+ parameters: {
5
+ viewport: {
6
+ defaultViewport: "mobile2"
7
+ }
8
+ },
9
+ decorators: [(story) => `
10
+ <div style="display: grid;
11
+ position: absolute;
12
+ top: 0;
13
+ bottom: 0;
14
+ left: 0;
15
+ right: 0;
16
+ align-items: center;
17
+ justify-items: center;">
18
+ ${story()}
19
+ </div>
20
+ `],
21
+ };
22
+ const Template = (args) => `
23
+ <vviinn-vps-button
24
+ api-path="${args.apiPath}"
25
+ token="${args.token}"
26
+ ></vviinn-vps-button>`;
27
+ export const Default = Template.bind({});
28
+ Default.args = {
29
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
30
+ apiPath: "https://api.vviinn.com"
31
+ };
@@ -0,0 +1,3 @@
1
+ :host {
2
+ cursor: pointer;
3
+ }
@@ -0,0 +1,33 @@
1
+ export default {
2
+ title: "Widgets/Visual Search/Widget",
3
+ parameters: {
4
+ viewport: {
5
+ defaultViewport: "mobile2"
6
+ }
7
+ }
8
+ };
9
+ const Template = ({ token, apiPath }) => `
10
+ <vviinn-vps-widget token="${token}"
11
+ api-path="${apiPath}"
12
+ active="true">
13
+ </vviinn-vps-widget>`;
14
+ export const Default = Template.bind({});
15
+ Default.args = {
16
+ token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
17
+ apiPath: "https://api.vviinn.com"
18
+ };
19
+ Default.storyName = "Modal Window";
20
+ Default.decorators = [(Story) => `
21
+ <style>
22
+ .sb-show-main.sb-main-padded {
23
+ padding: unset;
24
+ }
25
+
26
+ #root {
27
+ align-content: center;
28
+ display: grid;
29
+ height: 100vh;
30
+ justify-items: center;
31
+ }
32
+ </style>
33
+ ${Story()}`];
@@ -1,8 +1,11 @@
1
- import { Component, Host, h, State, Prop, Element, Watch } from "@stencil/core";
2
- import state from "../../store/store";
1
+ import { Component, Host, h, State, Prop, Element, Watch, Listen, } from "@stencil/core";
2
+ import { state } from "../../store/store";
3
3
  import { imageSearchState } from "../../store/imageSearch.store";
4
4
  import * as O from "fp-ts/lib/Option";
5
5
  import { slotChangeListener } from "../customized-slots";
6
+ import { v4 as uuidv4 } from "uuid";
7
+ import { createTrackingApi } from "../../openApi";
8
+ import { createFilterEvent, createProductViewVpsEvent, createSearchEvent, createWidgetVpsEvent, } from "../../tracking";
6
9
  /**
7
10
  * @prop --color-primary: color used for action button, slider bullets and selected detected object;
8
11
  *
@@ -28,6 +31,8 @@ import { slotChangeListener } from "../customized-slots";
28
31
  */
29
32
  export class VviinnVpsWidget {
30
33
  constructor() {
34
+ /** @internal */
35
+ this.apiPath = "https://api.vviinn.com";
31
36
  /** When true modal window with widget will be shown */
32
37
  this.active = false;
33
38
  /** Currency sign will shown after price */
@@ -37,6 +42,7 @@ export class VviinnVpsWidget {
37
42
  this.slidePosition = 0;
38
43
  this.width = 0;
39
44
  this.wrongImageFormat = false;
45
+ this.imageSource = null;
40
46
  }
41
47
  activeWatcher(value) {
42
48
  if (value) {
@@ -47,6 +53,39 @@ export class VviinnVpsWidget {
47
53
  document.body.style.overflow = this.overflow;
48
54
  }
49
55
  }
56
+ trackRecommendationView({ detail }) {
57
+ const recommendationViewEvent = createProductViewVpsEvent(Object.assign({ sessionId: this.uiSessionId }, detail));
58
+ this.trackingApi.trackEvent(recommendationViewEvent);
59
+ }
60
+ trackRecommendationClick({ detail }) {
61
+ const recommendationClickEvent = createProductViewVpsEvent(Object.assign({ sessionId: this.uiSessionId }, detail));
62
+ this.trackingApi.trackEvent(recommendationClickEvent);
63
+ }
64
+ trachSearchAreaChanges() {
65
+ const searchEvent = createSearchEvent({
66
+ sessionId: this.uiSessionId,
67
+ source: this.imageSource,
68
+ searchArea: "manual-selection",
69
+ });
70
+ this.trackingApi.trackEvent(searchEvent);
71
+ }
72
+ trackDetectedObject() {
73
+ const searchEvent = createSearchEvent({
74
+ sessionId: this.uiSessionId,
75
+ source: this.imageSource,
76
+ searchArea: "attention-point",
77
+ });
78
+ this.trackingApi.trackEvent(searchEvent);
79
+ }
80
+ trackFilter({ detail }) {
81
+ const searchEvent = createFilterEvent({
82
+ sessionId: this.uiSessionId,
83
+ source: this.imageSource,
84
+ kind: "category",
85
+ action: detail,
86
+ });
87
+ this.trackingApi.trackEvent(searchEvent);
88
+ }
50
89
  componentWillLoad() {
51
90
  slotChangeListener(this, this.el);
52
91
  }
@@ -55,14 +94,38 @@ export class VviinnVpsWidget {
55
94
  state.currencySign = this.currencySign;
56
95
  state.locale = this.locale;
57
96
  imageSearchState.token = this.token;
97
+ this.uiSessionId = uuidv4();
98
+ this.trackingApi = createTrackingApi(this.apiPath, this.token);
99
+ const widgetOpenEvent = createWidgetVpsEvent({
100
+ action: "open",
101
+ sessionId: this.uiSessionId,
102
+ });
103
+ this.trackingApi.trackEvent(widgetOpenEvent);
104
+ }
105
+ disconnectedCallback() {
106
+ const widgetOpenEvent = createWidgetVpsEvent({
107
+ action: "close",
108
+ sessionId: this.uiSessionId,
109
+ });
110
+ this.trackingApi.trackEvent(widgetOpenEvent);
58
111
  }
59
- handleImageSelection() {
112
+ handleImageSelection(source) {
113
+ this.imageSource = source;
60
114
  this.slidePosition = 1;
61
115
  const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
62
116
  const overlay = root.shadowRoot.querySelector("vviinn-overlay");
63
117
  const modal = overlay.querySelector("vviinn-modal");
64
118
  const modalBody = modal.shadowRoot.querySelector(".body");
65
119
  modalBody.scrollTop = 0;
120
+ this.trackInitialSearch();
121
+ }
122
+ trackInitialSearch() {
123
+ const searchEvent = createSearchEvent({
124
+ sessionId: this.uiSessionId,
125
+ source: this.imageSource,
126
+ searchArea: "full",
127
+ });
128
+ this.trackingApi.trackEvent(searchEvent);
66
129
  }
67
130
  resetState() {
68
131
  this.resetScroll("onboarding-block");
@@ -103,7 +166,7 @@ export class VviinnVpsWidget {
103
166
  h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }),
104
167
  h("vviinn-server-error", { class: { hidden: !imageSearchState.serverError }, onActionClick: () => (imageSearchState.serverError = false) }),
105
168
  h("vviinn-teaser", { class: { hidden: this.haveErrors() } }),
106
- h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection(), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" },
169
+ h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection("upload"), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" },
107
170
  h("span", { slot: "upload-button-text", class: "upload-button-content" },
108
171
  h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" },
109
172
  h("defs", null),
@@ -115,22 +178,25 @@ export class VviinnVpsWidget {
115
178
  h("div", { id: "onboarding-block", class: "start-page_block" },
116
179
  h("div", { class: "onboarding-wrapper" },
117
180
  h("vviinn-onboarding", null),
118
- h("vviinn-example-images", { onImageSelected: () => this.handleImageSelection(), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))),
181
+ h("vviinn-example-images", { onImageSelected: () => this.handleImageSelection("example"), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))),
119
182
  h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } },
120
183
  h("div", { class: "image-wrapper" },
121
184
  h("vviinn-image-view", null),
122
185
  h("div", { class: "filters-wrapper" },
123
186
  h("div", { class: "filters" }, imageSearchState.filters.map((filter) => (h("search-filters", { filter: filter })))))),
124
187
  h("div", { id: "results-block", class: "products-wrapper" },
125
- h("div", { class: { "nothing-found": true, hidden: imageSearchState.results.length > 0 } },
188
+ h("div", { class: {
189
+ "nothing-found": true,
190
+ hidden: imageSearchState.results.length > 0,
191
+ } },
126
192
  h("vviinn-empty-results", null),
127
193
  h("vviinn-onboarding", null)),
128
194
  h("div", { class: {
129
195
  hidden: imageSearchState.results.length <= 0,
130
196
  products: true,
131
- } }, imageSearchState.results.map((p) => {
197
+ } }, imageSearchState.results.map((p, i) => {
132
198
  var _a;
133
- return (h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card" }));
199
+ return (h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card", index: i }));
134
200
  }))))))));
135
201
  }
136
202
  static get is() { return "vviinn-vps-widget"; }
@@ -163,7 +229,7 @@ export class VviinnVpsWidget {
163
229
  "type": "string",
164
230
  "mutable": false,
165
231
  "complexType": {
166
- "original": "string | undefined",
232
+ "original": "string",
167
233
  "resolved": "string",
168
234
  "references": {}
169
235
  },
@@ -177,7 +243,8 @@ export class VviinnVpsWidget {
177
243
  "text": ""
178
244
  },
179
245
  "attribute": "api-path",
180
- "reflect": false
246
+ "reflect": false,
247
+ "defaultValue": "\"https://api.vviinn.com\""
181
248
  },
182
249
  "active": {
183
250
  "type": "boolean",
@@ -244,4 +311,35 @@ export class VviinnVpsWidget {
244
311
  "propName": "active",
245
312
  "methodName": "activeWatcher"
246
313
  }]; }
314
+ static get listeners() { return [{
315
+ "name": "recommendationView",
316
+ "method": "trackRecommendationView",
317
+ "target": undefined,
318
+ "capture": false,
319
+ "passive": false
320
+ }, {
321
+ "name": "recommendationClick",
322
+ "method": "trackRecommendationClick",
323
+ "target": undefined,
324
+ "capture": false,
325
+ "passive": false
326
+ }, {
327
+ "name": "cropperChanged",
328
+ "method": "trachSearchAreaChanges",
329
+ "target": undefined,
330
+ "capture": false,
331
+ "passive": false
332
+ }, {
333
+ "name": "detectedObjectClicked",
334
+ "method": "trackDetectedObject",
335
+ "target": undefined,
336
+ "capture": false,
337
+ "passive": false
338
+ }, {
339
+ "name": "filterSelected",
340
+ "method": "trackFilter",
341
+ "target": undefined,
342
+ "capture": false,
343
+ "passive": false
344
+ }]; }
247
345
  }
@@ -3,7 +3,7 @@ import * as E from "fp-ts/Either";
3
3
  import { pipe } from "fp-ts/function";
4
4
  import * as S from "fp-ts/Semigroup";
5
5
  import * as String from "fp-ts/string";
6
- import state from "../store/store";
6
+ import { state } from "../store/store";
7
7
  import { emptyApiPathError } from "../error";
8
8
  const stringMonoid = O.getMonoid(String.Monoid);
9
9
  export const getApiPath = () => pipe(O.getFirstMonoid().concat(O.fromNullable(state.apiPath), O.fromNullable(`${process.env.API_PATH}`)), E.fromOption(() => emptyApiPathError));
@@ -0,0 +1,27 @@
1
+ import { createConfiguration, DefaultApi, servers, } from "@vviinn/tracking-client-ts";
2
+ const STAGE_SERVER_IDENTIFIER = "stage";
3
+ export const getTrackingServerByApiPath = (apiPath) => isProductionPath(apiPath) ? servers[0] : servers[1];
4
+ export const isProductionPath = (apiPath) => !apiPath.includes(STAGE_SERVER_IDENTIFIER);
5
+ // TODO find way to utilize this function when we will use several openApi clients
6
+ export const createBearerAuth = (token) => {
7
+ const provider = {
8
+ getToken: () => {
9
+ return new Promise((resolve) => resolve(token));
10
+ },
11
+ };
12
+ const bearerConf = {
13
+ tokenProvider: provider,
14
+ };
15
+ return {
16
+ bearerAuth: bearerConf,
17
+ };
18
+ };
19
+ export const createTrackingApi = (apiPath, token) => {
20
+ const baseServer = getTrackingServerByApiPath(apiPath);
21
+ const authMethods = createBearerAuth(token);
22
+ const configuration = {
23
+ baseServer,
24
+ authMethods,
25
+ };
26
+ return new DefaultApi(createConfiguration(configuration));
27
+ };
@@ -1,11 +1,9 @@
1
1
  import { createStore } from "@stencil/store";
2
- const store = createStore({
3
- fallbackStyles: "",
4
- pricePrefix: null,
5
- currencySign: null,
6
- apiPath: undefined,
7
- locale: "de-DE",
2
+ import { trackingStore } from "./tracking.store";
3
+ export const { state, onChange } = createStore(Object.assign({ fallbackStyles: "", pricePrefix: null, currencySign: null, apiPath: null, token: null, locale: "de-DE" }, trackingStore));
4
+ onChange("apiPath", (val) => {
5
+ console.log("apiPathChanged", val);
6
+ });
7
+ onChange("token", (val) => {
8
+ console.log("tokenChanged", val);
8
9
  });
9
- export default store.state;
10
- export const dispose = store.dispose;
11
- export const state = store.state;
@@ -0,0 +1,3 @@
1
+ export const trackingStore = {
2
+ trackingEnabled: true,
3
+ };
@@ -0,0 +1,3 @@
1
+ export const createTrackingEvent = (widget) => (eventData) => {
2
+ return Object.assign(Object.assign({}, eventData), widget);
3
+ };