vviinn-widgets 2.0.0 → 2.2.1

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 (106) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/cjs/{app-globals-de6924b5.js → app-globals-d0251be8.js} +1 -1
  3. package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
  4. package/dist/cjs/customized-slots-14b77e4a.js +53 -0
  5. package/dist/cjs/{cropper-handler_28.cjs.entry.js → highlight-box_22.cjs.entry.js} +48 -437
  6. package/dist/{esm/Array-e81cf4a3.js → cjs/imageSearch.store-d9ed1a5b.js} +10009 -3391
  7. package/dist/cjs/{index-7adce49f.js → index-141137b2.js} +14 -362
  8. package/dist/cjs/{index-8a276115.js → index-a5e15a0c.js} +7 -1
  9. package/dist/cjs/loader.cjs.js +3 -3
  10. package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
  11. package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
  12. package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
  13. package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
  14. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +97 -0
  15. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  16. package/dist/collection/collection-manifest.json +2 -0
  17. package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +22 -18
  18. package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +78 -68
  19. package/dist/collection/components/vviinn-icons/index.js +4 -0
  20. package/dist/collection/components/vviinn-product-card/render-helpers.js +4 -4
  21. package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +5 -6
  22. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +26 -5
  23. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
  24. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
  25. package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
  26. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
  27. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
  28. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +148 -28
  29. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +31 -8
  30. package/dist/esm/Handler-639a4cb3.js +308 -0
  31. package/dist/esm/{app-globals-0a626970.js → app-globals-b6113170.js} +1 -1
  32. package/dist/esm/cropper-handler.entry.js +23 -0
  33. package/dist/esm/customized-slots-a952fb80.js +50 -0
  34. package/dist/esm/{cropper-handler_28.entry.js → highlight-box_22.entry.js} +21 -404
  35. package/dist/{cjs/Array-cce2fde8.js → esm/imageSearch.store-4ca31230.js} +8705 -2137
  36. package/dist/esm/{index-e77e65ae.js → index-017f18de.js} +6 -2
  37. package/dist/esm/{index-0ccfcee5.js → index-3e85e294.js} +14 -362
  38. package/dist/esm/loader.js +3 -3
  39. package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
  40. package/dist/esm/vviinn-error.entry.js +15 -0
  41. package/dist/esm/vviinn-preloader.entry.js +22 -0
  42. package/dist/esm/vviinn-vps-button.entry.js +39 -0
  43. package/dist/esm/vviinn-vps-widget.entry.js +93 -0
  44. package/dist/esm/vviinn-widgets.js +3 -3
  45. package/dist/types/campaign/Campaign.d.ts +1 -1
  46. package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +13 -7
  47. package/dist/types/components/vviinn-icons/index.d.ts +2 -0
  48. package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
  49. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
  50. package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
  51. package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
  52. package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
  53. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +36 -8
  54. package/dist/types/components.d.ts +62 -10
  55. package/dist/vviinn-widgets/p-0ed1ef7e.entry.js +1 -0
  56. package/dist/vviinn-widgets/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  57. package/dist/vviinn-widgets/p-3da18d7f.js +1 -0
  58. package/dist/vviinn-widgets/p-62a1b042.entry.js +1 -0
  59. package/dist/vviinn-widgets/p-68900093.entry.js +1 -0
  60. package/dist/vviinn-widgets/p-6c4c240d.entry.js +1 -0
  61. package/dist/vviinn-widgets/p-95e53d99.entry.js +1 -0
  62. package/dist/vviinn-widgets/p-9fee20e7.entry.js +1 -0
  63. package/dist/vviinn-widgets/p-d7894eaf.js +1 -0
  64. package/dist/vviinn-widgets/p-db0be4cd.js +1 -0
  65. package/dist/vviinn-widgets/p-eb15116d.entry.js +1 -0
  66. package/dist/vviinn-widgets/{p-489aee23.js → p-f00fddbb.js} +1 -1
  67. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  68. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  69. package/package.json +3 -1
  70. package/www/build/p-0ed1ef7e.entry.js +1 -0
  71. package/www/build/{p-6c4fd1db.js → p-16e49514.js} +1 -1
  72. package/www/build/p-1cc0cdfd.js +1 -0
  73. package/www/build/p-3da18d7f.js +1 -0
  74. package/www/build/p-62a1b042.entry.js +1 -0
  75. package/www/build/p-68900093.entry.js +1 -0
  76. package/www/build/p-6c4c240d.entry.js +1 -0
  77. package/www/build/p-95e53d99.entry.js +1 -0
  78. package/www/build/p-9fee20e7.entry.js +1 -0
  79. package/www/build/p-a67898be.css +1 -0
  80. package/www/build/p-d7894eaf.js +1 -0
  81. package/www/build/p-db0be4cd.js +1 -0
  82. package/www/build/p-eb15116d.entry.js +1 -0
  83. package/www/build/{p-489aee23.js → p-f00fddbb.js} +1 -1
  84. package/www/build/p-f582db5c.js +1 -0
  85. package/www/build/vviinn-widgets.esm.js +1 -1
  86. package/www/index.html +177 -8
  87. package/dist/cjs/imageSearch.store-39fce56c.js +0 -6926
  88. package/dist/cjs/vviinn-carousel.cjs.entry.js +0 -222
  89. package/dist/cjs/vviinn-vpr-widget.cjs.entry.js +0 -106
  90. package/dist/esm/imageSearch.store-b887ff78.js +0 -6893
  91. package/dist/esm/vviinn-carousel.entry.js +0 -218
  92. package/dist/esm/vviinn-vpr-widget.entry.js +0 -102
  93. package/dist/vviinn-widgets/p-2bf74c28.js +0 -1
  94. package/dist/vviinn-widgets/p-3063e23a.js +0 -1
  95. package/dist/vviinn-widgets/p-9145c82e.entry.js +0 -1
  96. package/dist/vviinn-widgets/p-ddcac3f8.js +0 -1
  97. package/dist/vviinn-widgets/p-f05da9f1.entry.js +0 -1
  98. package/dist/vviinn-widgets/p-f12f823d.entry.js +0 -1
  99. package/www/build/p-2bf74c28.js +0 -1
  100. package/www/build/p-3063e23a.js +0 -1
  101. package/www/build/p-9145c82e.entry.js +0 -1
  102. package/www/build/p-cbae3071.js +0 -125
  103. package/www/build/p-ddcac3f8.js +0 -1
  104. package/www/build/p-e0153ae2.css +0 -6
  105. package/www/build/p-f05da9f1.entry.js +0 -1
  106. package/www/build/p-f12f823d.entry.js +0 -1
