@liquidcommercedev/rmn-sdk 1.5.0-beta.28 → 1.5.0-beta.29
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
@@ -20924,8 +20924,18 @@ class EventService {
|
|
20924
20924
|
this.pubSubService.publish(exports.RMN_EVENT.LIFECYCLE_STATE, this.spotStates.get(placementId));
|
20925
20925
|
}
|
20926
20926
|
}
|
20927
|
+
saveSpotDataToLocalStorage(placementId, spot) {
|
20928
|
+
var _a;
|
20929
|
+
this.localStorageService.setSpot(spot.id, {
|
20930
|
+
placementId,
|
20931
|
+
spotId: spot.id,
|
20932
|
+
spotType: spot.spot,
|
20933
|
+
events: spot.events,
|
20934
|
+
productIds: (_a = spot.productIds) !== null && _a !== void 0 ? _a : [],
|
20935
|
+
});
|
20936
|
+
}
|
20927
20937
|
async handleClickEvent({ placementId, spot }) {
|
20928
|
-
var _a, _b
|
20938
|
+
var _a, _b;
|
20929
20939
|
this.pubSubService.publish(exports.RMN_EVENT.SPOT_EVENT, {
|
20930
20940
|
eventType: exports.RMN_SPOT_EVENT.CLICK,
|
20931
20941
|
placementId,
|
@@ -20936,13 +20946,7 @@ class EventService {
|
|
20936
20946
|
eventUrl: (_b = (_a = spot.events.find((event) => event.event === exports.RMN_SPOT_EVENT.CLICK)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '',
|
20937
20947
|
});
|
20938
20948
|
// Save spot to local storage for event tracking
|
20939
|
-
this.
|
20940
|
-
placementId,
|
20941
|
-
spotId: spot.id,
|
20942
|
-
spotType: spot.spot,
|
20943
|
-
events: spot.events,
|
20944
|
-
productIds: (_c = spot.productIds) !== null && _c !== void 0 ? _c : [],
|
20945
|
-
});
|
20949
|
+
this.saveSpotDataToLocalStorage(placementId, spot);
|
20946
20950
|
}
|
20947
20951
|
handleImpressionEvent(placementId, spot) {
|
20948
20952
|
this.pubSubService.publish(exports.RMN_EVENT.SPOT_EVENT, {
|
@@ -21173,6 +21177,16 @@ class LiquidCommerceRmnClient {
|
|
21173
21177
|
async spotSelection(params) {
|
21174
21178
|
return this.selectionService.spotSelection(params);
|
21175
21179
|
}
|
21180
|
+
/**
|
21181
|
+
* Publishes the spot data for a given placement ID to the RMN.
|
21182
|
+
*
|
21183
|
+
* @param {string} placementId - The unique identifier for the placement.
|
21184
|
+
* @param {ISpot} spot - The spot data.
|
21185
|
+
* @return {void} - Does not return any value.
|
21186
|
+
*/
|
21187
|
+
publishSpotToRmn(placementId, spot) {
|
21188
|
+
this.eventService.saveSpotDataToLocalStorage(placementId, spot);
|
21189
|
+
}
|
21176
21190
|
/**
|
21177
21191
|
* Injects the spot elements into their provided placement.
|
21178
21192
|
*
|
package/dist/index.esm.js
CHANGED
@@ -20922,8 +20922,18 @@ class EventService {
|
|
20922
20922
|
this.pubSubService.publish(RMN_EVENT.LIFECYCLE_STATE, this.spotStates.get(placementId));
|
20923
20923
|
}
|
20924
20924
|
}
|
20925
|
+
saveSpotDataToLocalStorage(placementId, spot) {
|
20926
|
+
var _a;
|
20927
|
+
this.localStorageService.setSpot(spot.id, {
|
20928
|
+
placementId,
|
20929
|
+
spotId: spot.id,
|
20930
|
+
spotType: spot.spot,
|
20931
|
+
events: spot.events,
|
20932
|
+
productIds: (_a = spot.productIds) !== null && _a !== void 0 ? _a : [],
|
20933
|
+
});
|
20934
|
+
}
|
20925
20935
|
async handleClickEvent({ placementId, spot }) {
|
20926
|
-
var _a, _b
|
20936
|
+
var _a, _b;
|
20927
20937
|
this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
|
20928
20938
|
eventType: RMN_SPOT_EVENT.CLICK,
|
20929
20939
|
placementId,
|
@@ -20934,13 +20944,7 @@ class EventService {
|
|
20934
20944
|
eventUrl: (_b = (_a = spot.events.find((event) => event.event === RMN_SPOT_EVENT.CLICK)) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '',
|
20935
20945
|
});
|
20936
20946
|
// Save spot to local storage for event tracking
|
20937
|
-
this.
|
20938
|
-
placementId,
|
20939
|
-
spotId: spot.id,
|
20940
|
-
spotType: spot.spot,
|
20941
|
-
events: spot.events,
|
20942
|
-
productIds: (_c = spot.productIds) !== null && _c !== void 0 ? _c : [],
|
20943
|
-
});
|
20947
|
+
this.saveSpotDataToLocalStorage(placementId, spot);
|
20944
20948
|
}
|
20945
20949
|
handleImpressionEvent(placementId, spot) {
|
20946
20950
|
this.pubSubService.publish(RMN_EVENT.SPOT_EVENT, {
|
@@ -21171,6 +21175,16 @@ class LiquidCommerceRmnClient {
|
|
21171
21175
|
async spotSelection(params) {
|
21172
21176
|
return this.selectionService.spotSelection(params);
|
21173
21177
|
}
|
21178
|
+
/**
|
21179
|
+
* Publishes the spot data for a given placement ID to the RMN.
|
21180
|
+
*
|
21181
|
+
* @param {string} placementId - The unique identifier for the placement.
|
21182
|
+
* @param {ISpot} spot - The spot data.
|
21183
|
+
* @return {void} - Does not return any value.
|
21184
|
+
*/
|
21185
|
+
publishSpotToRmn(placementId, spot) {
|
21186
|
+
this.eventService.saveSpotDataToLocalStorage(placementId, spot);
|
21187
|
+
}
|
21174
21188
|
/**
|
21175
21189
|
* Injects the spot elements into their provided placement.
|
21176
21190
|
*
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { RMN_EVENT } from 'enums';
|
2
|
+
import type { ISpot } from 'modules/selection';
|
2
3
|
import type { ILifecycleState, IRegisterSpotParams, IRmnEventMap } from './event.interface';
|
3
4
|
export declare class EventService {
|
4
5
|
private static instance;
|
@@ -23,6 +24,7 @@ export declare class EventService {
|
|
23
24
|
* @returns {void}
|
24
25
|
*/
|
25
26
|
handleSpotState(placementId: string, updates: Partial<ILifecycleState>, publish?: boolean): void;
|
27
|
+
saveSpotDataToLocalStorage(placementId: string, spot: ISpot): void;
|
26
28
|
private handleClickEvent;
|
27
29
|
private handleImpressionEvent;
|
28
30
|
private getSpotIdByPlacementId;
|
@@ -25,6 +25,14 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
25
25
|
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
26
26
|
error: string;
|
27
27
|
}>;
|
28
|
+
/**
|
29
|
+
* Publishes the spot data for a given placement ID to the RMN.
|
30
|
+
*
|
31
|
+
* @param {string} placementId - The unique identifier for the placement.
|
32
|
+
* @param {ISpot} spot - The spot data.
|
33
|
+
* @return {void} - Does not return any value.
|
34
|
+
*/
|
35
|
+
publishSpotToRmn(placementId: string, spot: ISpot): void;
|
28
36
|
/**
|
29
37
|
* Injects the spot elements into their provided placement.
|
30
38
|
*
|
package/dist/types/types.d.ts
CHANGED
@@ -6,11 +6,12 @@ export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
|
|
6
6
|
import type { RMN_ENV, RMN_EVENT } from 'enums';
|
7
7
|
import type { IInjectSpotElementParams } from 'modules/element';
|
8
8
|
import type { IRmnEventMap } from 'modules/event';
|
9
|
-
import type { ISpots, ISpotSelectionParams } from 'modules/selection';
|
9
|
+
import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
|
10
10
|
export interface IRmnClient {
|
11
11
|
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
12
12
|
error: string;
|
13
13
|
}>;
|
14
|
+
publishSpotToRmn(placementId: string, spot: ISpot): void;
|
14
15
|
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
15
16
|
}
|
16
17
|
export interface IRmnEventManager {
|
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.29",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|