web-manager 3.1.20 → 3.1.22
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.
- package/index.js +2 -1
- package/lib/storage.js +8 -16
- package/package.json +1 -1
package/index.js
CHANGED
@@ -1428,13 +1428,14 @@ function Manager() {
|
|
1428
1428
|
attributes: [
|
1429
1429
|
{name: 'data-account-id', value: utilities.get(options, chatsyPath + '.accountId', '')},
|
1430
1430
|
{name: 'data-chat-id', value: utilities.get(options, chatsyPath + '.chatId', '')},
|
1431
|
+
{name: 'data-settings', value: JSON.stringify(utilities.get(options, chatsyPath + '.settings', ''))},
|
1431
1432
|
],
|
1432
1433
|
crossorigin: true,
|
1433
1434
|
}, function(e) {
|
1434
1435
|
if (e) {
|
1435
1436
|
return reject(e);
|
1436
1437
|
}
|
1437
|
-
|
1438
|
+
|
1438
1439
|
chatsy.open();
|
1439
1440
|
dom.select('#prechat-btn').hide();
|
1440
1441
|
|
package/lib/storage.js
CHANGED
@@ -2,50 +2,42 @@
|
|
2
2
|
*/
|
3
3
|
var utilities = require('./utilities.js');
|
4
4
|
var support;
|
5
|
+
var pseudoStorage = {};
|
5
6
|
|
6
7
|
function Storage(storageObj) {
|
7
8
|
this.storage = storageObj;
|
8
9
|
}
|
9
10
|
|
10
11
|
Storage.get = function(path, def, options) {
|
11
|
-
var result;
|
12
12
|
path = path || '';
|
13
|
-
|
13
|
+
|
14
14
|
try {
|
15
|
-
|
16
|
-
result = utilities.get(JSON.parse(window.localStorage.getItem('_manager')) || {}, path, def);
|
15
|
+
return utilities.get(JSON.parse(window.localStorage.getItem('_manager')) || {}, path, def);
|
17
16
|
} catch (e) {
|
18
|
-
|
17
|
+
return utilities.get(pseudoStorage, path, def)
|
19
18
|
}
|
20
|
-
return result;
|
21
19
|
}
|
22
20
|
|
23
21
|
Storage.set = function(path, value, options) {
|
24
|
-
// if (typeof Storage !== 'undefined') { return };
|
25
22
|
var existing;
|
23
|
+
|
26
24
|
try {
|
27
25
|
existing = Storage.get('', {});
|
28
26
|
utilities.set(existing, path, value);
|
29
27
|
window.localStorage.setItem('_manager', JSON.stringify(existing));
|
30
28
|
} catch (e) {
|
31
|
-
|
29
|
+
utilities.set(pseudoStorage, path, value)
|
32
30
|
}
|
31
|
+
|
33
32
|
return existing;
|
34
33
|
}
|
35
34
|
|
36
35
|
Storage.clear = function(options) {
|
37
|
-
// options = options || {};
|
38
|
-
// options.type = options.type || 'manager';
|
39
|
-
// if (typeof Storage !== 'undefined') { return };
|
40
|
-
// if (options.type == 'manager') {
|
41
36
|
try {
|
42
37
|
window.localStorage.setItem('_manager', '{}');
|
43
38
|
} catch (e) {
|
44
|
-
|
39
|
+
pseudoStorage = {};
|
45
40
|
}
|
46
|
-
// } else {
|
47
|
-
// window.localStorage.clear();
|
48
|
-
// }
|
49
41
|
}
|
50
42
|
|
51
43
|
module.exports = Storage;
|
package/package.json
CHANGED