@liquidcommercedev/rmn-sdk 1.4.5 → 1.4.6-beta.2

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.
Files changed (79) hide show
  1. package/dist/index.cjs +1330 -734
  2. package/dist/index.esm.js +1331 -734
  3. package/dist/types/enums.d.ts +57 -1
  4. package/dist/types/index.umd.d.ts +2 -2
  5. package/dist/types/modules/element/component/carousel/carousel.component.d.ts +58 -0
  6. package/dist/types/modules/element/component/carousel/carousel.style.d.ts +1 -0
  7. package/dist/types/modules/element/component/carousel/index.d.ts +2 -0
  8. package/dist/types/modules/element/element.constant.d.ts +4 -0
  9. package/dist/types/modules/element/element.interface.d.ts +43 -0
  10. package/dist/types/modules/element/index.d.ts +3 -0
  11. package/dist/types/modules/element/spot.element.d.ts +2 -0
  12. package/dist/types/modules/element/spot.element.service.d.ts +28 -0
  13. package/dist/types/modules/element/template/helper.d.ts +2 -0
  14. package/dist/types/modules/element/template/index.d.ts +1 -0
  15. package/dist/types/modules/element/template/reservebar/collection-banner-without-text-block.template.d.ts +3 -0
  16. package/dist/types/modules/element/template/reservebar/homepage-hero-full-image.template.d.ts +3 -0
  17. package/dist/types/modules/element/template/reservebar/homepage-hero-three-tile.template.d.ts +3 -0
  18. package/dist/types/modules/element/template/reservebar/homepage-hero-two-tile.template.d.ts +3 -0
  19. package/dist/types/modules/element/template/reservebar/large-category-image-tout.template.d.ts +3 -0
  20. package/dist/types/modules/element/template/reservebar/navigation-banner.template.d.ts +3 -0
  21. package/dist/types/modules/element/template/reservebar/small-category-image-tout.template.d.ts +3 -0
  22. package/dist/types/modules/element/template/reservebar/small-discover-tout.template.d.ts +3 -0
  23. package/dist/types/modules/element/template/template.service.d.ts +10 -0
  24. package/dist/types/modules/element/template/template.type.d.ts +11 -0
  25. package/dist/types/modules/event/event.constant.d.ts +1 -0
  26. package/dist/types/modules/event/event.interface.d.ts +5 -0
  27. package/dist/types/modules/event/event.service.d.ts +5 -0
  28. package/dist/types/modules/event/helpers/index.d.ts +2 -0
  29. package/dist/types/modules/event/helpers/intersection.service.d.ts +8 -0
  30. package/dist/types/modules/event/helpers/resize.service.d.ts +30 -0
  31. package/dist/types/modules/event/index.d.ts +3 -0
  32. package/dist/types/modules/selection/index.d.ts +4 -0
  33. package/dist/types/modules/selection/selection.constant.d.ts +1 -0
  34. package/dist/types/modules/{spot/spot.interface.d.ts → selection/selection.interface.d.ts} +4 -13
  35. package/dist/types/modules/selection/selection.service.d.ts +16 -0
  36. package/dist/types/modules/{spot/spot.type.d.ts → selection/selection.type.d.ts} +1 -1
  37. package/dist/types/rmn-client.d.ts +39 -30
  38. package/dist/types/types.d.ts +7 -5
  39. package/package.json +1 -1
  40. package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
  41. package/dist/types/modules/spot/html/index.d.ts +0 -1
  42. package/dist/types/modules/spot/html/spot.element.service.d.ts +0 -7
  43. package/dist/types/modules/spot/html/spot.element.shadow-root.d.ts +0 -5
  44. package/dist/types/modules/spot/html/templates/iab/constants/fonts.constant.d.ts +0 -3
  45. package/dist/types/modules/spot/html/templates/index.d.ts +0 -1
  46. package/dist/types/modules/spot/html/templates/reservebar/collection-banner-without-text-block.template.d.ts +0 -2
  47. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-full-image.template.d.ts +0 -2
  48. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-three-tile.template.d.ts +0 -2
  49. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-two-tile.template.d.ts +0 -2
  50. package/dist/types/modules/spot/html/templates/reservebar/large-category-image-tout.template.d.ts +0 -2
  51. package/dist/types/modules/spot/html/templates/reservebar/navigation-banner.template.d.ts +0 -2
  52. package/dist/types/modules/spot/html/templates/reservebar/small-category-image-tout.template.d.ts +0 -2
  53. package/dist/types/modules/spot/html/templates/reservebar/small-discover-tout.template.d.ts +0 -2
  54. package/dist/types/modules/spot/html/templates/spot.template.d.ts +0 -21
  55. package/dist/types/modules/spot/index.d.ts +0 -6
  56. package/dist/types/modules/spot/spot.constant.d.ts +0 -4
  57. package/dist/types/modules/spot/spot.enum.d.ts +0 -57
  58. package/dist/types/modules/spot/spot.html.service.d.ts +0 -22
  59. package/dist/types/modules/spot/spot.selection.service.d.ts +0 -16
  60. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v1.template.d.ts +0 -0
  61. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v2.template.d.ts +0 -0
  62. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v3.template.d.ts +0 -0
  63. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/index.d.ts +0 -0
  64. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/in-text-v1.template.d.ts +0 -0
  65. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/index.d.ts +0 -0
  66. /package/dist/types/modules/{spot/html/templates → element/template}/iab/index.d.ts +0 -0
  67. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/index.d.ts +0 -0
  68. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v1.template.d.ts +0 -0
  69. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v2.template.d.ts +0 -0
  70. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/index.d.ts +0 -0
  71. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/large-rectangle-v1.template.d.ts +0 -0
  72. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/index.d.ts +0 -0
  73. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v1.template.d.ts +0 -0
  74. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v2.template.d.ts +0 -0
  75. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/index.d.ts +0 -0
  76. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/vertical-rectangle-v1.template.d.ts +0 -0
  77. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/index.d.ts +0 -0
  78. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/wide-skyscraper-v1.template.d.ts +0 -0
  79. /package/dist/types/modules/{spot/html/templates → element/template}/reservebar/index.d.ts +0 -0
