@liquidcommercedev/rmn-sdk 1.5.0-beta.37 → 1.5.0-beta.39
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 +37 -14
- package/dist/index.esm.js +37 -14
- package/dist/types/enums.d.ts +2 -1
- package/dist/types/modules/element/element.interface.d.ts +3 -2
- package/dist/types/modules/helper-service/proximity-observer.service.d.ts +1 -1
- package/dist/types/modules/spot-manager/spot-manager.interface.d.ts +5 -0
- package/package.json +1 -1
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
package/dist/index.cjs
CHANGED
@@ -63,6 +63,7 @@ exports.RMN_EVENT = void 0;
|
|
63
63
|
(function (RMN_EVENT) {
|
64
64
|
RMN_EVENT["LIFECYCLE_STATE"] = "LIFECYCLE_STATE";
|
65
65
|
RMN_EVENT["SPOT_EVENT"] = "SPOT_EVENT";
|
66
|
+
RMN_EVENT["RENDERED_SPOT_DATA"] = "RENDERED_SPOT_DATA";
|
66
67
|
})(exports.RMN_EVENT || (exports.RMN_EVENT = {}));
|
67
68
|
exports.RMN_SPOT_EVENT = void 0;
|
68
69
|
(function (RMN_SPOT_EVENT) {
|
@@ -17412,6 +17413,7 @@ class ProximityObserver {
|
|
17412
17413
|
this.mutationObserver = new MutationObserver((mutations) => {
|
17413
17414
|
mutations.forEach((mutation) => {
|
17414
17415
|
if (mutation.type === 'childList') {
|
17416
|
+
// Handle added nodes
|
17415
17417
|
mutation.addedNodes.forEach((node) => {
|
17416
17418
|
if (node instanceof HTMLElement) {
|
17417
17419
|
this.checkElement(node);
|
@@ -17422,14 +17424,33 @@ class ProximityObserver {
|
|
17422
17424
|
});
|
17423
17425
|
}
|
17424
17426
|
});
|
17427
|
+
// Handle removed nodes
|
17428
|
+
mutation.removedNodes.forEach((node) => {
|
17429
|
+
if (node instanceof HTMLElement) {
|
17430
|
+
this.handleRemovedElement(node);
|
17431
|
+
node.querySelectorAll('*').forEach((el) => {
|
17432
|
+
if (el instanceof HTMLElement) {
|
17433
|
+
this.handleRemovedElement(el);
|
17434
|
+
}
|
17435
|
+
});
|
17436
|
+
}
|
17437
|
+
});
|
17425
17438
|
}
|
17426
17439
|
});
|
17427
17440
|
});
|
17428
17441
|
// Start observing DOM changes
|
17429
|
-
|
17430
|
-
|
17431
|
-
|
17432
|
-
|
17442
|
+
if (document.body) {
|
17443
|
+
this.mutationObserver.observe(document.body, {
|
17444
|
+
childList: true,
|
17445
|
+
subtree: true,
|
17446
|
+
});
|
17447
|
+
}
|
17448
|
+
}
|
17449
|
+
handleRemovedElement(element) {
|
17450
|
+
if (element.id && this.processedIds.has(element.id)) {
|
17451
|
+
this.processedIds.delete(element.id);
|
17452
|
+
this.intersectionObserver.unobserve(element);
|
17453
|
+
}
|
17433
17454
|
}
|
17434
17455
|
checkElement(element) {
|
17435
17456
|
if (element.id && this.targetIds.has(element.id) && !this.processedIds.has(element.id)) {
|
@@ -17483,10 +17504,6 @@ class ProximityObserver {
|
|
17483
17504
|
});
|
17484
17505
|
// Trigger callback with the group
|
17485
17506
|
this.callback(groupIdsToProcess);
|
17486
|
-
// Cleanup if all elements have been processed
|
17487
|
-
if (this.targetIds.size === this.processedIds.size) {
|
17488
|
-
this.cleanup();
|
17489
|
-
}
|
17490
17507
|
});
|
17491
17508
|
}
|
17492
17509
|
/**
|
@@ -17513,12 +17530,6 @@ class ProximityObserver {
|
|
17513
17530
|
}
|
17514
17531
|
});
|
17515
17532
|
}
|
17516
|
-
cleanup() {
|
17517
|
-
this.intersectionObserver.disconnect();
|
17518
|
-
this.mutationObserver.disconnect();
|
17519
|
-
this.processedIds.clear();
|
17520
|
-
this.targetIds.clear();
|
17521
|
-
}
|
17522
17533
|
}
|
17523
17534
|
|
17524
17535
|
/**
|
@@ -21456,6 +21467,12 @@ class BrowserRmnClient {
|
|
21456
21467
|
spotElement,
|
21457
21468
|
});
|
21458
21469
|
placement.replaceChildren(spotElement);
|
21470
|
+
if (config === null || config === void 0 ? void 0 : config.listenRenderedSpotData) {
|
21471
|
+
this.spotManagerService.publish(exports.RMN_EVENT.RENDERED_SPOT_DATA, {
|
21472
|
+
placementId,
|
21473
|
+
data: [spotData],
|
21474
|
+
});
|
21475
|
+
}
|
21459
21476
|
this.spotManagerService.updateSpotLifecycleState(placementId, {
|
21460
21477
|
dom: {
|
21461
21478
|
spotElement,
|
@@ -21549,6 +21566,12 @@ class BrowserRmnClient {
|
|
21549
21566
|
return;
|
21550
21567
|
}
|
21551
21568
|
placement.replaceChildren(carouselElement);
|
21569
|
+
if (config === null || config === void 0 ? void 0 : config.listenRenderedSpotData) {
|
21570
|
+
this.spotManagerService.publish(exports.RMN_EVENT.RENDERED_SPOT_DATA, {
|
21571
|
+
placementId,
|
21572
|
+
data: spots,
|
21573
|
+
});
|
21574
|
+
}
|
21552
21575
|
this.spotManagerService.updateSpotLifecycleState(placementId, {
|
21553
21576
|
dom: {
|
21554
21577
|
spotElement: carouselElement,
|
package/dist/index.esm.js
CHANGED
@@ -61,6 +61,7 @@ var RMN_EVENT;
|
|
61
61
|
(function (RMN_EVENT) {
|
62
62
|
RMN_EVENT["LIFECYCLE_STATE"] = "LIFECYCLE_STATE";
|
63
63
|
RMN_EVENT["SPOT_EVENT"] = "SPOT_EVENT";
|
64
|
+
RMN_EVENT["RENDERED_SPOT_DATA"] = "RENDERED_SPOT_DATA";
|
64
65
|
})(RMN_EVENT || (RMN_EVENT = {}));
|
65
66
|
var RMN_SPOT_EVENT;
|
66
67
|
(function (RMN_SPOT_EVENT) {
|
@@ -17410,6 +17411,7 @@ class ProximityObserver {
|
|
17410
17411
|
this.mutationObserver = new MutationObserver((mutations) => {
|
17411
17412
|
mutations.forEach((mutation) => {
|
17412
17413
|
if (mutation.type === 'childList') {
|
17414
|
+
// Handle added nodes
|
17413
17415
|
mutation.addedNodes.forEach((node) => {
|
17414
17416
|
if (node instanceof HTMLElement) {
|
17415
17417
|
this.checkElement(node);
|
@@ -17420,14 +17422,33 @@ class ProximityObserver {
|
|
17420
17422
|
});
|
17421
17423
|
}
|
17422
17424
|
});
|
17425
|
+
// Handle removed nodes
|
17426
|
+
mutation.removedNodes.forEach((node) => {
|
17427
|
+
if (node instanceof HTMLElement) {
|
17428
|
+
this.handleRemovedElement(node);
|
17429
|
+
node.querySelectorAll('*').forEach((el) => {
|
17430
|
+
if (el instanceof HTMLElement) {
|
17431
|
+
this.handleRemovedElement(el);
|
17432
|
+
}
|
17433
|
+
});
|
17434
|
+
}
|
17435
|
+
});
|
17423
17436
|
}
|
17424
17437
|
});
|
17425
17438
|
});
|
17426
17439
|
// Start observing DOM changes
|
17427
|
-
|
17428
|
-
|
17429
|
-
|
17430
|
-
|
17440
|
+
if (document.body) {
|
17441
|
+
this.mutationObserver.observe(document.body, {
|
17442
|
+
childList: true,
|
17443
|
+
subtree: true,
|
17444
|
+
});
|
17445
|
+
}
|
17446
|
+
}
|
17447
|
+
handleRemovedElement(element) {
|
17448
|
+
if (element.id && this.processedIds.has(element.id)) {
|
17449
|
+
this.processedIds.delete(element.id);
|
17450
|
+
this.intersectionObserver.unobserve(element);
|
17451
|
+
}
|
17431
17452
|
}
|
17432
17453
|
checkElement(element) {
|
17433
17454
|
if (element.id && this.targetIds.has(element.id) && !this.processedIds.has(element.id)) {
|
@@ -17481,10 +17502,6 @@ class ProximityObserver {
|
|
17481
17502
|
});
|
17482
17503
|
// Trigger callback with the group
|
17483
17504
|
this.callback(groupIdsToProcess);
|
17484
|
-
// Cleanup if all elements have been processed
|
17485
|
-
if (this.targetIds.size === this.processedIds.size) {
|
17486
|
-
this.cleanup();
|
17487
|
-
}
|
17488
17505
|
});
|
17489
17506
|
}
|
17490
17507
|
/**
|
@@ -17511,12 +17528,6 @@ class ProximityObserver {
|
|
17511
17528
|
}
|
17512
17529
|
});
|
17513
17530
|
}
|
17514
|
-
cleanup() {
|
17515
|
-
this.intersectionObserver.disconnect();
|
17516
|
-
this.mutationObserver.disconnect();
|
17517
|
-
this.processedIds.clear();
|
17518
|
-
this.targetIds.clear();
|
17519
|
-
}
|
17520
17531
|
}
|
17521
17532
|
|
17522
17533
|
/**
|
@@ -21454,6 +21465,12 @@ class BrowserRmnClient {
|
|
21454
21465
|
spotElement,
|
21455
21466
|
});
|
21456
21467
|
placement.replaceChildren(spotElement);
|
21468
|
+
if (config === null || config === void 0 ? void 0 : config.listenRenderedSpotData) {
|
21469
|
+
this.spotManagerService.publish(RMN_EVENT.RENDERED_SPOT_DATA, {
|
21470
|
+
placementId,
|
21471
|
+
data: [spotData],
|
21472
|
+
});
|
21473
|
+
}
|
21457
21474
|
this.spotManagerService.updateSpotLifecycleState(placementId, {
|
21458
21475
|
dom: {
|
21459
21476
|
spotElement,
|
@@ -21547,6 +21564,12 @@ class BrowserRmnClient {
|
|
21547
21564
|
return;
|
21548
21565
|
}
|
21549
21566
|
placement.replaceChildren(carouselElement);
|
21567
|
+
if (config === null || config === void 0 ? void 0 : config.listenRenderedSpotData) {
|
21568
|
+
this.spotManagerService.publish(RMN_EVENT.RENDERED_SPOT_DATA, {
|
21569
|
+
placementId,
|
21570
|
+
data: spots,
|
21571
|
+
});
|
21572
|
+
}
|
21550
21573
|
this.spotManagerService.updateSpotLifecycleState(placementId, {
|
21551
21574
|
dom: {
|
21552
21575
|
spotElement: carouselElement,
|
package/dist/types/enums.d.ts
CHANGED
@@ -55,7 +55,8 @@ export declare enum RMN_FILTER_PROPERTIES {
|
|
55
55
|
}
|
56
56
|
export declare enum RMN_EVENT {
|
57
57
|
LIFECYCLE_STATE = "LIFECYCLE_STATE",
|
58
|
-
SPOT_EVENT = "SPOT_EVENT"
|
58
|
+
SPOT_EVENT = "SPOT_EVENT",
|
59
|
+
RENDERED_SPOT_DATA = "RENDERED_SPOT_DATA"
|
59
60
|
}
|
60
61
|
export declare enum RMN_SPOT_EVENT {
|
61
62
|
IMPRESSION = "IMPRESSION",
|
@@ -16,11 +16,12 @@ export interface ISpotOverlay {
|
|
16
16
|
}
|
17
17
|
export interface IInjectSpotElementConfig {
|
18
18
|
fluid?: boolean;
|
19
|
-
url?: string;
|
20
19
|
colors?: ISpotColors;
|
21
|
-
minScale?: number;
|
22
20
|
overlay?: ISpotOverlay;
|
23
21
|
carousel?: ICarouselOptions;
|
22
|
+
minScale?: number;
|
23
|
+
url?: string;
|
24
|
+
listenRenderedSpotData?: boolean;
|
24
25
|
}
|
25
26
|
export type IInjectSpotElementFilterType = Partial<Omit<RmnFilterType, RMN_FILTER_PROPERTIES.KEYWORDS> & {
|
26
27
|
exactMatch?: string;
|
@@ -13,6 +13,7 @@ export declare class ProximityObserver {
|
|
13
13
|
private readonly maxGroupSize;
|
14
14
|
constructor(elementIds: string[], callback: (intersectingIds: string[]) => void, options?: IProximityObserverOptions);
|
15
15
|
private initializeObservers;
|
16
|
+
private handleRemovedElement;
|
16
17
|
private checkElement;
|
17
18
|
private findNearbyTargetIds;
|
18
19
|
private handleIntersection;
|
@@ -25,6 +26,5 @@ export declare class ProximityObserver {
|
|
25
26
|
*/
|
26
27
|
private calculateDistance;
|
27
28
|
private observeExistingElements;
|
28
|
-
private cleanup;
|
29
29
|
}
|
30
30
|
export {};
|
@@ -36,9 +36,14 @@ export interface IRmnSpotEvent {
|
|
36
36
|
placementId: string;
|
37
37
|
spotId: string;
|
38
38
|
}
|
39
|
+
export interface IRmnRenderedSpotDataEvent {
|
40
|
+
placementId: string;
|
41
|
+
data: ISpot[];
|
42
|
+
}
|
39
43
|
export interface IRmnEventMap {
|
40
44
|
[RMN_EVENT.LIFECYCLE_STATE]: ILifecycleState;
|
41
45
|
[RMN_EVENT.SPOT_EVENT]: IRmnSpotEvent;
|
46
|
+
[RMN_EVENT.RENDERED_SPOT_DATA]: IRmnRenderedSpotDataEvent;
|
42
47
|
}
|
43
48
|
export interface IRegisterSpotParams {
|
44
49
|
placementId: string;
|
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.39",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|