@liquidcommercedev/rmn-sdk 1.4.6-beta.2 → 1.4.6-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +567 -471
- package/dist/index.esm.js +567 -472
- package/dist/types/index.umd.d.ts +2 -2
- package/dist/types/modules/element/component/carousel/carousel.component.d.ts +3 -58
- package/dist/types/modules/element/component/carousel/carousel.interface.d.ts +31 -0
- package/dist/types/modules/element/component/carousel/carousel.style.d.ts +2 -1
- package/dist/types/modules/element/component/carousel/index.d.ts +1 -0
- package/dist/types/modules/element/component/spot/index.d.ts +2 -0
- package/dist/types/modules/element/component/spot/spot.component.d.ts +3 -0
- package/dist/types/modules/element/component/spot/spot.interface.d.ts +10 -0
- package/dist/types/modules/element/element.constant.d.ts +2 -1
- package/dist/types/modules/element/element.interface.d.ts +16 -18
- package/dist/types/modules/element/{spot.element.service.d.ts → element.service.d.ts} +15 -3
- package/dist/types/modules/element/index.d.ts +1 -1
- package/dist/types/modules/element/template/helper.d.ts +1 -0
- package/dist/types/modules/element/template/template.service.d.ts +1 -1
- package/dist/types/modules/event/helpers/resize.service.d.ts +1 -1
- package/dist/types/rmn-client.d.ts +21 -8
- package/dist/types/static.constant.d.ts +3 -0
- package/dist/types/types.d.ts +3 -3
- package/package.json +2 -2
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
- package/dist/types/modules/element/spot.element.d.ts +0 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
import { RmnClient } from './index';
|
2
|
-
export { RmnClient };
|
1
|
+
import { RmnClient, RmnCreateSpotElement } from './index';
|
2
|
+
export { RmnClient, RmnCreateSpotElement };
|
@@ -1,58 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
-
}
|
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
|
+
}
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
import type { ICustomCarouselElementData } from './carousel.interface';
|
2
|
+
export declare const CAROUSEL_COMPONENT_STYLE: ({ width, height, fluid }: ICustomCarouselElementData) => string;
|
@@ -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,4 +1,5 @@
|
|
1
|
-
export declare const
|
1
|
+
export declare const SPOT_ELEMENT_TAG = "spot-element";
|
2
|
+
export declare const CAROUSEL_ELEMENT_TAG = "spot-carousel-element";
|
2
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";
|
3
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";
|
4
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";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { RMN_SPOT_TYPE } from 'enums';
|
2
|
-
import type { ICarouselOptions } from './component/carousel';
|
2
|
+
import type { ICarouselOptions, ICreateCarouselElementParams } from './component/carousel';
|
3
|
+
import type { ICreateSpotElementParams } from './component/spot';
|
3
4
|
export interface ISpotColors {
|
4
5
|
textColor?: string;
|
5
6
|
backgroundColor?: string;
|
@@ -10,34 +11,31 @@ export interface ISpotOverlay {
|
|
10
11
|
color: string;
|
11
12
|
colorStop: string;
|
12
13
|
}
|
13
|
-
export interface ISpotBaseConfig {
|
14
|
-
colors?: ISpotColors;
|
15
|
-
minScale?: number;
|
16
|
-
overlay?: ISpotOverlay[];
|
17
|
-
}
|
18
14
|
export interface IInjectSpotElement {
|
19
15
|
placementId: string;
|
20
16
|
spotType: RMN_SPOT_TYPE | string;
|
21
17
|
count?: number;
|
22
18
|
}
|
23
|
-
export interface
|
19
|
+
export interface IInjectSpotElementConfig {
|
20
|
+
url?: string;
|
21
|
+
colors?: ISpotColors;
|
22
|
+
minScale?: number;
|
23
|
+
overlay?: ISpotOverlay[];
|
24
24
|
carousel?: ICarouselOptions;
|
25
25
|
}
|
26
|
-
export interface
|
26
|
+
export interface ICreateElementConfig {
|
27
27
|
width: number;
|
28
28
|
height: number;
|
29
29
|
fluid?: boolean;
|
30
|
-
minScale
|
31
|
-
}
|
32
|
-
export interface ICreateFinalElementParams {
|
33
|
-
content: HTMLElement | string;
|
34
|
-
config: ICreateFinalElementConfig;
|
30
|
+
minScale: number;
|
35
31
|
}
|
36
32
|
export interface IElementService {
|
37
|
-
|
33
|
+
createSpotElement(data: ICreateSpotElementParams): HTMLElement | null;
|
34
|
+
createCarouselElement(data: ICreateCarouselElementParams): HTMLElement | null;
|
38
35
|
}
|
39
|
-
export
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
export interface IRmnCreateSpotElementConfig {
|
37
|
+
fluid?: boolean;
|
38
|
+
colors?: ISpotColors;
|
39
|
+
overlay?: ISpotOverlay[];
|
40
|
+
minScale?: number;
|
43
41
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import type { ISpot } from 'modules/selection';
|
2
|
-
import type {
|
2
|
+
import type { ICreateCarouselElementParams } from './component/carousel';
|
3
|
+
import type { ICreateSpotElementParams } from './component/spot';
|
4
|
+
import type { IElementService, ISpotColors } from './element.interface';
|
3
5
|
export declare class ElementService implements IElementService {
|
4
6
|
static getInstance(): ElementService;
|
5
7
|
/**
|
@@ -7,11 +9,21 @@ export declare class ElementService implements IElementService {
|
|
7
9
|
*
|
8
10
|
* This method is only available in browser environments.
|
9
11
|
*
|
10
|
-
* @param {
|
12
|
+
* @param {ICreateSpotElementParams} params - The parameters to create the final element.
|
11
13
|
*
|
12
14
|
* @return {HTMLElement | null} - The html element or null if the browser environment is not available.
|
13
15
|
*/
|
14
|
-
|
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;
|
15
27
|
/**
|
16
28
|
* Overrides the spot colors with the provided colors.
|
17
29
|
*
|
@@ -7,4 +7,4 @@ import type { ISpotTemplateConfig } from './template.type';
|
|
7
7
|
*
|
8
8
|
* @return {string} - The spot html string.
|
9
9
|
*/
|
10
|
-
export declare const
|
10
|
+
export declare const SPOT_TEMPLATE_HTML_ELEMENT: (spot: ISpot, config?: ISpotTemplateConfig) => HTMLElement | null;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { IAuthCredentials } from 'modules/auth';
|
2
|
-
import type { IInjectSpotElement,
|
3
|
-
import type { ISpots, ISpotSelectionParams } from 'modules/selection';
|
2
|
+
import type { IInjectSpotElement, IInjectSpotElementConfig, IRmnCreateSpotElementConfig } from 'modules/element';
|
3
|
+
import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
|
4
4
|
import type { IRmnClient, IRmnConfig } from 'types';
|
5
5
|
export declare class LiquidCommerceRmnClient implements IRmnClient {
|
6
6
|
private readonly selectionService;
|
@@ -19,18 +19,18 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
19
19
|
/**
|
20
20
|
* Injects the spot elements into their provided placement.
|
21
21
|
*
|
22
|
-
* @param {IInjectSpotElement[]} data - The spot
|
23
|
-
* @param {
|
22
|
+
* @param {IInjectSpotElement[]} data - The spot element's data.
|
23
|
+
* @param {IInjectSpotElementConfig} config - The configuration object.
|
24
24
|
*
|
25
25
|
* @return {Promise<void>} - A promise that resolves when the spot elements are injected.
|
26
26
|
*/
|
27
|
-
injectSpotElement(data: IInjectSpotElement[], config?:
|
27
|
+
injectSpotElement(data: IInjectSpotElement[], config?: IInjectSpotElementConfig): Promise<void>;
|
28
28
|
/**
|
29
29
|
* Injects a carousel element with the provided spots into the placement.
|
30
30
|
*
|
31
31
|
* @param {HTMLElement} placement - The placement element.
|
32
32
|
* @param {ISpot[]} spots - The spot data.
|
33
|
-
* @param {
|
33
|
+
* @param {IInjectSpotElementConfig} config - The configuration object.
|
34
34
|
*
|
35
35
|
* @return {void}
|
36
36
|
*/
|
@@ -41,7 +41,7 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
41
41
|
* @param {IInjectSpotElement} injectItem - The inject item data.
|
42
42
|
* @param {HTMLElement} placement - The placement element.
|
43
43
|
* @param {ISpot} spot - The spot data.
|
44
|
-
* @param {
|
44
|
+
* @param {IInjectSpotElementConfig} config - The configuration object.
|
45
45
|
*
|
46
46
|
* @return {void}
|
47
47
|
*/
|
@@ -64,4 +64,17 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
64
64
|
* @return {Promise<IRmnClient>} - The RmnClient instance.
|
65
65
|
*/
|
66
66
|
declare function RmnClient(apiKey: string, config: IRmnConfig): Promise<IRmnClient>;
|
67
|
-
|
67
|
+
/**
|
68
|
+
* Creates the spot html element based on the provided data using shadow dom.
|
69
|
+
*
|
70
|
+
* This method is useful when you are initializing the client in a non-browser environment.
|
71
|
+
* When you request a spot selection, you will receive the spot data in server-side and return them to the client.
|
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.
|
73
|
+
*
|
74
|
+
* @param {ISpot} spot - The spot data.
|
75
|
+
* @param {IRmnCreateSpotElementConfig} config - The configuration object.
|
76
|
+
*
|
77
|
+
* @return {HTMLElement | null} - The spot html element or null if the browser environment is not available.
|
78
|
+
*/
|
79
|
+
declare function RmnCreateSpotElement(spot: ISpot, config?: IRmnCreateSpotElementConfig): HTMLElement | null;
|
80
|
+
export { RmnClient, RmnCreateSpotElement };
|
package/dist/types/types.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
export type {
|
1
|
+
export type { IInjectSpotElement, IInjectSpotElementConfig, IRmnCreateSpotElementConfig, } from 'modules/element';
|
2
2
|
export type { ISpots, RmnFilterType, RmnSpotType } from 'modules/selection';
|
3
3
|
export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
|
4
4
|
import type { RMN_ENV } from 'enums';
|
5
|
-
import type { IInjectSpotElement,
|
5
|
+
import type { IInjectSpotElement, IInjectSpotElementConfig } from 'modules/element';
|
6
6
|
import type { ISpots, ISpotSelectionParams } from 'modules/selection';
|
7
7
|
export interface IRmnClient {
|
8
8
|
spotSelection(data: ISpotSelectionParams): Promise<ISpots>;
|
9
|
-
injectSpotElement(spots: IInjectSpotElement[], config?:
|
9
|
+
injectSpotElement(spots: IInjectSpotElement[], config?: IInjectSpotElementConfig): Promise<void>;
|
10
10
|
}
|
11
11
|
export interface IRmnConfig {
|
12
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.
|
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\"
|
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"
|