@liquidcommercedev/rmn-sdk 1.4.6-beta.5 → 1.4.6-beta.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +267 -203
- package/dist/index.esm.js +267 -203
- package/dist/types/enums.d.ts +1 -1
- package/dist/types/modules/element/component/utils.d.ts +1 -0
- package/dist/types/modules/element/element.interface.d.ts +2 -0
- package/dist/types/modules/event/event.interface.d.ts +13 -14
- package/dist/types/modules/event/index.d.ts +1 -0
- package/dist/types/modules/selection/selection.interface.d.ts +3 -1
- package/dist/types/modules/selection/selection.service.d.ts +4 -2
- package/dist/types/rmn-client.d.ts +7 -3
- package/dist/types/types.d.ts +3 -1
- package/package.json +1 -1
- package/umd/liquidcommerce-rmn-sdk.min.js +1 -1
package/dist/types/enums.d.ts
CHANGED
@@ -49,9 +49,9 @@ export declare enum RMN_FILTER_PROPERTIES {
|
|
49
49
|
SECTION = "section"
|
50
50
|
}
|
51
51
|
export declare enum RMN_SPOT_EVENT {
|
52
|
+
INJECT_SPOTS = "INJECT_SPOTS",
|
52
53
|
MOUNTED = "MOUNTED",
|
53
54
|
UNMOUNTED = "UNMOUNTED",
|
54
|
-
RESIZED = "RESIZED",
|
55
55
|
IMPRESSION = "IMPRESSION",
|
56
56
|
CLICK = "CLICK",
|
57
57
|
PURCHASE = "PURCHASE",
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function calculateScaleFactor(elementScale: number): number;
|
@@ -13,6 +13,7 @@ export interface ISpotOverlay {
|
|
13
13
|
colorStop: string;
|
14
14
|
}
|
15
15
|
export interface IInjectSpotElementConfig {
|
16
|
+
fluid?: boolean;
|
16
17
|
url?: string;
|
17
18
|
colors?: ISpotColors;
|
18
19
|
minScale?: number;
|
@@ -27,6 +28,7 @@ export interface IInjectSpotElement {
|
|
27
28
|
filter?: Partial<RmnFilterType>;
|
28
29
|
}
|
29
30
|
export interface ICreateElementConfig {
|
31
|
+
spot?: RMN_SPOT_TYPE;
|
30
32
|
width: number;
|
31
33
|
height: number;
|
32
34
|
fluid?: boolean;
|
@@ -4,6 +4,18 @@ export interface IFireEventParams {
|
|
4
4
|
event: RMN_SPOT_EVENT;
|
5
5
|
eventUrl: string;
|
6
6
|
}
|
7
|
+
export interface IInjectSpotError {
|
8
|
+
message: string;
|
9
|
+
spot?: {
|
10
|
+
type?: string;
|
11
|
+
placementId?: string;
|
12
|
+
};
|
13
|
+
}
|
14
|
+
export interface IInjectSpotsEvent {
|
15
|
+
isLoading: boolean;
|
16
|
+
isCompleted: boolean;
|
17
|
+
error: null | IInjectSpotError;
|
18
|
+
}
|
7
19
|
export interface IMountedEvent {
|
8
20
|
placementId: string;
|
9
21
|
spotId: string;
|
@@ -15,19 +27,6 @@ export interface IUnMountedEvent {
|
|
15
27
|
placementId: string;
|
16
28
|
spotId: string;
|
17
29
|
}
|
18
|
-
export interface IResizedEvent {
|
19
|
-
placementId: string;
|
20
|
-
spotId: string;
|
21
|
-
scale: number;
|
22
|
-
previousDimensions: {
|
23
|
-
width: number;
|
24
|
-
height: number;
|
25
|
-
};
|
26
|
-
currentDimensions: {
|
27
|
-
width: number;
|
28
|
-
height: number;
|
29
|
-
};
|
30
|
-
}
|
31
30
|
export interface IClickEvent {
|
32
31
|
placementId: string;
|
33
32
|
spotId: string;
|
@@ -55,9 +54,9 @@ export interface IBuyNowEvent {
|
|
55
54
|
spotId: string;
|
56
55
|
}
|
57
56
|
export interface IEventMap {
|
57
|
+
[RMN_SPOT_EVENT.INJECT_SPOTS]: IInjectSpotsEvent;
|
58
58
|
[RMN_SPOT_EVENT.MOUNTED]: IMountedEvent;
|
59
59
|
[RMN_SPOT_EVENT.UNMOUNTED]: IUnMountedEvent;
|
60
|
-
[RMN_SPOT_EVENT.RESIZED]: IResizedEvent;
|
61
60
|
[RMN_SPOT_EVENT.CLICK]: IClickEvent;
|
62
61
|
[RMN_SPOT_EVENT.IMPRESSION]: IImpressionEvent;
|
63
62
|
[RMN_SPOT_EVENT.ADD_TO_CART]: IAddToCartEvent;
|
@@ -33,5 +33,7 @@ export interface ISpot {
|
|
33
33
|
}
|
34
34
|
export type ISpots = Record<PlacementIdType, ISpot[]>;
|
35
35
|
export interface ISelectionService {
|
36
|
-
spotSelection(data: ISpotSelectionParams): Promise<ISpots
|
36
|
+
spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
|
37
|
+
error: string;
|
38
|
+
}>;
|
37
39
|
}
|
@@ -10,7 +10,9 @@ export declare class SelectionService extends BaseApi implements ISelectionServi
|
|
10
10
|
*
|
11
11
|
* @param {ISpotSelectionParams} data - Spots selection parameters.
|
12
12
|
*
|
13
|
-
* @return {Promise<ISpots>} - The spots response object.
|
13
|
+
* @return {Promise<ISpots | { error: string }>} - The spots response object.
|
14
14
|
*/
|
15
|
-
spotSelection(data: ISpotSelectionParams): Promise<ISpots
|
15
|
+
spotSelection(data: ISpotSelectionParams): Promise<ISpots | {
|
16
|
+
error: string;
|
17
|
+
}>;
|
16
18
|
}
|
@@ -15,9 +15,11 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
15
15
|
*
|
16
16
|
* @param {ISpotSelectionParams} params - Spots selection parameters.
|
17
17
|
*
|
18
|
-
* @return {Promise<ISpots>} - The spots response object.
|
18
|
+
* @return {Promise<ISpots | {error : string}>} - The spots response object.
|
19
19
|
*/
|
20
|
-
spotSelection(params: ISpotSelectionParams): Promise<ISpots
|
20
|
+
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
21
|
+
error: string;
|
22
|
+
}>;
|
21
23
|
/**
|
22
24
|
* Injects the spot elements into their provided placement.
|
23
25
|
*
|
@@ -37,7 +39,7 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
37
39
|
*
|
38
40
|
* @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
|
39
41
|
*
|
40
|
-
* @return {Promise<ISpots>} - The spots response object.
|
42
|
+
* @return {Promise<ISpots | {error: string}>} - The spots response object.
|
41
43
|
*/
|
42
44
|
private spotSelectionRequest;
|
43
45
|
/**
|
@@ -72,6 +74,8 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
|
|
72
74
|
* @return {void}
|
73
75
|
*/
|
74
76
|
private preventDuplicateSpotPlacementIds;
|
77
|
+
private preventNonExistentSpotTypes;
|
78
|
+
private eventError;
|
75
79
|
}
|
76
80
|
/**
|
77
81
|
* Creates a new instance of the RmnClient.
|
package/dist/types/types.d.ts
CHANGED
@@ -7,7 +7,9 @@ import type { RMN_ENV } from 'enums';
|
|
7
7
|
import type { IInjectSpotElementParams } from 'modules/element';
|
8
8
|
import type { ISpots, ISpotSelectionParams } from 'modules/selection';
|
9
9
|
export interface IRmnClient {
|
10
|
-
spotSelection(params: ISpotSelectionParams): Promise<ISpots
|
10
|
+
spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
|
11
|
+
error: string;
|
12
|
+
}>;
|
11
13
|
injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
|
12
14
|
eventManager(): EventService;
|
13
15
|
}
|
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.7",
|
6
6
|
"homepage": "https://docs.liquidcommerce.co/rmn-sdk",
|
7
7
|
"main": "./dist/index.cjs",
|
8
8
|
"module": "./dist/index.esm.js",
|