@@ -1,4 +1,60 @@
1
- export * from './modules/spot/spot.enum';
1
+ export declare enum RMN_SPOT_TYPE {
2
+ RB_HOMEPAGE_HERO_THREE_TILE = "rbHomepageHeroThreeTile",
3
+ RB_HOMEPAGE_HERO_TWO_TILE = "rbHomepageHeroTwoTile",
4
+ RB_HOMEPAGE_HERO_FULL_IMAGE = "rbHomepageHeroFullImage",
5
+ RB_LARGE_CATEGORY_IMAGE_TOUT = "rbLargeCategoryImageTout",
6
+ RB_SMALL_DISCOVER_TOUT = "rbSmallDiscoverTout",
7
+ RB_SMALL_CATEGORY_IMAGE_TOUT = "rbSmallCategoryImageTout",
8
+ RB_COLLECTION_BANNER_WITHOUT_TEXT_BLOCK = "rbCollectionBannerWithoutTextBlock",
9
+ RB_PRODUCT_UPCS = "rbProductUpcs",
10
+ RB_NAVIGATION_BANNER = "rbNavigationBanner",
11
+ BILLBOARD = "billboard",
12
+ LARGE_RECTANGLE = "largeRectangle",
13
+ VERTICAL_RECTANGLE = "verticalRectangle",
14
+ SQUARE = "square",
15
+ LARGE_LEADERBOARD = "largeLeaderboard",
16
+ WIDE_SKYSCRAPER = "wideSkyscraper",
17
+ IN_TEXT = "inText",
18
+ SMALL_RECTANGLE = "smallRectangle",
19
+ MEDIUM_RECTANGLE = "mediumRectangle",
20
+ BANNER = "banner",
21
+ LEADERBOARD = "leaderboard",
22
+ SKYSCRAPER = "skyscraper",
23
+ HALF_PAGE = "halfPage",
24
+ SMALL_SQUARE = "smallSquare",
25
+ VERTICAL_BANNER = "verticalBanner",
26
+ BUTTON_2 = "button2",
27
+ MICRO_BAR = "microBar",
28
+ POP_UP = "popUp",
29
+ PORTRAIT = "portrait",
30
+ SMARTPHONE_BANNER_1 = "smartphoneBanner1",
31
+ SMARTPHONE_BANNER_2 = "smartphoneBanner2",
32
+ MOBILE_PHONE_INTERSTITIAL_1 = "mobilePhoneInterstitial1",
33
+ MOBILE_PHONE_INTERSTITIAL_2 = "mobilePhoneInterstitial2",
34
+ MOBILE_PHONE_INTERSTITIAL_3 = "mobilePhoneInterstitial3",
35
+ FEATURE_PHONE_SMALL_BANNER = "featurePhoneSmallBanner",
36
+ FEATURE_PHONE_MEDIUM_BANNER = "featurePhoneMediumBanner",
37
+ FEATURE_PHONE_LARGE_BANNER = "featurePhoneLargeBanner"
38
+ }
39
+ export declare enum RMN_FILTER_PROPERTIES {
40
+ KEYWORDS = "keywords",
41
+ PARENTCO = "parentCo",
42
+ BRAND = "brand",
43
+ CATEGORY = "category",
44
+ TYPE = "type",
45
+ CLASSIFICATION = "classification",
46
+ HOLIDAY = "holiday",
47
+ PUBLISHERS = "publishers",
48
+ SECTION = "section"
49
+ }
50
+ export declare enum RMN_SPOT_EVENT {
51
+ IMPRESSION = "IMPRESSION",
52
+ CLICK = "CLICK",
53
+ PURCHASE = "PURCHASE",
54
+ ADD_TO_CART = "ADD_TO_CART",
55
+ ADD_TO_WISHLIST = "ADD_TO_WISHLIST",
56
+ BUY_NOW = "BUY_NOW"
57
+ }
2
58
  export declare enum RMN_ENV {
3
59
  LOCAL = "local",
4
60
  DEVELOPMENT = "development",
@@ -1,2 +1,2 @@
1
- import { RmnClient, RmnCreateSpotElement } from './index';
2
- export { RmnClient, RmnCreateSpotElement };
1
+ import { RmnClient } from './index';
2
+ export { RmnClient };
@@ -0,0 +1,58 @@
1
+ export type CarouselNavPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'middle-left' | 'middle-right' | 'middle-sides';
2
+ export interface ICarouselDotOptions {
3
+ position: CarouselNavPosition;
4
+ color: string;
5
+ activeColor: string;
6
+ }
7
+ export interface ICarouselButtonOptions {
8
+ position: CarouselNavPosition;
9
+ together: boolean;
10
+ textColor: string;
11
+ backgroundColor: string;
12
+ borderRadius: string;
13
+ prev: string;
14
+ next: string;
15
+ }
16
+ export interface ICarouselOptions {
17
+ autoplay?: boolean;
18
+ interval?: number;
19
+ useDots?: ICarouselDotOptions | false;
20
+ useButtons?: ICarouselButtonOptions | false;
21
+ }
22
+ export declare class CarouselComponent {
23
+ private readonly carousel;
24
+ private readonly shadowRoot;
25
+ private readonly slidesContainer;
26
+ private readonly slides;
27
+ private readonly autoplay;
28
+ private readonly interval;
29
+ private readonly dotsOptions;
30
+ private readonly buttonsOptions;
31
+ private currentSlide;
32
+ private dotElements;
33
+ private prevButton;
34
+ private nextButton;
35
+ private autoplayInterval;
36
+ constructor(slides: Array<HTMLElement | string>, options?: ICarouselOptions);
37
+ getElement(): HTMLElement;
38
+ private render;
39
+ private setupCarousel;
40
+ private renderSlides;
41
+ private renderDots;
42
+ private renderButtons;
43
+ private setupDots;
44
+ private setupButtons;
45
+ private nextSlide;
46
+ private prevSlide;
47
+ private goToSlide;
48
+ private updateCarousel;
49
+ private updateDots;
50
+ private startAutoplay;
51
+ private stopAutoplay;
52
+ private resetAutoplay;
53
+ private initializeDotOptions;
54
+ private initializeButtonOptions;
55
+ private validateOptions;
56
+ private validateDotsPosition;
57
+ private validateButtonsPosition;
58
+ }
@@ -0,0 +1 @@
1
+ export declare const CAROUSEL_COMPONENT_STYLE = "\n :host {\n position: relative;\n display: inline-block;\n margin: 0;\n overflow: hidden;\n height: 100%;\n width: 100%;\n }\n\n .carousel-slides {\n position: relative;\n height: 100%;\n width: 100%;\n }\n\n .carousel-slide {\n display: none;\n\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n }\n\n .carousel-slide.active {\n display: flex;\n }\n\n .carousel-dots {\n position: absolute;\n display: flex;\n align-items: center;\n gap: 8px;\n }\n\n .carousel-dots .dot {\n width: 12px;\n height: 12px;\n border-radius: 50%;\n cursor: pointer;\n transition: all 0.3s ease;\n }\n\n .carousel-dots.top-left,\n .carousel-dots.bottom-left {\n left: 10px;\n }\n\n .carousel-dots.top-center,\n .carousel-dots.bottom-center {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .carousel-dots.top-right,\n .carousel-dots.bottom-right {\n right: 10px;\n }\n\n .carousel-dots.top-left,\n .carousel-dots.top-center,\n .carousel-dots.top-right {\n top: 10px;\n }\n\n .carousel-dots.bottom-left,\n .carousel-dots.bottom-center,\n .carousel-dots.bottom-right {\n bottom: 10px;\n }\n\n .carousel-dots.middle-left {\n left: 10px;\n top: 50%;\n transform: translateY(-50%);\n flex-direction: column;\n }\n\n .carousel-dots.middle-right {\n right: 10px;\n top: 50%;\n transform: translateY(-50%);\n flex-direction: column;\n }\n\n .carousel-buttons button {\n background-color: #00000080;\n color: #fff;\n border: none;\n padding: 10px;\n cursor: pointer;\n transition: background-color 0.3s ease;\n }\n\n .carousel-buttons button:hover {\n background-color: #000000b3;\n }\n\n .carousel-buttons.buttons-separate button {\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n }\n\n .carousel-buttons.buttons-separate .prev-button {\n left: 10px;\n }\n\n .carousel-buttons.buttons-separate .next-button {\n right: 10px;\n }\n\n .carousel-buttons.buttons-together {\n position: absolute;\n display: flex;\n gap: 10px;\n }\n\n .carousel-buttons.buttons-together.top-left,\n .carousel-buttons.buttons-together.bottom-left {\n left: 10px;\n }\n\n .carousel-buttons.buttons-together.top-center,\n .carousel-buttons.buttons-together.bottom-center {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .carousel-buttons.buttons-together.top-right,\n .carousel-buttons.buttons-together.bottom-right {\n right: 10px;\n }\n\n .carousel-buttons.buttons-together.top-left,\n .carousel-buttons.buttons-together.top-center,\n .carousel-buttons.buttons-together.top-right {\n top: 10px;\n }\n\n .carousel-buttons.buttons-together.bottom-left,\n .carousel-buttons.buttons-together.bottom-center,\n .carousel-buttons.buttons-together.bottom-right {\n bottom: 10px;\n }\n\n .carousel-buttons.buttons-together.middle-left,\n .carousel-buttons.buttons-together.middle-right {\n top: 50%;\n transform: translateY(-50%);\n flex-direction: column;\n }\n\n .carousel-buttons.buttons-together.middle-left {\n left: 10px;\n }\n\n .carousel-buttons.buttons-together.middle-right {\n right: 10px;\n }\n\n @media (max-width: 768px) {\n .carousel-buttons button {\n padding: 8px 12px;\n font-size: 14px;\n }\n\n .carousel-dots .dot {\n width: 8px;\n height: 8px;\n }\n }\n";
@@ -0,0 +1,2 @@
1
+ export * from './carousel.component';
2
+ export * from './carousel.style';
@@ -0,0 +1,4 @@
1
+ export declare const ELEMENT_TAG = "spot-element";
2
+ 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";
3
+ 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";
4
+ 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";
@@ -0,0 +1,43 @@
1
+ import type { RMN_SPOT_TYPE } from 'enums';
2
+ import type { ICarouselOptions } from './component/carousel';
3
+ export interface ISpotColors {
4
+ textColor?: string;
5
+ backgroundColor?: string;
6
+ ctaTextColor?: string;
7
+ ctaBorderColor?: string;
8
+ }
9
+ export interface ISpotOverlay {
10
+ color: string;
11
+ colorStop: string;
12
+ }
13
+ export interface ISpotBaseConfig {
14
+ colors?: ISpotColors;
15
+ minScale?: number;
16
+ overlay?: ISpotOverlay[];
17
+ }
18
+ export interface IInjectSpotElement {
19
+ placementId: string;
20
+ spotType: RMN_SPOT_TYPE | string;
21
+ count?: number;
22
+ }
23
+ export interface IInjectSpotsConfig extends ISpotBaseConfig {
24
+ carousel?: ICarouselOptions;
25
+ }
26
+ export interface ICreateFinalElementConfig {
27
+ width: number;
28
+ height: number;
29
+ fluid?: boolean;
30
+ minScale?: number;
31
+ }
32
+ export interface ICreateFinalElementParams {
33
+ content: HTMLElement | string;
34
+ config: ICreateFinalElementConfig;
35
+ }
36
+ export interface IElementService {
37
+ createFinalElement(data: ICreateFinalElementParams): HTMLElement | null;
38
+ }
39
+ export type ICustomSpotElementData = ICreateFinalElementConfig;
40
+ export interface ICustomSpotElement extends HTMLElement {
41
+ data: ICustomSpotElementData;
42
+ content: HTMLElement | string;
43
+ }
@@ -0,0 +1,3 @@
1
+ export * from './element.constant';
2
+ export * from './element.interface';
3
+ export * from './spot.element.service';
@@ -0,0 +1,2 @@
1
+ declare let SpotElement: new () => HTMLElement;
2
+ export { SpotElement };
@@ -0,0 +1,28 @@
1
+ import type { ISpot } from 'modules/selection';
2
+ import type { ICreateFinalElementParams, IElementService, ISpotColors } from './element.interface';
3
+ export declare class ElementService implements IElementService {
4
+ static getInstance(): ElementService;
5
+ /**
6
+ * Creates the html element based on the provided data, content and configs using shadow dom.
7
+ *
8
+ * This method is only available in browser environments.
9
+ *
10
+ * @param {ICreateFinalElementParams} params - The parameters to create the final element.
11
+ *
12
+ * @return {HTMLElement | null} - The html element or null if the browser environment is not available.
13
+ */
14
+ createFinalElement({ content, config }: ICreateFinalElementParams): HTMLElement | null;
15
+ /**
16
+ * Overrides the spot colors with the provided colors.
17
+ *
18
+ * @param {ISpot} spot - The spot data.
19
+ * @param {ISpotColors} colors - The colors to override.
20
+ *
21
+ * @return {ISpot} - The spot data with the colors overridden.
22
+ */
23
+ overrideSpotColors(spot: ISpot, colors?: ISpotColors): ISpot;
24
+ /**
25
+ * @returns {boolean} - True if the browser environment is available and the element is defined.
26
+ */
27
+ private ensureBrowserEnvironmentAndDefineElement;
28
+ }
@@ -0,0 +1,2 @@
1
+ import type { ISpotOverlay } from '../element.interface';
2
+ export declare function linearGradientColorStop(overlay: ISpotOverlay[], fallback: string): string;
@@ -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,10 @@
1
+ import type { ISpot } from 'types';
2
+ import type { ISpotTemplateConfig } from './template.type';
3
+ /**
4
+ * Creates the spot html string based on the provided spot data.
5
+ *
6
+ * @param {ISpot} spot - The spot data.
7
+ *
8
+ * @return {string} - The spot html string.
9
+ */
10
+ export declare const GET_SPOT_TEMPLATE_HTML_STRING: (spot: ISpot, config?: ISpotTemplateConfig) => string;
@@ -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,5 @@
1
+ import type { RMN_SPOT_EVENT } from 'enums';
2
+ export interface IFireEventParams {
3
+ event: RMN_SPOT_EVENT;
4
+ eventUrl: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ import type { IFireEventParams } from './event.interface';
2
+ export declare class EventService {
3
+ fireEvent({ event, eventUrl }: IFireEventParams): Promise<void>;
4
+ private getRedirectUrlFromPayload;
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from './intersection.service';
2
+ export * from './resize.service';
@@ -0,0 +1,8 @@
1
+ export declare class IntersectionObserverService {
2
+ private observers;
3
+ private 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,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 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,3 @@
1
+ export * from './event.constant';
2
+ export * from './event.interface';
3
+ export * from './event.service';
@@ -0,0 +1,4 @@
1
+ export * from './selection.constant';
2
+ export * from './selection.interface';
3
+ export * from './selection.service';
4
+ export * from './selection.type';
@@ -0,0 +1 @@
1
+ export declare const SELECTION_API_PATH = "/spots/selection";
@@ -1,6 +1,6 @@
1
- import type { RMN_ENV } from './../../enums';
2
- import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from './spot.enum';
3
- import type { RmnFilterType, RmnSpotType, SpotIdentifierType, SpotVariantType } from './spot.type';
1
+ import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from 'enums';
2
+ import type { SpotIdentifierType, SpotVariantType } from 'modules/selection';
3
+ import type { RmnFilterType, RmnSpotType } from 'types';
4
4
  export interface ISpotSelectionParams {
5
5
  url?: string;
6
6
  spots: RmnSpotType[];
@@ -29,17 +29,8 @@ export interface ISpot {
29
29
  mobilePrimaryImage?: string;
30
30
  mobileSecondaryImage?: string;
31
31
  productUpcs?: string[];
32
- env: RMN_ENV;
33
- }
34
- export interface ICreateSpotElementConfig {
35
- fluid?: boolean;
36
- customContent?: HTMLElement | string;
37
- redirectOnClick?: boolean;
38
32
  }
39
33
  export type ISpots = Record<SpotIdentifierType, ISpot[]>;
40
- export interface ISpotSelectionService {
34
+ export interface ISelectionService {
41
35
  spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
42
36
  }
43
- export interface ISpotHtmlService {
44
- createSpotHtmlElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
45
- }
@@ -0,0 +1,16 @@
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>} - The spots response object.
14
+ */
15
+ spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
16
+ }
@@ -1,4 +1,4 @@
1
- import type { RMN_FILTER_PROPERTIES, RMN_SPOT_TYPE } from './spot.enum';
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
  };
@@ -1,9 +1,10 @@
1
- import type { IAuthCredentials } from './modules/auth';
2
- import type { ICreateSpotElementConfig, ISpot, ISpots, ISpotSelectionParams } from './modules/spot';
3
- import type { IRmnClient, IRmnConfig } from './types';
1
+ import type { IAuthCredentials } from 'modules/auth';
2
+ import type { IInjectSpotElement, IInjectSpotsConfig } from 'modules/element';
3
+ import type { ISpots, ISpotSelectionParams } from 'modules/selection';
4
+ import type { IRmnClient, IRmnConfig } from 'types';
4
5
  export declare class LiquidCommerceRmnClient implements IRmnClient {
5
- private readonly spotSelectionService;
6
- private readonly spotHtmlService;
6
+ private readonly selectionService;
7
+ private readonly elementService;
7
8
  constructor(auth: IAuthCredentials);
8
9
  /**
9
10
  * Makes a selection request on our server based on the provided data.
@@ -16,19 +17,43 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
16
17
  */
17
18
  spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
18
19
  /**
19
- * Creates the spot html element based on the provided data using shadow dom.
20
+ * Injects the spot elements into their provided placement.
20
21
  *
21
- * This method is useful when you are initializing the client in a browser environment, so you can create the spot html element directly from the RmnClient instance.
22
+ * @param {IInjectSpotElement[]} data - The spot elements data.
23
+ * @param {IInjectSpotsConfig} config - The configuration object.
22
24
  *
25
+ * @return {Promise<void>} - A promise that resolves when the spot elements are injected.
26
+ */
27
+ injectSpotElement(data: IInjectSpotElement[], config?: IInjectSpotsConfig): Promise<void>;
28
+ /**
29
+ * Injects a carousel element with the provided spots into the placement.
30
+ *
31
+ * @param {HTMLElement} placement - The placement element.
32
+ * @param {ISpot[]} spots - The spot data.
33
+ * @param {IInjectSpotsConfig} config - The configuration object.
34
+ *
35
+ * @return {void}
36
+ */
37
+ private injectCarouselSpotElement;
38
+ /**
39
+ * Injects a single spot element into the provided placement.
40
+ *
41
+ * @param {IInjectSpotElement} injectItem - The inject item data.
42
+ * @param {HTMLElement} placement - The placement element.
23
43
  * @param {ISpot} spot - The spot data.
24
- * @param {ICreateSpotElementConfig} config - The configuration object.
25
- * @param {ICreateSpotElementConfig.fluid} config.fluid - If the spot should be fluid or not.
26
- * @param {ICreateSpotElementConfig.customContent} config.customContent - Use a custom html element/string.
27
- * @param {ICreateSpotElementConfig.redirectOnClick} config.redirectOnClick - If the spot should redirect on click.
44
+ * @param {IInjectSpotsConfig} config - The configuration object.
45
+ *
46
+ * @return {void}
47
+ */
48
+ private injectOneSpotElement;
49
+ /**
50
+ * Normalizes the spot type data by adding a number suffix to the spot type.
28
51
  *
29
- * @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
52
+ * @param {IInjectSpotElement[]} spots - The spot type data.
53
+ *
54
+ * @return {IInjectSpotElement[]} - The normalized spot type data.
30
55
  */
31
- createSpotElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
56
+ private normalizeDataSpotType;
32
57
  }
33
58
  /**
34
59
  * Creates a new instance of the RmnClient.
@@ -39,20 +64,4 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
39
64
  * @return {Promise<IRmnClient>} - The RmnClient instance.
40
65
  */
41
66
  declare function RmnClient(apiKey: string, config: IRmnConfig): Promise<IRmnClient>;
42
- /**
43
- * Creates the spot html element based on the provided data using shadow dom.
44
- *
45
- * 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 back to the client.
47
- * 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
- *
49
- * @param {ISpot} spot - The spot data.
50
- * @param {ICreateSpotElementConfig} config - The configuration object.
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.
54
- *
55
- * @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
56
- */
57
- declare function RmnCreateSpotElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
58
- export { RmnClient, RmnCreateSpotElement };
67
+ export { RmnClient };
@@ -1,10 +1,12 @@
1
- export type { ICreateSpotElementConfig, ISpotEvent, ISpots, RmnFilterType, RmnSpotType, } from './modules/spot';
2
- export { ISpot, ISpotSelectionParams } from './modules/spot';
3
- import type { RMN_ENV } from './enums';
4
- import type { ICreateSpotElementConfig, ISpot, ISpots, ISpotSelectionParams } from './modules/spot';
1
+ export type { IInjectSpotsConfig } from 'modules/element';
2
+ export type { ISpots, RmnFilterType, RmnSpotType } from 'modules/selection';
3
+ export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
4
+ import type { RMN_ENV } from 'enums';
5
+ import type { IInjectSpotElement, IInjectSpotsConfig } from 'modules/element';
6
+ import type { ISpots, ISpotSelectionParams } from 'modules/selection';
5
7
  export interface IRmnClient {
6
8
  spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
7
- createSpotElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
9
+ injectSpotElement(spots: IInjectSpotElement[], config?: IInjectSpotsConfig): Promise<void>;
8
10
  }
9
11
  export interface IRmnConfig {
10
12
  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.4.5",
5
+ "version": "1.4.6-beta.2",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",