@liquidcommercedev/rmn-sdk 1.4.6-beta.1 → 1.4.6-beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/dist/index.cjs +1360 -645
  2. package/dist/index.esm.js +1360 -645
  3. package/dist/types/enums.d.ts +57 -1
  4. package/dist/types/modules/element/component/carousel/carousel.component.d.ts +3 -0
  5. package/dist/types/modules/element/component/carousel/carousel.interface.d.ts +31 -0
  6. package/dist/types/modules/element/component/carousel/carousel.style.d.ts +2 -0
  7. package/dist/types/modules/element/component/carousel/index.d.ts +3 -0
  8. package/dist/types/modules/element/component/spot/index.d.ts +2 -0
  9. package/dist/types/modules/element/component/spot/spot.component.d.ts +3 -0
  10. package/dist/types/modules/element/component/spot/spot.interface.d.ts +10 -0
  11. package/dist/types/modules/{spot/html/constants/html.constant.d.ts → element/element.constant.d.ts} +2 -5
  12. package/dist/types/modules/element/element.interface.d.ts +41 -0
  13. package/dist/types/modules/element/element.service.d.ts +40 -0
  14. package/dist/types/modules/element/index.d.ts +3 -0
  15. package/dist/types/modules/element/template/helper.d.ts +3 -0
  16. package/dist/types/modules/element/template/index.d.ts +1 -0
  17. package/dist/types/modules/element/template/reservebar/collection-banner-without-text-block.template.d.ts +3 -0
  18. package/dist/types/modules/element/template/reservebar/homepage-hero-full-image.template.d.ts +3 -0
  19. package/dist/types/modules/element/template/reservebar/homepage-hero-three-tile.template.d.ts +3 -0
  20. package/dist/types/modules/element/template/reservebar/homepage-hero-two-tile.template.d.ts +3 -0
  21. package/dist/types/modules/element/template/reservebar/large-category-image-tout.template.d.ts +3 -0
  22. package/dist/types/modules/element/template/reservebar/navigation-banner.template.d.ts +3 -0
  23. package/dist/types/modules/element/template/reservebar/small-category-image-tout.template.d.ts +3 -0
  24. package/dist/types/modules/element/template/reservebar/small-discover-tout.template.d.ts +3 -0
  25. package/dist/types/modules/element/template/template.service.d.ts +10 -0
  26. package/dist/types/modules/element/template/template.type.d.ts +11 -0
  27. package/dist/types/modules/event/event.constant.d.ts +1 -0
  28. package/dist/types/modules/event/event.interface.d.ts +5 -0
  29. package/dist/types/modules/event/event.service.d.ts +5 -0
  30. package/dist/types/modules/event/helpers/index.d.ts +2 -0
  31. package/dist/types/modules/event/helpers/intersection.service.d.ts +8 -0
  32. package/dist/types/modules/event/helpers/resize.service.d.ts +30 -0
  33. package/dist/types/modules/event/index.d.ts +3 -0
  34. package/dist/types/modules/selection/index.d.ts +4 -0
  35. package/dist/types/modules/selection/selection.constant.d.ts +1 -0
  36. package/dist/types/modules/{spot/spot.interface.d.ts → selection/selection.interface.d.ts} +4 -11
  37. package/dist/types/modules/selection/selection.service.d.ts +16 -0
  38. package/dist/types/modules/{spot/spot.type.d.ts → selection/selection.type.d.ts} +1 -1
  39. package/dist/types/rmn-client.d.ts +41 -19
  40. package/dist/types/static.constant.d.ts +3 -0
  41. package/dist/types/types.d.ts +7 -5
  42. package/package.json +2 -2
  43. package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
  44. package/dist/types/modules/spot/html/constants/index.d.ts +0 -1
  45. package/dist/types/modules/spot/html/index.d.ts +0 -1
  46. package/dist/types/modules/spot/html/spot.element.service.d.ts +0 -7
  47. package/dist/types/modules/spot/html/templates/index.d.ts +0 -1
  48. package/dist/types/modules/spot/html/templates/reservebar/collection-banner-without-text-block.template.d.ts +0 -2
  49. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-full-image.template.d.ts +0 -2
  50. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-three-tile.template.d.ts +0 -2
  51. package/dist/types/modules/spot/html/templates/reservebar/homepage-hero-two-tile.template.d.ts +0 -2
  52. package/dist/types/modules/spot/html/templates/reservebar/large-category-image-tout.template.d.ts +0 -2
  53. package/dist/types/modules/spot/html/templates/reservebar/navigation-banner.template.d.ts +0 -2
  54. package/dist/types/modules/spot/html/templates/reservebar/small-category-image-tout.template.d.ts +0 -2
  55. package/dist/types/modules/spot/html/templates/reservebar/small-discover-tout.template.d.ts +0 -2
  56. package/dist/types/modules/spot/html/templates/spot.template.d.ts +0 -21
  57. package/dist/types/modules/spot/index.d.ts +0 -6
  58. package/dist/types/modules/spot/spot.constant.d.ts +0 -4
  59. package/dist/types/modules/spot/spot.enum.d.ts +0 -57
  60. package/dist/types/modules/spot/spot.html.service.d.ts +0 -22
  61. package/dist/types/modules/spot/spot.selection.service.d.ts +0 -15
  62. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v1.template.d.ts +0 -0
  63. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v2.template.d.ts +0 -0
  64. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/billboard-v3.template.d.ts +0 -0
  65. /package/dist/types/modules/{spot/html/templates → element/template}/iab/billboard/index.d.ts +0 -0
  66. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/in-text-v1.template.d.ts +0 -0
  67. /package/dist/types/modules/{spot/html/templates → element/template}/iab/in-text/index.d.ts +0 -0
  68. /package/dist/types/modules/{spot/html/templates → element/template}/iab/index.d.ts +0 -0
  69. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/index.d.ts +0 -0
  70. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v1.template.d.ts +0 -0
  71. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-leaderboard/large-leaderboard-v2.template.d.ts +0 -0
  72. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/index.d.ts +0 -0
  73. /package/dist/types/modules/{spot/html/templates → element/template}/iab/large-rectangle/large-rectangle-v1.template.d.ts +0 -0
  74. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/index.d.ts +0 -0
  75. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v1.template.d.ts +0 -0
  76. /package/dist/types/modules/{spot/html/templates → element/template}/iab/square/square-v2.template.d.ts +0 -0
  77. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/index.d.ts +0 -0
  78. /package/dist/types/modules/{spot/html/templates → element/template}/iab/vertical-rectangle/vertical-rectangle-v1.template.d.ts +0 -0
  79. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/index.d.ts +0 -0
  80. /package/dist/types/modules/{spot/html/templates → element/template}/iab/wide-skyscraper/wide-skyscraper-v1.template.d.ts +0 -0
  81. /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",
