@liquidcommercedev/rmn-sdk 1.4.6-beta.6 → 1.4.6-beta.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
1
  import type { IAuthCredentials } from 'modules/auth';
2
2
  import type { IInjectSpotElementParams, IRmnCreateSpotElementConfig } from 'modules/element';
3
- import { EventService } from 'modules/event';
3
+ import { type IEventMap } from 'modules/event';
4
4
  import type { ISpot, ISpots, ISpotSelectionParams } from 'modules/selection';
5
5
  import type { IRmnClient, IRmnConfig } from 'types';
6
+ import type { RMN_SPOT_EVENT } from './enums';
6
7
  export declare class LiquidCommerceRmnClient implements IRmnClient {
7
8
  private readonly selectionService;
8
9
  private readonly elementService;
@@ -15,9 +16,11 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
15
16
  *
16
17
  * @param {ISpotSelectionParams} params - Spots selection parameters.
17
18
  *
18
- * @return {Promise<ISpots>} - The spots response object.
19
+ * @return {Promise<ISpots | {error : string}>} - The spots response object.
19
20
  */
20
- spotSelection(params: ISpotSelectionParams): Promise<ISpots>;
21
+ spotSelection(params: ISpotSelectionParams): Promise<ISpots | {
22
+ error: string;
23
+ }>;
21
24
  /**
22
25
  * Injects the spot elements into their provided placement.
23
26
  *
@@ -31,13 +34,16 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
31
34
  *
32
35
  * @return {EventService} - The event manager instance.
33
36
  */
34
- eventManager(): EventService;
37
+ eventManager: {
38
+ subscribe: (eventType: RMN_SPOT_EVENT, callback: (data: IEventMap[RMN_SPOT_EVENT]) => void) => (() => void);
39
+ publish: (eventType: RMN_SPOT_EVENT, data: IEventMap[RMN_SPOT_EVENT]) => void;
40
+ };
35
41
  /**
36
42
  * Makes a selection request on our server based on the provided data.
37
43
  *
38
44
  * @param {IInjectSpotElementParams} params - Parameters for injecting spot elements.
39
45
  *
40
- * @return {Promise<ISpots>} - The spots response object.
46
+ * @return {Promise<ISpots | {error: string}>} - The spots response object.
41
47
  */
42
48
  private spotSelectionRequest;
43
49
  /**
@@ -61,7 +67,6 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
61
67
  * @return {void}
62
68
  */
63
69
  private injectOneSpotElement;
64
- private eventSpotElement;
65
70
  /**
66
71
  * Prevents duplicate placement ids in the inject data.
67
72
  *
@@ -72,6 +77,8 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
72
77
  * @return {void}
73
78
  */
74
79
  private preventDuplicateSpotPlacementIds;
80
+ private preventNonExistentSpotTypes;
81
+ private updateSpotsState;
75
82
  }
76
83
  /**
77
84
  * Creates a new instance of the RmnClient.
@@ -1,15 +1,20 @@
1
- import type { EventService } from './modules/event';
1
+ import type { IEventMap } from './modules/event';
2
2
  export type { IInjectSpotElement, IInjectSpotElementConfig, IInjectSpotElementParams, IRmnCreateSpotElementConfig, ISpotColors, ISpotOverlay, } from 'modules/element';
3
3
  export type { CarouselNavPositionType, ICarouselButtonOptions, ICarouselDotOptions, ICarouselOptions, } from 'modules/element/component/carousel';
4
4
  export type { ISpots, RmnFilterType, RmnSpotType } from 'modules/selection';
5
5
  export { ISpot, ISpotEvent, ISpotSelectionParams } from 'modules/selection';
6
- import type { RMN_ENV } from 'enums';
6
+ import type { RMN_ENV, RMN_SPOT_EVENT } 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
- eventManager(): EventService;
14
+ eventManager: {
15
+ subscribe: (eventType: RMN_SPOT_EVENT, callback: (data: IEventMap[RMN_SPOT_EVENT]) => void) => () => void;
16
+ publish: (eventType: RMN_SPOT_EVENT, data: IEventMap[RMN_SPOT_EVENT]) => void;
17
+ };
13
18
  }
14
19
  export interface IRmnConfig {
15
20
  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.6",
5
+ "version": "1.4.6-beta.8",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",