@liquidcommercedev/rmn-sdk 1.5.0-beta.3 → 1.5.0-beta.31
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.
- package/dist/index.cjs +4068 -1297
- package/dist/index.esm.js +4069 -1298
- package/dist/types/common/helpers/event-type.helper.d.ts +8 -0
- package/dist/types/common/helpers/extract-deep.helper.d.ts +28 -0
- package/dist/types/common/helpers/index.d.ts +5 -0
- package/dist/types/common/helpers/utils.helper.d.ts +35 -0
- package/dist/types/common/http/api.constant.d.ts +1 -1
- package/dist/types/common/http/api.interface.d.ts +1 -1
- package/dist/types/common/http/base.api.d.ts +1 -1
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/constants/special-char.constant.d.ts +1 -0
- package/dist/types/enums.d.ts +9 -1
- package/dist/types/modules/element/component/skeleton/index.d.ts +2 -0
- package/dist/types/modules/element/component/skeleton/skeleton.component.d.ts +3 -0
- package/dist/types/modules/element/component/skeleton/skeleton.interface.d.ts +14 -0
- package/dist/types/modules/element/component/skeleton/skeleton.template.d.ts +2 -0
- package/dist/types/modules/element/element.constant.d.ts +3 -0
- package/dist/types/modules/element/element.service.d.ts +11 -0
- package/dist/types/modules/element/template/helper.d.ts +2 -1
- package/dist/types/modules/element/template/reservebar/in-text.template.d.ts +3 -0
- package/dist/types/modules/element/template/reservebar/index.d.ts +2 -0
- package/dist/types/modules/element/template/reservebar/video-player.template.d.ts +3 -0
- package/dist/types/modules/event/event.interface.d.ts +11 -32
- package/dist/types/modules/event/event.service.d.ts +13 -27
- package/dist/types/modules/event/index.d.ts +0 -1
- package/dist/types/modules/{event/helpers → helper-service}/index.d.ts +1 -0
- package/dist/types/modules/{event/helpers → helper-service}/intersection.service.d.ts +1 -1
- package/dist/types/modules/helper-service/localstorage.service.d.ts +85 -0
- package/dist/types/modules/{event/pubsub.d.ts → helper-service/pubsub.service.d.ts} +8 -8
- package/dist/types/modules/{event/helpers → helper-service}/resize.service.d.ts +1 -1
- package/dist/types/modules/monitor/index.d.ts +2 -0
- package/dist/types/modules/monitor/monitor.enums.d.ts +5 -0
- package/dist/types/modules/monitor/monitor.interface.d.ts +26 -0
- package/dist/types/modules/monitor/monitor.service.d.ts +12 -0
- package/dist/types/modules/monitor/monitors/datalayer.monitor.d.ts +12 -0
- package/dist/types/modules/selection/selection.interface.d.ts +18 -2
- package/dist/types/modules/selection/selection.service.d.ts +1 -0
- package/dist/types/modules/selection/selection.type.d.ts +5 -9
- package/dist/types/rmn-client.d.ts +26 -25
- package/dist/types/rmn-client.helper.d.ts +36 -0
- package/dist/types/types.d.ts +7 -5
- package/package.json +30 -30
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
- package/dist/types/modules/element/component/utils.d.ts +0 -1
- package/dist/types/modules/event/helpers/localstorage.service.d.ts +0 -26
- /package/dist/types/{static.constant.d.ts → constants/example.constant.d.ts} +0 -0
@@ -1,7 +1,5 @@
|
|
1
1
|
import type { RMN_FILTER_PROPERTIES, RMN_SPOT_TYPE } from 'enums';
|
2
|
-
export type RmnFilterType =
|
3
|
-
[key in RMN_FILTER_PROPERTIES]?: string[];
|
4
|
-
};
|
2
|
+
export type RmnFilterType = Partial<Record<RMN_FILTER_PROPERTIES, string[]>>;
|
5
3
|
export type PlacementIdType = RMN_SPOT_TYPE | `${RMN_SPOT_TYPE}${number}` | string;
|
6
4
|
export type SpotFilterType = {
|
7
5
|
placementId?: PlacementIdType;
|
@@ -19,10 +17,8 @@ type IABSpotTypeKeys = keyof {
|
|
19
17
|
type RBSpotTypeValues = (typeof RMN_SPOT_TYPE)[RBSpotTypeKeys];
|
20
18
|
type IABSpotTypeValues = (typeof RMN_SPOT_TYPE)[IABSpotTypeKeys];
|
21
19
|
export type SpotVariantType = RBSpotTypeValues | `${IABSpotTypeValues}V${number}`;
|
22
|
-
export type SpotDimensionsType = {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
};
|
27
|
-
};
|
20
|
+
export type SpotDimensionsType = Record<RMN_SPOT_TYPE, {
|
21
|
+
width: number;
|
22
|
+
height: number;
|
23
|
+
}>;
|
28
24
|
export {};
|
@@ -2,10 +2,16 @@ import type { IAuthCredentials } from 'modules/auth';
|
|
2
2
|
import type { IInjectSpotElementParams, IRmnCreateSpotElementConfig } from 'modules/element';
|
3
3
|
import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
|
4
4
|
import type { IRmnClient, IRmnConfig, IRmnEventManager } from 'types';
|
5
|
+
/**
|
6
|
+
* LiquidCommerce Rmn Client
|
7
|
+
*
|
8
|
+
* @class
|
9
|
+
*/
|
5
10
|
export declare class LiquidCommerceRmnClient implements IRmnClient {
|
6
11
|
private readonly selectionService;
|
7
12
|
private readonly elementService;
|
8
13
|
private readonly eventService;
|
14
|
+
private intersectionObserver;
|
9
15
|
constructor(auth: IAuthCredentials);
|
10
16
|
/**
|
11
17
|
* Makes a selection request on our server based on the provided data.
|
@@ -14,64 +20,59 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
14
20
|
*
|
15
21
|
* @param {ISpotSelectionParams} params - Spots selection parameters.
|
16
22
|
*
|
17
|
-
* @return {Promise<ISpots | {error : string}>} - The spots response object.
|
23
|
+
* @return {Promise<ISpots | { error : string }>} - The spots response object.
|
18
24
|
*/
|
19
25
|
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
20
26
|
error: string;
|
21
27
|
}>;
|
22
28
|
/**
|
23
|
-
*
|
29
|
+
* Publishes the spot data for a given placement ID to the RMN.
|
24
30
|
*
|
25
|
-
* @param {
|
26
|
-
*
|
27
|
-
* @return {
|
31
|
+
* @param {string} placementId - The unique identifier for the placement.
|
32
|
+
* @param {ISpot} spot - The spot data.
|
33
|
+
* @return {void} - Does not return any value.
|
28
34
|
*/
|
29
|
-
|
35
|
+
publishSpotToRmn(placementId: string, spot: ISpot): void;
|
30
36
|
/**
|
31
|
-
*
|
37
|
+
* Injects the spot elements into their provided placement.
|
32
38
|
*
|
33
39
|
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
34
40
|
*
|
35
|
-
* @return {Promise<
|
41
|
+
* @return {Promise<void>} - A promise that resolves when the spot elements are injected.
|
36
42
|
*/
|
37
|
-
|
43
|
+
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
38
44
|
/**
|
39
|
-
* Injects a
|
45
|
+
* Injects a single spot element into the provided placement.
|
40
46
|
*
|
41
47
|
* @param {HTMLElement} placement - The placement element.
|
42
|
-
* @param {ISpot
|
48
|
+
* @param {ISpot} spot - The spot data.
|
43
49
|
* @param {IInjectSpotElementConfig} config - The configuration object.
|
44
50
|
*
|
45
51
|
* @return {void}
|
46
52
|
*/
|
47
|
-
private
|
53
|
+
private injectOneSpotElement;
|
48
54
|
/**
|
49
|
-
* Injects a
|
55
|
+
* Injects a carousel element with the provided spots into the placement.
|
50
56
|
*
|
51
|
-
* @param {IInjectSpotElement} injectItem - The inject item data.
|
52
57
|
* @param {HTMLElement} placement - The placement element.
|
53
|
-
* @param {ISpot}
|
58
|
+
* @param {ISpot[]} spots - The spot data.
|
54
59
|
* @param {IInjectSpotElementConfig} config - The configuration object.
|
55
60
|
*
|
56
61
|
* @return {void}
|
57
62
|
*/
|
58
|
-
private
|
63
|
+
private injectCarouselSpotElement;
|
59
64
|
/**
|
60
|
-
*
|
61
|
-
*
|
62
|
-
* @param {IInjectSpotElement[]} inject - The inject data.
|
65
|
+
* Makes a selection request on our server based on the provided data.
|
63
66
|
*
|
64
|
-
* @
|
67
|
+
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
65
68
|
*
|
66
|
-
* @return {
|
69
|
+
* @return {Promise<ISpots | {error: string}>} - The spots response object.
|
67
70
|
*/
|
68
|
-
private
|
69
|
-
private preventNonExistentSpotTypes;
|
70
|
-
private updateSpotsState;
|
71
|
-
private useSpotSelectionExample;
|
71
|
+
private injectSpotSelectionRequest;
|
72
72
|
}
|
73
73
|
/**
|
74
74
|
* Creates a new instance of the RmnClient.
|
75
|
+
* Ensures the page is fully loaded before initializing.
|
75
76
|
*
|
76
77
|
* @param {string} apiKey - The api key.
|
77
78
|
* @param {IRmnConfig} config - The configuration object.
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import type { IInjectSpotElement } from 'modules/element';
|
2
|
+
import type { ISpots } from 'modules/selection';
|
3
|
+
/**
|
4
|
+
* Checks if the current environment is a browser environment.
|
5
|
+
*
|
6
|
+
* @return {boolean} - Whether the current environment is a browser environment.
|
7
|
+
*/
|
8
|
+
export declare function isBrowserEnvironment(): boolean;
|
9
|
+
/**
|
10
|
+
* Validates the inject data by preventing duplicate placement ids and non-existent spot types.
|
11
|
+
*
|
12
|
+
* @param {IInjectSpotElement[]} inject - The inject data.
|
13
|
+
* @return {IInjectSpotElement[]} - The validated inject data.
|
14
|
+
*/
|
15
|
+
export declare function validateInjectData(inject: IInjectSpotElement[]): IInjectSpotElement[];
|
16
|
+
/**
|
17
|
+
* Clears the placement element by removing all its children.
|
18
|
+
*
|
19
|
+
* @param {string} placementId - The placement id.
|
20
|
+
*
|
21
|
+
* @return {void}
|
22
|
+
*/
|
23
|
+
export declare function clearPlacement(placementId: string): void;
|
24
|
+
/**
|
25
|
+
* Prepares the spot placement for rendering by taking care of its styling.
|
26
|
+
*
|
27
|
+
* @param {HTMLElement} placement - The placement element.
|
28
|
+
*
|
29
|
+
* @return {void}
|
30
|
+
*/
|
31
|
+
export declare function prepareSpotPlacement(placement: HTMLElement): void;
|
32
|
+
export declare function useSpotSelectionExample(inject: IInjectSpotElement[]): Promise<ISpots | {
|
33
|
+
error: string;
|
34
|
+
}>;
|
35
|
+
export declare function setUserId(): void;
|
36
|
+
export declare function initDOMObserver(elementIds: string[], callback: (element: HTMLElement) => void): MutationObserver;
|
package/dist/types/types.d.ts
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
import type { IEventMap } from './modules/event';
|
2
1
|
export type { IInjectSpotElement, IInjectSpotElementConfig, IInjectSpotElementParams, IRmnCreateSpotElementConfig, ISpotColors, ISpotOverlay, } from 'modules/element';
|
3
2
|
export type { CarouselNavPositionType, ICarouselButtonOptions, ICarouselDotOptions, ICarouselOptions, } from 'modules/element/component/carousel';
|
3
|
+
export type { ILifecycleState, ILSDisplayConfig, ILSDom, ILSIdentifier, ILSState, IRmnEventMap, IRmnSpotEvent, } from 'modules/event';
|
4
4
|
export type { ISpots, RmnFilterType, RmnSpotType } from 'modules/selection';
|
5
5
|
export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
|
6
|
-
import type { RMN_ENV,
|
6
|
+
import type { RMN_ENV, RMN_EVENT } from 'enums';
|
7
7
|
import type { IInjectSpotElementParams } from 'modules/element';
|
8
|
-
import type {
|
8
|
+
import type { IRmnEventMap } from 'modules/event';
|
9
|
+
import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
|
9
10
|
export interface IRmnClient {
|
10
11
|
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
11
12
|
error: string;
|
12
13
|
}>;
|
14
|
+
publishSpotToRmn(placementId: string, spot: ISpot): void;
|
13
15
|
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
14
16
|
}
|
15
17
|
export interface IRmnEventManager {
|
16
|
-
subscribe: (eventType:
|
17
|
-
publish: (eventType:
|
18
|
+
subscribe: (eventType: RMN_EVENT, callback: (data: IRmnEventMap[RMN_EVENT]) => void) => () => void;
|
19
|
+
publish: (eventType: RMN_EVENT, data: IRmnEventMap[RMN_EVENT]) => void;
|
18
20
|
destroySpot: (placementId: string) => void;
|
19
21
|
}
|
20
22
|
export interface IRmnConfig {
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@liquidcommercedev/rmn-sdk",
|
3
3
|
"description": "LiquidCommerce RMN SDK",
|
4
4
|
"author": "LiquidCommerce Tech",
|
5
|
-
"version": "1.5.0-beta.
|
5
|
+
"version": "1.5.0-beta.31",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|
@@ -62,60 +62,60 @@
|
|
62
62
|
"dependencies": {
|
63
63
|
"axios": "^1.7.7",
|
64
64
|
"buffer": "^6.0.3",
|
65
|
-
"jose": "^5.9.
|
65
|
+
"jose": "^5.9.6"
|
66
66
|
},
|
67
67
|
"devDependencies": {
|
68
|
-
"@commitlint/cli": "^
|
69
|
-
"@commitlint/config-conventional": "^
|
70
|
-
"@eslint/eslintrc": "^3.
|
71
|
-
"@eslint/js": "^9.
|
72
|
-
"@rollup/plugin-commonjs": "^
|
68
|
+
"@commitlint/cli": "^19.5.0",
|
69
|
+
"@commitlint/config-conventional": "^19.5.0",
|
70
|
+
"@eslint/eslintrc": "^3.2.0",
|
71
|
+
"@eslint/js": "^9.15.0",
|
72
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
73
73
|
"@rollup/plugin-json": "^6.1.0",
|
74
|
-
"@rollup/plugin-node-resolve": "^15.
|
75
|
-
"@rollup/plugin-replace": "^
|
74
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
75
|
+
"@rollup/plugin-replace": "^6.0.1",
|
76
76
|
"@rollup/plugin-terser": "^0.4.4",
|
77
77
|
"@semantic-release/changelog": "^6.0.3",
|
78
78
|
"@semantic-release/git": "^10.0.1",
|
79
|
-
"@semantic-release/github": "^
|
79
|
+
"@semantic-release/github": "^11.0.1",
|
80
80
|
"@semantic-release/npm": "^12.0.1",
|
81
81
|
"@types/core-js": "^2.5.8",
|
82
82
|
"@types/crypto-js": "^4.2.2",
|
83
83
|
"@types/eslint__js": "^8.42.3",
|
84
|
-
"@types/jest": "^29.
|
85
|
-
"@types/node": "^
|
86
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
87
|
-
"@typescript-eslint/parser": "^8.
|
88
|
-
"@vitest/coverage-v8": "^1.
|
84
|
+
"@types/jest": "^29.5.14",
|
85
|
+
"@types/node": "^22.9.0",
|
86
|
+
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
87
|
+
"@typescript-eslint/parser": "^8.15.0",
|
88
|
+
"@vitest/coverage-v8": "^2.1.5",
|
89
89
|
"conventional-changelog-cli": "^5.0.0",
|
90
90
|
"crypto-js": "^4.2.0",
|
91
91
|
"dotenv": "^16.4.5",
|
92
|
-
"eslint": "^9.
|
92
|
+
"eslint": "^9.15.0",
|
93
93
|
"eslint-config-prettier": "^9.1.0",
|
94
|
-
"eslint-import-resolver-typescript": "^3.6.
|
95
|
-
"eslint-plugin-import": "^2.
|
96
|
-
"eslint-plugin-import-helpers": "^
|
97
|
-
"eslint-plugin-prettier": "^5.1
|
94
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
95
|
+
"eslint-plugin-import": "^2.31.0",
|
96
|
+
"eslint-plugin-import-helpers": "^2.0.1",
|
97
|
+
"eslint-plugin-prettier": "^5.2.1",
|
98
98
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
99
|
-
"eslint-plugin-sonarjs": "^2.0.
|
100
|
-
"eslint-plugin-unicorn": "^
|
99
|
+
"eslint-plugin-sonarjs": "^2.0.4",
|
100
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
101
101
|
"events": "^3.3.0",
|
102
102
|
"jest": "^29.7.0",
|
103
|
-
"jest-environment-jsdom": "^29.
|
103
|
+
"jest-environment-jsdom": "^29.7.0",
|
104
104
|
"prettier": "^3.3.3",
|
105
105
|
"process": "^0.11.10",
|
106
|
-
"rollup": "^4.
|
106
|
+
"rollup": "^4.27.3",
|
107
107
|
"rollup-plugin-livereload": "^2.0.5",
|
108
108
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
109
109
|
"rollup-plugin-serve": "^1.1.1",
|
110
110
|
"rollup-plugin-typescript2": "^0.36.0",
|
111
|
-
"semantic-release": "^24.
|
111
|
+
"semantic-release": "^24.2.0",
|
112
112
|
"ts-jest": "^29.2.5",
|
113
113
|
"ts-node": "^10.9.2",
|
114
|
-
"typedoc": "^0.26.
|
115
|
-
"typescript": "^5.
|
116
|
-
"typescript-eslint": "^8.
|
117
|
-
"vite": "^5.
|
118
|
-
"vitest": "^1.
|
114
|
+
"typedoc": "^0.26.11",
|
115
|
+
"typescript": "^5.6.3",
|
116
|
+
"typescript-eslint": "^8.15.0",
|
117
|
+
"vite": "^5.4.11",
|
118
|
+
"vitest": "^2.1.5"
|
119
119
|
},
|
120
120
|
"engines": {
|
121
121
|
"node": ">=20"
|