@liquidcommercedev/rmn-sdk 1.4.6 → 1.5.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +3234 -746
- package/dist/index.esm.js +3234 -747
- package/dist/types/common/helpers/utils.helper.d.ts +50 -0
- package/dist/types/common/helpers/uuid.helper.d.ts +49 -0
- package/dist/types/enums.d.ts +64 -1
- package/dist/types/example.constant.d.ts +4 -0
- package/dist/types/index.umd.d.ts +2 -2
- package/dist/types/modules/element/component/carousel/carousel.component.d.ts +3 -0
- package/dist/types/modules/element/component/carousel/carousel.interface.d.ts +35 -0
- package/dist/types/modules/element/component/carousel/carousel.style.d.ts +2 -0
- package/dist/types/modules/element/component/carousel/index.d.ts +3 -0
- package/dist/types/modules/element/component/spot/index.d.ts +2 -0
- package/dist/types/modules/element/component/spot/spot.component.d.ts +3 -0
- package/dist/types/modules/element/component/spot/spot.interface.d.ts +10 -0
- package/dist/types/modules/{spot/html/constants/html.constant.d.ts → element/element.constant.d.ts} +2 -5
- package/dist/types/modules/element/element.interface.d.ts +55 -0
- package/dist/types/modules/element/element.service.d.ts +40 -0
- package/dist/types/modules/element/index.d.ts +3 -0
- package/dist/types/modules/element/template/helper.d.ts +4 -0
- package/dist/types/modules/element/template/index.d.ts +1 -0
- package/dist/types/modules/element/template/reservebar/collection-banner-without-text-block.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/homepage-hero-full-image.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/homepage-hero-three-tile.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/homepage-hero-two-tile.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/large-category-image-tout.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/navigation-banner.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/small-category-image-tout.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/small-discover-tout.template.d.ts +3 -0
- package/dist/types/modules/element/template/template.service.d.ts +11 -0
- package/dist/types/modules/element/template/template.type.d.ts +11 -0
- package/dist/types/modules/event/event.constant.d.ts +1 -0
- package/dist/types/modules/event/event.interface.d.ts +46 -0
- package/dist/types/modules/event/event.service.d.ts +30 -0
- package/dist/types/modules/event/index.d.ts +3 -0
- package/dist/types/modules/helper-service/index.d.ts +4 -0
- package/dist/types/modules/helper-service/intersection.service.d.ts +8 -0
- package/dist/types/modules/helper-service/localstorage.service.d.ts +56 -0
- package/dist/types/modules/helper-service/pubsub.service.d.ts +69 -0
- package/dist/types/modules/helper-service/resize.service.d.ts +30 -0
- package/dist/types/modules/monitor/index.d.ts +2 -0
- package/dist/types/modules/monitor/monitor.enums.d.ts +4 -0
- package/dist/types/modules/monitor/monitor.interface.d.ts +11 -0
- package/dist/types/modules/monitor/monitor.service.d.ts +12 -0
- package/dist/types/modules/monitor/monitors/datalayer.monitor.d.ts +12 -0
- package/dist/types/modules/selection/index.d.ts +4 -0
- package/dist/types/modules/selection/selection.constant.d.ts +1 -0
- package/dist/types/modules/{spot/spot.interface.d.ts → selection/selection.interface.d.ts} +13 -14
- package/dist/types/modules/selection/selection.service.d.ts +18 -0
- package/dist/types/modules/{spot/spot.type.d.ts → selection/selection.type.d.ts} +4 -3
- package/dist/types/rmn-client.d.ts +66 -23
- package/dist/types/types.d.ts +18 -6
- package/package.json +2 -2
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
- package/dist/types/modules/spot/html/constants/index.d.ts +0 -1
- package/dist/types/modules/spot/html/index.d.ts +0 -1
- package/dist/types/modules/spot/html/spot.element.service.d.ts +0 -7
- package/dist/types/modules/spot/html/templates/index.d.ts +0 -1
- package/dist/types/modules/spot/html/templates/reservebar/collection-banner-without-text-block.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-full-image.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-three-tile.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-two-tile.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/large-category-image-tout.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/navigation-banner.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/small-category-image-tout.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/reservebar/small-discover-tout.template.d.ts +0 -2
- package/dist/types/modules/spot/html/templates/spot.template.d.ts +0 -21
- package/dist/types/modules/spot/index.d.ts +0 -6
- package/dist/types/modules/spot/spot.constant.d.ts +0 -4
- package/dist/types/modules/spot/spot.enum.d.ts +0 -57
- package/dist/types/modules/spot/spot.html.service.d.ts +0 -22
- package/dist/types/modules/spot/spot.selection.service.d.ts +0 -15
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v2.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v3.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/in-text-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v2.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/large-rectangle-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v2.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/vertical-rectangle-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/index.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/wide-skyscraper-v1.template.d.ts +0 -0
- /package/dist/types/modules/{spot/html/templates → element/template}/reservebar/index.d.ts +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
/**
|
2
|
+
* Callback function type for event subscribers
|
3
|
+
* @template T The type of data the callback receives
|
4
|
+
*/
|
5
|
+
export type PubSubCallback<T> = (data: T) => void;
|
6
|
+
/**
|
7
|
+
* Function type for unsubscribing from an event
|
8
|
+
*/
|
9
|
+
export type PubSubUnsubscribe = () => void;
|
10
|
+
/**
|
11
|
+
* PubsubService class
|
12
|
+
* Manages event subscriptions and publications
|
13
|
+
* @template IRmnEventMap A record type defining the structure of events and their data
|
14
|
+
*/
|
15
|
+
export declare class PubsubService<IRmnEventMap> {
|
16
|
+
private static instance;
|
17
|
+
static getInstance<IRmnEventMap>(): PubsubService<IRmnEventMap>;
|
18
|
+
/**
|
19
|
+
* Object to store subscribers for each event type
|
20
|
+
*/
|
21
|
+
private subscribers;
|
22
|
+
/**
|
23
|
+
* Subscribe to an event
|
24
|
+
* @param eventType - The type of event to subscribe to
|
25
|
+
* @param callback - The function to be called when the event is published
|
26
|
+
* @returns A function to unsubscribe from the event
|
27
|
+
*
|
28
|
+
* @Example:
|
29
|
+
* const unsubscribe = pubSub.subscribe('userLogin', (data) => {
|
30
|
+
* console.log(`User ${data.username} logged in`);
|
31
|
+
* });
|
32
|
+
*/
|
33
|
+
subscribe<K extends keyof IRmnEventMap>(eventType: K, callback: PubSubCallback<IRmnEventMap[K]>): PubSubUnsubscribe;
|
34
|
+
/**
|
35
|
+
* Publish an event
|
36
|
+
* @param eventType - The type of event to publish
|
37
|
+
* @param data - The data to be passed to the event subscribers
|
38
|
+
*
|
39
|
+
* @Example:
|
40
|
+
* pubSub.publish('userLogin', { username: 'john_doe', timestamp: Date.now() });
|
41
|
+
*/
|
42
|
+
publish<K extends keyof IRmnEventMap>(eventType: K, data: IRmnEventMap[K]): void;
|
43
|
+
}
|
44
|
+
/**
|
45
|
+
* Usage Example:
|
46
|
+
*
|
47
|
+
* interface IRmnEventMap {
|
48
|
+
* userLogin: { username: string; timestamp: number };
|
49
|
+
* pageView: { url: string; timestamp: number };
|
50
|
+
* }
|
51
|
+
*
|
52
|
+
* const pubSub = new PubsubService<IRmnEventMap>();
|
53
|
+
*
|
54
|
+
* // Subscribe to events
|
55
|
+
* const unsubscribeLogin = pubSub.subscribe('userLogin', (data) => {
|
56
|
+
* console.log(`User ${data.username} logged in at ${new Date(data.timestamp)}`);
|
57
|
+
* });
|
58
|
+
*
|
59
|
+
* pubSub.subscribe('pageView', (data) => {
|
60
|
+
* console.log(`Page ${data.url} viewed at ${new Date(data.timestamp)}`);
|
61
|
+
* });
|
62
|
+
*
|
63
|
+
* // Publish events
|
64
|
+
* pubSub.publish('userLogin', { username: 'john_doe', timestamp: Date.now() });
|
65
|
+
* pubSub.publish('pageView', { url: '/home', timestamp: Date.now() });
|
66
|
+
*
|
67
|
+
* // Unsubscribe from an event
|
68
|
+
* unsubscribeLogin();
|
69
|
+
*/
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export interface IResizeSize {
|
2
|
+
width: number;
|
3
|
+
height: number;
|
4
|
+
}
|
5
|
+
export interface IResizeOptions {
|
6
|
+
element: HTMLElement;
|
7
|
+
maxSize: IResizeSize;
|
8
|
+
minScale: number;
|
9
|
+
}
|
10
|
+
export interface ISizeChangedEvent extends CustomEvent {
|
11
|
+
detail: {
|
12
|
+
width: number;
|
13
|
+
height: number;
|
14
|
+
newWidth: number;
|
15
|
+
newHeight: number;
|
16
|
+
scale: number;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
export declare class ResizeObserverService {
|
20
|
+
private element;
|
21
|
+
private readonly container;
|
22
|
+
private resizeObserver;
|
23
|
+
private maxSize;
|
24
|
+
private minSize;
|
25
|
+
private aspectRatio;
|
26
|
+
constructor({ element, maxSize, minScale }: IResizeOptions);
|
27
|
+
private setDimensions;
|
28
|
+
private updateElementSize;
|
29
|
+
disconnect(): void;
|
30
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { RMN_SPOT_EVENT } from 'enums';
|
2
|
+
export interface INormalizedEventData {
|
3
|
+
event: RMN_SPOT_EVENT;
|
4
|
+
productIds: Array<string | number>;
|
5
|
+
}
|
6
|
+
export interface IFireAndPublishSpotEventParams {
|
7
|
+
spotEvent: RMN_SPOT_EVENT;
|
8
|
+
eventUrl: string;
|
9
|
+
placementId: string;
|
10
|
+
spotId: string;
|
11
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export declare class MonitorService {
|
2
|
+
private static instance;
|
3
|
+
private readonly implementedMonitor?;
|
4
|
+
private readonly pubSubService?;
|
5
|
+
private readonly localStorageService?;
|
6
|
+
private constructor();
|
7
|
+
static getInstance(): MonitorService;
|
8
|
+
start(): void;
|
9
|
+
private matchAndFireEvent;
|
10
|
+
private fireAndPublishSpotEvent;
|
11
|
+
private detectAnalyticsTool;
|
12
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { INormalizedEventData } from '../monitor.interface';
|
2
|
+
export declare class DataLayerMonitor {
|
3
|
+
private static instance;
|
4
|
+
private readonly originalPush;
|
5
|
+
private listener?;
|
6
|
+
private constructor();
|
7
|
+
static getInstance(): DataLayerMonitor;
|
8
|
+
setListener(listener: (data: INormalizedEventData) => void): void;
|
9
|
+
start(): void;
|
10
|
+
private cleanEventData;
|
11
|
+
stop(): void;
|
12
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const SELECTION_API_PATH = "/spots/selection";
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from '
|
2
|
-
import type {
|
1
|
+
import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from 'enums';
|
2
|
+
import type { PlacementIdType, SpotVariantType } from 'modules/selection';
|
3
|
+
import type { RmnFilterType, RmnSpotType } from 'types';
|
3
4
|
export interface ISpotSelectionParams {
|
4
5
|
url?: string;
|
5
6
|
spots: RmnSpotType[];
|
@@ -10,6 +11,7 @@ export interface ISpotEvent {
|
|
10
11
|
url: string;
|
11
12
|
}
|
12
13
|
export interface ISpot {
|
14
|
+
id: string;
|
13
15
|
events: ISpotEvent[];
|
14
16
|
spot: RMN_SPOT_TYPE;
|
15
17
|
variant: SpotVariantType;
|
@@ -27,17 +29,14 @@ export interface ISpot {
|
|
27
29
|
secondaryImage?: string;
|
28
30
|
mobilePrimaryImage?: string;
|
29
31
|
mobileSecondaryImage?: string;
|
30
|
-
|
32
|
+
productIds?: Array<string | number>;
|
33
|
+
rbProductUpcs?: Array<string | number>;
|
34
|
+
rbProductSalsifyGroupings?: Array<string | number>;
|
35
|
+
rbProductSalsifyPids?: Array<string | number>;
|
31
36
|
}
|
32
|
-
export
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
export type ISpots = Record<SpotIdentifierType, ISpot[]>;
|
38
|
-
export interface ISpotSelectionService {
|
39
|
-
spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
|
40
|
-
}
|
41
|
-
export interface ISpotHtmlService {
|
42
|
-
createSpotHtmlElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
|
37
|
+
export type ISpots = Record<PlacementIdType, ISpot[]>;
|
38
|
+
export interface ISelectionService {
|
39
|
+
spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
|
40
|
+
error: string;
|
41
|
+
}>;
|
43
42
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { BaseApi } from 'common/http';
|
2
|
+
import type { IAuthCredentials } from 'modules/auth';
|
3
|
+
import type { ISpots } from 'modules/selection';
|
4
|
+
import type { ISelectionService, ISpotSelectionParams } from './selection.interface';
|
5
|
+
export declare class SelectionService extends BaseApi implements ISelectionService {
|
6
|
+
private constructor();
|
7
|
+
static getInstance(auth: IAuthCredentials): SelectionService;
|
8
|
+
/**
|
9
|
+
* Makes a selection request on our server based on the provided data.
|
10
|
+
*
|
11
|
+
* @param {ISpotSelectionParams} data - Spots selection parameters.
|
12
|
+
*
|
13
|
+
* @return {Promise<ISpots | { error: string }>} - The spots response object.
|
14
|
+
*/
|
15
|
+
spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
|
16
|
+
error: string;
|
17
|
+
}>;
|
18
|
+
}
|
@@ -1,13 +1,14 @@
|
|
1
|
-
import type { RMN_FILTER_PROPERTIES, RMN_SPOT_TYPE } from '
|
1
|
+
import type { RMN_FILTER_PROPERTIES, RMN_SPOT_TYPE } from 'enums';
|
2
2
|
export type RmnFilterType = {
|
3
3
|
[key in RMN_FILTER_PROPERTIES]?: string[];
|
4
4
|
};
|
5
|
+
export type PlacementIdType = RMN_SPOT_TYPE | `${RMN_SPOT_TYPE}${number}` | string;
|
5
6
|
export type SpotFilterType = {
|
7
|
+
placementId?: PlacementIdType;
|
6
8
|
spot: RMN_SPOT_TYPE | string;
|
7
|
-
count
|
9
|
+
count?: number;
|
8
10
|
exactMatch?: string;
|
9
11
|
} & Omit<RmnFilterType, RMN_FILTER_PROPERTIES.KEYWORDS>;
|
10
|
-
export type SpotIdentifierType = RMN_SPOT_TYPE | `${RMN_SPOT_TYPE}${number}`;
|
11
12
|
export type RmnSpotType = RMN_SPOT_TYPE | string | SpotFilterType;
|
12
13
|
type RBSpotTypeKeys = keyof {
|
13
14
|
[K in keyof typeof RMN_SPOT_TYPE as K extends `RB_${string}` ? K : never]: (typeof RMN_SPOT_TYPE)[K];
|
@@ -1,34 +1,74 @@
|
|
1
|
-
import type { IAuthCredentials } from '
|
2
|
-
import type {
|
3
|
-
import type {
|
1
|
+
import type { IAuthCredentials } from 'modules/auth';
|
2
|
+
import type { IInjectSpotElementParams, IRmnCreateSpotElementConfig } from 'modules/element';
|
3
|
+
import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
|
4
|
+
import type { IRmnClient, IRmnConfig, IRmnEventManager } from 'types';
|
4
5
|
export declare class LiquidCommerceRmnClient implements IRmnClient {
|
5
|
-
private readonly
|
6
|
-
private readonly
|
6
|
+
private readonly selectionService;
|
7
|
+
private readonly elementService;
|
8
|
+
private readonly eventService;
|
7
9
|
constructor(auth: IAuthCredentials);
|
8
10
|
/**
|
9
11
|
* Makes a selection request on our server based on the provided data.
|
10
12
|
*
|
11
13
|
* To create a spot html element, use the RmnCreateSpotElement function.
|
12
14
|
*
|
13
|
-
* @param {ISpotSelectionParams}
|
15
|
+
* @param {ISpotSelectionParams} params - Spots selection parameters.
|
14
16
|
*
|
15
|
-
* @return {Promise<ISpots>} - The spots response object.
|
17
|
+
* @return {Promise<ISpots | { error : string }>} - The spots response object.
|
16
18
|
*/
|
17
|
-
spotSelection(
|
19
|
+
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
20
|
+
error: string;
|
21
|
+
}>;
|
18
22
|
/**
|
19
|
-
*
|
23
|
+
* Injects the spot elements into their provided placement.
|
20
24
|
*
|
21
|
-
*
|
25
|
+
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
22
26
|
*
|
27
|
+
* @return {Promise<void>} - A promise that resolves when the spot elements are injected.
|
28
|
+
*/
|
29
|
+
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
30
|
+
/**
|
31
|
+
* Makes a selection request on our server based on the provided data.
|
32
|
+
*
|
33
|
+
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
34
|
+
*
|
35
|
+
* @return {Promise<ISpots | {error: string}>} - The spots response object.
|
36
|
+
*/
|
37
|
+
private spotSelectionRequest;
|
38
|
+
/**
|
39
|
+
* Injects a carousel element with the provided spots into the placement.
|
40
|
+
*
|
41
|
+
* @param {HTMLElement} placement - The placement element.
|
42
|
+
* @param {ISpot[]} spots - The spot data.
|
43
|
+
* @param {IInjectSpotElementConfig} config - The configuration object.
|
44
|
+
*
|
45
|
+
* @return {void}
|
46
|
+
*/
|
47
|
+
private injectCarouselSpotElement;
|
48
|
+
/**
|
49
|
+
* Injects a single spot element into the provided placement.
|
50
|
+
*
|
51
|
+
* @param {IInjectSpotElement} injectItem - The inject item data.
|
52
|
+
* @param {HTMLElement} placement - The placement element.
|
23
53
|
* @param {ISpot} spot - The spot data.
|
24
|
-
* @param {
|
25
|
-
*
|
26
|
-
* @
|
27
|
-
|
54
|
+
* @param {IInjectSpotElementConfig} config - The configuration object.
|
55
|
+
*
|
56
|
+
* @return {void}
|
57
|
+
*/
|
58
|
+
private injectOneSpotElement;
|
59
|
+
/**
|
60
|
+
* Prevents duplicate placement ids in the inject data.
|
28
61
|
*
|
29
|
-
* @
|
62
|
+
* @param {IInjectSpotElement[]} inject - The inject data.
|
63
|
+
*
|
64
|
+
* @throws {Error} - If a duplicate placement id is found.
|
65
|
+
*
|
66
|
+
* @return {void}
|
30
67
|
*/
|
31
|
-
|
68
|
+
private preventDuplicateSpotPlacementIds;
|
69
|
+
private preventNonExistentSpotTypes;
|
70
|
+
private updateSpotsState;
|
71
|
+
private useSpotSelectionExample;
|
32
72
|
}
|
33
73
|
/**
|
34
74
|
* Creates a new instance of the RmnClient.
|
@@ -39,20 +79,23 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
39
79
|
* @return {Promise<IRmnClient>} - The RmnClient instance.
|
40
80
|
*/
|
41
81
|
declare function RmnClient(apiKey: string, config: IRmnConfig): Promise<IRmnClient>;
|
82
|
+
/**
|
83
|
+
* Creates a new instance of the RmnEventManager.
|
84
|
+
*
|
85
|
+
* @return {IRmnEventManager} - The RmnEventManager instance.
|
86
|
+
*/
|
87
|
+
declare function RmnEventManager(): IRmnEventManager;
|
42
88
|
/**
|
43
89
|
* Creates the spot html element based on the provided data using shadow dom.
|
44
90
|
*
|
45
91
|
* This method is useful when you are initializing the client in a non-browser environment.
|
46
|
-
* When you request a spot selection, you will receive the spot data in server-side and return them
|
92
|
+
* When you request a spot selection, you will receive the spot data in server-side and return them to the client.
|
47
93
|
* Then you can use this function to create the spot html element based on the provided data without the need of the RmnClient instance.
|
48
94
|
*
|
49
95
|
* @param {ISpot} spot - The spot data.
|
50
|
-
* @param {
|
51
|
-
* @param {ICreateSpotElementConfig.fluid} config.fluid - If the spot should be fluid or not.
|
52
|
-
* @param {ICreateSpotElementConfig.customContent} config.customContent - Use a custom html element/string.
|
53
|
-
* @param {ICreateSpotElementConfig.redirectOnClick} config.redirectOnClick - If the spot should redirect on click.
|
96
|
+
* @param {IRmnCreateSpotElementConfig} config - The configuration object.
|
54
97
|
*
|
55
98
|
* @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
|
56
99
|
*/
|
57
|
-
declare function RmnCreateSpotElement(spot: ISpot, config?:
|
58
|
-
export { RmnClient, RmnCreateSpotElement };
|
100
|
+
declare function RmnCreateSpotElement(spot: ISpot, config?: IRmnCreateSpotElementConfig): HTMLElement | null;
|
101
|
+
export { RmnClient, RmnCreateSpotElement, RmnEventManager };
|
package/dist/types/types.d.ts
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
-
export type {
|
2
|
-
export {
|
3
|
-
|
4
|
-
|
1
|
+
export type { IInjectSpotElement, IInjectSpotElementConfig, IInjectSpotElementParams, IRmnCreateSpotElementConfig, ISpotColors, ISpotOverlay, } from 'modules/element';
|
2
|
+
export type { CarouselNavPositionType, ICarouselButtonOptions, ICarouselDotOptions, ICarouselOptions, } from 'modules/element/component/carousel';
|
3
|
+
export type { ILifecycleState, ILSDisplayConfig, ILSDom, ILSIdentifier, ILSState, IRmnEventMap, IRmnSpotEvent, } from 'modules/event';
|
4
|
+
export type { ISpots, RmnFilterType, RmnSpotType } from 'modules/selection';
|
5
|
+
export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
|
6
|
+
import type { RMN_ENV, RMN_EVENT } from 'enums';
|
7
|
+
import type { IInjectSpotElementParams } from 'modules/element';
|
8
|
+
import type { IRmnEventMap } from 'modules/event';
|
9
|
+
import type { ISpots, ISpotSelectionParams } from 'modules/selection';
|
5
10
|
export interface IRmnClient {
|
6
|
-
spotSelection(
|
7
|
-
|
11
|
+
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
12
|
+
error: string;
|
13
|
+
}>;
|
14
|
+
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
15
|
+
}
|
16
|
+
export interface IRmnEventManager {
|
17
|
+
subscribe: (eventType: RMN_EVENT, callback: (data: IRmnEventMap[RMN_EVENT]) => void) => () => void;
|
18
|
+
publish: (eventType: RMN_EVENT, data: IRmnEventMap[RMN_EVENT]) => void;
|
19
|
+
destroySpot: (placementId: string) => void;
|
8
20
|
}
|
9
21
|
export interface IRmnConfig {
|
10
22
|
env: RMN_ENV;
|
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
|
+
"version": "1.5.0-beta.10",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"test": "vitest run",
|
43
43
|
"test:watch": "vitest",
|
44
44
|
"test:coverage": "vitest run --coverage",
|
45
|
-
"lint": "eslint \"src/**/*.ts\"
|
45
|
+
"lint": "eslint \"src/**/*.ts\"",
|
46
46
|
"format": "prettier --write \"src/**/*.ts\"",
|
47
47
|
"docs": "typedoc --out docs src",
|
48
48
|
"prepublishOnly": "pnpm run build"
|