@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.
Files changed (91) hide show
  1. package/dist/index.cjs +3234 -746
  2. package/dist/index.esm.js +3234 -747
  3. package/dist/types/common/helpers/utils.helper.d.ts +50 -0
  4. package/dist/types/common/helpers/uuid.helper.d.ts +49 -0
  5. package/dist/types/enums.d.ts +64 -1
  6. package/dist/types/example.constant.d.ts +4 -0
  7. package/dist/types/index.umd.d.ts +2 -2
  8. package/dist/types/modules/element/component/carousel/carousel.component.d.ts +3 -0
  9. package/dist/types/modules/element/component/carousel/carousel.interface.d.ts +35 -0
  10. package/dist/types/modules/element/component/carousel/carousel.style.d.ts +2 -0
  11. package/dist/types/modules/element/component/carousel/index.d.ts +3 -0
  12. package/dist/types/modules/element/component/spot/index.d.ts +2 -0
  13. package/dist/types/modules/element/component/spot/spot.component.d.ts +3 -0
  14. package/dist/types/modules/element/component/spot/spot.interface.d.ts +10 -0
  15. package/dist/types/modules/{spot/html/constants/html.constant.d.ts → element/element.constant.d.ts} +2 -5
  16. package/dist/types/modules/element/element.interface.d.ts +55 -0
  17. package/dist/types/modules/element/element.service.d.ts +40 -0
  18. package/dist/types/modules/element/index.d.ts +3 -0
  19. package/dist/types/modules/element/template/helper.d.ts +4 -0
  20. package/dist/types/modules/element/template/index.d.ts +1 -0
  21. package/dist/types/modules/element/template/reservebar/collection-banner-without-text-block.template.d.ts +3 -0
  22. package/dist/types/modules/element/template/reservebar/homepage-hero-full-image.template.d.ts +3 -0
  23. package/dist/types/modules/element/template/reservebar/homepage-hero-three-tile.template.d.ts +3 -0
  24. package/dist/types/modules/element/template/reservebar/homepage-hero-two-tile.template.d.ts +3 -0
  25. package/dist/types/modules/element/template/reservebar/large-category-image-tout.template.d.ts +3 -0
  26. package/dist/types/modules/element/template/reservebar/navigation-banner.template.d.ts +3 -0
  27. package/dist/types/modules/element/template/reservebar/small-category-image-tout.template.d.ts +3 -0
  28. package/dist/types/modules/element/template/reservebar/small-discover-tout.template.d.ts +3 -0
  29. package/dist/types/modules/element/template/template.service.d.ts +11 -0
  30. package/dist/types/modules/element/template/template.type.d.ts +11 -0
  31. package/dist/types/modules/event/event.constant.d.ts +1 -0
  32. package/dist/types/modules/event/event.interface.d.ts +46 -0
  33. package/dist/types/modules/event/event.service.d.ts +30 -0
  34. package/dist/types/modules/event/index.d.ts +3 -0
  35. package/dist/types/modules/helper-service/index.d.ts +4 -0
  36. package/dist/types/modules/helper-service/intersection.service.d.ts +8 -0
  37. package/dist/types/modules/helper-service/localstorage.service.d.ts +56 -0
  38. package/dist/types/modules/helper-service/pubsub.service.d.ts +69 -0
  39. package/dist/types/modules/helper-service/resize.service.d.ts +30 -0
  40. package/dist/types/modules/monitor/index.d.ts +2 -0
  41. package/dist/types/modules/monitor/monitor.enums.d.ts +4 -0
  42. package/dist/types/modules/monitor/monitor.interface.d.ts +11 -0
  43. package/dist/types/modules/monitor/monitor.service.d.ts +12 -0
  44. package/dist/types/modules/monitor/monitors/datalayer.monitor.d.ts +12 -0
  45. package/dist/types/modules/selection/index.d.ts +4 -0
  46. package/dist/types/modules/selection/selection.constant.d.ts +1 -0
  47. package/dist/types/modules/{spot/spot.interface.d.ts → selection/selection.interface.d.ts} +13 -14
  48. package/dist/types/modules/selection/selection.service.d.ts +18 -0
  49. package/dist/types/modules/{spot/spot.type.d.ts → selection/selection.type.d.ts} +4 -3
  50. package/dist/types/rmn-client.d.ts +66 -23
  51. package/dist/types/types.d.ts +18 -6
  52. package/package.json +2 -2
  53. package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
  54. package/dist/types/modules/spot/html/constants/index.d.ts +0 -1
  55. package/dist/types/modules/spot/html/index.d.ts +0 -1
  56. package/dist/types/modules/spot/html/spot.element.service.d.ts +0 -7
  57. package/dist/types/modules/spot/html/templates/index.d.ts +0 -1
  58. package/dist/types/modules/spot/html/templates/reservebar/collection-banner-without-text-block.template.d.ts +0 -2
  59. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-full-image.template.d.ts +0 -2
  60. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-three-tile.template.d.ts +0 -2
  61. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-two-tile.template.d.ts +0 -2
  62. package/dist/types/modules/spot/html/templates/reservebar/large-category-image-tout.template.d.ts +0 -2
  63. package/dist/types/modules/spot/html/templates/reservebar/navigation-banner.template.d.ts +0 -2
  64. package/dist/types/modules/spot/html/templates/reservebar/small-category-image-tout.template.d.ts +0 -2
  65. package/dist/types/modules/spot/html/templates/reservebar/small-discover-tout.template.d.ts +0 -2
  66. package/dist/types/modules/spot/html/templates/spot.template.d.ts +0 -21
  67. package/dist/types/modules/spot/index.d.ts +0 -6
  68. package/dist/types/modules/spot/spot.constant.d.ts +0 -4
  69. package/dist/types/modules/spot/spot.enum.d.ts +0 -57
  70. package/dist/types/modules/spot/spot.html.service.d.ts +0 -22
  71. package/dist/types/modules/spot/spot.selection.service.d.ts +0 -15
  72. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v1.template.d.ts +0 -0
  73. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v2.template.d.ts +0 -0
  74. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v3.template.d.ts +0 -0
  75. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/index.d.ts +0 -0
  76. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/in-text-v1.template.d.ts +0 -0
  77. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/index.d.ts +0 -0
  78. /package/dist/types/modules/{spot/html/templates → element/template}/iab/index.d.ts +0 -0
  79. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/index.d.ts +0 -0
  80. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v1.template.d.ts +0 -0
  81. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v2.template.d.ts +0 -0
  82. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/index.d.ts +0 -0
  83. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/large-rectangle-v1.template.d.ts +0 -0
  84. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/index.d.ts +0 -0
  85. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v1.template.d.ts +0 -0
  86. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v2.template.d.ts +0 -0
  87. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/index.d.ts +0 -0
  88. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/vertical-rectangle-v1.template.d.ts +0 -0
  89. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/index.d.ts +0 -0
  90. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/wide-skyscraper-v1.template.d.ts +0 -0
  91. /package/dist/types/modules/{spot/html/templates → element/template}/reservebar/index.d.ts +0 -0
