@liquidcommercedev/rmn-sdk 1.5.0-beta.33 → 1.5.0-beta.34
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/index.cjs +142 -402
- package/dist/index.esm.js +142 -402
- package/dist/types/modules/element/component/spot/spot.component.d.ts +1 -0
- package/dist/types/modules/helper-service/proximity-observer.service.d.ts +18 -18
- package/dist/types/modules/spot-template/reservebar/video-player.template.d.ts +0 -15
- package/package.json +1 -1
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
package/dist/index.esm.js
CHANGED
@@ -17145,7 +17145,7 @@ class DummyHTMLElement {
|
|
17145
17145
|
}
|
17146
17146
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
17147
17147
|
attachShadow(_options) {
|
17148
|
-
throw new Error('attachShadow is not supported in non-browser environment');
|
17148
|
+
throw new Error('Liquid Commerce Rmn Sdk: attachShadow is not supported in non-browser environment');
|
17149
17149
|
}
|
17150
17150
|
appendChild(node) {
|
17151
17151
|
return node;
|
@@ -17180,6 +17180,12 @@ class BaseSpotComponent extends BaseElement {
|
|
17180
17180
|
writable: true,
|
17181
17181
|
value: void 0
|
17182
17182
|
});
|
17183
|
+
Object.defineProperty(this, "_container", {
|
17184
|
+
enumerable: true,
|
17185
|
+
configurable: true,
|
17186
|
+
writable: true,
|
17187
|
+
value: void 0
|
17188
|
+
});
|
17183
17189
|
}
|
17184
17190
|
initializeData(data, config) {
|
17185
17191
|
if (this.dataInitialized) {
|
@@ -17196,19 +17202,19 @@ class BaseSpotComponent extends BaseElement {
|
|
17196
17202
|
if (!this.initialized || !this.dataInitialized || !isBrowser) {
|
17197
17203
|
return;
|
17198
17204
|
}
|
17199
|
-
|
17205
|
+
this._container = this._config.useShadowDom
|
17200
17206
|
? this.shadowRoot || this.attachShadow({ mode: 'open' })
|
17201
17207
|
: this;
|
17202
|
-
|
17208
|
+
this._container.innerHTML = '';
|
17203
17209
|
const style = document.createElement('style');
|
17204
17210
|
style.textContent = this.baseStyles() + this.styles();
|
17205
|
-
|
17211
|
+
this._container.appendChild(style);
|
17206
17212
|
const content = this.template();
|
17207
17213
|
if (typeof content === 'string') {
|
17208
|
-
|
17214
|
+
this._container.innerHTML += content;
|
17209
17215
|
}
|
17210
17216
|
else {
|
17211
|
-
|
17217
|
+
this._container.appendChild(content);
|
17212
17218
|
}
|
17213
17219
|
}
|
17214
17220
|
baseStyles() {
|
@@ -17536,7 +17542,7 @@ Object.defineProperty(LocalStorageService, "encryptData", {
|
|
17536
17542
|
|
17537
17543
|
class ProximityObserver {
|
17538
17544
|
constructor(elementIds, callback, options = {}) {
|
17539
|
-
var _a, _b
|
17545
|
+
var _a, _b;
|
17540
17546
|
Object.defineProperty(this, "intersectionObserver", {
|
17541
17547
|
enumerable: true,
|
17542
17548
|
configurable: true,
|
@@ -17555,13 +17561,7 @@ class ProximityObserver {
|
|
17555
17561
|
writable: true,
|
17556
17562
|
value: void 0
|
17557
17563
|
});
|
17558
|
-
Object.defineProperty(this, "
|
17559
|
-
enumerable: true,
|
17560
|
-
configurable: true,
|
17561
|
-
writable: true,
|
17562
|
-
value: void 0
|
17563
|
-
});
|
17564
|
-
Object.defineProperty(this, "processedGroups", {
|
17564
|
+
Object.defineProperty(this, "processedIds", {
|
17565
17565
|
enumerable: true,
|
17566
17566
|
configurable: true,
|
17567
17567
|
writable: true,
|
@@ -17573,13 +17573,7 @@ class ProximityObserver {
|
|
17573
17573
|
writable: true,
|
17574
17574
|
value: void 0
|
17575
17575
|
});
|
17576
|
-
Object.defineProperty(this, "
|
17577
|
-
enumerable: true,
|
17578
|
-
configurable: true,
|
17579
|
-
writable: true,
|
17580
|
-
value: void 0
|
17581
|
-
});
|
17582
|
-
Object.defineProperty(this, "horizontalThreshold", {
|
17576
|
+
Object.defineProperty(this, "proximityThreshold", {
|
17583
17577
|
enumerable: true,
|
17584
17578
|
configurable: true,
|
17585
17579
|
writable: true,
|
@@ -17595,125 +17589,130 @@ class ProximityObserver {
|
|
17595
17589
|
enumerable: true,
|
17596
17590
|
configurable: true,
|
17597
17591
|
writable: true,
|
17598
|
-
value:
|
17592
|
+
value: 20
|
17599
17593
|
});
|
17600
17594
|
this.targetIds = new Set(elementIds);
|
17601
|
-
this.
|
17602
|
-
this.processedGroups = new Set();
|
17595
|
+
this.processedIds = new Set();
|
17603
17596
|
this.callback = callback;
|
17604
|
-
this.
|
17605
|
-
this.
|
17606
|
-
this.
|
17607
|
-
this.
|
17608
|
-
|
17609
|
-
|
17610
|
-
|
17611
|
-
}
|
17612
|
-
initializeIntersectionObserver() {
|
17597
|
+
this.proximityThreshold = (_a = options.proximityThreshold) !== null && _a !== void 0 ? _a : 500;
|
17598
|
+
this.intersectionMargin = (_b = options.intersectionMargin) !== null && _b !== void 0 ? _b : '2000px';
|
17599
|
+
this.initializeObservers();
|
17600
|
+
this.observeExistingElements();
|
17601
|
+
}
|
17602
|
+
initializeObservers() {
|
17603
|
+
// Initialize intersection observer to detect when elements are near viewport
|
17613
17604
|
this.intersectionObserver = new IntersectionObserver(this.handleIntersection.bind(this), {
|
17614
17605
|
rootMargin: this.intersectionMargin,
|
17615
|
-
threshold: 0,
|
17616
17606
|
});
|
17617
|
-
|
17618
|
-
|
17619
|
-
|
17607
|
+
// Initialize mutation observer to detect new elements
|
17608
|
+
this.mutationObserver = new MutationObserver((mutations) => {
|
17609
|
+
mutations.forEach((mutation) => {
|
17610
|
+
if (mutation.type === 'childList') {
|
17611
|
+
mutation.addedNodes.forEach((node) => {
|
17612
|
+
if (node instanceof HTMLElement) {
|
17613
|
+
this.checkElement(node);
|
17614
|
+
node.querySelectorAll('*').forEach((el) => {
|
17615
|
+
if (el instanceof HTMLElement) {
|
17616
|
+
this.checkElement(el);
|
17617
|
+
}
|
17618
|
+
});
|
17619
|
+
}
|
17620
|
+
});
|
17621
|
+
}
|
17622
|
+
});
|
17623
|
+
});
|
17624
|
+
// Start observing DOM changes
|
17620
17625
|
this.mutationObserver.observe(document.body, {
|
17621
17626
|
childList: true,
|
17622
17627
|
subtree: true,
|
17623
17628
|
});
|
17624
17629
|
}
|
17625
|
-
|
17626
|
-
|
17627
|
-
|
17628
|
-
|
17629
|
-
|
17630
|
-
|
17631
|
-
|
17632
|
-
|
17633
|
-
const
|
17634
|
-
|
17635
|
-
const
|
17636
|
-
|
17637
|
-
|
17638
|
-
|
17639
|
-
if (
|
17640
|
-
|
17641
|
-
|
17642
|
-
if (!
|
17643
|
-
|
17644
|
-
|
17645
|
-
const
|
17646
|
-
const
|
17647
|
-
|
17648
|
-
|
17649
|
-
|
17650
|
-
|
17651
|
-
|
17652
|
-
const totalDistance = Math.sqrt(Math.pow(horizontalDistance, 2) + Math.pow(verticalDistance, 2));
|
17653
|
-
nearbyElements.push({ element: el, distance: totalDistance });
|
17630
|
+
checkElement(element) {
|
17631
|
+
if (element.id && this.targetIds.has(element.id) && !this.processedIds.has(element.id)) {
|
17632
|
+
this.intersectionObserver.observe(element);
|
17633
|
+
}
|
17634
|
+
}
|
17635
|
+
findNearbyTargetIds(element) {
|
17636
|
+
// Cache element rectangle to avoid multiple calculations
|
17637
|
+
const elementCenter = this.getElementCenter(element);
|
17638
|
+
const nearbyTargets = [];
|
17639
|
+
// Use for...of instead of forEach for better performance and ability to break early
|
17640
|
+
for (const targetId of this.targetIds) {
|
17641
|
+
// Early exit conditions
|
17642
|
+
if (this.processedIds.has(targetId))
|
17643
|
+
continue;
|
17644
|
+
if (targetId === element.id)
|
17645
|
+
continue;
|
17646
|
+
const targetElement = document.getElementById(targetId);
|
17647
|
+
if (!targetElement)
|
17648
|
+
continue;
|
17649
|
+
// Calculate distance between element centers
|
17650
|
+
const targetCenter = this.getElementCenter(targetElement);
|
17651
|
+
const distance = this.calculateDistance(elementCenter, targetCenter);
|
17652
|
+
if (distance <= this.proximityThreshold) {
|
17653
|
+
nearbyTargets.push({ id: targetId, distance });
|
17654
|
+
// Early exit if we've reached maxResults
|
17655
|
+
if (nearbyTargets.length >= this.maxGroupSize)
|
17656
|
+
break;
|
17654
17657
|
}
|
17655
|
-
}
|
17656
|
-
// Sort by distance and
|
17657
|
-
return
|
17658
|
-
.sort((a, b) => a.distance - b.distance)
|
17659
|
-
.slice(0, this.maxGroupSize - 1)
|
17660
|
-
.map((item) => item.element);
|
17658
|
+
}
|
17659
|
+
// Sort by distance and return only the IDs
|
17660
|
+
return nearbyTargets.sort((a, b) => a.distance - b.distance).map((target) => target.id);
|
17661
17661
|
}
|
17662
17662
|
handleIntersection(entries) {
|
17663
17663
|
entries.forEach((entry) => {
|
17664
17664
|
if (!entry.isIntersecting)
|
17665
17665
|
return;
|
17666
17666
|
const element = entry.target;
|
17667
|
-
if (this.
|
17668
|
-
return;
|
17669
|
-
// Only process if element is in viewport range
|
17670
|
-
if (!this.isElementInViewportRange(element))
|
17667
|
+
if (!element.id || this.processedIds.has(element.id))
|
17671
17668
|
return;
|
17672
|
-
|
17673
|
-
const
|
17674
|
-
|
17675
|
-
|
17676
|
-
|
17677
|
-
|
17669
|
+
// Find nearby target elements
|
17670
|
+
const allGroupIds = [element.id, ...this.findNearbyTargetIds(element)];
|
17671
|
+
// Take only up to maxGroupSize elements
|
17672
|
+
const groupIdsToProcess = allGroupIds.slice(0, this.maxGroupSize);
|
17673
|
+
// Mark all found IDs as processed
|
17674
|
+
groupIdsToProcess.forEach((id) => {
|
17675
|
+
this.processedIds.add(id);
|
17676
|
+
const el = document.getElementById(id);
|
17677
|
+
if (el)
|
17678
|
+
this.intersectionObserver.unobserve(el);
|
17679
|
+
});
|
17680
|
+
// Trigger callback with the group
|
17681
|
+
this.callback(groupIdsToProcess);
|
17682
|
+
// Cleanup if all elements have been processed
|
17683
|
+
if (this.targetIds.size === this.processedIds.size) {
|
17684
|
+
this.cleanup();
|
17678
17685
|
}
|
17679
17686
|
});
|
17680
17687
|
}
|
17681
|
-
|
17682
|
-
|
17683
|
-
|
17684
|
-
|
17685
|
-
|
17686
|
-
|
17687
|
-
|
17688
|
-
|
17689
|
-
|
17690
|
-
node
|
17691
|
-
.querySelectorAll('*')
|
17692
|
-
.forEach((el) => this.checkAndObserveElement(el));
|
17693
|
-
}
|
17694
|
-
});
|
17695
|
-
}
|
17696
|
-
});
|
17688
|
+
/**
|
17689
|
+
* Calculates the center point of an HTML element.
|
17690
|
+
*/
|
17691
|
+
getElementCenter(element) {
|
17692
|
+
const rect = element.getBoundingClientRect();
|
17693
|
+
return {
|
17694
|
+
x: rect.left + rect.width / 2,
|
17695
|
+
y: rect.top + rect.height / 2,
|
17696
|
+
};
|
17697
17697
|
}
|
17698
|
-
|
17699
|
-
|
17700
|
-
|
17701
|
-
|
17702
|
-
|
17698
|
+
/**
|
17699
|
+
* Calculates the Euclidean distance between two points.
|
17700
|
+
*/
|
17701
|
+
calculateDistance(point1, point2) {
|
17702
|
+
return Math.hypot(point1.x - point2.x, point1.y - point2.y);
|
17703
17703
|
}
|
17704
|
-
|
17704
|
+
observeExistingElements() {
|
17705
17705
|
this.targetIds.forEach((id) => {
|
17706
17706
|
const element = document.getElementById(id);
|
17707
17707
|
if (element) {
|
17708
|
-
this.
|
17708
|
+
this.checkElement(element);
|
17709
17709
|
}
|
17710
17710
|
});
|
17711
17711
|
}
|
17712
17712
|
cleanup() {
|
17713
17713
|
this.intersectionObserver.disconnect();
|
17714
17714
|
this.mutationObserver.disconnect();
|
17715
|
-
this.
|
17716
|
-
this.processedGroups.clear();
|
17715
|
+
this.processedIds.clear();
|
17717
17716
|
this.targetIds.clear();
|
17718
17717
|
}
|
17719
17718
|
}
|
@@ -19453,144 +19452,38 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19453
19452
|
writable: true,
|
19454
19453
|
value: () => `.${this._config.prefix}__video-element`
|
19455
19454
|
});
|
19456
|
-
Object.defineProperty(this, "timelineSelector", {
|
19457
|
-
enumerable: true,
|
19458
|
-
configurable: true,
|
19459
|
-
writable: true,
|
19460
|
-
value: () => `.${this._config.prefix}__timeline`
|
19461
|
-
});
|
19462
|
-
Object.defineProperty(this, "playButtonSelector", {
|
19463
|
-
enumerable: true,
|
19464
|
-
configurable: true,
|
19465
|
-
writable: true,
|
19466
|
-
value: () => `.${this._config.prefix}__play-button`
|
19467
|
-
});
|
19468
19455
|
Object.defineProperty(this, "muteButtonSelector", {
|
19469
19456
|
enumerable: true,
|
19470
19457
|
configurable: true,
|
19471
19458
|
writable: true,
|
19472
19459
|
value: () => `.${this._config.prefix}__mute-button`
|
19473
19460
|
});
|
19474
|
-
Object.defineProperty(this, "volumeSliderSelector", {
|
19475
|
-
enumerable: true,
|
19476
|
-
configurable: true,
|
19477
|
-
writable: true,
|
19478
|
-
value: () => `.${this._config.prefix}__volume-slider`
|
19479
|
-
});
|
19480
19461
|
Object.defineProperty(this, "video", {
|
19481
19462
|
enumerable: true,
|
19482
19463
|
configurable: true,
|
19483
19464
|
writable: true,
|
19484
19465
|
value: null
|
19485
19466
|
});
|
19486
|
-
Object.defineProperty(this, "timeline", {
|
19487
|
-
enumerable: true,
|
19488
|
-
configurable: true,
|
19489
|
-
writable: true,
|
19490
|
-
value: null
|
19491
|
-
});
|
19492
19467
|
this.bindEventHandlers();
|
19493
19468
|
}
|
19494
|
-
get container() {
|
19495
|
-
return this._config.useShadowDom && this.shadowRoot ? this.shadowRoot : this;
|
19496
|
-
}
|
19497
19469
|
// Initialization Methods
|
19498
19470
|
bindEventHandlers() {
|
19499
|
-
this.handlePlayPause = this.handlePlayPause.bind(this);
|
19500
|
-
this.handleTimelineClick = this.handleTimelineClick.bind(this);
|
19501
|
-
this.handleVolumeChange = this.handleVolumeChange.bind(this);
|
19502
|
-
this.updateProgress = this.updateProgress.bind(this);
|
19503
|
-
this.hideOverlay = this.hideOverlay.bind(this);
|
19504
19471
|
this.handleMuteToggle = this.handleMuteToggle.bind(this);
|
19505
19472
|
}
|
19506
19473
|
// UI Update Methods
|
19507
|
-
updatePlayIcon(isPaused) {
|
19508
|
-
const playIcon = this.container.querySelector(`.${this._config.prefix}__play-icon`);
|
19509
|
-
if (!playIcon)
|
19510
|
-
return;
|
19511
|
-
playIcon.innerHTML = isPaused ? this.getPlayIcon() : this.getPauseIcon();
|
19512
|
-
}
|
19513
19474
|
updateMuteIcon(isMuted) {
|
19514
|
-
const muteIcon = this.
|
19475
|
+
const muteIcon = this._container.querySelector(`.${this._config.prefix}__mute-icon`);
|
19515
19476
|
if (!muteIcon)
|
19516
19477
|
return;
|
19517
19478
|
muteIcon.innerHTML = isMuted ? this.getMuteIcon() : this.getUnmuteIcon();
|
19518
19479
|
}
|
19519
|
-
updateProgress() {
|
19520
|
-
if (!this.video)
|
19521
|
-
return;
|
19522
|
-
const progress = this.container.querySelector(`.${this._config.prefix}__progress`);
|
19523
|
-
const currentTime = this.container.querySelector(`.${this._config.prefix}__current-time`);
|
19524
|
-
const duration = this.container.querySelector(`.${this._config.prefix}__duration`);
|
19525
|
-
if (progress instanceof HTMLElement && this.video.duration) {
|
19526
|
-
const percentage = (this.video.currentTime / this.video.duration) * 100;
|
19527
|
-
progress.style.width = `${percentage}%`;
|
19528
|
-
}
|
19529
|
-
if (currentTime instanceof HTMLElement) {
|
19530
|
-
currentTime.textContent = this.formatTime(this.video.currentTime);
|
19531
|
-
}
|
19532
|
-
if (duration instanceof HTMLElement && this.video.duration) {
|
19533
|
-
duration.textContent = this.formatTime(this.video.duration);
|
19534
|
-
}
|
19535
|
-
}
|
19536
19480
|
// Event Handlers
|
19537
|
-
handlePlayPause(event) {
|
19538
|
-
event.preventDefault();
|
19539
|
-
if (!this.video)
|
19540
|
-
return;
|
19541
|
-
if (this.video.paused) {
|
19542
|
-
this.video
|
19543
|
-
.play()
|
19544
|
-
.then(() => {
|
19545
|
-
this.updatePlayIcon(false);
|
19546
|
-
this.hideOverlay();
|
19547
|
-
})
|
19548
|
-
.catch(console.error);
|
19549
|
-
}
|
19550
|
-
else {
|
19551
|
-
this.video.pause();
|
19552
|
-
this.updatePlayIcon(true);
|
19553
|
-
}
|
19554
|
-
}
|
19555
|
-
handleTimelineClick(event) {
|
19556
|
-
event.preventDefault();
|
19557
|
-
if (!this.video || !this.timeline)
|
19558
|
-
return;
|
19559
|
-
const rect = this.timeline.getBoundingClientRect();
|
19560
|
-
const position = (event.clientX - rect.left) / rect.width;
|
19561
|
-
this.video.currentTime = position * this.video.duration;
|
19562
|
-
}
|
19563
|
-
handleVolumeChange(event) {
|
19564
|
-
if (!this.video)
|
19565
|
-
return;
|
19566
|
-
const input = event.target;
|
19567
|
-
this.video.volume = parseFloat(input.value);
|
19568
|
-
}
|
19569
19481
|
handleMuteToggle(event) {
|
19570
19482
|
event.preventDefault();
|
19571
19483
|
if (!this.video)
|
19572
19484
|
return;
|
19573
19485
|
this.video.muted = !this.video.muted;
|
19574
19486
|
this.updateMuteIcon(this.video.muted);
|
19575
|
-
const volumeSlider = this.container.querySelector(this.volumeSliderSelector());
|
19576
|
-
if (volumeSlider) {
|
19577
|
-
volumeSlider.value = this.video.muted ? '0' : this.video.volume.toString();
|
19578
|
-
}
|
19579
|
-
}
|
19580
|
-
// Utility Methods
|
19581
|
-
formatTime(seconds) {
|
19582
|
-
const minutes = Math.floor(seconds / 60);
|
19583
|
-
const remainingSeconds = Math.floor(seconds % 60);
|
19584
|
-
return `${minutes}:${remainingSeconds.toString().padStart(2, '0')}`;
|
19585
|
-
}
|
19586
|
-
hideOverlay() {
|
19587
|
-
const overlay = this.container.querySelector(`.${this._config.prefix}__overlay`);
|
19588
|
-
if (!(overlay instanceof HTMLElement))
|
19589
|
-
return;
|
19590
|
-
overlay.style.opacity = '0';
|
19591
|
-
setTimeout(() => {
|
19592
|
-
overlay.style.display = 'none';
|
19593
|
-
}, 300);
|
19594
19487
|
}
|
19595
19488
|
// Icon Templates
|
19596
19489
|
getMuteIcon() {
|
@@ -19610,95 +19503,32 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19610
19503
|
</svg>
|
19611
19504
|
`;
|
19612
19505
|
}
|
19613
|
-
getPlayIcon() {
|
19614
|
-
return `
|
19615
|
-
<svg height="20px" viewBox="0 0 512 512" width="20px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
19616
|
-
<path fill="#fff" d="M405.2,232.9L126.8,67.2c-3.4-2-6.9-3.2-10.9-3.2c-10.9,0-19.8,9-19.8,20H96v344h0.1c0,11,8.9,20,19.8,20 c4.1,0,7.5-1.4,11.2-3.4l278.1-165.5c6.6-5.5,10.8-13.8,10.8-23.1C416,246.7,411.8,238.5,405.2,232.9z"/>
|
19617
|
-
</svg>
|
19618
|
-
`;
|
19619
|
-
}
|
19620
|
-
getPauseIcon() {
|
19621
|
-
return `
|
19622
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
19623
|
-
<path fill="#fff" d="M11 22h-4v-20h4v20zm6-20h-4v20h4v-20z"/>
|
19624
|
-
</svg>
|
19625
|
-
`;
|
19626
|
-
}
|
19627
19506
|
// Lifecycle Methods
|
19628
19507
|
connected() {
|
19629
19508
|
this.initializeElements();
|
19630
|
-
this.setupAutoplay();
|
19631
19509
|
this.attachEventListeners();
|
19632
19510
|
}
|
19633
19511
|
disconnected() {
|
19634
19512
|
this.removeEventListeners();
|
19635
19513
|
}
|
19636
19514
|
initializeElements() {
|
19637
|
-
this.video = this.
|
19638
|
-
this.timeline = this.container.querySelector(this.timelineSelector());
|
19639
|
-
}
|
19640
|
-
setupAutoplay() {
|
19641
|
-
if (this._data.video.autoplay && this.video) {
|
19642
|
-
setTimeout(() => {
|
19643
|
-
this.hideOverlay();
|
19644
|
-
}, 1000);
|
19645
|
-
}
|
19515
|
+
this.video = this._container.querySelector(this.videoSelector());
|
19646
19516
|
}
|
19647
19517
|
attachEventListeners() {
|
19648
|
-
var _a;
|
19649
19518
|
if (!this.video)
|
19650
19519
|
return;
|
19651
|
-
this.
|
19652
|
-
this.video.addEventListener('loadedmetadata', this.updateProgress);
|
19653
|
-
this.video.addEventListener('play', this.hideOverlay);
|
19654
|
-
this.video.addEventListener('volumechange', () => {
|
19655
|
-
if (this.video) {
|
19656
|
-
this.updateMuteIcon(this.video.muted || this.video.volume === 0);
|
19657
|
-
}
|
19658
|
-
});
|
19659
|
-
const playButton = this.container.querySelector(this.playButtonSelector());
|
19660
|
-
const muteButton = this.container.querySelector(this.muteButtonSelector());
|
19661
|
-
const volumeSlider = this.container.querySelector(this.volumeSliderSelector());
|
19662
|
-
playButton === null || playButton === void 0 ? void 0 : playButton.addEventListener('click', this.handlePlayPause);
|
19520
|
+
const muteButton = this._container.querySelector(this.muteButtonSelector());
|
19663
19521
|
muteButton === null || muteButton === void 0 ? void 0 : muteButton.addEventListener('click', this.handleMuteToggle);
|
19664
|
-
(_a = this.timeline) === null || _a === void 0 ? void 0 : _a.addEventListener('click', this.handleTimelineClick);
|
19665
|
-
volumeSlider === null || volumeSlider === void 0 ? void 0 : volumeSlider.addEventListener('input', this.handleVolumeChange);
|
19666
19522
|
}
|
19667
19523
|
removeEventListeners() {
|
19668
|
-
var _a;
|
19669
19524
|
if (!this.video)
|
19670
19525
|
return;
|
19671
|
-
this.
|
19672
|
-
this.video.removeEventListener('loadedmetadata', this.updateProgress);
|
19673
|
-
this.video.removeEventListener('play', this.hideOverlay);
|
19674
|
-
this.video.removeEventListener('volumechange', () => null);
|
19675
|
-
const playButton = this.container.querySelector(this.playButtonSelector());
|
19676
|
-
const muteButton = this.container.querySelector(this.muteButtonSelector());
|
19677
|
-
const volumeSlider = this.container.querySelector(this.volumeSliderSelector());
|
19678
|
-
playButton === null || playButton === void 0 ? void 0 : playButton.removeEventListener('click', this.handlePlayPause);
|
19526
|
+
const muteButton = this._container.querySelector(this.muteButtonSelector());
|
19679
19527
|
muteButton === null || muteButton === void 0 ? void 0 : muteButton.removeEventListener('click', this.handleMuteToggle);
|
19680
|
-
(_a = this.timeline) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', this.handleTimelineClick);
|
19681
|
-
volumeSlider === null || volumeSlider === void 0 ? void 0 : volumeSlider.removeEventListener('input', this.handleVolumeChange);
|
19682
19528
|
}
|
19683
19529
|
template() {
|
19684
19530
|
const prefix = this._config.prefix;
|
19685
|
-
const { url, posterTitle, posterDescription
|
19686
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19687
|
-
autoplay,
|
19688
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19689
|
-
mute,
|
19690
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19691
|
-
loop,
|
19692
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19693
|
-
showControls,
|
19694
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19695
|
-
showPlay,
|
19696
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19697
|
-
showTimeline,
|
19698
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19699
|
-
showVolume,
|
19700
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
19701
|
-
showTime, } = this._data.video;
|
19531
|
+
const { url, posterTitle, posterDescription } = this._data.video;
|
19702
19532
|
if (!url) {
|
19703
19533
|
return '<p>Please provide a video source</p>';
|
19704
19534
|
}
|
@@ -19719,72 +19549,31 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19719
19549
|
<video
|
19720
19550
|
class="${prefix}__video-element"
|
19721
19551
|
src="${url}"
|
19722
|
-
|
19723
|
-
|
19724
|
-
|
19552
|
+
autoplay
|
19553
|
+
muted
|
19554
|
+
loop
|
19725
19555
|
preload="metadata"
|
19726
19556
|
>
|
19727
19557
|
Your browser doesn't support HTML5 video playback.
|
19728
19558
|
</video>
|
19729
19559
|
</div>
|
19730
|
-
`;
|
19731
|
-
const renderPlayButton = () => !showPlay
|
19732
|
-
? ''
|
19733
|
-
: `
|
19734
|
-
<button type="button" class="${prefix}__play-button">
|
19735
|
-
<span class="${prefix}__play-icon">
|
19736
|
-
${autoplay ? this.getPauseIcon() : this.getPlayIcon()}
|
19737
|
-
</span>
|
19738
|
-
</button>
|
19739
19560
|
`;
|
19740
19561
|
const renderMuteButton = () => `
|
19741
19562
|
<button type="button" class="${prefix}__mute-button">
|
19742
19563
|
<span class="${prefix}__mute-icon">
|
19743
|
-
${
|
19564
|
+
${this.getMuteIcon()}
|
19744
19565
|
</span>
|
19745
19566
|
</button>
|
19746
19567
|
`;
|
19747
|
-
const
|
19748
|
-
? ''
|
19749
|
-
: `
|
19750
|
-
<div class="${prefix}__volume-control">
|
19751
|
-
<input
|
19752
|
-
type="range"
|
19753
|
-
min="0"
|
19754
|
-
max="1"
|
19755
|
-
step="0.1"
|
19756
|
-
value="${mute ? '0' : '1'}"
|
19757
|
-
class="${prefix}__volume-slider"
|
19758
|
-
/>
|
19759
|
-
</div>
|
19760
|
-
`;
|
19761
|
-
const renderTimeline = () => !showTimeline
|
19762
|
-
? ''
|
19763
|
-
: `
|
19764
|
-
<div class="${prefix}__timeline">
|
19765
|
-
<div class="${prefix}__progress"></div>
|
19766
|
-
</div>
|
19767
|
-
`;
|
19768
|
-
const renderTime = () => !showTime
|
19769
|
-
? ''
|
19770
|
-
: `
|
19771
|
-
<div class="${prefix}__time">
|
19772
|
-
<span class="${prefix}__current-time">0:00</span> /
|
19773
|
-
<span class="${prefix}__duration">0:00</span>
|
19774
|
-
</div>
|
19775
|
-
`;
|
19776
|
-
const renderControls = () => !showControls
|
19777
|
-
? ''
|
19778
|
-
: `
|
19568
|
+
const renderControls = () => `
|
19779
19569
|
<div class="${prefix}__controls">
|
19780
|
-
${renderPlayButton()}
|
19781
19570
|
${renderMuteButton()}
|
19782
|
-
${renderVolumeControl()}
|
19783
|
-
${renderTimeline()}
|
19784
|
-
${renderTime()}
|
19785
19571
|
</div>
|
19786
19572
|
`;
|
19787
19573
|
return `
|
19574
|
+
${GFONT_PRECONNECT}
|
19575
|
+
${GFONT_SOURCE_SANS_3}
|
19576
|
+
${GFONT_CORMORANT}
|
19788
19577
|
<div class="${prefix}">
|
19789
19578
|
${renderOverlay()}
|
19790
19579
|
${renderVideo()}
|
@@ -19799,7 +19588,6 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19799
19588
|
width: 100%;
|
19800
19589
|
height: 100%;
|
19801
19590
|
background: #000;
|
19802
|
-
border-radius: 8px;
|
19803
19591
|
overflow: hidden;
|
19804
19592
|
position: relative;
|
19805
19593
|
}
|
@@ -19810,33 +19598,39 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19810
19598
|
left: 0;
|
19811
19599
|
right: 0;
|
19812
19600
|
z-index: 2;
|
19813
|
-
background-image: url('${this._data.video.poster}');
|
19814
|
-
background-color: rgba(0, 0, 0, 0.5);
|
19815
|
-
transition: opacity 0.3s ease;
|
19816
19601
|
width: 100%;
|
19817
19602
|
height: 100%;
|
19818
19603
|
display: flex;
|
19819
19604
|
flex-direction: column;
|
19820
19605
|
justify-content: flex-end;
|
19606
|
+
background-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 40%);
|
19821
19607
|
}
|
19822
19608
|
|
19823
19609
|
.${prefix}__overlay-text {
|
19824
19610
|
padding: 3rem;
|
19825
19611
|
display: flex;
|
19826
19612
|
flex-direction: column;
|
19827
|
-
gap:
|
19613
|
+
gap: 8px;
|
19828
19614
|
}
|
19829
19615
|
|
19830
19616
|
.${prefix}__title {
|
19831
19617
|
color: #fff;
|
19618
|
+
font-size: 26px;
|
19832
19619
|
margin: 0;
|
19833
|
-
font-
|
19620
|
+
font-family: "Cormorant", system-ui;
|
19621
|
+
font-style: normal;
|
19622
|
+
font-weight: 300;
|
19623
|
+
line-height: normal;
|
19834
19624
|
}
|
19835
19625
|
|
19836
19626
|
.${prefix}__description {
|
19837
19627
|
color: #ccc;
|
19838
19628
|
margin: 0;
|
19839
|
-
font-size:
|
19629
|
+
font-size: 13px;
|
19630
|
+
font-family: "Source Sans 3", system-ui;
|
19631
|
+
font-style: normal;
|
19632
|
+
font-weight: 400;
|
19633
|
+
line-height: 20px;
|
19840
19634
|
}
|
19841
19635
|
|
19842
19636
|
.${prefix}__video-container {
|
@@ -19854,75 +19648,23 @@ class RbVideoPlayerSE extends BaseSpotComponent {
|
|
19854
19648
|
|
19855
19649
|
.${prefix}__controls {
|
19856
19650
|
position: absolute;
|
19857
|
-
bottom:
|
19858
|
-
|
19859
|
-
|
19860
|
-
background: rgba(0, 0, 0, 0.7);
|
19651
|
+
bottom: 5px;
|
19652
|
+
right: 5px;
|
19653
|
+
background: rgba(0, 0, 0, 0.5);
|
19861
19654
|
padding: 8px;
|
19862
19655
|
display: flex;
|
19863
19656
|
align-items: center;
|
19864
|
-
gap: 8px;
|
19865
19657
|
opacity: 0;
|
19866
19658
|
transition: opacity 0.3s;
|
19867
19659
|
z-index: 3;
|
19660
|
+
width: fit-content;
|
19661
|
+
border-radius: 50%;
|
19868
19662
|
}
|
19869
19663
|
|
19870
19664
|
.${prefix}:hover .${prefix}__controls {
|
19871
19665
|
opacity: 1;
|
19872
19666
|
}
|
19873
19667
|
|
19874
|
-
.${prefix}__play-button {
|
19875
|
-
background: none;
|
19876
|
-
border: none;
|
19877
|
-
color: white;
|
19878
|
-
cursor: pointer;
|
19879
|
-
width: 32px;
|
19880
|
-
height: 32px;
|
19881
|
-
padding: 0;
|
19882
|
-
display: flex;
|
19883
|
-
align-items: center;
|
19884
|
-
justify-content: center;
|
19885
|
-
}
|
19886
|
-
|
19887
|
-
.${prefix}__play-icon svg {
|
19888
|
-
width: 20px;
|
19889
|
-
height: 20px;
|
19890
|
-
}
|
19891
|
-
|
19892
|
-
.${prefix}__play-button:hover {
|
19893
|
-
opacity: 0.8;
|
19894
|
-
}
|
19895
|
-
|
19896
|
-
.${prefix}__timeline {
|
19897
|
-
flex-grow: 1;
|
19898
|
-
height: 4px;
|
19899
|
-
background: rgba(255, 255, 255, 0.3);
|
19900
|
-
cursor: pointer;
|
19901
|
-
position: relative;
|
19902
|
-
}
|
19903
|
-
|
19904
|
-
.${prefix}__progress {
|
19905
|
-
height: 100%;
|
19906
|
-
background: #fff;
|
19907
|
-
width: 0%;
|
19908
|
-
}
|
19909
|
-
|
19910
|
-
.${prefix}__time {
|
19911
|
-
color: white;
|
19912
|
-
font-size: 14px;
|
19913
|
-
min-width: 100px;
|
19914
|
-
text-align: center;
|
19915
|
-
}
|
19916
|
-
|
19917
|
-
.${prefix}__volume-control {
|
19918
|
-
width: 100px;
|
19919
|
-
}
|
19920
|
-
|
19921
|
-
.${prefix}__volume-slider {
|
19922
|
-
width: 100%;
|
19923
|
-
cursor: pointer;
|
19924
|
-
}
|
19925
|
-
|
19926
19668
|
.${prefix}__mute-button {
|
19927
19669
|
background: none;
|
19928
19670
|
border: none;
|
@@ -21817,21 +21559,19 @@ class BrowserRmnClient {
|
|
21817
21559
|
}
|
21818
21560
|
// Validate inject data
|
21819
21561
|
params.inject = validateInjectData(params.inject);
|
21820
|
-
|
21562
|
+
const placementIds = params.inject.map((item) => item.placementId);
|
21563
|
+
new ProximityObserver(placementIds, (intersectingPlacementIds) => __awaiter(this, void 0, void 0, function* () {
|
21821
21564
|
/**
|
21822
21565
|
* Called when elements are within range
|
21823
21566
|
*
|
21824
21567
|
* intersectingPlacementIds includes:
|
21825
|
-
* 1. The element that came within
|
21826
|
-
* 2. Any unprocessed elements within
|
21568
|
+
* 1. The element that came within 2000px
|
21569
|
+
* 2. Any unprocessed elements within 500px of that element
|
21827
21570
|
*/
|
21828
21571
|
yield this.processPlacements(params, intersectingPlacementIds);
|
21829
|
-
// console.info('intersectingPlacementIds', intersectingPlacementIds);
|
21830
21572
|
}), {
|
21831
|
-
|
21832
|
-
|
21833
|
-
horizontalThreshold: 400,
|
21834
|
-
maxGroupSize: 5,
|
21573
|
+
proximityThreshold: 500,
|
21574
|
+
intersectionMargin: '2000px',
|
21835
21575
|
});
|
21836
21576
|
});
|
21837
21577
|
}
|