@@ -0,0 +1,3 @@
1
+ import type { ICustomCarouselElement } from './carousel.interface';
2
+ declare let CarouselElement: new () => ICustomCarouselElement;
3
+ export { CarouselElement };
@@ -0,0 +1,31 @@
1
+ import type { ICreateElementConfig } from 'modules/element';
2
+ export type CarouselNavPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'middle-left' | 'middle-right' | 'middle-sides';
3
+ export interface ICarouselDotOptions {
4
+ position: CarouselNavPosition;
5
+ color: string;
6
+ activeColor: string;
7
+ }
8
+ export interface ICarouselButtonOptions {
9
+ position: CarouselNavPosition;
10
+ together: boolean;
11
+ textColor: string;
12
+ backgroundColor: string;
13
+ borderRadius: string;
14
+ prev: string;
15
+ next: string;
16
+ }
17
+ export interface ICarouselOptions {
18
+ autoplay?: boolean;
19
+ interval?: number;
20
+ useDots?: ICarouselDotOptions | boolean;
21
+ useButtons?: ICarouselButtonOptions | boolean;
22
+ }
23
+ export type ICustomCarouselElementData = ICreateElementConfig & ICarouselOptions;
24
+ export interface ICustomCarouselElement extends HTMLElement {
25
+ data: ICustomCarouselElementData;
26
+ slides: HTMLElement[];
27
+ }
28
+ export interface ICreateCarouselElementParams {
29
+ slides: HTMLElement[];
30
+ config: ICreateElementConfig;
31
+ }
@@ -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,41 @@
1
+ import type { RMN_SPOT_TYPE } from 'enums';
2
+ import type { ICarouselOptions, ICreateCarouselElementParams } from './component/carousel';
3
+ import type { ICreateSpotElementParams } from './component/spot';
4
+ export interface ISpotColors {
5
+ textColor?: string;
6
+ backgroundColor?: string;
7
+ ctaTextColor?: string;
8
+ ctaBorderColor?: string;
9
+ }
10
+ export interface ISpotOverlay {
11
+ color: string;
12
+ colorStop: string;
13
+ }
14
+ export interface IInjectSpotElement {
15
+ placementId: string;
16
+ spotType: RMN_SPOT_TYPE | string;
17
+ count?: number;
18
+ }
19
+ export interface IInjectSpotElementConfig {
20
+ url?: string;
21
+ colors?: ISpotColors;
22
+ minScale?: number;
23
+ overlay?: ISpotOverlay[];
24
+ carousel?: ICarouselOptions;
25
+ }
26
+ export interface ICreateElementConfig {
27
+ width: number;
28
+ height: number;
29
+ fluid?: boolean;
30
+ minScale: number;
31
+ }
32
+ export interface IElementService {
33
+ createSpotElement(data: ICreateSpotElementParams): HTMLElement | null;
34
+ createCarouselElement(data: ICreateCarouselElementParams): HTMLElement | null;
35
+ }
36
+ export interface IRmnCreateSpotElementConfig {
37
+ fluid?: boolean;
38
+ colors?: ISpotColors;
39
+ overlay?: ISpotOverlay[];
40
+ minScale?: number;
41
+ }
@@ -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,3 @@
1
+ import type { ISpotOverlay } from '../element.interface';
2
+ export declare function linearGradientColorStop(overlay: ISpotOverlay[], fallback: string): string;
3
+ 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,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 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,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,5 +1,6 @@
1
- import type { RMN_SPOT_EVENT, RMN_SPOT_TYPE } from './spot.enum';
2
- 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';
3
4
  export interface ISpotSelectionParams {
4
5
  url?: string;
5
6
  spots: RmnSpotType[];
@@ -29,15 +30,7 @@ export interface ISpot {
29
30
  mobileSecondaryImage?: string;
30
31
  productUpcs?: string[];
31
32
  }
32
- export interface ICreateSpotElementConfig {
33
- fluid?: boolean;
34
- customContent?: HTMLElement | string;
35
- redirectOnClick?: boolean;
36
- }
37
33
  export type ISpots = Record<SpotIdentifierType, ISpot[]>;
38
- export interface ISpotSelectionService {
34
+ export interface ISelectionService {
39
35
  spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
40
36
  }
41
- export interface ISpotHtmlService {
42
- createSpotHtmlElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
43
- }
@@ -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, IInjectSpotElementConfig, IRmnCreateSpotElementConfig } from 'modules/element';
3
+ import type { ISpot, 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 element's data.
23
+ * @param {IInjectSpotElementConfig} 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?: IInjectSpotElementConfig): 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 {IInjectSpotElementConfig} 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 {IInjectSpotElementConfig} 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.
51
+ *
52
+ * @param {IInjectSpotElement[]} spots - The spot type data.
28
53
  *
29
- * @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
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.
@@ -43,16 +68,13 @@ declare function RmnClient(apiKey: string, config: IRmnConfig): Promise<IRmnClie
43
68
  * Creates the spot html element based on the provided data using shadow dom.
44
69
  *
45
70
  * 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.
71
+ * When you request a spot selection, you will receive the spot data in server-side and return them to the client.
47
72
  * 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
73
  *
49
74
  * @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.
75
+ * @param {IRmnCreateSpotElementConfig} config - The configuration object.
54
76
  *
55
77
  * @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
56
78
  */
57
- declare function RmnCreateSpotElement(spot: ISpot, config?: ICreateSpotElementConfig): HTMLElement | null;
79
+ declare function RmnCreateSpotElement(spot: ISpot, config?: IRmnCreateSpotElementConfig): HTMLElement | null;
58
80
  export { RmnClient, RmnCreateSpotElement };
@@ -0,0 +1,3 @@
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>;
@@ -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 { IInjectSpotElement, IInjectSpotElementConfig, IRmnCreateSpotElementConfig, } 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, IInjectSpotElementConfig } 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?: IInjectSpotElementConfig): 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.6-beta.1",
5
+ "version": "1.4.6-beta.3",
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\" --fix",
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"