vviinn-widgets 2.5.2 → 2.7.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.
- package/dist/cjs/{app-globals-d15b4c2c.js → app-globals-047a582c.js} +1 -1
- package/dist/cjs/{highlight-box_22.cjs.entry.js → cropper-handler_27.cjs.entry.js} +473 -85
- package/dist/cjs/{customized-slots-0c0d0665.js → customized-slots-cb722e68.js} +1 -1
- package/dist/cjs/{index-0f5516a6.js → index-bd771524.js} +1 -1
- package/dist/cjs/{imageSearch.store-865c23f4.js → index-d07466b9.js} +14707 -11093
- package/dist/cjs/{index-31b9cb7a.js → index-fcafbfe5.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{vviinn-carousel_3.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +35 -208
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +5 -3
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +7 -2
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +4 -4
- package/dist/cjs/vviinn-widgets.cjs.js +3 -3
- package/dist/collection/campaign/VCSCampaignService.js +4 -2
- package/dist/collection/campaign/VPRCampaignService.js +4 -2
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +21 -1
- package/dist/collection/components/vviinn-vpr-button/stories/args.js +6 -0
- package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +2 -0
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +23 -0
- package/dist/collection/components/vviinn-vpr-widget/stories/args.js +7 -0
- package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +12 -13
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +28 -1
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +9 -5
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +18 -1
- package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +11 -7
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +23 -0
- package/dist/collection/searchSession/searchSession.js +6 -1
- package/dist/collection/store/imageSearch.store.js +2 -7
- package/dist/esm/{app-globals-6f6aa89e.js → app-globals-68b1d848.js} +1 -1
- package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +404 -21
- package/dist/esm/{customized-slots-6b427dda.js → customized-slots-95a05ceb.js} +1 -1
- package/dist/esm/{imageSearch.store-0ae87235.js → index-33fe5a25.js} +14832 -11234
- package/dist/esm/{index-59f44eaa.js → index-75a1f589.js} +1 -1
- package/dist/esm/{index-ac05c460.js → index-f9df412f.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +15 -187
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +5 -3
- package/dist/esm/vviinn-vpr-button.entry.js +7 -2
- package/dist/esm/vviinn-vps-button.entry.js +4 -4
- package/dist/esm/vviinn-widgets.js +3 -3
- package/dist/types/campaign/CampaignService.d.ts +1 -1
- package/dist/types/campaign/VCSCampaignService.d.ts +2 -1
- package/dist/types/campaign/VPRCampaignService.d.ts +2 -1
- package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +2 -0
- package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +6 -0
- package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +6 -0
- package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +2 -0
- package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +6 -0
- package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +6 -0
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +3 -0
- package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +2 -0
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +2 -0
- package/dist/types/components.d.ts +40 -0
- package/dist/types/searchSession/searchSession.d.ts +2 -1
- package/dist/types/store/imageSearch.store.d.ts +7 -6
- package/dist/vviinn-widgets/{p-bad1809f.js → p-4e55513e.js} +1 -1
- package/dist/vviinn-widgets/p-5358970c.entry.js +1 -0
- package/{www/build/p-c36546fa.js → dist/vviinn-widgets/p-66015ad7.js} +1 -1
- package/dist/vviinn-widgets/p-669a156c.entry.js +1 -0
- package/dist/vviinn-widgets/p-8080679b.entry.js +1 -0
- package/dist/vviinn-widgets/p-9de1b0e7.js +1 -0
- package/dist/vviinn-widgets/{p-ee46fc83.js → p-b254eee7.js} +1 -1
- package/dist/vviinn-widgets/p-c1cd51ef.entry.js +1 -0
- package/dist/vviinn-widgets/p-e32c30d4.entry.js +1 -0
- package/dist/vviinn-widgets/{p-118ac907.js → p-f6e59cb2.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +3 -3
- package/www/build/{p-bad1809f.js → p-4e55513e.js} +1 -1
- package/www/build/p-5358970c.entry.js +1 -0
- package/{dist/vviinn-widgets/p-c36546fa.js → www/build/p-66015ad7.js} +1 -1
- package/www/build/p-669a156c.entry.js +1 -0
- package/www/build/p-8080679b.entry.js +1 -0
- package/www/build/p-9de1b0e7.js +1 -0
- package/www/build/{p-ee46fc83.js → p-b254eee7.js} +1 -1
- package/www/build/p-c1cd51ef.entry.js +1 -0
- package/www/build/p-e32c30d4.entry.js +1 -0
- package/www/build/p-eb8f77e4.js +1 -0
- package/www/build/{p-118ac907.js → p-f6e59cb2.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/cjs/Handler-176539c8.js +0 -331
- package/dist/cjs/cropper-handler.cjs.entry.js +0 -27
- package/dist/cjs/index-0eb3036a.js +0 -3235
- package/dist/cjs/vviinn-error.cjs.entry.js +0 -19
- package/dist/cjs/vviinn-preloader.cjs.entry.js +0 -26
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +0 -167
- package/dist/esm/Handler-f9b8735c.js +0 -309
- package/dist/esm/cropper-handler.entry.js +0 -23
- package/dist/esm/index-2e296af4.js +0 -3224
- package/dist/esm/vviinn-error.entry.js +0 -15
- package/dist/esm/vviinn-preloader.entry.js +0 -22
- package/dist/esm/vviinn-vps-widget.entry.js +0 -163
- package/dist/vviinn-widgets/p-11f61564.js +0 -1
- package/dist/vviinn-widgets/p-39fdc5c9.entry.js +0 -1
- package/dist/vviinn-widgets/p-762dc067.entry.js +0 -1
- package/dist/vviinn-widgets/p-7e2f542c.js +0 -1
- package/dist/vviinn-widgets/p-8d56e795.entry.js +0 -1
- package/dist/vviinn-widgets/p-8f955b15.entry.js +0 -1
- package/dist/vviinn-widgets/p-9654fe35.entry.js +0 -1
- package/dist/vviinn-widgets/p-9e5adc42.js +0 -1
- package/dist/vviinn-widgets/p-b3731705.entry.js +0 -1
- package/dist/vviinn-widgets/p-d991330b.entry.js +0 -1
- package/dist/vviinn-widgets/p-da9c933b.entry.js +0 -1
- package/dist/vviinn-widgets/p-f41e25f0.entry.js +0 -1
- package/www/build/p-11f61564.js +0 -1
- package/www/build/p-39fdc5c9.entry.js +0 -1
- package/www/build/p-762dc067.entry.js +0 -1
- package/www/build/p-7e2f542c.js +0 -1
- package/www/build/p-8d56e795.entry.js +0 -1
- package/www/build/p-8f955b15.entry.js +0 -1
- package/www/build/p-9654fe35.entry.js +0 -1
- package/www/build/p-9e5adc42.js +0 -1
- package/www/build/p-b3731705.entry.js +0 -1
- package/www/build/p-cfd998c1.js +0 -1
- package/www/build/p-d991330b.entry.js +0 -1
- package/www/build/p-da9c933b.entry.js +0 -1
- package/www/build/p-f41e25f0.entry.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-bd771524.js');
|
|
4
4
|
|
|
5
5
|
const ArrowIcon = () => (index.h("svg", { width: "12", height: "20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
6
6
|
index.h("path", { d: "M0 10 10 0l1.4 1.4L2.8 10l8.6 8.6L10 20 0 10Z" })));
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const appGlobals = require('./app-globals-
|
|
5
|
+
const index = require('./index-bd771524.js');
|
|
6
|
+
const appGlobals = require('./app-globals-047a582c.js');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
Stencil Client Patch Esm v2.9.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
|
|
|
16
16
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
17
17
|
return patchEsm().then(() => {
|
|
18
18
|
appGlobals.globalScripts();
|
|
19
|
-
return index.bootstrapLazy([["cropper-
|
|
19
|
+
return index.bootstrapLazy([["cropper-handler_27.cjs",[[1,"vviinn-vps-widget",{"token":[1],"apiPath":[1,"api-path"],"active":[1028],"currencySign":[1,"currency-sign"],"locale":[1],"campaignId":[1,"campaign-id"],"slidePosition":[32],"width":[32],"wrongImageFormat":[32]},[[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"],[0,"cropperChanged","trachSearchAreaChanges"],[0,"detectedObjectClicked","trackDetectedObject"],[0,"filterSelected","trackFilter"]]],[1,"vviinn-image-view"],[1,"vviinn-onboarding"],[1,"vviinn-example-images",null,[[0,"exampleImageSelected","handleImageSelection"],[0,"exampleImageError","handleImageSelectionError"]]],[1,"vviinn-overlayed-modal",{"active":[4]}],[1,"vviinn-empty-results"],[1,"vviinn-image-selector"],[1,"vviinn-server-error"],[1,"vviinn-wrong-format"],[1,"search-filters",{"filter":[16],"selectedCategoryId":[32],"hideFilters":[32]}],[1,"vviinn-privacy-badge"],[1,"vviinn-teaser"],[1,"image-cropper",{"disabled":[4],"handleMove":[32]}],[1,"vviinn-example-image",{"src":[1],"width":[2],"height":[2],"selected":[32]}],[1,"highlight-box"],[1,"vviinn-detected-object",{"detectedObject":[16],"position":[32]}],[1,"vviinn-modal",{"active":[1540],"slider":[32]}],[1,"vviinn-onboarding-card-1"],[1,"vviinn-onboarding-card-2"],[1,"vviinn-onboarding-card-3"],[1,"vviinn-overlay"],[1,"vviinn-slide"],[1,"vviinn-slider",{"showBullets":[4,"show-bullets"],"position":[514],"showArrows":[4,"show-arrows"],"elementsCount":[32],"internalPosition":[32],"swipeStartPosition":[32]}],[1,"cropper-handler",{"handler":[16],"disabled":[4]}],[1,"vviinn-error"],[1,"vviinn-preloader"],[1,"vviinn-product-card",{"brand":[1],"currency":[1],"deeplink":[1],"image":[1],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"locale":[1],"price":[2],"pricePrefix":[1,"price-prefix"],"productId":[1,"product-id"],"productTitle":[1,"product-title"],"productType":[1,"product-type"],"salePrice":[2,"sale-price"],"responsive":[4],"dimmedBackground":[4,"dimmed-background"],"index":[2],"imageLoaded":[32]}]]],["vviinn-vps-button.cjs",[[1,"vviinn-vps-button",{"token":[1],"currencySign":[1,"currency-sign"],"locale":[1],"campaignId":[1,"campaign-id"],"apiPath":[1,"api-path"],"pressed":[32]},[[0,"modalClosed","handleModalClosed"]]]]],["vviinn-carousel_2.cjs",[[1,"vviinn-vpr-widget",{"blockTitle":[1,"block-title"],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"productId":[1,"product-id"],"token":[1],"currencySign":[1,"currency-sign"],"pricePrefix":[1,"price-prefix"],"mode":[1],"campaignType":[1,"campaign-type"],"locale":[1],"campaigns":[1],"apiPath":[1,"api-path"],"useCarousel":[4,"use-carousel"],"showScroll":[4,"show-scroll"],"cssUrl":[1,"css-url"],"recommendations":[32],"loaded":[32]},[[0,"productImageLoaded","handleImageLoading"],[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"]]],[0,"vviinn-carousel",{"mode":[1],"imageWidth":[2,"image-width"],"showScroll":[4,"show-scroll"],"recommendations":[16],"moveDirection":[32],"contentGroups":[32],"activeContentGroup":[32]}]]],["vviinn-recommendations-sidebar.cjs",[[1,"vviinn-recommendations-sidebar",{"sidebarTitle":[1,"sidebar-title"],"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"widgetScrollbar":[4,"widget-scrollbar"],"campaigns":[1],"state":[32]},[[16,"click","bodyClickListener"]]]]],["vviinn-vpr-button.cjs",[[1,"vviinn-vpr-button",{"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"sidebarTitle":[1,"sidebar-title"],"modalScrollbar":[4,"modal-scrollbar"],"campaigns":[1]}]]]], options);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
7
|
-
const index$
|
|
8
|
-
const Handler = require('./Handler-176539c8.js');
|
|
9
|
-
const index$2 = require('./index-0eb3036a.js');
|
|
5
|
+
const index = require('./index-bd771524.js');
|
|
6
|
+
const index$1 = require('./index-d07466b9.js');
|
|
7
|
+
const index$2 = require('./index-fcafbfe5.js');
|
|
10
8
|
|
|
11
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%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) button{border-radius:2px}:host(.grid) button{border-radius:50%}button{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}button{fill:#525252}button.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";
|
|
12
10
|
|
|
@@ -194,7 +192,7 @@ let VviinnCarousel = class {
|
|
|
194
192
|
}
|
|
195
193
|
renderGrid() {
|
|
196
194
|
const recommendations = this.renderRecommendationsElements();
|
|
197
|
-
const grouppedContent =
|
|
195
|
+
const grouppedContent = index$1._Array.chunksOf(this.getColumnsNumber())(recommendations);
|
|
198
196
|
return this.renderRecommendationGroups(grouppedContent);
|
|
199
197
|
}
|
|
200
198
|
renderBullets() {
|
|
@@ -206,188 +204,12 @@ let VviinnCarousel = class {
|
|
|
206
204
|
}, onClick: () => this.scroll(index$1) })));
|
|
207
205
|
}
|
|
208
206
|
render() {
|
|
209
|
-
return (index.h(index.Host, { class: this.getClassMap() }, index.h("div", { class: Object.assign({ body: true }, this.getClassMap()) }, index.h("button", { class: "prev", onClick: () => this.showPrev(), part: "carousel-button" }, index.h(index$
|
|
207
|
+
return (index.h(index.Host, { class: this.getClassMap() }, index.h("div", { class: Object.assign({ body: true }, this.getClassMap()) }, index.h("button", { class: "prev", onClick: () => this.showPrev(), part: "carousel-button" }, index.h(index$2.ChevronIcon, null)), index.h("div", { class: this.getContentClassMap(), onScroll: () => this.processScrollbarWidth() }, this.renderRecommendations()), index.h("button", { class: "next", onClick: () => this.showNext(), part: "carousel-button" }, index.h(index$2.ChevronIcon, null))), this.showBullets() ? (index.h("div", { class: "bullets" }, this.renderBullets())) : ("")));
|
|
210
208
|
}
|
|
211
209
|
get el() { return index.getElement(this); }
|
|
212
210
|
};
|
|
213
211
|
VviinnCarousel.style = vviinnCarouselCss;
|
|
214
212
|
|
|
215
|
-
class GtagAnalytics {
|
|
216
|
-
sendImpression(product) {
|
|
217
|
-
var _a, _b, _c;
|
|
218
|
-
gtag('event', 'view_item_list', {
|
|
219
|
-
items: [
|
|
220
|
-
{
|
|
221
|
-
id: product.productId,
|
|
222
|
-
name: product.title,
|
|
223
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
224
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
225
|
-
list_name: 'VI VPR View',
|
|
226
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
227
|
-
}
|
|
228
|
-
]
|
|
229
|
-
});
|
|
230
|
-
return undefined;
|
|
231
|
-
}
|
|
232
|
-
sendClick(product) {
|
|
233
|
-
var _a, _b, _c;
|
|
234
|
-
gtag('event', 'select_content', {
|
|
235
|
-
content_type: 'product',
|
|
236
|
-
items: [
|
|
237
|
-
{
|
|
238
|
-
id: product.productId,
|
|
239
|
-
name: product.title,
|
|
240
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
241
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
242
|
-
list_name: 'VI VPR View',
|
|
243
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
});
|
|
247
|
-
return undefined;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
class GAnalytics {
|
|
252
|
-
constructor() {
|
|
253
|
-
ga('require', 'ec');
|
|
254
|
-
}
|
|
255
|
-
convertProduct(product) {
|
|
256
|
-
var _a, _b, _c;
|
|
257
|
-
return {
|
|
258
|
-
id: product.productId,
|
|
259
|
-
name: product.title,
|
|
260
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
261
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
262
|
-
list: 'VI VPR View',
|
|
263
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
sendImpression(product) {
|
|
267
|
-
ga('ec:addImpression', this.convertProduct(product));
|
|
268
|
-
return undefined;
|
|
269
|
-
}
|
|
270
|
-
sendClick(product) {
|
|
271
|
-
var _a, _b, _c;
|
|
272
|
-
ga('ec:addProduct', {
|
|
273
|
-
id: product.productId,
|
|
274
|
-
name: product.title,
|
|
275
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
276
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
277
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
278
|
-
});
|
|
279
|
-
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
280
|
-
return undefined;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const getGtagAnalytics = () => imageSearch_store._function.pipe(imageSearch_store.Option.fromNullable(window.gtag), imageSearch_store.Option.map(() => new GtagAnalytics()));
|
|
285
|
-
const getCommonAnalytics = () => imageSearch_store._function.pipe(imageSearch_store.Option.fromNullable(window.ga), imageSearch_store.Option.map(() => new GAnalytics()));
|
|
286
|
-
const analyticsMonoid = imageSearch_store.Option.getMonoid(imageSearch_store.Semigroup.first());
|
|
287
|
-
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
288
|
-
|
|
289
|
-
const FIT_EXPR = /fit\/\d+\//;
|
|
290
|
-
const containsFit = (url) => {
|
|
291
|
-
return imageSearch_store._function.pipe(url.match(FIT_EXPR), imageSearch_store.Either.fromNullable(url), imageSearch_store.Either.map(() => url));
|
|
292
|
-
};
|
|
293
|
-
const processWidth = (url, size) => {
|
|
294
|
-
return imageSearch_store._function.pipe(containsFit(url), imageSearch_store.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), imageSearch_store.Either.getOrElse(() => url));
|
|
295
|
-
};
|
|
296
|
-
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
297
|
-
const FormattedPrice = (props) => {
|
|
298
|
-
var _a;
|
|
299
|
-
const locale = props.locale;
|
|
300
|
-
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
301
|
-
minimumFractionDigits: 2,
|
|
302
|
-
}).format(props.price);
|
|
303
|
-
const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
|
|
304
|
-
return (index.h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
|
|
305
|
-
};
|
|
306
|
-
const Price = (props) => {
|
|
307
|
-
const priceEl = (index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
|
|
308
|
-
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
309
|
-
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
310
|
-
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
|
|
311
|
-
index.h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
|
|
312
|
-
]) : (index.h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
|
|
313
|
-
};
|
|
314
|
-
const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
315
|
-
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image", width: props.width, height: props.height, src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
316
|
-
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
317
|
-
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
318
|
-
|
|
319
|
-
const vviinnProductCardCss = ":host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:\"\";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}";
|
|
320
|
-
|
|
321
|
-
let VviinnProductCard = class {
|
|
322
|
-
constructor(hostRef) {
|
|
323
|
-
index.registerInstance(this, hostRef);
|
|
324
|
-
this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
|
|
325
|
-
this.recommendationView = index.createEvent(this, "recommendationView", 7);
|
|
326
|
-
this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
|
|
327
|
-
this.productImageLoaded = index.createEvent(this, "productImageLoaded", 7);
|
|
328
|
-
this.currency = undefined;
|
|
329
|
-
this.imageRatio = 1;
|
|
330
|
-
this.imageWidth = 200;
|
|
331
|
-
this.locale = undefined;
|
|
332
|
-
this.pricePrefix = undefined;
|
|
333
|
-
this.responsive = false;
|
|
334
|
-
this.dimmedBackground = false;
|
|
335
|
-
/** @internal */
|
|
336
|
-
this.index = 0;
|
|
337
|
-
this.imageLoaded = false;
|
|
338
|
-
this.productData = null;
|
|
339
|
-
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
340
|
-
}
|
|
341
|
-
connectedCallback() {
|
|
342
|
-
this.productData = {
|
|
343
|
-
product: this.productId,
|
|
344
|
-
rank: this.index,
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
intersectionCallback(data) {
|
|
348
|
-
if (data.some((entry) => entry.isIntersecting)) {
|
|
349
|
-
imageSearch_store._function.pipe(getAnalyticsModule, imageSearch_store.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
350
|
-
this.recommendationView.emit(this.productData);
|
|
351
|
-
this.intersectionObserver.disconnect();
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
componentDidLoad() {
|
|
355
|
-
this.recommendationLoad.emit(this.productData);
|
|
356
|
-
this.intersectionObserver.observe(this.el);
|
|
357
|
-
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
358
|
-
links.forEach((link) => link.addEventListener("click", (event) => {
|
|
359
|
-
event.preventDefault();
|
|
360
|
-
event.stopImmediatePropagation();
|
|
361
|
-
this.recommendationClick.emit(this.productData);
|
|
362
|
-
imageSearch_store._function.pipe(getAnalyticsModule, imageSearch_store.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
363
|
-
}));
|
|
364
|
-
}
|
|
365
|
-
getProduct() {
|
|
366
|
-
return imageSearch_store.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
367
|
-
}
|
|
368
|
-
renderImage() {
|
|
369
|
-
const props = {
|
|
370
|
-
width: this.imageWidth,
|
|
371
|
-
height: this.imageWidth * this.imageRatio,
|
|
372
|
-
src: this.image,
|
|
373
|
-
title: this.productTitle,
|
|
374
|
-
lazy: false,
|
|
375
|
-
};
|
|
376
|
-
return this.responsive
|
|
377
|
-
? ResponsiveImage(props, () => this.kek())
|
|
378
|
-
: Image(props, () => this.kek());
|
|
379
|
-
}
|
|
380
|
-
kek() {
|
|
381
|
-
this.productImageLoaded.emit(this.productId);
|
|
382
|
-
}
|
|
383
|
-
render() {
|
|
384
|
-
var _a, _b, _c;
|
|
385
|
-
return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : imageSearch_store.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : imageSearch_store.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : imageSearch_store.state.locale })));
|
|
386
|
-
}
|
|
387
|
-
get el() { return index.getElement(this); }
|
|
388
|
-
};
|
|
389
|
-
VviinnProductCard.style = vviinnProductCardCss;
|
|
390
|
-
|
|
391
213
|
const createBearerString = (x) => `Bearer ${x}`;
|
|
392
214
|
const createAuthedHeader = (x) => new Headers({
|
|
393
215
|
Authorization: x,
|
|
@@ -397,7 +219,7 @@ const createFetchAuthOptions = (x) => {
|
|
|
397
219
|
headers: x,
|
|
398
220
|
};
|
|
399
221
|
};
|
|
400
|
-
const createBearAuthedHeader =
|
|
222
|
+
const createBearAuthedHeader = index$1._function.flow(createBearerString, createAuthedHeader, createFetchAuthOptions);
|
|
401
223
|
|
|
402
224
|
const isVPR = (c) => c._tag === "VPR";
|
|
403
225
|
function fold(onVPR, onVCS) {
|
|
@@ -407,20 +229,20 @@ function fromString(s) {
|
|
|
407
229
|
return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
|
|
408
230
|
}
|
|
409
231
|
|
|
410
|
-
const sequenceToEither =
|
|
411
|
-
const apiGet = (path, data = {}) =>
|
|
232
|
+
const sequenceToEither = index$1.sequenceT(index$1.Apply);
|
|
233
|
+
const apiGet = (path, data = {}) => index$1.pipe(sequenceToEither(index$1.getApiPath(), index$1.createInitGetRequest), index$1.fromEither, index$1.chainW(index$1.makeRequest(path, data)));
|
|
412
234
|
|
|
413
|
-
const getVPRRecommendations = (productId) => (options) => {
|
|
414
|
-
const url = `product/${productId}/similar-products
|
|
235
|
+
const getVPRRecommendations = (productId) => (campaigns) => (options) => {
|
|
236
|
+
const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/similar-products`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}`));
|
|
415
237
|
return apiGet(url, options);
|
|
416
238
|
};
|
|
417
239
|
|
|
418
|
-
const getVCSRecommendations = (productId) => (options) => {
|
|
419
|
-
const url = `product/${productId}/cross-selling-products
|
|
240
|
+
const getVCSRecommendations = (productId) => (campaigns) => (options) => {
|
|
241
|
+
const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/cross-selling-products`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}`));
|
|
420
242
|
return apiGet(url, options);
|
|
421
243
|
};
|
|
422
244
|
|
|
423
|
-
const getRecommendationsService = (campaignType) =>
|
|
245
|
+
const getRecommendationsService = (campaignType) => index$1._function.pipe(fromString(campaignType), fold(() => getVPRRecommendations, () => getVCSRecommendations));
|
|
424
246
|
|
|
425
247
|
function isFunction(value) {
|
|
426
248
|
return typeof value === 'function';
|
|
@@ -1050,6 +872,8 @@ let VviinnVprWidget = class {
|
|
|
1050
872
|
this.campaignType = "VPR";
|
|
1051
873
|
/** Locale for currency formatting */
|
|
1052
874
|
this.locale = "de-DE";
|
|
875
|
+
/** comma-separated list of campaign-ids */
|
|
876
|
+
this.campaigns = "";
|
|
1053
877
|
/** @internal */
|
|
1054
878
|
this.apiPath = "https://api.vviinn.com";
|
|
1055
879
|
/** @internal */
|
|
@@ -1066,19 +890,22 @@ let VviinnVprWidget = class {
|
|
|
1066
890
|
handleCampaignTypeChange() {
|
|
1067
891
|
this.getRecommendations();
|
|
1068
892
|
}
|
|
893
|
+
handleCampaignsChange() {
|
|
894
|
+
this.getRecommendations();
|
|
895
|
+
}
|
|
1069
896
|
handleApiPathChange(newPath) {
|
|
1070
|
-
|
|
897
|
+
index$1.state.apiPath = newPath;
|
|
1071
898
|
this.getRecommendations();
|
|
1072
899
|
}
|
|
1073
900
|
handleImageLoading({ detail }) {
|
|
1074
901
|
this.productImageLoadedSubject.next(detail);
|
|
1075
902
|
}
|
|
1076
903
|
trackRecommendationView({ detail }) {
|
|
1077
|
-
const recommendationViewEvent = index$
|
|
904
|
+
const recommendationViewEvent = index$1.createProductViewVprEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
1078
905
|
this.trackingApi.trackEvent(recommendationViewEvent);
|
|
1079
906
|
}
|
|
1080
907
|
trackRecommendationClick({ detail }) {
|
|
1081
|
-
const recommendationClickEvent = index$
|
|
908
|
+
const recommendationClickEvent = index$1.createProductClickVprEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
1082
909
|
this.trackingApi.trackEvent(recommendationClickEvent).finally(() => {
|
|
1083
910
|
const product = this.recommendations.find((r) => r.productId === detail.product);
|
|
1084
911
|
if (!product || !product.deeplink)
|
|
@@ -1087,27 +914,27 @@ let VviinnVprWidget = class {
|
|
|
1087
914
|
});
|
|
1088
915
|
}
|
|
1089
916
|
connectedCallback() {
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
this.uiSessionId = index$
|
|
1094
|
-
this.trackingApi = index$
|
|
1095
|
-
const widgetOpenEvent = index$
|
|
917
|
+
index$1.state.apiPath = this.apiPath;
|
|
918
|
+
index$1.state.currencySign = this.currencySign;
|
|
919
|
+
index$1.state.locale = this.locale;
|
|
920
|
+
this.uiSessionId = index$1.v4();
|
|
921
|
+
this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
|
|
922
|
+
const widgetOpenEvent = index$1.createWidgetVprEvent({
|
|
1096
923
|
action: "open",
|
|
1097
924
|
session_id: this.uiSessionId,
|
|
1098
925
|
});
|
|
1099
926
|
this.trackingApi.trackEvent(widgetOpenEvent);
|
|
1100
927
|
}
|
|
1101
928
|
disconnectedCallback() {
|
|
1102
|
-
const widgetCloseEvent = index$
|
|
929
|
+
const widgetCloseEvent = index$1.createWidgetVprEvent({
|
|
1103
930
|
action: "close",
|
|
1104
931
|
session_id: this.uiSessionId,
|
|
1105
932
|
});
|
|
1106
933
|
this.trackingApi.trackEvent(widgetCloseEvent);
|
|
1107
934
|
}
|
|
1108
935
|
async componentWillLoad() {
|
|
1109
|
-
|
|
1110
|
-
|
|
936
|
+
index$1.state.pricePrefix = this.pricePrefix;
|
|
937
|
+
index$1.state.currencySign = this.currencySign;
|
|
1111
938
|
this.getRecommendations();
|
|
1112
939
|
}
|
|
1113
940
|
async getRecommendations() {
|
|
@@ -1115,9 +942,9 @@ let VviinnVprWidget = class {
|
|
|
1115
942
|
return;
|
|
1116
943
|
const campaignType = this.campaignType.length > 0 ? this.campaignType : "VPR";
|
|
1117
944
|
const headers = createBearAuthedHeader(this.token);
|
|
1118
|
-
const request =
|
|
945
|
+
const request = index$1._function.pipe(index$1.TaskEither.of(getRecommendationsService(campaignType)), index$1.TaskEither.ap(index$1.TaskEither.of(this.productId)), index$1.TaskEither.ap(index$1.TaskEither.of(index$1.checkEmpryString(this.campaigns))), index$1.TaskEither.ap(index$1.TaskEither.of(headers)), index$1.TaskEither.flatten);
|
|
1119
946
|
const runRequest = await request();
|
|
1120
|
-
|
|
947
|
+
index$1._function.pipe(runRequest, index$1.Either.fold((error) => this.handleError(error), (data) => this.handleRecommendationsSucces(data)));
|
|
1121
948
|
}
|
|
1122
949
|
handleError(error) {
|
|
1123
950
|
console.log("ERROR:", error);
|
|
@@ -1125,7 +952,7 @@ let VviinnVprWidget = class {
|
|
|
1125
952
|
handleRecommendationsSucces(data) {
|
|
1126
953
|
var _a;
|
|
1127
954
|
this.recommendations = (_a = data === null || data === void 0 ? void 0 : data.extended) !== null && _a !== void 0 ? _a : data;
|
|
1128
|
-
|
|
955
|
+
index$1.imageSearchState.results = this.recommendations;
|
|
1129
956
|
this.loaded = true;
|
|
1130
957
|
this.productIds = this.recommendations.map((r) => r.productId);
|
|
1131
958
|
this.productImageLoadedSubject.subscribe((id) => {
|
|
@@ -1146,7 +973,7 @@ let VviinnVprWidget = class {
|
|
|
1146
973
|
loaded: this.loaded,
|
|
1147
974
|
empty: this.recommendations.length == 0,
|
|
1148
975
|
[this.mode]: true,
|
|
1149
|
-
}, "aria-hidden": this.loaded ? "false" : "true" }, this.renderExternalCSS(), index.h("style", null,
|
|
976
|
+
}, "aria-hidden": this.loaded ? "false" : "true" }, this.renderExternalCSS(), index.h("style", null, index$1.state.fallbackStyles), index.h("h2", { part: "recommendations-title" }, this.blockTitle), this.useCarousel ? this.renderCarousel() : this.renderResults()));
|
|
1150
977
|
}
|
|
1151
978
|
renderRecommendation(recommendation, index$1) {
|
|
1152
979
|
return (index.h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.useDimmedBackgroundInCard(), index: index$1 }));
|
|
@@ -1164,11 +991,11 @@ let VviinnVprWidget = class {
|
|
|
1164
991
|
static get watchers() { return {
|
|
1165
992
|
"productId": ["handleProductIdChange"],
|
|
1166
993
|
"campaignType": ["handleCampaignTypeChange"],
|
|
994
|
+
"campaigns": ["handleCampaignsChange"],
|
|
1167
995
|
"apiPath": ["handleApiPathChange"]
|
|
1168
996
|
}; }
|
|
1169
997
|
};
|
|
1170
998
|
VviinnVprWidget.style = vviinnVprWidgetCss;
|
|
1171
999
|
|
|
1172
1000
|
exports.vviinn_carousel = VviinnCarousel;
|
|
1173
|
-
exports.vviinn_product_card = VviinnProductCard;
|
|
1174
1001
|
exports.vviinn_vpr_widget = VviinnVprWidget;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$1 = require('./index-
|
|
5
|
+
const index = require('./index-bd771524.js');
|
|
6
|
+
const index$1 = require('./index-fcafbfe5.js');
|
|
7
7
|
|
|
8
8
|
const recommendationsSidebarCss = ":host{--vviinn-carousel-columns:0;box-sizing:border-box;display:block;display:flex;height:100vh;left:0;position:fixed;top:0;transition:background 0.1s ease-in-out;width:100vw}:host(.open){background:rgba(0, 0, 0, 0.2)}:host(.bottom){flex-direction:column;justify-content:end}:host(.right){flex-direction:row;justify-content:flex-end}header{position:relative;text-align:center;padding:32px}header.contains-source-img{display:grid;justify-items:center;grid-gap:12px}img.source-image{width:64px;height:64px;border-radius:50%;box-shadow:0px 2px 4px rgba(0, 0, 0, 0.15);padding:8px}:host(.right) header{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.1)}main{padding:0 24px}:host(.right) main{overflow:auto}.sidebar{background:white;box-sizing:border-box;display:flex;flex-direction:column}:host(.bottom.idle) .sidebar,:host(.bottom.closed) .sidebar{transform:translateY(100%)}:host(.bottom.closed) .sidebar{-webkit-animation-name:slideOutFromBottom;animation-name:slideOutFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.bottom.open) .sidebar{-webkit-animation-name:slideInFromBottom;animation-name:slideInFromBottom;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.idle) .sidebar{transform:translateX(100%)}:host(.right.closed) .sidebar{-webkit-animation-name:slideOutFromRight;animation-name:slideOutFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right.open) .sidebar{-webkit-animation-name:slideInFromRight;animation-name:slideInFromRight;-webkit-animation-duration:0.5s;animation-duration:0.5s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}:host(.right) .sidebar{max-width:480px}:host(.right) vviinn-vpr-widget::part(recommendations-grid){display:grid;grid-template-columns:repeat(2, 1fr);grid-gap:24px}:host(.right) vviinn-vpr-widget{overflow:auto}:host(.right) vviinn-vpr-widget::part(image){border:none}.title{font-style:normal;font-weight:500;font-size:28px;line-height:40px;text-align:center;color:#000000}vviinn-vpr-widget::part(title),vviinn-vpr-widget::part(brand),vviinn-vpr-widget::part(type){text-align:left}vviinn-vpr-widget::part(price-container){align-self:start}.close-sidebar{background:transparent;border:none;cursor:pointer;margin:0;padding:0;position:absolute;right:24px;top:24px}@-webkit-keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideInFromBottom{from{transform:translateY(100%)}to{transform:translateY(0)}}@-webkit-keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes slideOutFromBottom{from{transform:translateY(0)}to{transform:translateY(100%)}}@-webkit-keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slideInFromRight{from{transform:translateX(100%)}to{transform:translateX(0)}}@-webkit-keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes slideOutFromRight{from{transform:translateX(0)}to{transform:translateX(100%)}}";
|
|
9
9
|
|
|
@@ -14,6 +14,8 @@ let RecommendationsSidebar = class {
|
|
|
14
14
|
this.position = "bottom";
|
|
15
15
|
this.sourceImage = null;
|
|
16
16
|
this.widgetScrollbar = false;
|
|
17
|
+
/** comma-separated list of campaign-ids */
|
|
18
|
+
this.campaigns = "";
|
|
17
19
|
this.state = "idle";
|
|
18
20
|
}
|
|
19
21
|
bodyClickListener(event) {
|
|
@@ -41,7 +43,7 @@ let RecommendationsSidebar = class {
|
|
|
41
43
|
return (_a = this.el.shadowRoot.querySelector("aside")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
42
44
|
}
|
|
43
45
|
render() {
|
|
44
|
-
return (index.h(index.Host, { class: this.getClassMap() }, index.h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) }, index.h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" }, this.isSourceImageValid() ? this.renderSourceImage() : null, index.h("span", { class: "title", part: "title" }, this.sidebarTitle), index.h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") }, index.h(index$1.CrossIcon, null))), index.h("main", { part: "sidebar-content" }, index.h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar })))));
|
|
46
|
+
return (index.h(index.Host, { class: this.getClassMap() }, index.h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) }, index.h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" }, this.isSourceImageValid() ? this.renderSourceImage() : null, index.h("span", { class: "title", part: "title" }, this.sidebarTitle), index.h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") }, index.h(index$1.CrossIcon, null))), index.h("main", { part: "sidebar-content" }, index.h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns })))));
|
|
45
47
|
}
|
|
46
48
|
renderSourceImage() {
|
|
47
49
|
return (index.h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$1 = require('./index-
|
|
5
|
+
const index = require('./index-bd771524.js');
|
|
6
|
+
const index$1 = require('./index-fcafbfe5.js');
|
|
7
7
|
|
|
8
8
|
const vviinnVprButtonCss = ":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#F4F4F4;outline:none}";
|
|
9
9
|
|
|
@@ -14,6 +14,8 @@ let VviinnVprButton = class {
|
|
|
14
14
|
this.sourceImage = null;
|
|
15
15
|
this.sidebarTitle = "Visually similar products";
|
|
16
16
|
this.modalScrollbar = false;
|
|
17
|
+
/** comma-separated list of campaign-ids */
|
|
18
|
+
this.campaigns = "";
|
|
17
19
|
this.sidebar = null;
|
|
18
20
|
this.sidebarCloseListener = () => {
|
|
19
21
|
document.body.removeChild(this.sidebar);
|
|
@@ -30,11 +32,14 @@ let VviinnVprButton = class {
|
|
|
30
32
|
sidebar.position = this.position;
|
|
31
33
|
sidebar.sourceImage = this.sourceImage;
|
|
32
34
|
sidebar.widgetScrollbar = this.modalScrollbar;
|
|
35
|
+
sidebar.campaigns = this.campaigns;
|
|
33
36
|
this.sidebar = sidebar;
|
|
34
37
|
sidebar.addEventListener("modalClosed", this.sidebarCloseListener);
|
|
35
38
|
document.body.append(this.sidebar);
|
|
36
39
|
}
|
|
37
40
|
disconnectedCallback() {
|
|
41
|
+
if (!this.sidebar)
|
|
42
|
+
return;
|
|
38
43
|
this.sidebar.removeEventListener("modalCLosed", this.sidebarCloseListener);
|
|
39
44
|
document.body.removeChild(this.sidebar);
|
|
40
45
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$1 = require('./index-
|
|
7
|
-
const customizedSlots = require('./customized-slots-
|
|
5
|
+
const index = require('./index-bd771524.js');
|
|
6
|
+
const index$1 = require('./index-fcafbfe5.js');
|
|
7
|
+
const customizedSlots = require('./customized-slots-cb722e68.js');
|
|
8
8
|
|
|
9
9
|
const vviinnVpsButtonCss = ":host{cursor:pointer}";
|
|
10
10
|
|
|
@@ -34,7 +34,7 @@ let VviinnVpsButton = class {
|
|
|
34
34
|
this.pressed = true;
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
|
-
return (index.h(index.Host, { tabindex: "0", role: "button", pressed: this.pressed, onClick: () => this.handleClick(), onKeyDown: (ev) => this.handleKeyDown(ev) }, index.h("slot", null, index.h(index$1.CameraIcon, null)), index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-vps-widget", { active: this.pressed, "currency-sign": "\u20AC", token: this.token, locale: this.locale, apiPath: this.apiPath, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, product-card, example-images" })));
|
|
37
|
+
return (index.h(index.Host, { tabindex: "0", role: "button", pressed: this.pressed, onClick: () => this.handleClick(), onKeyDown: (ev) => this.handleKeyDown(ev) }, index.h("slot", null, index.h(index$1.CameraIcon, null)), index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-vps-widget", { active: this.pressed, "currency-sign": "\u20AC", token: this.token, locale: this.locale, apiPath: this.apiPath, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, product-card, example-images", campaignId: this.campaignId })));
|
|
38
38
|
}
|
|
39
39
|
get el() { return index.getElement(this); }
|
|
40
40
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const appGlobals = require('./app-globals-
|
|
3
|
+
const index = require('./index-bd771524.js');
|
|
4
|
+
const appGlobals = require('./app-globals-047a582c.js');
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
Stencil Client Patch Browser v2.9.0 | MIT Licensed | https://stenciljs.com
|
|
@@ -17,5 +17,5 @@ const patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(options => {
|
|
19
19
|
appGlobals.globalScripts();
|
|
20
|
-
return index.bootstrapLazy([["cropper-
|
|
20
|
+
return index.bootstrapLazy([["cropper-handler_27.cjs",[[1,"vviinn-vps-widget",{"token":[1],"apiPath":[1,"api-path"],"active":[1028],"currencySign":[1,"currency-sign"],"locale":[1],"campaignId":[1,"campaign-id"],"slidePosition":[32],"width":[32],"wrongImageFormat":[32]},[[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"],[0,"cropperChanged","trachSearchAreaChanges"],[0,"detectedObjectClicked","trackDetectedObject"],[0,"filterSelected","trackFilter"]]],[1,"vviinn-image-view"],[1,"vviinn-onboarding"],[1,"vviinn-example-images",null,[[0,"exampleImageSelected","handleImageSelection"],[0,"exampleImageError","handleImageSelectionError"]]],[1,"vviinn-overlayed-modal",{"active":[4]}],[1,"vviinn-empty-results"],[1,"vviinn-image-selector"],[1,"vviinn-server-error"],[1,"vviinn-wrong-format"],[1,"search-filters",{"filter":[16],"selectedCategoryId":[32],"hideFilters":[32]}],[1,"vviinn-privacy-badge"],[1,"vviinn-teaser"],[1,"image-cropper",{"disabled":[4],"handleMove":[32]}],[1,"vviinn-example-image",{"src":[1],"width":[2],"height":[2],"selected":[32]}],[1,"highlight-box"],[1,"vviinn-detected-object",{"detectedObject":[16],"position":[32]}],[1,"vviinn-modal",{"active":[1540],"slider":[32]}],[1,"vviinn-onboarding-card-1"],[1,"vviinn-onboarding-card-2"],[1,"vviinn-onboarding-card-3"],[1,"vviinn-overlay"],[1,"vviinn-slide"],[1,"vviinn-slider",{"showBullets":[4,"show-bullets"],"position":[514],"showArrows":[4,"show-arrows"],"elementsCount":[32],"internalPosition":[32],"swipeStartPosition":[32]}],[1,"cropper-handler",{"handler":[16],"disabled":[4]}],[1,"vviinn-error"],[1,"vviinn-preloader"],[1,"vviinn-product-card",{"brand":[1],"currency":[1],"deeplink":[1],"image":[1],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"locale":[1],"price":[2],"pricePrefix":[1,"price-prefix"],"productId":[1,"product-id"],"productTitle":[1,"product-title"],"productType":[1,"product-type"],"salePrice":[2,"sale-price"],"responsive":[4],"dimmedBackground":[4,"dimmed-background"],"index":[2],"imageLoaded":[32]}]]],["vviinn-vps-button.cjs",[[1,"vviinn-vps-button",{"token":[1],"currencySign":[1,"currency-sign"],"locale":[1],"campaignId":[1,"campaign-id"],"apiPath":[1,"api-path"],"pressed":[32]},[[0,"modalClosed","handleModalClosed"]]]]],["vviinn-carousel_2.cjs",[[1,"vviinn-vpr-widget",{"blockTitle":[1,"block-title"],"imageRatio":[2,"image-ratio"],"imageWidth":[2,"image-width"],"productId":[1,"product-id"],"token":[1],"currencySign":[1,"currency-sign"],"pricePrefix":[1,"price-prefix"],"mode":[1],"campaignType":[1,"campaign-type"],"locale":[1],"campaigns":[1],"apiPath":[1,"api-path"],"useCarousel":[4,"use-carousel"],"showScroll":[4,"show-scroll"],"cssUrl":[1,"css-url"],"recommendations":[32],"loaded":[32]},[[0,"productImageLoaded","handleImageLoading"],[0,"recommendationView","trackRecommendationView"],[0,"recommendationClick","trackRecommendationClick"]]],[0,"vviinn-carousel",{"mode":[1],"imageWidth":[2,"image-width"],"showScroll":[4,"show-scroll"],"recommendations":[16],"moveDirection":[32],"contentGroups":[32],"activeContentGroup":[32]}]]],["vviinn-recommendations-sidebar.cjs",[[1,"vviinn-recommendations-sidebar",{"sidebarTitle":[1,"sidebar-title"],"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"widgetScrollbar":[4,"widget-scrollbar"],"campaigns":[1],"state":[32]},[[16,"click","bodyClickListener"]]]]],["vviinn-vpr-button.cjs",[[1,"vviinn-vpr-button",{"token":[1],"productId":[1,"product-id"],"position":[1],"sourceImage":[1,"source-image"],"sidebarTitle":[1,"sidebar-title"],"modalScrollbar":[4,"modal-scrollbar"],"campaigns":[1]}]]]], options);
|
|
21
21
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { apiGet } from "../network/apiClient";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import * as O from "fp-ts/Option";
|
|
3
|
+
import { pipe } from "fp-ts/lib/function";
|
|
4
|
+
export const getVCSRecommendations = (productId) => (campaigns) => (options) => {
|
|
5
|
+
const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/cross-selling-products`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}`));
|
|
4
6
|
return apiGet(url, options);
|
|
5
7
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { apiGet } from "../network/apiClient";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import * as O from "fp-ts/Option";
|
|
3
|
+
import { pipe } from "fp-ts/lib/function";
|
|
4
|
+
export const getVPRRecommendations = (productId) => (campaigns) => (options) => {
|
|
5
|
+
const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/similar-products`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}`));
|
|
4
6
|
return apiGet(url, options);
|
|
5
7
|
};
|
|
@@ -5,6 +5,8 @@ export class RecommendationsSidebar {
|
|
|
5
5
|
this.position = "bottom";
|
|
6
6
|
this.sourceImage = null;
|
|
7
7
|
this.widgetScrollbar = false;
|
|
8
|
+
/** comma-separated list of campaign-ids */
|
|
9
|
+
this.campaigns = "";
|
|
8
10
|
this.state = "idle";
|
|
9
11
|
}
|
|
10
12
|
bodyClickListener(event) {
|
|
@@ -40,7 +42,7 @@ export class RecommendationsSidebar {
|
|
|
40
42
|
h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") },
|
|
41
43
|
h(CrossIcon, null))),
|
|
42
44
|
h("main", { part: "sidebar-content" },
|
|
43
|
-
h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar })))));
|
|
45
|
+
h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title", token: this.token, productId: this.productId, imageWidth: 300, blockTitle: "", mode: this.position === "bottom" ? "continuity" : "grid", useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns })))));
|
|
44
46
|
}
|
|
45
47
|
renderSourceImage() {
|
|
46
48
|
return (h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
|
|
@@ -168,6 +170,24 @@ export class RecommendationsSidebar {
|
|
|
168
170
|
"attribute": "widget-scrollbar",
|
|
169
171
|
"reflect": false,
|
|
170
172
|
"defaultValue": "false"
|
|
173
|
+
},
|
|
174
|
+
"campaigns": {
|
|
175
|
+
"type": "string",
|
|
176
|
+
"mutable": false,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "string",
|
|
179
|
+
"resolved": "string",
|
|
180
|
+
"references": {}
|
|
181
|
+
},
|
|
182
|
+
"required": false,
|
|
183
|
+
"optional": false,
|
|
184
|
+
"docs": {
|
|
185
|
+
"tags": [],
|
|
186
|
+
"text": "comma-separated list of campaign-ids"
|
|
187
|
+
},
|
|
188
|
+
"attribute": "campaigns",
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"defaultValue": "\"\""
|
|
171
191
|
}
|
|
172
192
|
}; }
|
|
173
193
|
static get states() { return {
|