@liquidcommercedev/rmn-sdk 1.5.0-beta.30 → 1.5.0-beta.32

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.
@@ -11,18 +11,4 @@ export declare function extractDeepValues(data: unknown, target: ExtractorTarget
11
11
  onlyFirst?: boolean;
12
12
  shouldIncludeZero?: boolean;
13
13
  }): ExtractedValue[] | ExtractedValue | undefined;
14
- /**
15
- * Cleans and normalizes an array of product IDs by:
16
- * 1. Converting all IDs to strings
17
- * 2. Trimming whitespace
18
- * 3. Removing leading zeros while preserving single "0"
19
- * 4. Filtering out empty/invalid values
20
- *
21
- * @param ids - Array of product IDs that can be either strings or numbers
22
- * @returns Array of cleaned string IDs
23
- *
24
- * @example
25
- * cleanProductIds(["001", " 123 ", 456, "0"]) // ["1", "123", "456", "0"]
26
- */
27
- export declare function cleanProductIds(ids: Array<string | number>): string[];
28
14
  export {};
@@ -1,6 +1,7 @@
1
1
  export * from './event-type.helper';
2
2
  export * from './extract-deep.helper';
3
3
  export * from './helpers.interface';
4
+ export * from './normalize-string.helper';
4
5
  export * from './object.helper';
5
6
  export * from './string.helper';
6
7
  export * from './utils.helper';
@@ -0,0 +1,14 @@
1
+ export declare class NormalizeStringHelper {
2
+ private static instance;
3
+ private readonly characterMaps;
4
+ private readonly regex;
5
+ constructor();
6
+ static getInstance(): NormalizeStringHelper;
7
+ normalize(text: string): string;
8
+ /**
9
+ * Removes leading zeros from a string number unless the string is just "0"
10
+ * @param text - The string to process
11
+ * @returns The string without leading zeros
12
+ */
13
+ private removeLeadingZerosIfNumber;
14
+ }
@@ -1,2 +1,2 @@
1
1
  export * from './example.constant';
2
- export * from './special-char.constant';
2
+ export * from './special-chars-map.constant';
@@ -0,0 +1 @@
1
+ export declare const SPECIAL_CHARS_MAP: Record<string, string>;
@@ -10,46 +10,12 @@ export interface ILocalStorageSpot {
10
10
  spotId: string;
11
11
  spotType: RMN_SPOT_TYPE;
12
12
  events: ISpotEvent[];
13
- firedEvents: IFiredSpotEvent[];
13
+ firedEvents?: IFiredSpotEvent[];
14
14
  productIds: Array<string | number>;
15
15
  createdAt?: number;
16
16
  }
17
- export type LocalStorageSpotsMapType = Map<string, // spotId
17
+ export type LocalStorageSpots = Record<string, // spotId
18
18
  ILocalStorageSpot>;
19
- export type LocalStorageSpotsObjectType = Record<string, // spotId
20
- ILocalStorageSpot>;
21
- export type LocalStorageSpotArray = [
22
- string,
23
- string,
24
- RMN_SPOT_TYPE,
25
- string[],
26
- Array<[string, RMN_SPOT_EVENT]>,
27
- Array<string | number>,
28
- // PRODUCT_IDS = 5
29
- number | undefined
30
- ];
31
- export declare enum ENUM_LOCAL_STORAGE_SPOT_ARRAY_INDEX {
32
- PLACEMENT_ID = 0,
33
- SPOT_ID = 1,
34
- SPOT_TYPE = 2,
35
- EVENTS = 3,
36
- FIRED_EVENTS = 4,
37
- PRODUCT_IDS = 5,
38
- CREATED_AT = 6
39
- }
40
- export declare const LOCAL_STORAGE_SPOT_EVENTS_ARRAY_INDEX: {
41
- readonly IMPRESSION: 0;
42
- readonly CLICK: 1;
43
- readonly PURCHASE: 2;
44
- readonly ADD_TO_CART: 3;
45
- readonly REMOVE_FROM_CART: 4;
46
- readonly ADD_TO_CART_FROM_DETAILS: 5;
47
- readonly ADD_TO_WISHLIST: 6;
48
- readonly EXPAND_PRODUCT: 7;
49
- readonly BUY_NOW: 8;
50
- };
51
- export type LocalStorageSpotsArrayType = Record<string, // spotId
52
- LocalStorageSpotArray>;
53
19
  export declare class LocalStorageService {
54
20
  private spots?;
55
21
  private static instance;
@@ -59,11 +25,10 @@ export declare class LocalStorageService {
59
25
  private static readonly encryptData;
60
26
  private constructor();
61
27
  static getInstance(): LocalStorageService;
62
- private syncLocalStorage;
63
28
  setSpot(spotId: string, data: ILocalStorageSpot): void;
64
29
  removeSpot(spotId: string): void;
65
30
  getSpot(spotId: string): ILocalStorageSpot | undefined;
66
- getSpots(): LocalStorageSpotsObjectType | undefined;
31
+ getSpots(): LocalStorageSpots | undefined;
67
32
  /**
68
33
  * Retrieves the user ID from the local storage key.
69
34
  * If the key is not found, a new user ID is generated and set.
@@ -79,6 +44,7 @@ export declare class LocalStorageService {
79
44
  * @return {void} This method does not return a value.
80
45
  */
81
46
  setUserId(): void;
47
+ private syncLocalStorage;
82
48
  private updateLocalStorage;
83
49
  private clearLocalStorage;
84
50
  private removeExpiredSpots;
@@ -90,13 +56,13 @@ export declare class LocalStorageService {
90
56
  * Converts a spot object to an array.
91
57
  *
92
58
  * @param {ILocalStorageSpot} obj - The spot object to convert.
93
- * @return {LocalStorageSpotArray} An array representation of the spot object.
59
+ * @return {SpotArrayType} An array representation of the spot object.
94
60
  */
95
61
  private spotObjectToArray;
96
62
  /**
97
63
  * Converts an array representation of spot data into an object representation.
98
64
  *
99
- * @param {LocalStorageSpotArray} arr - The array containing spot data.
65
+ * @param {SpotArrayType} arr - The array containing spot data.
100
66
  * @return {ILocalStorageSpot} An object representation of the spot data.
101
67
  */
102
68
  private spotArrayToObject;
@@ -1,8 +1,9 @@
1
1
  export declare class MonitorService {
2
2
  private static instance;
3
3
  private readonly implementedMonitor?;
4
- private readonly pubSubService?;
5
- private readonly localStorageService?;
4
+ private readonly pubSubService;
5
+ private readonly localStorageService;
6
+ private readonly normalizeStringHelper;
6
7
  private constructor();
7
8
  static getInstance(): MonitorService;
8
9
  start(): void;
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.30",
5
+ "version": "1.5.0-beta.32",
6
6
  "homepage": "https://docs.liquidcommerce.co/rmn-sdk",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.esm.js",