@@ -1,222 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-7adce49f.js');
6
- const _Array = require('./Array-cce2fde8.js');
7
- const index$1 = require('./index-8a276115.js');
8
-
9
- 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%}.bullet.active{background:#161616}:host(:not(.show-scrollbar)) .content{-ms-overflow-style:none;scrollbar-width:none;overflow:hidden}@media (max-width: 480px){:host(.modern) button{display:none}}.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}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.modern) button{border-radius:2px}:host(.classic) 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.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;min-width:100%;grid-template-columns:repeat(auto-fit, minmax(var(--vviinn-carousel-image-width, --vviinn-carousel-image-width-system), 1fr));align-items:center;justify-items:center;grid-gap:16px}.items-group.incomplete{grid-template-columns:repeat(auto-fit, minmax(var(--vviinn-carousel-image-width, --vviinn-carousel-image-width-system), 1fr))}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}";
10
-
11
- const COLUMNS_NUMBER_CSS_VAR = "--vviinn-carousel-columns-internal";
12
- const CAROUSEL_WIDTH_CSS_VAR = "--vviinn-carousel-content-width";
13
- const CAROUSEL_IMAGE_WIDTH_CSS_VAR = "--vviinn-carousel-image-width";
14
- const CONTENT_GROUP_CSS_CLASS = "items-group";
15
- const INCOMPLETE_GROUP_CSS_CLASS = "incomplete";
16
- let VviinnCarousel = class {
17
- constructor(hostRef) {
18
- index.registerInstance(this, hostRef);
19
- this.moveDirection = "right";
20
- this.contentGroups = [];
21
- this.activeContentGroup = 0;
22
- this.mode = "modern";
23
- this.imageWidth = 140;
24
- this.showScroll = true;
25
- this.content = [];
26
- this.columns = 0;
27
- this.resizeObserver = new ResizeObserver(() => this.handleResize());
28
- this.mutationObserver = new MutationObserver(() => this.cloneSlottedContent());
29
- }
30
- connectedCallback() {
31
- this.setItemWidth();
32
- }
33
- disconnectedCallback() {
34
- this.resizeObserver.disconnect();
35
- }
36
- componentDidRender() {
37
- this.setWidth();
38
- this.processScrollbarWidth();
39
- this.columns = this.getColumnsNumber();
40
- const slot = this.el.querySelector("#slot");
41
- this.mutationObserver.observe(slot, { subtree: true, childList: true });
42
- }
43
- getItemWidthFromDocument() {
44
- return parseInt(getComputedStyle(document.body).getPropertyValue(CAROUSEL_IMAGE_WIDTH_CSS_VAR));
45
- }
46
- setItemWidth() {
47
- const widthInDocument = this.getItemWidthFromDocument();
48
- const itemWidth = isNaN(widthInDocument) ? this.imageWidth : 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
- };
57
- }
58
- handleResize() {
59
- this.setWidth();
60
- this.processScrollbarWidth();
61
- this.setItemWidth();
62
- const newColumns = this.getColumnsNumber();
63
- if (newColumns !== this.columns) {
64
- this.renderContent();
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
- setWidth() {
74
- const parent = this.el.offsetParent;
75
- if (!parent)
76
- return;
77
- const parentStyles = getComputedStyle(parent);
78
- const parentWidth = parent.getBoundingClientRect().width;
79
- const width = parentWidth -
80
- (parseInt(parentStyles["padding-right"]) +
81
- parseInt(parentStyles["padding-left"]));
82
- this.el.style.setProperty(CAROUSEL_WIDTH_CSS_VAR, `${width}px`);
83
- }
84
- cloneSlottedContent() {
85
- const slot = this.el.querySelector("#slot");
86
- const content = Array.from(slot.children);
87
- if (content.length > 0) {
88
- this.content = content;
89
- this.renderContent();
90
- this.setWidth();
91
- this.resizeObserver.observe(this.el.offsetParent);
92
- this.mutationObserver.disconnect();
93
- }
94
- }
95
- renderContent() {
96
- const c = this.mode === "classic"
97
- ? _Array._Array.chunksOf(this.getColumnsNumber())(this.content)
98
- : this.content.reduce((fragment, element) => {
99
- fragment.append(element);
100
- return fragment;
101
- }, new DocumentFragment());
102
- this.mode === "classic" ? this.renderGroup(c) : this.renderLine(c);
103
- }
104
- renderGroup(content) {
105
- const columnsNumber = this.getColumnsNumber();
106
- const groups = content.map((el) => {
107
- const container = document.createElement("div");
108
- const groupClassNames = el.length < columnsNumber
109
- ? [CONTENT_GROUP_CSS_CLASS, INCOMPLETE_GROUP_CSS_CLASS]
110
- : [CONTENT_GROUP_CSS_CLASS];
111
- container.classList.add(...groupClassNames);
112
- return el.reduce((acc, el) => {
113
- acc.append(el);
114
- return acc;
115
- }, container);
116
- });
117
- const combinedElements = groups.reduce((fragment, element) => {
118
- fragment.append(element);
119
- return fragment;
120
- }, new DocumentFragment());
121
- this.appendToContent(combinedElements);
122
- this.contentGroups = this.getContentGroups();
123
- }
124
- renderLine(item) {
125
- this.appendToContent(item);
126
- }
127
- getActiveGroupIndex() {
128
- var _a, _b;
129
- const contentNodeLeft = (_b = (_a = this.getContentNode()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) === null || _b === void 0 ? void 0 : _b.left;
130
- if (!contentNodeLeft)
131
- return 0;
132
- const groups = this.getContentGroups();
133
- const groupsPositions = groups.map((g) => g.getBoundingClientRect().left);
134
- const indexedPositions = groupsPositions
135
- .map((value, index) => [value, index])
136
- .filter((x) => x[0] >= 0);
137
- return indexedPositions.length > 0 ? indexedPositions[0][1] : 0;
138
- }
139
- getContentNode() {
140
- return this.el.querySelector(".content");
141
- }
142
- getContent() {
143
- const children = this.getContentNode().children;
144
- return Array.from(children).map((c) => c);
145
- }
146
- getColumnsNumber() {
147
- const styleSheet = getComputedStyle(this.el);
148
- const columnsInCss = styleSheet.getPropertyValue(COLUMNS_NUMBER_CSS_VAR);
149
- return parseInt(columnsInCss);
150
- }
151
- getContentGroups() {
152
- return Array.from(this.el.querySelectorAll(`.${CONTENT_GROUP_CSS_CLASS}`));
153
- }
154
- appendToContent(content) {
155
- const contentNode = this.getContentNode();
156
- contentNode.innerHTML = "";
157
- contentNode.append(content);
158
- }
159
- showNext() {
160
- this.moveDirection = "right";
161
- const contentContainer = this.getContentNode();
162
- requestAnimationFrame(() => {
163
- contentContainer.scrollTo({
164
- top: 0,
165
- left: contentContainer.scrollLeft + this.calculateMoveStep(),
166
- behavior: "smooth",
167
- });
168
- });
169
- }
170
- showPrev() {
171
- this.moveDirection = "left";
172
- const contentContainer = this.getContentNode();
173
- requestAnimationFrame(() => {
174
- contentContainer.scrollTo({
175
- top: 0,
176
- left: contentContainer.scrollLeft - this.calculateMoveStep(),
177
- behavior: "smooth",
178
- });
179
- });
180
- }
181
- scroll(index) {
182
- const contentContainer = this.getContentNode();
183
- requestAnimationFrame(() => {
184
- contentContainer.scrollTo({
185
- top: 0,
186
- left: this.calculateMoveStep() * index,
187
- behavior: "smooth",
188
- });
189
- });
190
- }
191
- processScrollbarWidth() {
192
- const target = this.getContentNode();
193
- const scrollRatio = (target.scrollLeft + target.clientWidth) / target.scrollWidth;
194
- const scrolledWidth = target.clientWidth * scrollRatio;
195
- this.el.style.setProperty("--vviinn-progressbar-width", `${scrolledWidth}px`);
196
- this.activeContentGroup = this.getActiveGroupIndex();
197
- }
198
- showBullets() {
199
- return this.mode === "classic" && this.showScroll;
200
- }
201
- showScrollbar() {
202
- return this.mode === "modern" && this.showScroll;
203
- }
204
- getClassMap() {
205
- return {
206
- [this.mode]: true,
207
- "show-scrollbar": this.showScrollbar(),
208
- };
209
- }
210
- render() {
211
- return (index.h(index.Host, { class: this.getClassMap() }, index.h("div", { class: "body" }, index.h("button", { class: "prev", onClick: () => this.showPrev() }, index.h(index$1.ChevronIcon, null)), index.h("div", { class: this.getContentClassMap(), onScroll: () => this.processScrollbarWidth() }), index.h("button", { class: "next", onClick: () => this.showNext() }, index.h(index$1.ChevronIcon, null))), this.showBullets() ? (index.h("div", { class: "bullets" }, this.contentGroups
212
- .map((_, i) => i)
213
- .map((i) => (index.h("div", { class: {
214
- bullet: true,
215
- active: this.activeContentGroup === i,
216
- }, onClick: () => this.scroll(i) }))))) : (""), index.h("div", { id: "slot" }, index.h("slot", null))));
217
- }
218
- get el() { return index.getElement(this); }
219
- };
220
- VviinnCarousel.style = vviinnCarouselCss;
221
-
222
- exports.vviinn_carousel = VviinnCarousel;
@@ -1,106 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-7adce49f.js');
6
- const _Array = require('./Array-cce2fde8.js');
7
- const imageSearch_store = require('./imageSearch.store-39fce56c.js');
8
-
9
- const createBearerString = (x) => `Bearer ${x}`;
10
- const createAuthedHeader = (x) => new Headers({
11
- Authorization: x,
12
- });
13
- const createFetchAuthOptions = (x) => {
14
- return {
15
- headers: x,
16
- };
17
- };
18
- const createBearAuthedHeader = _Array._function.flow(createBearerString, createAuthedHeader, createFetchAuthOptions);
19
-
20
- const isVPR = (c) => c._tag === "VPR";
21
- function fold(onVPR, onVCS) {
22
- return (c) => (isVPR(c) ? onVPR() : onVCS());
23
- }
24
- function fromString(s) {
25
- return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
26
- }
27
-
28
- const sequenceToEither = imageSearch_store.sequenceT(imageSearch_store.Apply);
29
- const apiGet = (path, data = {}) => imageSearch_store.pipe(sequenceToEither(imageSearch_store.getApiPath(), imageSearch_store.createInitGetRequest), imageSearch_store.fromEither, imageSearch_store.chainW(imageSearch_store.makeRequest(path, data)));
30
-
31
- const getVPRRecommendations = (productId) => (options) => {
32
- const url = `product/${productId}/similar-products`;
33
- return apiGet(url, options);
34
- };
35
-
36
- const getVCSRecommendations = (productId) => (options) => {
37
- const url = `product/${productId}/cross-selling-products`;
38
- return apiGet(url, options);
39
- };
40
-
41
- const getRecommendationsService = (campaignType) => _Array._function.pipe(fromString(campaignType), fold(() => getVPRRecommendations, () => getVCSRecommendations));
42
-
43
- const vviinnVprWidgetCss = ":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.classic) vviinn-product-card::part(image){border:1px solid #DDDDDD}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}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}:host(.classic) vviinn-product-card::part(price-container){align-self:center}:host(.modern) vviinn-product-card::part(title),:host(.modern) vviinn-product-card::part(brand),:host(.modern) vviinn-product-card::part(type){text-align:left;max-width:unset}";
44
-
45
- let VviinnVprWidget = class {
46
- constructor(hostRef) {
47
- index.registerInstance(this, hostRef);
48
- /** Title for recommendations widget */
49
- this.blockTitle = "Recommended products";
50
- /** Ratio of each recommended product image */
51
- this.imageRatio = 1;
52
- /** Width of each recommended product image */
53
- this.imageWidth = 300;
54
- /** Currency sign will shown after price */
55
- this.currencySign = "€";
56
- /** Use slider or grid view */
57
- this.mode = "modern";
58
- /** Campaign type */
59
- this.campaignType = "VPR";
60
- /** Locale for currency formatting */
61
- this.locale = "de-DE";
62
- this.showScroll = true;
63
- this.recommendations = [];
64
- this.loaded = false;
65
- }
66
- handleProductIdChange() {
67
- this.getRecommendations();
68
- }
69
- connectedCallback() {
70
- imageSearch_store.state$1.apiPath = this.apiPath;
71
- imageSearch_store.state$1.currencySign = this.currencySign;
72
- imageSearch_store.state$1.locale = this.locale;
73
- }
74
- async componentWillLoad() {
75
- imageSearch_store.state$1.pricePrefix = this.pricePrefix;
76
- imageSearch_store.state$1.currencySign = this.currencySign;
77
- this.getRecommendations();
78
- }
79
- async getRecommendations() {
80
- if (this.productId === undefined || this.token === undefined)
81
- return;
82
- const headers = createBearAuthedHeader(this.token);
83
- const request = _Array._function.pipe(imageSearch_store.TaskEither.of(getRecommendationsService(this.campaignType)), imageSearch_store.TaskEither.ap(imageSearch_store.TaskEither.of(this.productId)), imageSearch_store.TaskEither.ap(imageSearch_store.TaskEither.of(headers)), imageSearch_store.TaskEither.flatten);
84
- const runRequest = await request();
85
- _Array._function.pipe(runRequest, imageSearch_store.Either.fold((error) => this.handleError(error), (data) => this.handleRecommendationsSucces(data)));
86
- }
87
- handleError(error) {
88
- console.log("ERROR:", error);
89
- }
90
- handleRecommendationsSucces(data) {
91
- var _a;
92
- this.recommendations = (_a = data === null || data === void 0 ? void 0 : data.extended) !== null && _a !== void 0 ? _a : data;
93
- imageSearch_store.imageSearchState.results = this.recommendations;
94
- this.loaded = true;
95
- }
96
- render() {
97
- return (index.h(index.Host, { class: { loaded: this.loaded, empty: this.recommendations.length == 0, [this.mode]: true }, "aria-hidden": this.loaded ? "false" : "true" }, index.h("style", null, imageSearch_store.state$1.fallbackStyles), index.h("h2", { part: "recommendations-title" }, this.blockTitle), index.h("vviinn-carousel", { exportparts: "brand, currency, deeplink, image, type, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, title: product-title", mode: this.mode, imageWidth: this.imageWidth, showScroll: this.showScroll }, this.recommendations.map((r) => (index.h("vviinn-product-card", { productId: r.productId, productTitle: r.title, image: r.image.thumbnail, brand: r.brand, imageWidth: this.imageWidth, imageRatio: this.imageRatio, price: r.price.actual, salePrice: r.price.sale, responsive: this.mode === "classic", dimmedBackground: this.mode === "modern", exportparts: "title" }))))));
98
- }
99
- get el() { return index.getElement(this); }
100
- static get watchers() { return {
101
- "productId": ["handleProductIdChange"]
102
- }; }
103
- };
104
- VviinnVprWidget.style = vviinnVprWidgetCss;
105
-
106
- exports.vviinn_vpr_widget = VviinnVprWidget;