@liquidcommercedev/rmn-sdk 1.4.6-beta.5 → 1.4.6-beta.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +267 -203
- package/dist/index.esm.js +267 -203
- package/dist/types/enums.d.ts +1 -1
- package/dist/types/modules/element/component/utils.d.ts +1 -0
- package/dist/types/modules/element/element.interface.d.ts +2 -0
- package/dist/types/modules/event/event.interface.d.ts +13 -14
- package/dist/types/modules/event/index.d.ts +1 -0
- package/dist/types/modules/selection/selection.interface.d.ts +3 -1
- package/dist/types/modules/selection/selection.service.d.ts +4 -2
- package/dist/types/rmn-client.d.ts +7 -3
- package/dist/types/types.d.ts +3 -1
- package/package.json +1 -1
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
package/dist/index.esm.js
CHANGED
@@ -54,9 +54,9 @@ var RMN_FILTER_PROPERTIES;
|
|
54
54
|
})(RMN_FILTER_PROPERTIES || (RMN_FILTER_PROPERTIES = {}));
|
55
55
|
var RMN_SPOT_EVENT;
|
56
56
|
(function (RMN_SPOT_EVENT) {
|
57
|
+
RMN_SPOT_EVENT["INJECT_SPOTS"] = "INJECT_SPOTS";
|
57
58
|
RMN_SPOT_EVENT["MOUNTED"] = "MOUNTED";
|
58
59
|
RMN_SPOT_EVENT["UNMOUNTED"] = "UNMOUNTED";
|
59
|
-
RMN_SPOT_EVENT["RESIZED"] = "RESIZED";
|
60
60
|
RMN_SPOT_EVENT["IMPRESSION"] = "IMPRESSION";
|
61
61
|
RMN_SPOT_EVENT["CLICK"] = "CLICK";
|
62
62
|
RMN_SPOT_EVENT["PURCHASE"] = "PURCHASE";
|
@@ -15244,9 +15244,9 @@ class ResizeObserverService {
|
|
15244
15244
|
newWidth = Math.min(containerWidth, this.maxSize.width);
|
15245
15245
|
newHeight = newWidth / this.aspectRatio;
|
15246
15246
|
// If the height exceeds the container, adjust based on height
|
15247
|
-
if (
|
15248
|
-
|
15249
|
-
|
15247
|
+
if (newWidth > containerWidth) {
|
15248
|
+
newWidth = containerWidth;
|
15249
|
+
newHeight = containerHeight * this.aspectRatio;
|
15250
15250
|
}
|
15251
15251
|
// Ensure we're not going below minimum dimensions
|
15252
15252
|
newWidth = Math.max(newWidth, this.minSize.width);
|
@@ -15273,6 +15273,36 @@ class ResizeObserverService {
|
|
15273
15273
|
}
|
15274
15274
|
}
|
15275
15275
|
|
15276
|
+
function calculateScaleFactor(elementScale) {
|
15277
|
+
// Step 1: Apply square root for non-linear scaling
|
15278
|
+
// This creates a more gradual scaling effect, especially for larger changes
|
15279
|
+
// For example:
|
15280
|
+
// - elementScale of 0.25 (1/4 size) becomes 0.5
|
15281
|
+
// - elementScale of 1 (unchanged) remains 1
|
15282
|
+
// - elementScale of 4 (4x size) becomes 2
|
15283
|
+
const baseFactor = Math.sqrt(elementScale);
|
15284
|
+
// Step 2: Apply additional dampening to further soften the scaling effect
|
15285
|
+
// The dampening factor (0.5) can be adjusted:
|
15286
|
+
// - Lower values (closer to 0) make scaling more subtle
|
15287
|
+
// - Higher values (closer to 1) make scaling more pronounced
|
15288
|
+
const dampening = 0.35;
|
15289
|
+
// Calculate the scaleFactor:
|
15290
|
+
// 1. (baseFactor - 1) represents the change from the original size
|
15291
|
+
// 2. Multiply by dampening to reduce the effect
|
15292
|
+
// 3. Add 1 to center the scaling around the original size
|
15293
|
+
// For example, if baseFactor is 2:
|
15294
|
+
// scaleFactor = 1 + (2 - 1) * 0.5 = 1.5
|
15295
|
+
const scaleFactor = 1 + (baseFactor - 1) * dampening;
|
15296
|
+
// Step 3: Define the allowed range for the scale factor
|
15297
|
+
// This ensures that the font size never changes too drastically
|
15298
|
+
const minScale = 0.35; // Font will never be smaller than 50% of original
|
15299
|
+
const maxScale = 1.5; // Font will never be larger than 150% of original
|
15300
|
+
// Step 4: Clamp the scale factor to the defined range
|
15301
|
+
// Math.min ensures the value doesn't exceed maxScale
|
15302
|
+
// Math.max ensures the value isn't less than minScale
|
15303
|
+
return Math.max(minScale, Math.min(maxScale, scaleFactor));
|
15304
|
+
}
|
15305
|
+
|
15276
15306
|
const CAROUSEL_COMPONENT_STYLE = ({ width, height, fluid }) => `
|
15277
15307
|
:host {
|
15278
15308
|
position: relative;
|
@@ -15460,6 +15490,7 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15460
15490
|
this.autoplayInterval = null;
|
15461
15491
|
this.useDots = false;
|
15462
15492
|
this.useButtons = false;
|
15493
|
+
this.originalFontSizes = new Map();
|
15463
15494
|
this.attachShadow({ mode: 'open' });
|
15464
15495
|
}
|
15465
15496
|
connectedCallback() {
|
@@ -15498,7 +15529,7 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15498
15529
|
this.validateOptions();
|
15499
15530
|
}
|
15500
15531
|
setupResizeObserver() {
|
15501
|
-
if (this.data) {
|
15532
|
+
if (this.data && !this.data.fluid) {
|
15502
15533
|
this.resizeObserver = new ResizeObserverService({
|
15503
15534
|
element: this,
|
15504
15535
|
maxSize: {
|
@@ -15510,9 +15541,29 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15510
15541
|
this.addEventListener('spotSizeChanged', this.handleCarouselSizeChanged.bind(this));
|
15511
15542
|
}
|
15512
15543
|
}
|
15513
|
-
|
15514
|
-
|
15515
|
-
|
15544
|
+
handleCarouselSizeChanged(event) {
|
15545
|
+
const isRBSpot = 'rbHeroadaksda'.startsWith('rb');
|
15546
|
+
if (!isRBSpot) {
|
15547
|
+
// Adjust text elements font size based on the scale factor
|
15548
|
+
this.adjustFontSize(event.detail.scale);
|
15549
|
+
}
|
15550
|
+
}
|
15551
|
+
adjustFontSize(elementScale) {
|
15552
|
+
var _a;
|
15553
|
+
const scaleFactor = calculateScaleFactor(elementScale);
|
15554
|
+
// Find all text elements within the shadow root
|
15555
|
+
const elements = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('h1, h2, h3, h4, p, span');
|
15556
|
+
elements === null || elements === void 0 ? void 0 : elements.forEach((element) => {
|
15557
|
+
if (element instanceof HTMLElement) {
|
15558
|
+
if (!this.originalFontSizes.has(element)) {
|
15559
|
+
const originalSize = parseFloat(window.getComputedStyle(element).fontSize);
|
15560
|
+
this.originalFontSizes.set(element, originalSize);
|
15561
|
+
}
|
15562
|
+
const originalSize = this.originalFontSizes.get(element);
|
15563
|
+
const newFontSize = originalSize * scaleFactor;
|
15564
|
+
element.style.fontSize = `${newFontSize}px`;
|
15565
|
+
}
|
15566
|
+
});
|
15516
15567
|
}
|
15517
15568
|
render() {
|
15518
15569
|
var _a;
|
@@ -15721,7 +15772,7 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15721
15772
|
* #########################################################
|
15722
15773
|
*/
|
15723
15774
|
setupResizeObserver() {
|
15724
|
-
if (this.data) {
|
15775
|
+
if (this.data && !this.data.fluid) {
|
15725
15776
|
this.resizeObserver = new ResizeObserverService({
|
15726
15777
|
element: this,
|
15727
15778
|
maxSize: {
|
@@ -15738,13 +15789,16 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15738
15789
|
* #########################################################
|
15739
15790
|
*/
|
15740
15791
|
handleSpotSizeChanged(event) {
|
15741
|
-
|
15742
|
-
|
15743
|
-
|
15792
|
+
var _a, _b, _c;
|
15793
|
+
const isRBSpot = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.spot) === null || _b === void 0 ? void 0 : _b.startsWith('rb')) !== null && _c !== void 0 ? _c : false;
|
15794
|
+
if (!isRBSpot) {
|
15795
|
+
// Adjust text elements font size based on the scale factor
|
15796
|
+
this.adjustFontSize(event.detail.scale);
|
15797
|
+
}
|
15744
15798
|
}
|
15745
15799
|
adjustFontSize(elementScale) {
|
15746
15800
|
var _a;
|
15747
|
-
const scaleFactor =
|
15801
|
+
const scaleFactor = calculateScaleFactor(elementScale);
|
15748
15802
|
// Find all text elements within the shadow root
|
15749
15803
|
const elements = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('h1, h2, h3, h4, p, span');
|
15750
15804
|
elements === null || elements === void 0 ? void 0 : elements.forEach((element) => {
|
@@ -15759,35 +15813,6 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
15759
15813
|
}
|
15760
15814
|
});
|
15761
15815
|
}
|
15762
|
-
calculateScaleFactor(elementScale) {
|
15763
|
-
// Step 1: Apply square root for non-linear scaling
|
15764
|
-
// This creates a more gradual scaling effect, especially for larger changes
|
15765
|
-
// For example:
|
15766
|
-
// - elementScale of 0.25 (1/4 size) becomes 0.5
|
15767
|
-
// - elementScale of 1 (unchanged) remains 1
|
15768
|
-
// - elementScale of 4 (4x size) becomes 2
|
15769
|
-
const baseFactor = Math.sqrt(elementScale);
|
15770
|
-
// Step 2: Apply additional dampening to further soften the scaling effect
|
15771
|
-
// The dampening factor (0.5) can be adjusted:
|
15772
|
-
// - Lower values (closer to 0) make scaling more subtle
|
15773
|
-
// - Higher values (closer to 1) make scaling more pronounced
|
15774
|
-
const dampening = 0.5;
|
15775
|
-
// Calculate the scaleFactor:
|
15776
|
-
// 1. (baseFactor - 1) represents the change from the original size
|
15777
|
-
// 2. Multiply by dampening to reduce the effect
|
15778
|
-
// 3. Add 1 to center the scaling around the original size
|
15779
|
-
// For example, if baseFactor is 2:
|
15780
|
-
// scaleFactor = 1 + (2 - 1) * 0.5 = 1.5
|
15781
|
-
const scaleFactor = 1 + (baseFactor - 1) * dampening;
|
15782
|
-
// Step 3: Define the allowed range for the scale factor
|
15783
|
-
// This ensures that the font size never changes too drastically
|
15784
|
-
const minScale = 0.5; // Font will never be smaller than 90% of original
|
15785
|
-
const maxScale = 1.5; // Font will never be larger than 110% of original
|
15786
|
-
// Step 4: Clamp the scale factor to the defined range
|
15787
|
-
// Math.min ensures the value doesn't exceed maxScale
|
15788
|
-
// Math.max ensures the value isn't less than minScale
|
15789
|
-
return Math.max(minScale, Math.min(maxScale, scaleFactor));
|
15790
|
-
}
|
15791
15816
|
/**
|
15792
15817
|
* Spot element rendering
|
15793
15818
|
* #########################################################
|
@@ -15838,6 +15863,7 @@ class ElementService {
|
|
15838
15863
|
}
|
15839
15864
|
const spot = document.createElement(SPOT_ELEMENT_TAG);
|
15840
15865
|
spot.data = {
|
15866
|
+
spot: config === null || config === void 0 ? void 0 : config.spot,
|
15841
15867
|
fluid: (_a = config === null || config === void 0 ? void 0 : config.fluid) !== null && _a !== void 0 ? _a : false,
|
15842
15868
|
...config,
|
15843
15869
|
};
|
@@ -15859,6 +15885,7 @@ class ElementService {
|
|
15859
15885
|
}
|
15860
15886
|
const carousel = document.createElement(CAROUSEL_ELEMENT_TAG);
|
15861
15887
|
carousel.data = {
|
15888
|
+
spot: config === null || config === void 0 ? void 0 : config.spot,
|
15862
15889
|
fluid: false,
|
15863
15890
|
...config,
|
15864
15891
|
};
|
@@ -16743,12 +16770,7 @@ function wideSkyscraperV1Template(spot) {
|
|
16743
16770
|
|
16744
16771
|
const STYLES$7 = ({ primaryImage, mobilePrimaryImage = primaryImage }, { prefix }) => `
|
16745
16772
|
<style>
|
16746
|
-
|
16747
|
-
min-width: 320px;
|
16748
|
-
min-height: 223px;
|
16749
|
-
}
|
16750
|
-
|
16751
|
-
.${prefix}__content {
|
16773
|
+
.${prefix} {
|
16752
16774
|
display: block;
|
16753
16775
|
width: 100%;
|
16754
16776
|
height: 100%;
|
@@ -16757,10 +16779,11 @@ const STYLES$7 = ({ primaryImage, mobilePrimaryImage = primaryImage }, { prefix
|
|
16757
16779
|
background-repeat: no-repeat;
|
16758
16780
|
background-position: center;
|
16759
16781
|
cursor: pointer;
|
16782
|
+
container-type: inline-size;
|
16760
16783
|
}
|
16761
16784
|
|
16762
|
-
@
|
16763
|
-
.${prefix}
|
16785
|
+
@container (min-width: 640px) {
|
16786
|
+
.${prefix} {
|
16764
16787
|
background-image: url("${primaryImage}");
|
16765
16788
|
}
|
16766
16789
|
}
|
@@ -16770,7 +16793,7 @@ function rbCollectionBannerWithoutTextBlockTemplate(spot, config) {
|
|
16770
16793
|
const { prefix = '' } = config;
|
16771
16794
|
return `
|
16772
16795
|
${STYLES$7(spot, config)}
|
16773
|
-
<div class="${prefix}
|
16796
|
+
<div class="${prefix}"></div>
|
16774
16797
|
`;
|
16775
16798
|
}
|
16776
16799
|
|
@@ -16779,16 +16802,6 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16779
16802
|
return `
|
16780
16803
|
<style>
|
16781
16804
|
.${prefix} {
|
16782
|
-
min-width: 320px;
|
16783
|
-
min-height: 388px;
|
16784
|
-
width: 100%;
|
16785
|
-
height: 100%;
|
16786
|
-
display: block;
|
16787
|
-
position: relative;
|
16788
|
-
container-type: inline-size;
|
16789
|
-
}
|
16790
|
-
|
16791
|
-
.${prefix}__content {
|
16792
16805
|
display: flex;
|
16793
16806
|
flex-direction: column;
|
16794
16807
|
justify-content: flex-end;
|
@@ -16803,6 +16816,7 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16803
16816
|
box-sizing: border-box;
|
16804
16817
|
color: ${textColor};
|
16805
16818
|
cursor: pointer;
|
16819
|
+
container-type: inline-size;
|
16806
16820
|
}
|
16807
16821
|
|
16808
16822
|
.${prefix}__text {
|
@@ -16847,17 +16861,17 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16847
16861
|
transition: background-color 0.3s ease;
|
16848
16862
|
}
|
16849
16863
|
|
16850
|
-
.${prefix}
|
16864
|
+
.${prefix}:hover .cta-button {
|
16851
16865
|
background-color: ${ctaBorderColor.length === 7 ? `${ctaBorderColor}15` : `${ctaBorderColor}`};
|
16852
16866
|
}
|
16853
16867
|
|
16854
|
-
@
|
16855
|
-
.${prefix}
|
16868
|
+
@container (min-width: 640px) {
|
16869
|
+
.${prefix} {
|
16856
16870
|
background-image: linear-gradient(to top, ${linearGradient}), url("${primaryImage}");
|
16857
16871
|
}
|
16858
16872
|
}
|
16859
16873
|
|
16860
|
-
@
|
16874
|
+
@container (min-width: 768px) {
|
16861
16875
|
.${prefix}__primary-image {
|
16862
16876
|
width: 66.66666%;
|
16863
16877
|
height: 100%;
|
@@ -16868,7 +16882,7 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16868
16882
|
height: 100%;
|
16869
16883
|
width: 33.33333%;
|
16870
16884
|
}
|
16871
|
-
|
16885
|
+
|
16872
16886
|
.${prefix}__secondary-image {
|
16873
16887
|
width: 100%;
|
16874
16888
|
height: 50%;
|
@@ -16877,7 +16891,7 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16877
16891
|
.${prefix}__header {
|
16878
16892
|
font-size: 22px;
|
16879
16893
|
}
|
16880
|
-
|
16894
|
+
|
16881
16895
|
.${prefix}__description {
|
16882
16896
|
font-size: 12px;
|
16883
16897
|
}
|
@@ -16887,7 +16901,7 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16887
16901
|
}
|
16888
16902
|
}
|
16889
16903
|
|
16890
|
-
@
|
16904
|
+
@container (min-width: 1024px) {
|
16891
16905
|
.${prefix}__header {
|
16892
16906
|
font-size: 24px;
|
16893
16907
|
}
|
@@ -16901,11 +16915,11 @@ const STYLES$6 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
16901
16915
|
}
|
16902
16916
|
}
|
16903
16917
|
|
16904
|
-
@
|
16918
|
+
@container (min-width: 1280px) {
|
16905
16919
|
.${prefix}__header {
|
16906
16920
|
font-size: 28px;
|
16907
16921
|
}
|
16908
|
-
|
16922
|
+
|
16909
16923
|
.${prefix}__description {
|
16910
16924
|
font-size: 14px;
|
16911
16925
|
}
|
@@ -16925,13 +16939,11 @@ function rbHomepageHeroFullImageTemplate(spot, config) {
|
|
16925
16939
|
${GFONT_CORMORANT}
|
16926
16940
|
${STYLES$6(spot, config)}
|
16927
16941
|
<div class="${prefix}">
|
16928
|
-
|
16929
|
-
|
16930
|
-
|
16931
|
-
|
16932
|
-
|
16933
|
-
</div>
|
16934
|
-
</div>
|
16942
|
+
<div class="${prefix}__text">
|
16943
|
+
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
16944
|
+
${spot.description ? `<p class="${prefix}__description">${spot.description}</p>` : ''}
|
16945
|
+
${spot.ctaText ? `<span class="${prefix}__cta-button">${spot.ctaText}</span>` : ''}
|
16946
|
+
</div>
|
16935
16947
|
</div>
|
16936
16948
|
`;
|
16937
16949
|
}
|
@@ -16939,8 +16951,6 @@ function rbHomepageHeroFullImageTemplate(spot, config) {
|
|
16939
16951
|
const STYLES$5 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextColor = textColor, primaryImage, mobilePrimaryImage = primaryImage, secondaryImage, mobileSecondaryImage = secondaryImage, }, { prefix }) => `
|
16940
16952
|
<style>
|
16941
16953
|
.${prefix} {
|
16942
|
-
min-width: 320px;
|
16943
|
-
min-height: 388px;
|
16944
16954
|
width: 100%;
|
16945
16955
|
height: 100%;
|
16946
16956
|
display: block;
|
@@ -16952,7 +16962,7 @@ const STYLES$5 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
16952
16962
|
width: 100%;
|
16953
16963
|
height: 100%;
|
16954
16964
|
display: flex;
|
16955
|
-
flex-direction: column;
|
16965
|
+
flex-direction: column;
|
16956
16966
|
background-color: transparent;
|
16957
16967
|
gap: 5px;
|
16958
16968
|
color: inherit;
|
@@ -17039,7 +17049,7 @@ const STYLES$5 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
17039
17049
|
opacity: 0.8;
|
17040
17050
|
}
|
17041
17051
|
|
17042
|
-
@
|
17052
|
+
@container (min-width: 640px) {
|
17043
17053
|
.${prefix}__primary-image {
|
17044
17054
|
background-image: url("${primaryImage}");
|
17045
17055
|
}
|
@@ -17049,7 +17059,7 @@ const STYLES$5 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
17049
17059
|
}
|
17050
17060
|
}
|
17051
17061
|
|
17052
|
-
@
|
17062
|
+
@container (min-width: 768px) {
|
17053
17063
|
.${prefix}__content {
|
17054
17064
|
flex-direction: row;
|
17055
17065
|
}
|
@@ -17074,6 +17084,39 @@ const STYLES$5 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
17074
17084
|
width: 100%;
|
17075
17085
|
height: 50%;
|
17076
17086
|
}
|
17087
|
+
.${prefix}__header {
|
17088
|
+
font-size: 22px;
|
17089
|
+
}
|
17090
|
+
.${prefix}__description {
|
17091
|
+
font-size: 12px;
|
17092
|
+
}
|
17093
|
+
.${prefix}__cta-button {
|
17094
|
+
font-size: 12px;
|
17095
|
+
}
|
17096
|
+
}
|
17097
|
+
|
17098
|
+
@container (min-width: 1024px) {
|
17099
|
+
.${prefix}__header {
|
17100
|
+
font-size: 24px;
|
17101
|
+
}
|
17102
|
+
.${prefix}__description {
|
17103
|
+
font-size: 13px;
|
17104
|
+
}
|
17105
|
+
.${prefix}__cta-button {
|
17106
|
+
font-size: 13px;
|
17107
|
+
}
|
17108
|
+
}
|
17109
|
+
|
17110
|
+
@container (min-width: 1280px) {
|
17111
|
+
.${prefix}__header {
|
17112
|
+
font-size: 28px;
|
17113
|
+
}
|
17114
|
+
.${prefix}__description {
|
17115
|
+
font-size: 14px;
|
17116
|
+
}
|
17117
|
+
.${prefix}__cta-button {
|
17118
|
+
font-size: 14px;
|
17119
|
+
}
|
17077
17120
|
}
|
17078
17121
|
</style>
|
17079
17122
|
`;
|
@@ -17103,23 +17146,15 @@ function rbHomepageHeroThreeTileTemplate(spot, config) {
|
|
17103
17146
|
const STYLES$4 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextColor = textColor, primaryImage, mobilePrimaryImage = primaryImage, }, { prefix }) => `
|
17104
17147
|
<style>
|
17105
17148
|
.${prefix} {
|
17106
|
-
min-width: 320px;
|
17107
|
-
min-height: 388px;
|
17108
|
-
width: 100%;
|
17109
|
-
height: 100%;
|
17110
|
-
display: block;
|
17111
|
-
position: relative;
|
17112
|
-
container-type: inline-size;
|
17113
|
-
}
|
17114
|
-
|
17115
|
-
.${prefix}__content {
|
17116
17149
|
width: 100%;
|
17117
17150
|
height: 100%;
|
17118
17151
|
display: flex;
|
17119
|
-
flex-direction: column-reverse;
|
17152
|
+
flex-direction: column-reverse;
|
17120
17153
|
background-color: transparent;
|
17121
17154
|
gap: 5px;
|
17122
17155
|
cursor: pointer;
|
17156
|
+
container-type: inline-size;
|
17157
|
+
position: relative;
|
17123
17158
|
}
|
17124
17159
|
|
17125
17160
|
.${prefix}__image {
|
@@ -17164,7 +17199,7 @@ const STYLES$4 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
17164
17199
|
font-style: normal;
|
17165
17200
|
font-weight: 400;
|
17166
17201
|
}
|
17167
|
-
|
17202
|
+
|
17168
17203
|
.${prefix}__cta-button {
|
17169
17204
|
color: ${ctaTextColor};
|
17170
17205
|
background-color: transparent;
|
@@ -17185,25 +17220,57 @@ const STYLES$4 = ({ textColor = '#212121', backgroundColor = '#e8e6de', ctaTextC
|
|
17185
17220
|
opacity: 0.8;
|
17186
17221
|
}
|
17187
17222
|
|
17188
|
-
@
|
17223
|
+
@container (min-width: 640px) {
|
17189
17224
|
.${prefix}__image {
|
17190
17225
|
background-image: url("${primaryImage}");
|
17191
17226
|
}
|
17192
17227
|
}
|
17193
|
-
|
17194
|
-
|
17228
|
+
|
17229
|
+
@container (min-width: 768px) {
|
17230
|
+
.${prefix} {
|
17195
17231
|
flex-direction: row;
|
17196
17232
|
}
|
17197
|
-
|
17198
17233
|
.${prefix}__image {
|
17199
17234
|
width: 66.66666%;
|
17200
17235
|
height: 100%;
|
17201
17236
|
}
|
17202
|
-
|
17203
17237
|
.${prefix}__text {
|
17204
17238
|
width: 33.33333%;
|
17205
17239
|
height: 100%;
|
17206
17240
|
}
|
17241
|
+
.${prefix}__header {
|
17242
|
+
font-size: 22px;
|
17243
|
+
}
|
17244
|
+
.${prefix}__description {
|
17245
|
+
font-size: 12px;
|
17246
|
+
}
|
17247
|
+
.${prefix}__cta-button {
|
17248
|
+
font-size: 12px;
|
17249
|
+
}
|
17250
|
+
}
|
17251
|
+
|
17252
|
+
@container (min-width: 1024px) {
|
17253
|
+
.${prefix}__header {
|
17254
|
+
font-size: 24px;
|
17255
|
+
}
|
17256
|
+
.${prefix}__description {
|
17257
|
+
font-size: 13px;
|
17258
|
+
}
|
17259
|
+
.${prefix}__cta-button {
|
17260
|
+
font-size: 13px;
|
17261
|
+
}
|
17262
|
+
}
|
17263
|
+
|
17264
|
+
@container (min-width: 1280px) {
|
17265
|
+
.${prefix}__header {
|
17266
|
+
font-size: 28px;
|
17267
|
+
}
|
17268
|
+
.${prefix}__description {
|
17269
|
+
font-size: 14px;
|
17270
|
+
}
|
17271
|
+
.${prefix}__cta-button {
|
17272
|
+
font-size: 14px;
|
17273
|
+
}
|
17207
17274
|
}
|
17208
17275
|
</style>
|
17209
17276
|
`;
|
@@ -17215,14 +17282,12 @@ function rbHomepageHeroTwoTileTemplate(spot, config) {
|
|
17215
17282
|
${GFONT_CORMORANT}
|
17216
17283
|
${STYLES$4(spot, config)}
|
17217
17284
|
<div class="${prefix}">
|
17218
|
-
<div class="${prefix}
|
17219
|
-
|
17220
|
-
|
17221
|
-
|
17222
|
-
${spot.ctaText ? `<span class="${prefix}__cta-button">${spot.ctaText}</span>` : ''}
|
17223
|
-
</div>
|
17224
|
-
<div class="${prefix}__image"></div>
|
17285
|
+
<div class="${prefix}__text">
|
17286
|
+
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
17287
|
+
${spot.description ? `<p class="${prefix}__description">${spot.description}</p>` : ''}
|
17288
|
+
${spot.ctaText ? `<span class="${prefix}__cta-button">${spot.ctaText}</span>` : ''}
|
17225
17289
|
</div>
|
17290
|
+
<div class="${prefix}__image"></div>
|
17226
17291
|
</div>
|
17227
17292
|
`;
|
17228
17293
|
}
|
@@ -17231,12 +17296,7 @@ const STYLES$3 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
17231
17296
|
const linearGradient = linearGradientColorStop(overlay || [], 'rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 30%');
|
17232
17297
|
return `
|
17233
17298
|
<style>
|
17234
|
-
|
17235
|
-
min-width: 320px;
|
17236
|
-
min-height: 334px;
|
17237
|
-
}
|
17238
|
-
|
17239
|
-
.${prefix}__content {
|
17299
|
+
.${prefix} {
|
17240
17300
|
width: 100%;
|
17241
17301
|
height: 100%;
|
17242
17302
|
display: flex;
|
@@ -17250,6 +17310,7 @@ const STYLES$3 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
17250
17310
|
overflow: hidden;
|
17251
17311
|
cursor: pointer;
|
17252
17312
|
color: ${textColor};
|
17313
|
+
container-type: inline-size;
|
17253
17314
|
}
|
17254
17315
|
|
17255
17316
|
.${prefix}__text {
|
@@ -17296,17 +17357,17 @@ const STYLES$3 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
17296
17357
|
font-weight: 400;
|
17297
17358
|
}
|
17298
17359
|
|
17299
|
-
.${prefix}
|
17360
|
+
.${prefix}:hover .${prefix}__cta-button {
|
17300
17361
|
background-color: ${ctaBorderColor.length === 7 ? `${ctaBorderColor}15` : `${ctaBorderColor}`};
|
17301
17362
|
}
|
17302
17363
|
|
17303
|
-
@
|
17304
|
-
.${prefix}
|
17364
|
+
@container (min-width: 640px) {
|
17365
|
+
.${prefix} {
|
17305
17366
|
background-image: linear-gradient(to top, ${linearGradient}), url("${primaryImage}");
|
17306
17367
|
}
|
17307
17368
|
}
|
17308
17369
|
|
17309
|
-
@
|
17370
|
+
@container (min-width: 768px) {
|
17310
17371
|
.${prefix}__text {
|
17311
17372
|
padding: 25px;
|
17312
17373
|
}
|
@@ -17325,7 +17386,7 @@ const STYLES$3 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
17325
17386
|
}
|
17326
17387
|
}
|
17327
17388
|
|
17328
|
-
@
|
17389
|
+
@container (min-width: 1024px) {
|
17329
17390
|
.${prefix}__text {
|
17330
17391
|
padding: 30px;
|
17331
17392
|
}
|
@@ -17343,7 +17404,7 @@ const STYLES$3 = ({ textColor = '#ffffff', ctaTextColor = textColor, ctaBorderCo
|
|
17343
17404
|
}
|
17344
17405
|
}
|
17345
17406
|
|
17346
|
-
@
|
17407
|
+
@container (min-width: 1280px) {
|
17347
17408
|
.${prefix}__cta-button {
|
17348
17409
|
font-size: 14px;
|
17349
17410
|
}
|
@@ -17358,7 +17419,7 @@ function rbLargeCategoryImageToutTemplate(spot, config) {
|
|
17358
17419
|
${GFONT_SOURCE_SANS_3}
|
17359
17420
|
${GFONT_CORMORANT}
|
17360
17421
|
${STYLES$3(spot, config)}
|
17361
|
-
<div class="${prefix}
|
17422
|
+
<div class="${prefix}">
|
17362
17423
|
<div class="${prefix}__text">
|
17363
17424
|
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
17364
17425
|
${spot.description ? `<p class="${prefix}__description">${spot.description}</p>` : ''}
|
@@ -17372,12 +17433,7 @@ const STYLES$2 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17372
17433
|
const linearGradient = linearGradientColorStop(overlay || [], 'rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 30%');
|
17373
17434
|
return `
|
17374
17435
|
<style>
|
17375
|
-
|
17376
|
-
min-width: 320px;
|
17377
|
-
min-height: 150px;
|
17378
|
-
}
|
17379
|
-
|
17380
|
-
.${prefix}__content {
|
17436
|
+
.${prefix} {
|
17381
17437
|
width: 100%;
|
17382
17438
|
height: 100%;
|
17383
17439
|
display: flex;
|
@@ -17390,6 +17446,7 @@ const STYLES$2 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17390
17446
|
background-size: cover;
|
17391
17447
|
background-position: center;
|
17392
17448
|
background-repeat: no-repeat;
|
17449
|
+
container-type: inline-size;
|
17393
17450
|
}
|
17394
17451
|
|
17395
17452
|
.${prefix}__text {
|
@@ -17407,25 +17464,25 @@ const STYLES$2 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17407
17464
|
margin: 0;
|
17408
17465
|
}
|
17409
17466
|
|
17410
|
-
@
|
17411
|
-
.${prefix}
|
17467
|
+
@container (min-width: 640px) {
|
17468
|
+
.${prefix} {
|
17412
17469
|
background-image: linear-gradient(to top, ${linearGradient}), url("${primaryImage}");
|
17413
17470
|
}
|
17414
17471
|
}
|
17415
17472
|
|
17416
|
-
@
|
17473
|
+
@container (min-width: 768px) {
|
17417
17474
|
.${prefix}__header {
|
17418
17475
|
font-size: 22px;
|
17419
17476
|
}
|
17420
17477
|
}
|
17421
17478
|
|
17422
|
-
@
|
17479
|
+
@container (min-width: 1024px) {
|
17423
17480
|
.${prefix}__header {
|
17424
17481
|
font-size: 24px;
|
17425
17482
|
}
|
17426
17483
|
}
|
17427
17484
|
|
17428
|
-
@
|
17485
|
+
@container (min-width: 1280px) {
|
17429
17486
|
.${prefix}__header {
|
17430
17487
|
font-size: 28px;
|
17431
17488
|
}
|
@@ -17439,7 +17496,7 @@ function rbNavigationBannerTemplate(spot, config) {
|
|
17439
17496
|
${GFONT_PRECONNECT}
|
17440
17497
|
${GFONT_SOURCE_SANS_3}
|
17441
17498
|
${STYLES$2(spot, config)}
|
17442
|
-
<div class="${prefix}
|
17499
|
+
<div class="${prefix}">
|
17443
17500
|
<div class="${prefix}__text">
|
17444
17501
|
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
17445
17502
|
</div>
|
@@ -17451,12 +17508,7 @@ const STYLES$1 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17451
17508
|
const linearGradient = linearGradientColorStop(overlay || [], 'rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 30%');
|
17452
17509
|
return `
|
17453
17510
|
<style>
|
17454
|
-
|
17455
|
-
min-width: 165px;
|
17456
|
-
min-height: 300px;
|
17457
|
-
}
|
17458
|
-
|
17459
|
-
.${prefix}__content {
|
17511
|
+
.${prefix} {
|
17460
17512
|
width: 100%;
|
17461
17513
|
height: 100%;
|
17462
17514
|
display: flex;
|
@@ -17469,6 +17521,7 @@ const STYLES$1 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17469
17521
|
border-radius: 5px;
|
17470
17522
|
overflow: hidden;
|
17471
17523
|
cursor: pointer;
|
17524
|
+
container-type: inline-size;
|
17472
17525
|
}
|
17473
17526
|
|
17474
17527
|
.${prefix}__text {
|
@@ -17483,12 +17536,11 @@ const STYLES$1 = ({ textColor = '#ffffff', primaryImage, mobilePrimaryImage = pr
|
|
17483
17536
|
font-family: "Source Sans 3", system-ui;
|
17484
17537
|
font-style: normal;
|
17485
17538
|
font-weight: 400;
|
17486
|
-
line-height: normal;
|
17487
17539
|
margin: 0;
|
17488
17540
|
}
|
17489
17541
|
|
17490
|
-
@
|
17491
|
-
.${prefix}
|
17542
|
+
@container (min-width: 640px) {
|
17543
|
+
.${prefix} {
|
17492
17544
|
background-image: linear-gradient(to top, ${linearGradient}), url("${primaryImage}");
|
17493
17545
|
}
|
17494
17546
|
}
|
@@ -17501,7 +17553,7 @@ function rbSmallCategoryImageToutTemplate(spot, config) {
|
|
17501
17553
|
${GFONT_PRECONNECT}
|
17502
17554
|
${GFONT_CORMORANT}
|
17503
17555
|
${STYLES$1(spot, config)}
|
17504
|
-
<div class="${prefix}
|
17556
|
+
<div class="${prefix}">
|
17505
17557
|
<div class="${prefix}__text">
|
17506
17558
|
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
17507
17559
|
</div>
|
@@ -17511,12 +17563,7 @@ function rbSmallCategoryImageToutTemplate(spot, config) {
|
|
17511
17563
|
|
17512
17564
|
const STYLES = ({ textColor = '#000000', backgroundColor = 'transparent', primaryImage, mobilePrimaryImage = primaryImage, }, { prefix }) => `
|
17513
17565
|
<style>
|
17514
|
-
|
17515
|
-
min-width: 165px;
|
17516
|
-
min-height: 250px;
|
17517
|
-
}
|
17518
|
-
|
17519
|
-
.${prefix}__content {
|
17566
|
+
.${prefix} {
|
17520
17567
|
width: 100%;
|
17521
17568
|
height: 100%;
|
17522
17569
|
background-color: ${backgroundColor};
|
@@ -17524,6 +17571,7 @@ const STYLES = ({ textColor = '#000000', backgroundColor = 'transparent', primar
|
|
17524
17571
|
display: flex;
|
17525
17572
|
flex-direction: column;
|
17526
17573
|
border-radius: 5px;
|
17574
|
+
container-type: inline-size;
|
17527
17575
|
}
|
17528
17576
|
|
17529
17577
|
.${prefix}__image {
|
@@ -17555,11 +17603,10 @@ const STYLES = ({ textColor = '#000000', backgroundColor = 'transparent', primar
|
|
17555
17603
|
font-family: "Source Sans 3", system-ui;
|
17556
17604
|
font-style: normal;
|
17557
17605
|
font-weight: 400;
|
17558
|
-
line-height: normal;
|
17559
17606
|
margin: 0;
|
17560
17607
|
}
|
17561
17608
|
|
17562
|
-
@
|
17609
|
+
@container (min-width: 640px) {
|
17563
17610
|
.${prefix}__image {
|
17564
17611
|
background-image: url("${primaryImage}");
|
17565
17612
|
}
|
@@ -17572,7 +17619,7 @@ function rbSmallDiscoverToutTemplate(spot, config) {
|
|
17572
17619
|
${GFONT_PRECONNECT}
|
17573
17620
|
${GFONT_CORMORANT}
|
17574
17621
|
${STYLES(spot, config)}
|
17575
|
-
<div class="${prefix}
|
17622
|
+
<div class="${prefix}">
|
17576
17623
|
<div class="${prefix}__image"></div>
|
17577
17624
|
<div class="${prefix}__text">
|
17578
17625
|
${spot.header ? `<h2 class="${prefix}__header">${spot.header}</h2>` : ''}
|
@@ -17753,8 +17800,6 @@ class EventService {
|
|
17753
17800
|
element,
|
17754
17801
|
impressionTracked: false,
|
17755
17802
|
});
|
17756
|
-
// Handle resize observer
|
17757
|
-
// this.handleResizeObserver(placementId, spot, element);
|
17758
17803
|
// Handle intersection observer
|
17759
17804
|
this.handleIntersectionObserver(placementId, spot, element);
|
17760
17805
|
// Attach click event listener
|
@@ -17792,35 +17837,6 @@ class EventService {
|
|
17792
17837
|
this.activeSpots.delete(spotId);
|
17793
17838
|
}
|
17794
17839
|
}
|
17795
|
-
// private handleResizeObserver(placementId: string, spot: ISpot, element: HTMLElement): void {
|
17796
|
-
// // this.resizeObserver = new ResizeObserverService({
|
17797
|
-
// // element,
|
17798
|
-
// // maxSize: {
|
17799
|
-
// // width: spot.width,
|
17800
|
-
// // height: spot.height,
|
17801
|
-
// // },
|
17802
|
-
// // minScale: 0.25,
|
17803
|
-
// // });
|
17804
|
-
//
|
17805
|
-
// const sizeChangedCb = (event: ISizeChangedEvent) => {
|
17806
|
-
// // Publish spot resized event
|
17807
|
-
// this.pubSub.publish(RMN_SPOT_EVENT.RESIZED, {
|
17808
|
-
// placementId,
|
17809
|
-
// spotId: spot.id,
|
17810
|
-
// scale: event.detail.scale,
|
17811
|
-
// previousDimensions: {
|
17812
|
-
// width: event.detail.width,
|
17813
|
-
// height: event.detail.height,
|
17814
|
-
// },
|
17815
|
-
// currentDimensions: {
|
17816
|
-
// width: event.detail.newWidth,
|
17817
|
-
// height: event.detail.newHeight,
|
17818
|
-
// },
|
17819
|
-
// });
|
17820
|
-
// };
|
17821
|
-
//
|
17822
|
-
// element.addEventListener('spotSizeChanged', sizeChangedCb as EventListener);
|
17823
|
-
// }
|
17824
17840
|
handleIntersectionObserver(placementId, spot, element) {
|
17825
17841
|
const spotIsVisibleCb = async () => {
|
17826
17842
|
var _a, _b;
|
@@ -17896,19 +17912,19 @@ class SelectionService extends BaseApi {
|
|
17896
17912
|
*
|
17897
17913
|
* @param {ISpotSelectionParams} data - Spots selection parameters.
|
17898
17914
|
*
|
17899
|
-
* @return {Promise<ISpots>} - The spots response object.
|
17915
|
+
* @return {Promise<ISpots | { error: string }>} - The spots response object.
|
17900
17916
|
*/
|
17901
17917
|
async spotSelection(data) {
|
17902
17918
|
const { isOk, val, isErr } = await this.post(SELECTION_API_PATH, data, {});
|
17903
17919
|
if (isErr) {
|
17904
|
-
|
17920
|
+
return { error: `There was an error during spot selection: (${isErr === null || isErr === void 0 ? void 0 : isErr.errorMessage})` };
|
17905
17921
|
}
|
17906
17922
|
if (isOk && val && val.data && (val === null || val === void 0 ? void 0 : val.refresh.token)) {
|
17907
17923
|
this.authInfo.authenticated = true;
|
17908
17924
|
this.authInfo.token = val.refresh.token;
|
17909
17925
|
return val.data.spots;
|
17910
17926
|
}
|
17911
|
-
|
17927
|
+
return { error: 'Spot selection response was not successful' };
|
17912
17928
|
}
|
17913
17929
|
}
|
17914
17930
|
|
@@ -17925,7 +17941,7 @@ class LiquidCommerceRmnClient {
|
|
17925
17941
|
*
|
17926
17942
|
* @param {ISpotSelectionParams} params - Spots selection parameters.
|
17927
17943
|
*
|
17928
|
-
* @return {Promise<ISpots>} - The spots response object.
|
17944
|
+
* @return {Promise<ISpots | {error : string}>} - The spots response object.
|
17929
17945
|
*/
|
17930
17946
|
async spotSelection(params) {
|
17931
17947
|
return this.selectionService.spotSelection(params);
|
@@ -17939,31 +17955,51 @@ class LiquidCommerceRmnClient {
|
|
17939
17955
|
*/
|
17940
17956
|
async injectSpotElement(params) {
|
17941
17957
|
var _a;
|
17942
|
-
const
|
17958
|
+
const config = params.config;
|
17959
|
+
let inject = params.inject;
|
17960
|
+
this.eventService.publish(RMN_SPOT_EVENT.INJECT_SPOTS, {
|
17961
|
+
isLoading: true,
|
17962
|
+
isCompleted: false,
|
17963
|
+
error: null,
|
17964
|
+
});
|
17943
17965
|
if (!inject.length) {
|
17944
|
-
|
17966
|
+
this.eventError('RmnSdk: Failed to inject spot element. Please provide at least one spot element to inject.');
|
17967
|
+
return;
|
17968
|
+
}
|
17969
|
+
const hasDuplicatePlacementIds = this.preventDuplicateSpotPlacementIds(inject);
|
17970
|
+
if (!hasDuplicatePlacementIds) {
|
17971
|
+
return;
|
17972
|
+
}
|
17973
|
+
inject = this.preventNonExistentSpotTypes(inject);
|
17974
|
+
const response = await this.spotSelectionRequest({ ...params, inject });
|
17975
|
+
if (typeof response === 'object' && 'error' in response) {
|
17976
|
+
this.eventError(response.error);
|
17945
17977
|
return;
|
17946
17978
|
}
|
17947
|
-
this.preventDuplicateSpotPlacementIds(inject);
|
17948
|
-
const response = await this.spotSelectionRequest(params);
|
17949
17979
|
for (const item of inject) {
|
17950
17980
|
const itemConfig = (_a = item.config) !== null && _a !== void 0 ? _a : config;
|
17951
17981
|
const spots = response[item.placementId];
|
17952
17982
|
if (!(spots === null || spots === void 0 ? void 0 : spots.length)) {
|
17953
|
-
|
17983
|
+
this.eventError(`RmnSdk: Failed to inject spot element. No spots found for type "${item.spotType}".`, { placementId: item.placementId, type: item.spotType });
|
17954
17984
|
continue;
|
17955
17985
|
}
|
17956
17986
|
const placementId = item.placementId.replace('#', '');
|
17957
17987
|
const placement = document.getElementById(placementId);
|
17958
17988
|
if (!placement) {
|
17959
|
-
|
17989
|
+
this.eventError(`RmnSdk: Failed to inject spot element. Placement not found for id "#${placementId}".`, { placementId, type: item.spotType });
|
17960
17990
|
continue;
|
17961
17991
|
}
|
17962
17992
|
if (spots.length === 1) {
|
17963
|
-
this.injectOneSpotElement(item, placement, spots[0], itemConfig);
|
17993
|
+
const isInjected = this.injectOneSpotElement(item, placement, spots[0], itemConfig);
|
17994
|
+
if (!isInjected) {
|
17995
|
+
continue;
|
17996
|
+
}
|
17964
17997
|
}
|
17965
17998
|
if (spots.length > 1) {
|
17966
|
-
this.injectCarouselSpotElement(placement, spots, itemConfig);
|
17999
|
+
const isInjected = this.injectCarouselSpotElement(placement, spots, itemConfig);
|
18000
|
+
if (!isInjected) {
|
18001
|
+
continue;
|
18002
|
+
}
|
17967
18003
|
}
|
17968
18004
|
}
|
17969
18005
|
}
|
@@ -17980,7 +18016,7 @@ class LiquidCommerceRmnClient {
|
|
17980
18016
|
*
|
17981
18017
|
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
17982
18018
|
*
|
17983
|
-
* @return {Promise<ISpots>} - The spots response object.
|
18019
|
+
* @return {Promise<ISpots | {error: string}>} - The spots response object.
|
17984
18020
|
*/
|
17985
18021
|
async spotSelectionRequest(params) {
|
17986
18022
|
const { inject, filter, config } = params;
|
@@ -18012,8 +18048,8 @@ class LiquidCommerceRmnClient {
|
|
18012
18048
|
const spot = this.elementService.overrideSpotColors(spotItem, config === null || config === void 0 ? void 0 : config.colors);
|
18013
18049
|
const content = SPOT_TEMPLATE_HTML_ELEMENT(spot, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
|
18014
18050
|
if (!content) {
|
18015
|
-
|
18016
|
-
|
18051
|
+
this.eventError(`RmnSdk: Failed to inject carousel spot element. Could not create element for type "${spot.spot}".`, { placementId: placement.id, type: spot.spot });
|
18052
|
+
continue;
|
18017
18053
|
}
|
18018
18054
|
this.eventSpotElement({
|
18019
18055
|
spot,
|
@@ -18029,6 +18065,7 @@ class LiquidCommerceRmnClient {
|
|
18029
18065
|
const carouselElement = this.elementService.createCarouselElement({
|
18030
18066
|
slides: carouselSlides,
|
18031
18067
|
config: {
|
18068
|
+
fluid: config === null || config === void 0 ? void 0 : config.fluid,
|
18032
18069
|
width: maxWidth,
|
18033
18070
|
height: maxHeight,
|
18034
18071
|
minScale: (_a = config === null || config === void 0 ? void 0 : config.minScale) !== null && _a !== void 0 ? _a : 0.25, // Scale down to 25% of the original size
|
@@ -18036,10 +18073,11 @@ class LiquidCommerceRmnClient {
|
|
18036
18073
|
},
|
18037
18074
|
});
|
18038
18075
|
if (!carouselElement) {
|
18039
|
-
|
18040
|
-
return;
|
18076
|
+
this.eventError(`RmnSdk: Failed to inject spot carousel element. Could not create spot carousel element.`, { placementId: placement.id });
|
18077
|
+
return false;
|
18041
18078
|
}
|
18042
18079
|
placement.replaceChildren(carouselElement);
|
18080
|
+
return true;
|
18043
18081
|
}
|
18044
18082
|
/**
|
18045
18083
|
* Injects a single spot element into the provided placement.
|
@@ -18056,20 +18094,22 @@ class LiquidCommerceRmnClient {
|
|
18056
18094
|
const spotData = this.elementService.overrideSpotColors(spot, config === null || config === void 0 ? void 0 : config.colors);
|
18057
18095
|
const content = SPOT_TEMPLATE_HTML_ELEMENT(spotData, { overlay: config === null || config === void 0 ? void 0 : config.overlay });
|
18058
18096
|
if (!content) {
|
18059
|
-
|
18060
|
-
return;
|
18097
|
+
this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
|
18098
|
+
return false;
|
18061
18099
|
}
|
18062
18100
|
const spotElement = this.elementService.createSpotElement({
|
18063
18101
|
content,
|
18064
18102
|
config: {
|
18103
|
+
fluid: config === null || config === void 0 ? void 0 : config.fluid,
|
18104
|
+
spot: spot.spot,
|
18065
18105
|
width: spot.width,
|
18066
18106
|
height: spot.height,
|
18067
18107
|
minScale: (_a = config === null || config === void 0 ? void 0 : config.minScale) !== null && _a !== void 0 ? _a : 0.25, // Scale down to 25% of the original size
|
18068
18108
|
},
|
18069
18109
|
});
|
18070
18110
|
if (!spotElement) {
|
18071
|
-
|
18072
|
-
return;
|
18111
|
+
this.eventError(`RmnSdk: Failed to inject spot element. Could not create element for type "${injectItem.spotType}".`, { placementId: injectItem.placementId, type: injectItem.spotType });
|
18112
|
+
return false;
|
18073
18113
|
}
|
18074
18114
|
this.eventSpotElement({
|
18075
18115
|
spot,
|
@@ -18077,6 +18117,7 @@ class LiquidCommerceRmnClient {
|
|
18077
18117
|
element: spotElement,
|
18078
18118
|
});
|
18079
18119
|
placement.replaceChildren(spotElement);
|
18120
|
+
return true;
|
18080
18121
|
}
|
18081
18122
|
eventSpotElement({ spot, placementId, element, }) {
|
18082
18123
|
this.eventService.registerSpot({
|
@@ -18098,10 +18139,33 @@ class LiquidCommerceRmnClient {
|
|
18098
18139
|
const placementIds = new Set();
|
18099
18140
|
for (const item of inject) {
|
18100
18141
|
if (placementIds.has(item.placementId)) {
|
18101
|
-
|
18142
|
+
this.eventError(`RmnSdk: Duplicate placement id (${item.placementId}) found. Please provide a unique placement id for each spot element.`, { placementId: item.placementId, type: item.spotType });
|
18143
|
+
return false;
|
18102
18144
|
}
|
18103
18145
|
placementIds.add(item.placementId);
|
18104
18146
|
}
|
18147
|
+
return true;
|
18148
|
+
}
|
18149
|
+
preventNonExistentSpotTypes(inject) {
|
18150
|
+
const newInject = [];
|
18151
|
+
for (const item of inject) {
|
18152
|
+
if (!Object.values(RMN_SPOT_TYPE).includes(item.spotType)) {
|
18153
|
+
this.eventError(`RmnSdk: Invalid spot type (${item.spotType}) found. Please provide a valid spot type for each spot element.`, { placementId: item.placementId, type: item.spotType });
|
18154
|
+
continue;
|
18155
|
+
}
|
18156
|
+
newInject.push(item);
|
18157
|
+
}
|
18158
|
+
return newInject;
|
18159
|
+
}
|
18160
|
+
eventError(error, spot) {
|
18161
|
+
this.eventService.publish(RMN_SPOT_EVENT.INJECT_SPOTS, {
|
18162
|
+
isLoading: false,
|
18163
|
+
isCompleted: true,
|
18164
|
+
error: {
|
18165
|
+
message: error,
|
18166
|
+
spot,
|
18167
|
+
},
|
18168
|
+
});
|
18105
18169
|
}
|
18106
18170
|
}
|
18107
18171
|
/**
|