@wildix/xbees-connect 1.1.2-alpha.1 → 1.1.2-alpha.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.2-alpha.0",
3
+ "version": "1.1.2-alpha.3",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -243,11 +243,14 @@ export class Client {
243
243
  this.addEventListener(EventType.USE_THEME, callback);
244
244
  }
245
245
  getFromStorage(key) {
246
- this.localStorageManager.retrieve(key);
246
+ return this.localStorageManager.retrieve(key);
247
247
  }
248
248
  saveToStorage(key, value) {
249
249
  this.localStorageManager.save(key, value);
250
250
  }
251
+ deleteFromStorage(key) {
252
+ this.localStorageManager.delete(key);
253
+ }
251
254
  onStorage(listener) {
252
255
  this.localStorageManager.onStorage(listener);
253
256
  }
@@ -44,6 +44,10 @@ class LocalStorageManager {
44
44
  // Save data to localStorage
45
45
  localStorage.setItem(this.getStorageKey(key), JSON.stringify(value));
46
46
  }
47
+ delete(key) {
48
+ // Save data to localStorage
49
+ localStorage.removeItem(this.getStorageKey(key));
50
+ }
47
51
  retrieve(key) {
48
52
  // Retrieve data from localStorage
49
53
  const data = localStorage.getItem(this.getStorageKey(key));
@@ -51,7 +51,8 @@ export declare class Client implements ConnectClient {
51
51
  onSuggestContacts(callback: (query: string, resolve: SuggestContactsResolver, reject: Reject) => void): RemoveEventListener;
52
52
  onLookupAndMatchContact(callback: (query: ContactQuery, resolve: LookupAndMatchContactsResolver, reject: Reject) => void): RemoveEventListener;
53
53
  onThemeChange(callback: Callback<EventType.USE_THEME>): void;
54
- getFromStorage(key: string): void;
55
- saveToStorage(key: string, value: any): void;
54
+ getFromStorage<Type>(key: string): Type | null;
55
+ saveToStorage<SavingType>(key: string, value: SavingType): void;
56
+ deleteFromStorage(key: string): void;
56
57
  onStorage(listener: StorageEventCallback): void;
57
58
  }
@@ -10,6 +10,7 @@ declare class LocalStorageManager {
10
10
  private calculateIntegrationKey;
11
11
  private shouldUseIntegrationKey;
12
12
  save(key: string, value: any): void;
13
+ delete(key: string): void;
13
14
  retrieve(key: string): any;
14
15
  get(key: string): any;
15
16
  onStorage(listener: StorageEventCallback): void;
@@ -190,12 +190,18 @@ export interface ConnectClient {
190
190
  onCallEnded: (callback: Callback<EventType.TERMINATE_CALL>) => void;
191
191
  /**
192
192
  * Removes particular callback from handling events */
193
- off: (callback: Callback) => void;
193
+ off: (callback: Callback | StorageEventCallback) => void;
194
194
  /**
195
195
  * saves data to localStorage */
196
- saveToStorage: (key: string, value: any) => void;
196
+ saveToStorage: <SavingType>(key: string, value: SavingType) => void;
197
197
  /**
198
198
  * Retrieves data from localStorage */
199
- getFromStorage: (key: string) => void;
199
+ getFromStorage: <Type>(key: string) => Type | null;
200
+ /**
201
+ * Removes data from localStorage */
202
+ deleteFromStorage: (key: string) => void;
203
+ /**
204
+ * listens on localStorage */
205
+ onStorage: (listener: StorageEventCallback) => void;
200
206
  }
201
207
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildix/xbees-connect",
3
- "version": "1.1.2-alpha.1",
3
+ "version": "1.1.2-alpha.4",
4
4
  "description": "This library provides easy communication between x-bees and integrated web applications",
5
5
  "author": "dimitri.chernykh <dimitri.chernykh@wildix.com>",
6
6
  "homepage": "",
@@ -42,5 +42,5 @@
42
42
  "engines": {
43
43
  "node": ">=16"
44
44
  },
45
- "gitHead": "a481bbfe4b0fdcba3b554a1af7015cedf6f6ba82"
45
+ "gitHead": "979e70be023f6764abb0ab2e90c49b6c7ebfb7cc"
46
46
  }