@liquidcommercedev/rmn-sdk 1.5.0-beta.14 → 1.5.0-beta.16

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.
@@ -45,7 +45,8 @@ LocalStorageSpotArray>;
45
45
  export declare class LocalStorageService {
46
46
  private spots?;
47
47
  private static instance;
48
- private static readonly localStorageKey;
48
+ private static readonly localStorageKeyPrefix;
49
+ private static localStorageKey;
49
50
  private static readonly spotExpirationTime;
50
51
  private static readonly encryptData;
51
52
  private constructor();
@@ -58,6 +59,13 @@ export declare class LocalStorageService {
58
59
  private updateLocalStorage;
59
60
  private clearLocalStorage;
60
61
  private removeExpiredSpots;
62
+ getUserId(): string;
63
+ /**
64
+ * Sets the user ID in the local storage.
65
+ * If no existing key is found,
66
+ * it generates a new unique ID and sets it as the local storage key.
67
+ */
68
+ setUserId(): void;
61
69
  private mapToObject;
62
70
  private objectToMap;
63
71
  private spotEventObjectToArray;
@@ -2,6 +2,10 @@ 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
+ * @class
8
+ */
5
9
  export declare class LiquidCommerceRmnClient implements IRmnClient {
6
10
  private readonly selectionService;
7
11
  private readonly elementService;
@@ -28,21 +32,9 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
28
32
  * @return {Promise<void>} - A promise that resolves when the spot elements are injected.
29
33
  */
30
34
  injectSpotElement(params: IInjectSpotElementParams): Promise<void>;
31
- /** ========================= HELPER METHODS ========================= **/
32
- /**
33
- * Injects a carousel element with the provided spots into the placement.
34
- *
35
- * @param {HTMLElement} placement - The placement element.
36
- * @param {ISpot[]} spots - The spot data.
37
- * @param {IInjectSpotElementConfig} config - The configuration object.
38
- *
39
- * @return {void}
40
- */
41
- private injectCarouselSpotElement;
42
35
  /**
43
36
  * Injects a single spot element into the provided placement.
44
37
  *
45
- * @param {IInjectSpotElement} injectItem - The inject item data.
46
38
  * @param {HTMLElement} placement - The placement element.
47
39
  * @param {ISpot} spot - The spot data.
48
40
  * @param {IInjectSpotElementConfig} config - The configuration object.
@@ -51,13 +43,15 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
51
43
  */
52
44
  private injectOneSpotElement;
53
45
  /**
54
- * Clears the placement element by removing all its children.
46
+ * Injects a carousel element with the provided spots into the placement.
55
47
  *
56
- * @param {string} placementId - The placement id.
48
+ * @param {HTMLElement} placement - The placement element.
49
+ * @param {ISpot[]} spots - The spot data.
50
+ * @param {IInjectSpotElementConfig} config - The configuration object.
57
51
  *
58
52
  * @return {void}
59
53
  */
60
- private clearPlacement;
54
+ private injectCarouselSpotElement;
61
55
  /**
62
56
  * Makes a selection request on our server based on the provided data.
63
57
  *
@@ -65,25 +59,7 @@ export declare class LiquidCommerceRmnClient implements IRmnClient {
65
59
  *
66
60
  * @return {Promise<ISpots | {error: string}>} - The spots response object.
67
61
  */
68
- private spotSelectionRequest;
69
- /**
70
- * Prevents duplicate placement ids in the inject data.
71
- *
72
- * @param {IInjectSpotElement[]} inject - The inject data.
73
- *
74
- * @throws {Error} - If a duplicate placement id is found.
75
- *
76
- * @return {void}
77
- */
78
- private preventDuplicateSpotPlacementIds;
79
- /**
80
- * Prevents non-existent spot types in the inject data.
81
- *
82
- * @param {IInjectSpotElement[]} inject - The inject data.
83
- * @return {IInjectSpotElement[]} - The filtered inject data.
84
- */
85
- private preventNonExistentSpotTypes;
86
- private useSpotSelectionExample;
62
+ private injectSpotSelectionRequest;
87
63
  }
88
64
  /**
89
65
  * Creates a new instance of the RmnClient.
@@ -0,0 +1,40 @@
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
+ /**
33
+ * Waits for the DOM to be ready before continuing.
34
+ *
35
+ * @return {Promise<void>} - A promise that resolves when the DOM is ready.
36
+ */
37
+ export declare function waitForDOM(): Promise<void>;
38
+ export declare function useSpotSelectionExample(inject: IInjectSpotElement[]): Promise<ISpots | {
39
+ error: string;
40
+ }>;
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.14",
5
+ "version": "1.5.0-beta.16",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",