@ada-support/web-storage 0.7.1 → 0.8.0

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.
@@ -98,6 +98,9 @@ border: 1px solid;
98
98
  <td>previousZDTags</td><td>Used to cache Zendesk tags assigned to a conversation. This is stored on Ada domain.</td><td>Web Storage</td><td>Persistent</td>
99
99
  </tr>
100
100
  <tr>
101
+ <td>pusherTransportTLS</td><td>Used by Pusher API for realtime messaging.</td><td>Web Storage</td><td>Persistent</td>
102
+ </tr>
103
+ <tr>
101
104
  <td>secretButton</td><td>Used during Oracle handoffs to indicate whether the agent has sent a request for a secret message. Allows the state to persist between page changes.</td><td>Web Storage</td><td>Persistent</td>
102
105
  </tr>
103
106
  <tr>
@@ -4,6 +4,7 @@ export declare const createStorage: (storageProvider: Storage) => {
4
4
  readonly setItem: <K extends keyof StorageValueByKey>(key: K, value: StorageValueByKey[K]) => void;
5
5
  readonly getItem: <K_1 extends keyof StorageValueByKey>(key: K_1) => StorageValueByKey[K_1] | null;
6
6
  readonly removeItem: <K_2 extends keyof StorageValueByKey>(key: K_2) => void;
7
+ readonly clear: () => void;
7
8
  /** Stores a key/value pair within `ada-functional-storage` Storage key */
8
9
  readonly setFnItem: <K_3 extends keyof AdaFunctionalStorageValue>(key: K_3, value: AdaFunctionalStorageValue[K_3]) => void;
9
10
  /** Gets a value under `ada-functional-storage` Storage key */
@@ -41,6 +41,14 @@ var createStorage = function (storageProvider) {
41
41
  console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
42
42
  }
43
43
  },
44
+ clear: function () {
45
+ try {
46
+ storageProvider.clear();
47
+ }
48
+ catch (e) {
49
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
50
+ }
51
+ },
44
52
  /** Stores a key/value pair within `ada-functional-storage` Storage key */
45
53
  setFnItem: function (key, value) {
46
54
  var _a;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export declare const adaLocalStorage: {
3
3
  readonly setItem: <K extends keyof StorageValueByKey>(key: K, value: StorageValueByKey[K]) => void;
4
4
  readonly getItem: <K_1 extends keyof StorageValueByKey>(key: K_1) => StorageValueByKey[K_1] | null;
5
5
  readonly removeItem: <K_2 extends keyof StorageValueByKey>(key: K_2) => void;
6
+ readonly clear: () => void;
6
7
  readonly setFnItem: <K_3 extends keyof import("./functional-storage").AdaFunctionalStorageValue>(key: K_3, value: import("./functional-storage").AdaFunctionalStorageValue[K_3]) => void;
7
8
  readonly getFnItem: <K_4 extends keyof import("./functional-storage").AdaFunctionalStorageValue>(key: K_4) => import("./functional-storage").AdaFunctionalStorageValue[K_4] | null;
8
9
  };
@@ -10,6 +11,7 @@ export declare const adaSessionStorage: {
10
11
  readonly setItem: <K extends keyof StorageValueByKey>(key: K, value: StorageValueByKey[K]) => void;
11
12
  readonly getItem: <K_1 extends keyof StorageValueByKey>(key: K_1) => StorageValueByKey[K_1] | null;
12
13
  readonly removeItem: <K_2 extends keyof StorageValueByKey>(key: K_2) => void;
14
+ readonly clear: () => void;
13
15
  readonly setFnItem: <K_3 extends keyof import("./functional-storage").AdaFunctionalStorageValue>(key: K_3, value: import("./functional-storage").AdaFunctionalStorageValue[K_3]) => void;
14
16
  readonly getFnItem: <K_4 extends keyof import("./functional-storage").AdaFunctionalStorageValue>(key: K_4) => import("./functional-storage").AdaFunctionalStorageValue[K_4] | null;
15
17
  };
@@ -30,4 +30,10 @@ exports.THIRD_PARTY_ITEMS = [
30
30
  type: "Cookie",
31
31
  duration: "3 Months"
32
32
  },
33
+ {
34
+ keyName: "pusherTransportTLS",
35
+ description: "Used by Pusher API for realtime messaging.",
36
+ type: "Web Storage",
37
+ duration: "Persistent"
38
+ },
33
39
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-support/web-storage",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "A package to provide access to Web Storage API",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
@@ -5,7 +5,6 @@ const WEB_STORAGE_ACCESS_ERROR_MESSAGE = "Cannot access Web Storage API";
5
5
 
6
6
  export const createStorage = (storageProvider: Storage) => {
7
7
  const storage = {
8
-
9
8
  setItem: <K extends StorageKey>(key: K, value: StorageValueByKey[K]): void => {
10
9
  try {
11
10
  storageProvider.setItem(key, JSON.stringify(value));
@@ -34,6 +33,14 @@ export const createStorage = (storageProvider: Storage) => {
34
33
  }
35
34
  },
36
35
 
36
+ clear: () => {
37
+ try {
38
+ storageProvider.clear();
39
+ } catch (e) {
40
+ console.warn(WEB_STORAGE_ACCESS_ERROR_MESSAGE);
41
+ }
42
+ },
43
+
37
44
  /** Stores a key/value pair within `ada-functional-storage` Storage key */
38
45
  setFnItem: <K extends keyof AdaFunctionalStorageValue>(key: K, value: AdaFunctionalStorageValue[K]): void => {
39
46
  const currentValue = storage.getItem("ada-functional-storage") || {};
@@ -34,4 +34,10 @@ export const THIRD_PARTY_ITEMS: WebStorageItem[] = [
34
34
  type: "Cookie",
35
35
  duration: "3 Months",
36
36
  },
37
+ {
38
+ keyName: "pusherTransportTLS",
39
+ description: "Used by Pusher API for realtime messaging.",
40
+ type: "Web Storage",
41
+ duration: "Persistent",
42
+ },
37
43
  ];