@@ -0,0 +1,50 @@
1
+ import { RMN_SPOT_EVENT } from 'enums';
2
+ import type { IFireEventParams } from 'modules/event';
3
+ export interface IExtractIdsProps {
4
+ id?: string | number;
5
+ upc?: string | number;
6
+ [key: string]: string | number | undefined;
7
+ }
8
+ /**
9
+ * Determines the event type from a raw event string.
10
+ *
11
+ * @param {string} [event] - The raw event string to evaluate.
12
+ * @returns {RMN_SPOT_EVENT | null} - The corresponding RMN_SPOT_EVENT or null if no match is found.
13
+ */
14
+ export declare function getEventTypeFromRawEvent(event?: string): RMN_SPOT_EVENT | null;
15
+ /**
16
+ * Recursively extracts ID values from a nested data structure.
17
+ * Searches for specified property names and collects their primitive values (strings/numbers).
18
+ *
19
+ * @param data - The data structure to search through (can be nested objects/arrays)
20
+ * @param propertyNames - Array of property names to look for
21
+ * @returns Array of extracted ID values (strings/numbers only)
22
+ *
23
+ * @example
24
+ * const data = {
25
+ * id: [1, 2, 3],
26
+ * nested: { id: 'abc' },
27
+ * items: [{ id: 456 }]
28
+ * };
29
+ * extractDeepIds(data); // Returns [1, 2, 3, 'abc', 456]
30
+ */
31
+ export declare function extractDeepIds(data: any, propertyNames?: string[]): Array<string | number>;
32
+ export declare function fallbackEventFire(url: string): Promise<boolean>;
33
+ /**
34
+ * Extracts and decodes a URL from a base64-encoded query parameter.
35
+ *
36
+ * @param {string} url - The URL containing the base64-encoded query parameter.
37
+ * @returns {string | null} - The decoded URL or null if not found or invalid.
38
+ */
39
+ export declare function getRedirectUrlFromPayload(url: string): string | null;
40
+ /**
41
+ * Fires an event using the navigator.sendBeacon method or a fallback method if sendBeacon is not available.
42
+ * If the event is a click event and a redirect URL is found, it redirects the user to that URL.
43
+ *
44
+ * @param {IFireEventParams} params - The parameters for firing the event.
45
+ * @param {RMN_SPOT_EVENT} params.event - The event type.
46
+ * @param {string} params.eventUrl - The URL to which the event is sent.
47
+ * @returns {Promise<void>} - A promise that resolves when the event is fired.
48
+ */
49
+ export declare function fireEvent({ event, eventUrl }: IFireEventParams): Promise<void>;
50
+ export declare function calculateScaleFactor(elementScale: number): number;
@@ -0,0 +1,49 @@
1
+ export declare class UniqueIdGenerator {
2
+ private static readonly epoch;
3
+ private static readonly nodeBits;
4
+ private static readonly sequenceBits;
5
+ private static lastTimestamp;
6
+ private static sequence;
7
+ private static nodeId;
8
+ private static readonly base32Chars;
9
+ /**
10
+ * Initialize the generator with a node ID
11
+ * @param nodeId Number between 0-1023 to identify this instance
12
+ */
13
+ static initialize(nodeId?: number): void;
14
+ /**
15
+ * Convert a number to base32 string with specified length
16
+ */
17
+ private static toBase32;
18
+ /**
19
+ * Generate a cryptographically secure random number
20
+ */
21
+ private static getSecureRandom;
22
+ /**
23
+ * Wait until next millisecond
24
+ */
25
+ private static waitNextMillis;
26
+ /**
27
+ * Generates a highly unique ID with the following format:
28
+ * TTTTTTTTTTCCCCNNNNNRRRR
29
+ * T: Timestamp (10 chars)
30
+ * C: Counter (4 chars)
31
+ * N: Node ID (5 chars)
32
+ * R: Random (4 chars)
33
+ *
34
+ * Total length: 23 characters, always uppercase alphanumeric
35
+ */
36
+ static generate(): string;
37
+ /**
38
+ * Validates if a string matches the expected ID format
39
+ */
40
+ static isValid(id: string): boolean;
41
+ /**
42
+ * Decode base32 string to number
43
+ */
44
+ private static decodeBase32;
45
+ /**
46
+ * Extract timestamp from ID
47
+ */
48
+ static getTimestamp(id: string): Date;
49
+ }
@@ -1,4 +1,67 @@
1
- export * from './modules/spot/spot.enum';
1
+ export declare enum RMN_SPOT_TYPE {
2
+ RB_HOMEPAGE_HERO = "rbHomepageHero",
3
+ RB_HOMEPAGE_HERO_THREE_TILE = "rbHomepageHeroThreeTile",
4
+ RB_HOMEPAGE_HERO_TWO_TILE = "rbHomepageHeroTwoTile",
5
+ RB_HOMEPAGE_HERO_FULL_IMAGE = "rbHomepageHeroFullImage",
6
+ RB_LARGE_CATEGORY_IMAGE_TOUT = "rbLargeCategoryImageTout",
7
+ RB_SMALL_DISCOVER_TOUT = "rbSmallDiscoverTout",
8
+ RB_SMALL_CATEGORY_IMAGE_TOUT = "rbSmallCategoryImageTout",
9
+ RB_COLLECTION_BANNER_WITHOUT_TEXT_BLOCK = "rbCollectionBannerWithoutTextBlock",
10
+ RB_PRODUCT_UPCS = "rbProductUpcs",
11
+ RB_NAVIGATION_BANNER = "rbNavigationBanner",
12
+ BILLBOARD = "billboard",
13
+ LARGE_RECTANGLE = "largeRectangle",
14
+ VERTICAL_RECTANGLE = "verticalRectangle",
15
+ SQUARE = "square",
16
+ LARGE_LEADERBOARD = "largeLeaderboard",
17
+ WIDE_SKYSCRAPER = "wideSkyscraper",
18
+ IN_TEXT = "inText",
19
+ SMALL_RECTANGLE = "smallRectangle",
20
+ MEDIUM_RECTANGLE = "mediumRectangle",
21
+ BANNER = "banner",
22
+ LEADERBOARD = "leaderboard",
23
+ SKYSCRAPER = "skyscraper",
24
+ HALF_PAGE = "halfPage",
25
+ SMALL_SQUARE = "smallSquare",
26
+ VERTICAL_BANNER = "verticalBanner",
27
+ BUTTON_2 = "button2",
28
+ MICRO_BAR = "microBar",
29
+ POP_UP = "popUp",
30
+ PORTRAIT = "portrait",
31
+ SMARTPHONE_BANNER_1 = "smartphoneBanner1",
32
+ SMARTPHONE_BANNER_2 = "smartphoneBanner2",
33
+ MOBILE_PHONE_INTERSTITIAL_1 = "mobilePhoneInterstitial1",
34
+ MOBILE_PHONE_INTERSTITIAL_2 = "mobilePhoneInterstitial2",
35
+ MOBILE_PHONE_INTERSTITIAL_3 = "mobilePhoneInterstitial3",
36
+ FEATURE_PHONE_SMALL_BANNER = "featurePhoneSmallBanner",
37
+ FEATURE_PHONE_MEDIUM_BANNER = "featurePhoneMediumBanner",
38
+ FEATURE_PHONE_LARGE_BANNER = "featurePhoneLargeBanner"
39
+ }
40
+ export declare enum RMN_FILTER_PROPERTIES {
41
+ KEYWORDS = "keywords",
42
+ PAGE_LOCATION = "pageLocation",
43
+ PARENTCO = "parentCo",
44
+ BRAND = "brand",
45
+ CATEGORY = "category",
46
+ TYPE = "type",
47
+ CLASSIFICATION = "classification",
48
+ HOLIDAY = "holiday",
49
+ PUBLISHERS = "publishers",
50
+ SECTION = "section"
51
+ }
52
+ export declare enum RMN_EVENT {
53
+ LIFECYCLE_STATE = "LIFECYCLE_STATE",
54
+ SPOT_EVENT = "SPOT_EVENT"
55
+ }
56
+ export declare enum RMN_SPOT_EVENT {
57
+ IMPRESSION = "IMPRESSION",
58
+ CLICK = "CLICK",
59
+ PURCHASE = "PURCHASE",
60
+ ADD_TO_CART = "ADD_TO_CART",
61
+ REMOVE_FROM_CART = "REMOVE_FROM_CART",
62
+ ADD_TO_WISHLIST = "ADD_TO_WISHLIST",
63
+ BUY_NOW = "BUY_NOW"
64
+ }
2
65
  export declare enum RMN_ENV {
3
66
  LOCAL = "local",
4
67
  DEVELOPMENT = "development",
@@ -0,0 +1,4 @@
1
+ import type { ISpotEvent, ISpots } from 'types';
2
+ export declare const SPOT_EVENTS_EXAMPLE: ISpotEvent[];
3
+ export declare const RB_SPOTS_SELECTION_EXAMPLE: Partial<ISpots>;
4
+ export declare const IAB_SPOTS_SELECTION_EXAMPLE: Partial<ISpots>;
@@ -1,2 +1,2 @@
1
- import { RmnClient, RmnCreateSpotElement } from './index';
2
- export { RmnClient, RmnCreateSpotElement };
1
+ import { RmnClient, RmnCreateSpotElement, RmnEventManager } from './index';
2
+ export { RmnClient, RmnCreateSpotElement, RmnEventManager };
@@ -0,0 +1,3 @@
1
+ import type { ICustomCarouselElement } from './carousel.interface';
2
+ declare let CarouselElement: new () => ICustomCarouselElement;
3
+ export { CarouselElement };
@@ -0,0 +1,35 @@
1
+ import type { ICreateElementConfig } from 'modules/element';
2
+ export type CarouselNavPositionType = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'middle-left' | 'middle-right' | 'middle-sides';
3
+ export interface ICarouselDotOptions {
4
+ position: CarouselNavPositionType;
5
+ color: string;
6
+ activeColor: string;
7
+ size: 'small' | 'base' | 'large';
8
+ opacity: number;
9
+ }
10
+ export interface ICarouselButtonOptions {
11
+ position: CarouselNavPositionType;
12
+ together: boolean;
13
+ textColor: string;
14
+ backgroundColor: string;
15
+ borderRadius: string;
16
+ size: 'small' | 'base' | 'large';
17
+ opacity: number;
18
+ prev: string;
19
+ next: string;
20
+ }
21
+ export interface ICarouselOptions {
22
+ autoplay?: boolean;
23
+ interval?: number;
24
+ useDots?: ICarouselDotOptions | boolean;
25
+ useButtons?: ICarouselButtonOptions | boolean;
26
+ }
27
+ export type ICustomCarouselElementData = ICreateElementConfig & ICarouselOptions;
28
+ export interface ICustomCarouselElement extends HTMLElement {
29
+ data: ICustomCarouselElementData;
30
+ slides: HTMLElement[];
31
+ }
32
+ export interface ICreateCarouselElementParams {
33
+ slides: HTMLElement[];
34
+ config: ICreateElementConfig;
35
+ }
@@ -0,0 +1,2 @@
1
+ import type { ICustomCarouselElementData } from './carousel.interface';
2
+ export declare const CAROUSEL_COMPONENT_STYLE: ({ width, height, fluid }: ICustomCarouselElementData) => string;
@@ -0,0 +1,3 @@
1
+ export * from './carousel.component';
2
+ export * from './carousel.interface';
3
+ export * from './carousel.style';
@@ -0,0 +1,2 @@
1
+ export * from './spot.component';
2
+ export * from './spot.interface';
@@ -0,0 +1,3 @@
1
+ import type { ICustomSpotElement } from './spot.interface';
2
+ declare let SpotElement: new () => ICustomSpotElement;
3
+ export { SpotElement };
@@ -0,0 +1,10 @@
1
+ import type { ICreateElementConfig } from 'modules/element';
2
+ export type ICustomSpotElementData = ICreateElementConfig;
3
+ export interface ICustomSpotElement extends HTMLElement {
4
+ data: ICustomSpotElementData;
5
+ content: HTMLElement;
6
+ }
7
+ export interface ICreateSpotElementParams {
8
+ content: HTMLElement;
9
+ config: ICreateElementConfig;
10
+ }
@@ -1,8 +1,5 @@
1
+ export declare const SPOT_ELEMENT_TAG = "spot-element";
2
+ export declare const CAROUSEL_ELEMENT_TAG = "spot-carousel-element";
1
3
  export declare const GFONT_PRECONNECT = "\n <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n";
2
4
  export declare const GFONT_SOURCE_SANS_3 = "\n <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap\">\n";
3
5
  export declare const GFONT_CORMORANT = "\n <link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@0,300..700;1,300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap\">\n";
4
- export declare const SPOT_ELEMENT_TEMPLATE: (width: number, height: number, hasCustomContent: boolean) => {
5
- style: HTMLStyleElement;
6
- wrapper: HTMLDivElement;
7
- slot: HTMLSlotElement;
8
- };
@@ -0,0 +1,55 @@
1
+ import type { RMN_FILTER_PROPERTIES, RMN_SPOT_TYPE } from 'enums';
2
+ import type { ICarouselOptions, ICreateCarouselElementParams } from 'modules/element/component/carousel';
3
+ import type { ICreateSpotElementParams } from 'modules/element/component/spot';
4
+ import type { RmnFilterType } from 'modules/selection';
5
+ export interface ISpotColors {
6
+ textColor?: string;
7
+ backgroundColor?: string;
8
+ ctaTextColor?: string;
9
+ ctaBorderColor?: string;
10
+ }
11
+ export interface ISpotOverlay {
12
+ size: 'small' | 'base' | 'large';
13
+ color: string;
14
+ opacity: 'light' | 'medium' | 'dark';
15
+ }
16
+ export interface IInjectSpotElementConfig {
17
+ fluid?: boolean;
18
+ url?: string;
19
+ colors?: ISpotColors;
20
+ minScale?: number;
21
+ overlay?: ISpotOverlay;
22
+ carousel?: ICarouselOptions;
23
+ }
24
+ export type IInjectSpotElementFilterType = Partial<Omit<RmnFilterType, RMN_FILTER_PROPERTIES.KEYWORDS> & {
25
+ exactMatch?: string;
26
+ }>;
27
+ export interface IInjectSpotElement {
28
+ placementId: string;
29
+ spotType: RMN_SPOT_TYPE | string;
30
+ count?: number;
31
+ config?: Omit<IInjectSpotElementConfig, 'url'>;
32
+ filter?: IInjectSpotElementFilterType;
33
+ }
34
+ export interface ICreateElementConfig {
35
+ spot?: RMN_SPOT_TYPE;
36
+ width: number;
37
+ height: number;
38
+ fluid?: boolean;
39
+ minScale: number;
40
+ }
41
+ export interface IInjectSpotElementParams {
42
+ inject: IInjectSpotElement[];
43
+ config?: IInjectSpotElementConfig;
44
+ filter?: Partial<RmnFilterType>;
45
+ }
46
+ export interface IElementService {
47
+ createSpotElement(params: ICreateSpotElementParams): HTMLElement | null;
48
+ createCarouselElement(params: ICreateCarouselElementParams): HTMLElement | null;
49
+ }
50
+ export interface IRmnCreateSpotElementConfig {
51
+ fluid?: boolean;
52
+ colors?: ISpotColors;
53
+ overlay?: ISpotOverlay;
54
+ minScale?: number;
55
+ }
@@ -0,0 +1,40 @@
1
+ import type { ISpot } from 'modules/selection';
2
+ import type { ICreateCarouselElementParams } from './component/carousel';
3
+ import type { ICreateSpotElementParams } from './component/spot';
4
+ import type { IElementService, ISpotColors } from './element.interface';
5
+ export declare class ElementService implements IElementService {
6
+ static getInstance(): ElementService;
7
+ /**
8
+ * Creates the html element based on the provided data, content and configs using shadow dom.
9
+ *
10
+ * This method is only available in browser environments.
11
+ *
12
+ * @param {ICreateSpotElementParams} params - The parameters to create the final element.
13
+ *
14
+ * @return {HTMLElement | null} - The html element or null if the browser environment is not available.
15
+ */
16
+ createSpotElement({ content, config }: ICreateSpotElementParams): HTMLElement | null;
17
+ /**
18
+ * Creates the carousel html element based on the provided slides and configs using shadow dom.
19
+ *
20
+ * This method is only available in browser environments.
21
+ *
22
+ * @param {ICreateCarouselElementParams} params - The parameters to create the final element.
23
+ *
24
+ * @return {HTMLElement | null} - The html element or null if the browser environment is not available.
25
+ */
26
+ createCarouselElement({ slides, config, }: ICreateCarouselElementParams): HTMLElement | null;
27
+ /**
28
+ * Overrides the spot colors with the provided colors.
29
+ *
30
+ * @param {ISpot} spot - The spot data.
31
+ * @param {ISpotColors} colors - The colors to override.
32
+ *
33
+ * @return {ISpot} - The spot data with the colors overridden.
34
+ */
35
+ overrideSpotColors(spot: ISpot, colors?: ISpotColors): ISpot;
36
+ /**
37
+ * @returns {boolean} - True if the browser environment is available and the element is defined.
38
+ */
39
+ private ensureBrowserEnvironmentAndDefineElement;
40
+ }
@@ -0,0 +1,3 @@
1
+ export * from './element.constant';
2
+ export * from './element.interface';
3
+ export * from './element.service';
@@ -0,0 +1,4 @@
1
+ import type { ISpotOverlay } from '../element.interface';
2
+ export declare function convertHexToRgba(hex: string, opacity?: number): string;
3
+ export declare function generateGradientColor(overlay?: ISpotOverlay, fallback?: string): string;
4
+ export declare function spotHtmlStringToElement(htmlString: string): HTMLElement;
@@ -0,0 +1 @@
1
+ export * from './template.service';
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbCollectionBannerWithoutTextBlockTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbHomepageHeroFullImageTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbHomepageHeroThreeTileTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbHomepageHeroTwoTileTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbLargeCategoryImageToutTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbNavigationBannerTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbSmallCategoryImageToutTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,3 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from '../template.type';
3
+ export declare function rbSmallDiscoverToutTemplate(spot: ISpot, config: ISpotTemplateConfig): string;
@@ -0,0 +1,11 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from './template.type';
3
+ /**
4
+ * Returns the HTML element for the given spot.
5
+ *
6
+ * @param {ISpot} spot - The spot object.
7
+ * @param {ISpotTemplateConfig} config - The spot template configuration.
8
+ *
9
+ * @return {HTMLElement | null} - The HTML element for the given spot or null if the spot template is not found.
10
+ */
11
+ export declare const SPOT_TEMPLATE_HTML_ELEMENT: (spot: ISpot, config?: ISpotTemplateConfig) => HTMLElement | null;
@@ -0,0 +1,11 @@
1
+ import type { RMN_SPOT_TYPE } from 'enums';
2
+ import type { SpotVariantType } from 'modules/selection';
3
+ import type { ISpot } from 'types';
4
+ import type { ISpotOverlay } from '../element.interface';
5
+ export interface ISpotTemplateConfig {
6
+ overlay?: ISpotOverlay;
7
+ prefix?: string;
8
+ }
9
+ export type TemplateFunction = (spot: ISpot, config: ISpotTemplateConfig) => string;
10
+ export type SpotTypeTemplate = Partial<Record<SpotVariantType, TemplateFunction>>;
11
+ export type SpotTemplates = Record<RMN_SPOT_TYPE, SpotTypeTemplate>;
@@ -0,0 +1 @@
1
+ export declare const EVENT_API_PATH = "/spots/event";
@@ -0,0 +1,46 @@
1
+ import type { RMN_EVENT, RMN_SPOT_EVENT } from 'enums';
2
+ import type { ISpot } from '../selection';
3
+ export interface IFireEventParams {
4
+ event: RMN_SPOT_EVENT;
5
+ eventUrl: string;
6
+ }
7
+ export interface ILSIdentifier {
8
+ placementId: string;
9
+ spotId: string;
10
+ spotType: string;
11
+ }
12
+ export interface ILSDom {
13
+ visibleOnViewport: boolean;
14
+ spotElement?: HTMLElement;
15
+ }
16
+ export interface ILSState {
17
+ mounted: boolean;
18
+ unmounted: boolean;
19
+ loading: boolean;
20
+ error?: string;
21
+ }
22
+ export interface ILSDisplayConfig {
23
+ isCarousel: boolean;
24
+ isCarouselItem: boolean;
25
+ isSingleItem: boolean;
26
+ }
27
+ export interface ILifecycleState {
28
+ identifier: Partial<ILSIdentifier>;
29
+ dom?: Partial<ILSDom>;
30
+ state?: Partial<ILSState>;
31
+ displayConfig?: Partial<ILSDisplayConfig>;
32
+ }
33
+ export interface IRmnSpotEvent {
34
+ eventType: RMN_SPOT_EVENT;
35
+ placementId: string;
36
+ spotId: string;
37
+ }
38
+ export interface IRmnEventMap {
39
+ [RMN_EVENT.LIFECYCLE_STATE]: ILifecycleState;
40
+ [RMN_EVENT.SPOT_EVENT]: IRmnSpotEvent;
41
+ }
42
+ export interface IRegisterSpotParams {
43
+ placementId: string;
44
+ spotElement: HTMLElement;
45
+ spot: ISpot;
46
+ }
@@ -0,0 +1,30 @@
1
+ import { RMN_EVENT } from 'enums';
2
+ import type { ILifecycleState, IRegisterSpotParams, IRmnEventMap } from './event.interface';
3
+ export declare class EventService {
4
+ private static instance;
5
+ private pubSubService;
6
+ private localStorageService;
7
+ private intersectionObserver;
8
+ private spotStates;
9
+ private activeSpots;
10
+ private constructor();
11
+ static getInstance(): EventService;
12
+ subscribe(eventType: RMN_EVENT, callback: (data: IRmnEventMap[RMN_EVENT]) => void): () => void;
13
+ publish(eventType: RMN_EVENT, data: IRmnEventMap[RMN_EVENT]): void;
14
+ registerSpot(params: IRegisterSpotParams): void;
15
+ unregisterSpot(placementId: string): void;
16
+ /**
17
+ * Updates the state of a spot.
18
+ *
19
+ * @param {string} placementId - The placement ID of the spot.
20
+ * @param {Partial<ILifecycleState>} updates - The updates to apply to the spot state.
21
+ * @param {boolean} publish - Whether to publish the updated state.
22
+ *
23
+ * @returns {void}
24
+ */
25
+ handleSpotState(placementId: string, updates: Partial<ILifecycleState>, publish?: boolean): void;
26
+ private deepMerge;
27
+ private handleClick;
28
+ private handleIntersectionObserver;
29
+ private fireImpressionEvent;
30
+ }
@@ -0,0 +1,3 @@
1
+ export * from './event.constant';
2
+ export * from './event.interface';
3
+ export * from './event.service';
@@ -0,0 +1,4 @@
1
+ export * from './intersection.service';
2
+ export * from './localstorage.service';
3
+ export * from './pubsub.service';
4
+ export * from './resize.service';
@@ -0,0 +1,8 @@
1
+ export declare class IntersectionObserverService {
2
+ private observers;
3
+ private readonly defaultOptions;
4
+ constructor(defaultOptions?: IntersectionObserverInit);
5
+ observe(element: HTMLElement, callback: (entry: IntersectionObserverEntry) => void, options?: IntersectionObserverInit): void;
6
+ unobserve(element: HTMLElement): void;
7
+ unobserveAll(): void;
8
+ }
@@ -0,0 +1,56 @@
1
+ import type { RMN_SPOT_TYPE } from 'enums';
2
+ import type { ISpotEvent } from 'modules/selection';
3
+ export interface ILocalStorageSpot {
4
+ placementId: string;
5
+ spotId: string;
6
+ spotType: RMN_SPOT_TYPE;
7
+ events: ISpotEvent[];
8
+ productIds: Array<string | number>;
9
+ createdAt?: number;
10
+ }
11
+ export type LocalStorageSpotsMapType = Map<string, // spotId
12
+ ILocalStorageSpot>;
13
+ export type LocalStorageSpotsObjectType = Record<string, // spotId
14
+ ILocalStorageSpot>;
15
+ export type LocalStorageSpotArray = [
16
+ string,
17
+ string,
18
+ RMN_SPOT_TYPE,
19
+ ISpotEvent[],
20
+ Array<string | number>,
21
+ // PRODUCT_IDS = 4
22
+ number | undefined
23
+ ];
24
+ export declare enum ENUM_LOCAL_STORAGE_SPOT_ARRAY_INDEX {
25
+ PLACEMENT_ID = 0,
26
+ SPOT_ID = 1,
27
+ SPOT_TYPE = 2,
28
+ EVENTS = 3,
29
+ PRODUCT_IDS = 4,
30
+ CREATED_AT = 5
31
+ }
32
+ export type LocalStorageSpotsArrayType = Record<string, // spotId
33
+ LocalStorageSpotArray>;
34
+ export declare class LocalStorageService {
35
+ private spots?;
36
+ private static instance;
37
+ private static readonly localStorageKey;
38
+ private static readonly spotExpirationTime;
39
+ private static readonly encryptData;
40
+ private constructor();
41
+ static getInstance(): LocalStorageService;
42
+ private syncLocalStorage;
43
+ setSpot(spotId: string, data: ILocalStorageSpot): void;
44
+ removeSpot(spotId: string): void;
45
+ getSpot(spotId: string): ILocalStorageSpot | undefined;
46
+ getSpots(): LocalStorageSpotsObjectType | undefined;
47
+ private updateLocalStorage;
48
+ private clearLocalStorage;
49
+ private removeExpiredSpots;
50
+ private mapToObject;
51
+ private objectToMap;
52
+ private objectToArray;
53
+ private arrayToObject;
54
+ private encryptData;
55
+ private decryptData;
56
+ }