@liquidcommercedev/rmn-sdk 1.5.0-beta.25 → 1.5.0-beta.26
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
CHANGED
@@ -6178,6 +6178,7 @@ const extractorConfig = {
|
|
6178
6178
|
'final_price',
|
6179
6179
|
'retail_price',
|
6180
6180
|
],
|
6181
|
+
quantity: ['quantity', 'qty'],
|
6181
6182
|
};
|
6182
6183
|
/**
|
6183
6184
|
* Extracts deep values from an object based on specified target type
|
@@ -16675,8 +16676,8 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
16675
16676
|
// Map clone to original for event handling
|
16676
16677
|
this.cloneToOriginalMap.set(clonedSlide, this.slides[index]);
|
16677
16678
|
let isDragging = false;
|
16678
|
-
slideElement.addEventListener('mousedown', () => isDragging = false);
|
16679
|
-
slideElement.addEventListener('mousemove', () => isDragging = true);
|
16679
|
+
slideElement.addEventListener('mousedown', () => (isDragging = false));
|
16680
|
+
slideElement.addEventListener('mousemove', () => (isDragging = true));
|
16680
16681
|
// Add event delegation to the slide container
|
16681
16682
|
slideElement.addEventListener('click', (e) => {
|
16682
16683
|
if (isDragging) {
|
@@ -18911,7 +18912,7 @@ function rbHomepageHeroTwoTileTemplate(spot, config) {
|
|
18911
18912
|
`;
|
18912
18913
|
}
|
18913
18914
|
|
18914
|
-
const STYLES$4 = ({ textColor = '#
|
18915
|
+
const STYLES$4 = ({ textColor = '#212121', backgroundColor = 'transparent' }, { prefix }) => `
|
18915
18916
|
<style>
|
18916
18917
|
.${prefix} {
|
18917
18918
|
display: block;
|
@@ -18928,6 +18929,10 @@ const STYLES$4 = ({ textColor = '#ffffff', backgroundColor = 'transparent' }, {
|
|
18928
18929
|
font-family: "Source Sans 3", system-ui;
|
18929
18930
|
margin: 0;
|
18930
18931
|
}
|
18932
|
+
|
18933
|
+
.${prefix}__header:hover {
|
18934
|
+
color: #b5914a;
|
18935
|
+
}
|
18931
18936
|
</style>
|
18932
18937
|
`;
|
18933
18938
|
function rbInTextTemplate(spot, config) {
|
@@ -19410,8 +19415,13 @@ class DataLayerMonitor {
|
|
19410
19415
|
onlyFirst: true,
|
19411
19416
|
shouldIncludeZero: true,
|
19412
19417
|
});
|
19418
|
+
const productQuantity = extractDeepValues(data, 'quantity', {
|
19419
|
+
onlyFirst: true,
|
19420
|
+
shouldIncludeZero: true,
|
19421
|
+
});
|
19413
19422
|
if (productPrice) {
|
19414
19423
|
normalizedData.productPrice = productPrice;
|
19424
|
+
normalizedData.productQuantity = productQuantity !== null && productQuantity !== void 0 ? productQuantity : 1;
|
19415
19425
|
}
|
19416
19426
|
}
|
19417
19427
|
return normalizedData;
|
@@ -19461,7 +19471,7 @@ class MonitorService {
|
|
19461
19471
|
this.implementedMonitor.start();
|
19462
19472
|
}
|
19463
19473
|
async matchAndFireEvent(eventData, spots) {
|
19464
|
-
var _a
|
19474
|
+
var _a;
|
19465
19475
|
if (!spots)
|
19466
19476
|
return;
|
19467
19477
|
const eventProductIds = new Set(cleanProductIds(eventData.productIds));
|
@@ -19472,16 +19482,32 @@ class MonitorService {
|
|
19472
19482
|
if (!hasCommonProductIds || !Object.values(exports.RMN_SPOT_EVENT).includes(eventData.event)) {
|
19473
19483
|
continue;
|
19474
19484
|
}
|
19475
|
-
const
|
19476
|
-
|
19477
|
-
|
19478
|
-
|
19485
|
+
const eventPosition = spot.events.findIndex((event) => event.event === eventData.event);
|
19486
|
+
if (eventPosition === -1)
|
19487
|
+
continue;
|
19488
|
+
const eventUrl = spot.events[eventPosition].url;
|
19489
|
+
const gmv = eventData.productPrice && eventData.productQuantity
|
19490
|
+
? eventData.productPrice * eventData.productQuantity
|
19491
|
+
: undefined;
|
19492
|
+
// gmv = gross merchandise value, it is calculated by multiplying the product price by the product quantity
|
19493
|
+
const additionalQueryParams = objectToQueryParams({ gmv });
|
19494
|
+
// Fire the event and publish it to the pubsub service
|
19479
19495
|
await this.fireAndPublishSpotEvent({
|
19480
19496
|
spotEvent: eventData.event,
|
19481
19497
|
eventUrl: `${eventUrl}${additionalQueryParams ? `&${additionalQueryParams}` : ''}`,
|
19482
19498
|
placementId: spot.placementId,
|
19483
19499
|
spotId: spot.spotId,
|
19484
19500
|
});
|
19501
|
+
// Remove the event url from the spot to prevent duplicate events
|
19502
|
+
spot.events[eventPosition].url = '';
|
19503
|
+
// Update the spots in the local storage
|
19504
|
+
(_a = this.localStorageService) === null || _a === void 0 ? void 0 : _a.setSpot(spot.spotId, {
|
19505
|
+
placementId: spot.placementId,
|
19506
|
+
spotId: spot.spotId,
|
19507
|
+
spotType: spot.spotType,
|
19508
|
+
events: spot.events,
|
19509
|
+
productIds: spot.productIds,
|
19510
|
+
});
|
19485
19511
|
}
|
19486
19512
|
}
|
19487
19513
|
async fireAndPublishSpotEvent({ spotEvent, eventUrl, placementId, spotId, }) {
|
package/dist/index.esm.js
CHANGED
@@ -6176,6 +6176,7 @@ const extractorConfig = {
|
|
6176
6176
|
'final_price',
|
6177
6177
|
'retail_price',
|
6178
6178
|
],
|
6179
|
+
quantity: ['quantity', 'qty'],
|
6179
6180
|
};
|
6180
6181
|
/**
|
6181
6182
|
* Extracts deep values from an object based on specified target type
|
@@ -16673,8 +16674,8 @@ if (typeof window !== 'undefined' && typeof window.customElements !== 'undefined
|
|
16673
16674
|
// Map clone to original for event handling
|
16674
16675
|
this.cloneToOriginalMap.set(clonedSlide, this.slides[index]);
|
16675
16676
|
let isDragging = false;
|
16676
|
-
slideElement.addEventListener('mousedown', () => isDragging = false);
|
16677
|
-
slideElement.addEventListener('mousemove', () => isDragging = true);
|
16677
|
+
slideElement.addEventListener('mousedown', () => (isDragging = false));
|
16678
|
+
slideElement.addEventListener('mousemove', () => (isDragging = true));
|
16678
16679
|
// Add event delegation to the slide container
|
16679
16680
|
slideElement.addEventListener('click', (e) => {
|
16680
16681
|
if (isDragging) {
|
@@ -18909,7 +18910,7 @@ function rbHomepageHeroTwoTileTemplate(spot, config) {
|
|
18909
18910
|
`;
|
18910
18911
|
}
|
18911
18912
|
|
18912
|
-
const STYLES$4 = ({ textColor = '#
|
18913
|
+
const STYLES$4 = ({ textColor = '#212121', backgroundColor = 'transparent' }, { prefix }) => `
|
18913
18914
|
<style>
|
18914
18915
|
.${prefix} {
|
18915
18916
|
display: block;
|
@@ -18926,6 +18927,10 @@ const STYLES$4 = ({ textColor = '#ffffff', backgroundColor = 'transparent' }, {
|
|
18926
18927
|
font-family: "Source Sans 3", system-ui;
|
18927
18928
|
margin: 0;
|
18928
18929
|
}
|
18930
|
+
|
18931
|
+
.${prefix}__header:hover {
|
18932
|
+
color: #b5914a;
|
18933
|
+
}
|
18929
18934
|
</style>
|
18930
18935
|
`;
|
18931
18936
|
function rbInTextTemplate(spot, config) {
|
@@ -19408,8 +19413,13 @@ class DataLayerMonitor {
|
|
19408
19413
|
onlyFirst: true,
|
19409
19414
|
shouldIncludeZero: true,
|
19410
19415
|
});
|
19416
|
+
const productQuantity = extractDeepValues(data, 'quantity', {
|
19417
|
+
onlyFirst: true,
|
19418
|
+
shouldIncludeZero: true,
|
19419
|
+
});
|
19411
19420
|
if (productPrice) {
|
19412
19421
|
normalizedData.productPrice = productPrice;
|
19422
|
+
normalizedData.productQuantity = productQuantity !== null && productQuantity !== void 0 ? productQuantity : 1;
|
19413
19423
|
}
|
19414
19424
|
}
|
19415
19425
|
return normalizedData;
|
@@ -19459,7 +19469,7 @@ class MonitorService {
|
|
19459
19469
|
this.implementedMonitor.start();
|
19460
19470
|
}
|
19461
19471
|
async matchAndFireEvent(eventData, spots) {
|
19462
|
-
var _a
|
19472
|
+
var _a;
|
19463
19473
|
if (!spots)
|
19464
19474
|
return;
|
19465
19475
|
const eventProductIds = new Set(cleanProductIds(eventData.productIds));
|
@@ -19470,16 +19480,32 @@ class MonitorService {
|
|
19470
19480
|
if (!hasCommonProductIds || !Object.values(RMN_SPOT_EVENT).includes(eventData.event)) {
|
19471
19481
|
continue;
|
19472
19482
|
}
|
19473
|
-
const
|
19474
|
-
|
19475
|
-
|
19476
|
-
|
19483
|
+
const eventPosition = spot.events.findIndex((event) => event.event === eventData.event);
|
19484
|
+
if (eventPosition === -1)
|
19485
|
+
continue;
|
19486
|
+
const eventUrl = spot.events[eventPosition].url;
|
19487
|
+
const gmv = eventData.productPrice && eventData.productQuantity
|
19488
|
+
? eventData.productPrice * eventData.productQuantity
|
19489
|
+
: undefined;
|
19490
|
+
// gmv = gross merchandise value, it is calculated by multiplying the product price by the product quantity
|
19491
|
+
const additionalQueryParams = objectToQueryParams({ gmv });
|
19492
|
+
// Fire the event and publish it to the pubsub service
|
19477
19493
|
await this.fireAndPublishSpotEvent({
|
19478
19494
|
spotEvent: eventData.event,
|
19479
19495
|
eventUrl: `${eventUrl}${additionalQueryParams ? `&${additionalQueryParams}` : ''}`,
|
19480
19496
|
placementId: spot.placementId,
|
19481
19497
|
spotId: spot.spotId,
|
19482
19498
|
});
|
19499
|
+
// Remove the event url from the spot to prevent duplicate events
|
19500
|
+
spot.events[eventPosition].url = '';
|
19501
|
+
// Update the spots in the local storage
|
19502
|
+
(_a = this.localStorageService) === null || _a === void 0 ? void 0 : _a.setSpot(spot.spotId, {
|
19503
|
+
placementId: spot.placementId,
|
19504
|
+
spotId: spot.spotId,
|
19505
|
+
spotType: spot.spotType,
|
19506
|
+
events: spot.events,
|
19507
|
+
productIds: spot.productIds,
|
19508
|
+
});
|
19483
19509
|
}
|
19484
19510
|
}
|
19485
19511
|
async fireAndPublishSpotEvent({ spotEvent, eventUrl, placementId, spotId, }) {
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@liquidcommercedev/rmn-sdk",
|
3
3
|
"description": "LiquidCommerce RMN SDK",
|
4
4
|
"author": "LiquidCommerce Tech",
|
5
|
-
"version": "1.5.0-beta.
|
5
|
+
"version": "1.5.0-beta.26",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|