podchat-browser 12.8.3 → 12.8.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.
- package/dist/node/buildConfig.json +1 -1
- package/dist/node/chat.js +371 -371
- package/dist/node/lib/store/eventEmitter.js +23 -23
- package/dist/node/lib/store/index.js +15 -15
- package/dist/node/lib/store/threads.js +151 -151
- package/dist/podchat-browser-bundle.js +48328 -48317
- package/package.json +3 -3
- package/src/buildConfig.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.storeEvents = void 0;
|
|
9
|
-
|
|
10
|
-
var _events = _interopRequireDefault(require("events"));
|
|
11
|
-
|
|
12
|
-
var Emitter = new _events["default"]();
|
|
13
|
-
var storeEvents = {
|
|
14
|
-
on: function on(eventName, callback) {
|
|
15
|
-
Emitter.on(eventName, callback);
|
|
16
|
-
},
|
|
17
|
-
off: function off(eventName) {
|
|
18
|
-
Emitter.off(eventName);
|
|
19
|
-
},
|
|
20
|
-
emit: function emit(eventName, data) {
|
|
21
|
-
Emitter.emit(eventName, data);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.storeEvents = void 0;
|
|
9
|
+
|
|
10
|
+
var _events = _interopRequireDefault(require("events"));
|
|
11
|
+
|
|
12
|
+
var Emitter = new _events["default"]();
|
|
13
|
+
var storeEvents = {
|
|
14
|
+
on: function on(eventName, callback) {
|
|
15
|
+
Emitter.on(eventName, callback);
|
|
16
|
+
},
|
|
17
|
+
off: function off(eventName) {
|
|
18
|
+
Emitter.off(eventName);
|
|
19
|
+
},
|
|
20
|
+
emit: function emit(eventName, data) {
|
|
21
|
+
Emitter.emit(eventName, data);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
24
|
exports.storeEvents = storeEvents;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.store = void 0;
|
|
7
|
-
|
|
8
|
-
var _threads = require("./threads");
|
|
9
|
-
|
|
10
|
-
var _eventEmitter = require("./eventEmitter");
|
|
11
|
-
|
|
12
|
-
var store = {
|
|
13
|
-
threads: _threads.threadsList,
|
|
14
|
-
events: _eventEmitter.storeEvents
|
|
15
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.store = void 0;
|
|
7
|
+
|
|
8
|
+
var _threads = require("./threads");
|
|
9
|
+
|
|
10
|
+
var _eventEmitter = require("./eventEmitter");
|
|
11
|
+
|
|
12
|
+
var store = {
|
|
13
|
+
threads: _threads.threadsList,
|
|
14
|
+
events: _eventEmitter.storeEvents
|
|
15
|
+
};
|
|
16
16
|
exports.store = store;
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.threadsList = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _eventEmitter = require("./eventEmitter");
|
|
13
|
-
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
|
|
18
|
-
var list = [];
|
|
19
|
-
var eventsList = {
|
|
20
|
-
SINGLE_THREAD_UPDATE: "singleThreadUpdate",
|
|
21
|
-
UNREAD_COUNT_UPDATED: 'unreadCountUpdated',
|
|
22
|
-
LAST_SEEN_MESSAGE_TIME_UPDATED: 'lastSeenMessageTimeUpdated'
|
|
23
|
-
};
|
|
24
|
-
var threadsList = {
|
|
25
|
-
eventsList: eventsList,
|
|
26
|
-
get: function get(id) {
|
|
27
|
-
return list[threadsList.findIndex(id)];
|
|
28
|
-
},
|
|
29
|
-
getAll: function getAll() {
|
|
30
|
-
return list;
|
|
31
|
-
},
|
|
32
|
-
findIndex: function findIndex(threadId) {
|
|
33
|
-
return list.findIndex(function (item) {
|
|
34
|
-
return (item === null || item === void 0 ? void 0 : item.get().id) == threadId;
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
save: function save(thread) {
|
|
38
|
-
var localThread;
|
|
39
|
-
var localThreadIndex = threadsList.findIndex(thread.id);
|
|
40
|
-
|
|
41
|
-
if (localThreadIndex > -1) {
|
|
42
|
-
list[localThreadIndex].set(thread);
|
|
43
|
-
localThread = list[localThreadIndex];
|
|
44
|
-
} else {
|
|
45
|
-
localThread = new ThreadObject(thread);
|
|
46
|
-
list = [localThread].concat(list);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
_eventEmitter.storeEvents.emit(eventsList.SINGLE_THREAD_UPDATE, localThread.get());
|
|
50
|
-
},
|
|
51
|
-
saveMany: function saveMany(newThreads) {
|
|
52
|
-
if (Array.isArray(newThreads)) {
|
|
53
|
-
var nonExistingThreads = [];
|
|
54
|
-
|
|
55
|
-
for (var item in newThreads) {
|
|
56
|
-
var localThreadIndex = threadsList.findIndex(newThreads[item].id);
|
|
57
|
-
|
|
58
|
-
if (localThreadIndex > -1) {
|
|
59
|
-
list[localThreadIndex].set(newThreads[item]);
|
|
60
|
-
} else {
|
|
61
|
-
nonExistingThreads.push(new ThreadObject(newThreads[item]));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (nonExistingThreads.length) {
|
|
66
|
-
list = nonExistingThreads.concat(list);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
remove: function remove(id) {
|
|
71
|
-
var localThreadIndex = threadsList.findIndex(id);
|
|
72
|
-
|
|
73
|
-
if (localThreadIndex > -1) {
|
|
74
|
-
delete list[localThreadIndex];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
exports.threadsList = threadsList;
|
|
79
|
-
|
|
80
|
-
function ThreadObject(thread) {
|
|
81
|
-
var config = {
|
|
82
|
-
thread: thread,
|
|
83
|
-
latestReceivedMessage: null
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
function makeSureUnreadCountExists(thread) {
|
|
87
|
-
if (!thread.unreadCount) {
|
|
88
|
-
if (config.thread.unreadCount) thread.unreadCount = config.thread.unreadCount;else thread.unreadCount = 0;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
makeSureUnreadCountExists(config.thread);
|
|
93
|
-
return {
|
|
94
|
-
set: function set(thread) {
|
|
95
|
-
makeSureUnreadCountExists(thread);
|
|
96
|
-
config.thread = _objectSpread(_objectSpread({}, config.thread), thread);
|
|
97
|
-
},
|
|
98
|
-
get: function get() {
|
|
99
|
-
return config.thread;
|
|
100
|
-
},
|
|
101
|
-
update: function update(field, newValue) {
|
|
102
|
-
config.thread[field] = newValue;
|
|
103
|
-
|
|
104
|
-
_eventEmitter.storeEvents.emit(eventsList.SINGLE_THREAD_UPDATE, config.thread);
|
|
105
|
-
},
|
|
106
|
-
unreadCount: {
|
|
107
|
-
set: function set(count) {
|
|
108
|
-
config.thread.unreadCount = count;
|
|
109
|
-
|
|
110
|
-
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
111
|
-
},
|
|
112
|
-
get: function get() {
|
|
113
|
-
return config.thread.unreadCount;
|
|
114
|
-
},
|
|
115
|
-
increase: function increase() {
|
|
116
|
-
config.thread.unreadCount++;
|
|
117
|
-
|
|
118
|
-
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
119
|
-
},
|
|
120
|
-
decrease: function decrease(time) {
|
|
121
|
-
if (time > config.thread.lastSeenMessageTime && config.thread.unreadCount > 0) {
|
|
122
|
-
config.thread.unreadCount--;
|
|
123
|
-
|
|
124
|
-
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
lastSeenMessageTime: {
|
|
129
|
-
set: function set(number) {
|
|
130
|
-
if (number > config.thread.lastSeenMessageTime) {
|
|
131
|
-
config.thread.lastSeenMessageTime = number;
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
get: function get() {
|
|
135
|
-
return config.thread.lastSeenMessageTime;
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.threadsList = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _eventEmitter = require("./eventEmitter");
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
+
|
|
18
|
+
var list = [];
|
|
19
|
+
var eventsList = {
|
|
20
|
+
SINGLE_THREAD_UPDATE: "singleThreadUpdate",
|
|
21
|
+
UNREAD_COUNT_UPDATED: 'unreadCountUpdated',
|
|
22
|
+
LAST_SEEN_MESSAGE_TIME_UPDATED: 'lastSeenMessageTimeUpdated'
|
|
23
|
+
};
|
|
24
|
+
var threadsList = {
|
|
25
|
+
eventsList: eventsList,
|
|
26
|
+
get: function get(id) {
|
|
27
|
+
return list[threadsList.findIndex(id)];
|
|
28
|
+
},
|
|
29
|
+
getAll: function getAll() {
|
|
30
|
+
return list;
|
|
31
|
+
},
|
|
32
|
+
findIndex: function findIndex(threadId) {
|
|
33
|
+
return list.findIndex(function (item) {
|
|
34
|
+
return (item === null || item === void 0 ? void 0 : item.get().id) == threadId;
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
save: function save(thread) {
|
|
38
|
+
var localThread;
|
|
39
|
+
var localThreadIndex = threadsList.findIndex(thread.id);
|
|
40
|
+
|
|
41
|
+
if (localThreadIndex > -1) {
|
|
42
|
+
list[localThreadIndex].set(thread);
|
|
43
|
+
localThread = list[localThreadIndex];
|
|
44
|
+
} else {
|
|
45
|
+
localThread = new ThreadObject(thread);
|
|
46
|
+
list = [localThread].concat(list);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_eventEmitter.storeEvents.emit(eventsList.SINGLE_THREAD_UPDATE, localThread.get());
|
|
50
|
+
},
|
|
51
|
+
saveMany: function saveMany(newThreads) {
|
|
52
|
+
if (Array.isArray(newThreads)) {
|
|
53
|
+
var nonExistingThreads = [];
|
|
54
|
+
|
|
55
|
+
for (var item in newThreads) {
|
|
56
|
+
var localThreadIndex = threadsList.findIndex(newThreads[item].id);
|
|
57
|
+
|
|
58
|
+
if (localThreadIndex > -1) {
|
|
59
|
+
list[localThreadIndex].set(newThreads[item]);
|
|
60
|
+
} else {
|
|
61
|
+
nonExistingThreads.push(new ThreadObject(newThreads[item]));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (nonExistingThreads.length) {
|
|
66
|
+
list = nonExistingThreads.concat(list);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
remove: function remove(id) {
|
|
71
|
+
var localThreadIndex = threadsList.findIndex(id);
|
|
72
|
+
|
|
73
|
+
if (localThreadIndex > -1) {
|
|
74
|
+
delete list[localThreadIndex];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.threadsList = threadsList;
|
|
79
|
+
|
|
80
|
+
function ThreadObject(thread) {
|
|
81
|
+
var config = {
|
|
82
|
+
thread: thread,
|
|
83
|
+
latestReceivedMessage: null
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
function makeSureUnreadCountExists(thread) {
|
|
87
|
+
if (!thread.unreadCount) {
|
|
88
|
+
if (config.thread.unreadCount) thread.unreadCount = config.thread.unreadCount;else thread.unreadCount = 0;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
makeSureUnreadCountExists(config.thread);
|
|
93
|
+
return {
|
|
94
|
+
set: function set(thread) {
|
|
95
|
+
makeSureUnreadCountExists(thread);
|
|
96
|
+
config.thread = _objectSpread(_objectSpread({}, config.thread), thread);
|
|
97
|
+
},
|
|
98
|
+
get: function get() {
|
|
99
|
+
return config.thread;
|
|
100
|
+
},
|
|
101
|
+
update: function update(field, newValue) {
|
|
102
|
+
config.thread[field] = newValue;
|
|
103
|
+
|
|
104
|
+
_eventEmitter.storeEvents.emit(eventsList.SINGLE_THREAD_UPDATE, config.thread);
|
|
105
|
+
},
|
|
106
|
+
unreadCount: {
|
|
107
|
+
set: function set(count) {
|
|
108
|
+
config.thread.unreadCount = count;
|
|
109
|
+
|
|
110
|
+
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
111
|
+
},
|
|
112
|
+
get: function get() {
|
|
113
|
+
return config.thread.unreadCount;
|
|
114
|
+
},
|
|
115
|
+
increase: function increase() {
|
|
116
|
+
config.thread.unreadCount++;
|
|
117
|
+
|
|
118
|
+
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
119
|
+
},
|
|
120
|
+
decrease: function decrease(time) {
|
|
121
|
+
if (time > config.thread.lastSeenMessageTime && config.thread.unreadCount > 0) {
|
|
122
|
+
config.thread.unreadCount--;
|
|
123
|
+
|
|
124
|
+
_eventEmitter.storeEvents.emit(eventsList.UNREAD_COUNT_UPDATED, config.thread);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
lastSeenMessageTime: {
|
|
129
|
+
set: function set(number) {
|
|
130
|
+
if (number > config.thread.lastSeenMessageTime) {
|
|
131
|
+
config.thread.lastSeenMessageTime = number;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
get: function get() {
|
|
135
|
+
return config.thread.lastSeenMessageTime;
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
139
|
/**
|
|
140
140
|
* local helper to detect and always replace the correct lastMessageVO in thread
|
|
141
|
-
*/
|
|
142
|
-
latestReceivedMessage: {
|
|
143
|
-
getTime: function getTime() {
|
|
144
|
-
return config.latestReceivedMessage ? config.latestReceivedMessage.time : 0;
|
|
145
|
-
},
|
|
146
|
-
get: function get() {
|
|
147
|
-
return config.latestReceivedMessage;
|
|
148
|
-
},
|
|
149
|
-
set: function set(message) {
|
|
150
|
-
config.latestReceivedMessage = message;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
};
|
|
141
|
+
*/
|
|
142
|
+
latestReceivedMessage: {
|
|
143
|
+
getTime: function getTime() {
|
|
144
|
+
return config.latestReceivedMessage ? config.latestReceivedMessage.time : 0;
|
|
145
|
+
},
|
|
146
|
+
get: function get() {
|
|
147
|
+
return config.latestReceivedMessage;
|
|
148
|
+
},
|
|
149
|
+
set: function set(message) {
|
|
150
|
+
config.latestReceivedMessage = message;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
154
|
}
|