qiscus-sdk-core 2.14.0 → 2.14.2
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/qiscus-sdk-core.js +130 -14
- package/dist/qiscus-sdk-core.js.map +1 -1
- package/dist/qiscus-sdk-core.min.js +3 -3
- package/dist/qiscus-sdk-core.min.js.map +1 -1
- package/lib/index.js +14 -3
- package/lib/lib/adapters/expired-token.js +4 -5
- package/lib/lib/adapters/mqtt.js +25 -2
- package/lib/lib/adapters/sync.js +71 -2
- package/lib/lib/utils.js +14 -0
- package/package.json +1 -1
package/dist/qiscus-sdk-core.js
CHANGED
|
@@ -29966,7 +29966,7 @@ function extend() {
|
|
|
29966
29966
|
/*! exports provided: name, version, description, license, main, browser, unpkg, files, scripts, devDependencies, dependencies, babel, prettier, engines, packageManager, default */
|
|
29967
29967
|
/***/ (function(module) {
|
|
29968
29968
|
|
|
29969
|
-
module.exports = JSON.parse("{\"name\":\"qiscus-sdk-core\",\"version\":\"2.14.
|
|
29969
|
+
module.exports = JSON.parse("{\"name\":\"qiscus-sdk-core\",\"version\":\"2.14.2\",\"description\":\"Qiscus Web SDK Core\",\"license\":\"MIT\",\"main\":\"lib/index.js\",\"browser\":\"dist/qiscus-sdk-core.min.js\",\"unpkg\":\"dist/qiscus-sdk-core.min.js\",\"files\":[\"lib\",\"dist\"],\"scripts\":{\"build\":\"npm-run-all --parallel build:node build:web build:web:dev\",\"build:dev\":\"npm-run-all --parallel build:node build:web:dev\",\"build:dev:watch\":\"npm-run-all --parallel build:web:watch serve\",\"build:node\":\"babel -d lib src\",\"build:node:watch\":\"babel -w -d lib src\",\"build:web\":\"webpack --env.production --env.target=web\",\"build:web:dev\":\"webpack --env.development --env.target=web\",\"build:web:watch\":\"webpack --env.development --env.target=web --watch\",\"dev\":\"webpack --env.development --progress --colors --watch\",\"watch\":\"npm-run-all build:web:watch build:node:watch\",\"test\":\"mocha --require @babel/register --colors 'test/**/*test.js'\",\"test:watch\":\"npm run test -- -w\",\"clean\":\"rimraf dist lib\",\"preversion\":\"npm-run-all clean build\",\"prepublishOnly\":\"npm-run-all clean build\",\"serve\":\"http-server -p 1234 -c-1 dist\",\"dev:serve\":\"run-p serve watch\",\"release:patch\":\"np patch --any-branch --yolo\"},\"devDependencies\":{\"@babel/cli\":\"^7.10.5\",\"@babel/core\":\"^7.11.4\",\"@babel/plugin-proposal-class-properties\":\"^7.10.4\",\"@babel/plugin-transform-runtime\":\"^7.11.0\",\"@babel/polyfill\":\"^7.10.4\",\"@babel/preset-env\":\"^7.11.0\",\"@babel/register\":\"^7.10.5\",\"@commitlint/cli\":\"^8.3.5\",\"@commitlint/config-conventional\":\"^8.3.4\",\"babel-eslint\":\"^8.2.6\",\"babel-loader\":\"^8.0.6\",\"babel-plugin-add-module-exports\":\"^1.0.2\",\"babel-plugin-date-fns\":\"^0.1.0\",\"chai\":\"^4.2.0\",\"chai-spies\":\"^1.0.0\",\"eslint\":\"5.0.0\",\"eslint-config-standard\":\"^12.0.0\",\"eslint-loader\":\"^2.2.1\",\"eslint-plugin-import\":\"^2.22.0\",\"eslint-plugin-node\":\"^8.0.1\",\"eslint-plugin-promise\":\"^4.2.1\",\"eslint-plugin-standard\":\"^4.0.1\",\"http-server\":\"^0.12.3\",\"mocha\":\"^5.2.0\",\"np\":\"^8.0.4\",\"npm-run-all\":\"^4.1.5\",\"rimraf\":\"^2.7.1\",\"serve\":\"^12.0.0\",\"webpack\":\"^4.44.1\",\"webpack-cli\":\"^3.3.12\"},\"dependencies\":{\"@babel/runtime\":\"^7.11.2\",\"date-fns\":\"^1.30.1\",\"is_js\":\"^0.9.0\",\"lodash.debounce\":\"^4.0.8\",\"lodash.throttle\":\"^4.1.1\",\"mitt\":\"^1.2.0\",\"mqtt\":\"~4.2.6\",\"superagent\":\"^3.8.3\"},\"babel\":{\"presets\":[[\"@babel/preset-env\",{\"modules\":\"auto\"}]],\"plugins\":[\"@babel/plugin-transform-runtime\",\"@babel/plugin-proposal-class-properties\",\"babel-plugin-add-module-exports\"]},\"prettier\":{\"semi\":false,\"singleQuote\":true,\"trailingComma\":\"es5\"},\"engines\":{\"node\":\"16.15.1\"},\"packageManager\":\"pnpm@8.15.9\"}");
|
|
29970
29970
|
|
|
29971
29971
|
/***/ }),
|
|
29972
29972
|
|
|
@@ -30486,9 +30486,12 @@ var QiscusSDK = /*#__PURE__*/function () {
|
|
|
30486
30486
|
return _this2._retrySendComment(m);
|
|
30487
30487
|
});
|
|
30488
30488
|
});
|
|
30489
|
+
this.syncAdapter.on('last-message-id.new', function (id) {
|
|
30490
|
+
_this2.last_received_comment_id = id;
|
|
30491
|
+
});
|
|
30489
30492
|
this.customEventAdapter = Object(_lib_adapters_custom_event__WEBPACK_IMPORTED_MODULE_18__["default"])(this.realtimeAdapter, this.user_id);
|
|
30490
30493
|
this.setEventListeners();
|
|
30491
|
-
case
|
|
30494
|
+
case 57:
|
|
30492
30495
|
case "end":
|
|
30493
30496
|
return _context3.stop();
|
|
30494
30497
|
}
|
|
@@ -30672,20 +30675,28 @@ var QiscusSDK = /*#__PURE__*/function () {
|
|
|
30672
30675
|
});
|
|
30673
30676
|
_this3.HTTPAdapter.setToken(_this3.userData.token);
|
|
30674
30677
|
var user = response.user;
|
|
30678
|
+
_this3._delayedSync = Object(_lib_utils__WEBPACK_IMPORTED_MODULE_20__["delayed"])(function () {
|
|
30679
|
+
_this3.synchronize();
|
|
30680
|
+
_this3.synchronizeEvent();
|
|
30681
|
+
}, 500);
|
|
30675
30682
|
_this3.expiredTokenAdapter = new _lib_adapters_expired_token__WEBPACK_IMPORTED_MODULE_24__["ExpiredTokenAdapter"]({
|
|
30676
30683
|
httpAdapter: _this3.HTTPAdapter,
|
|
30677
30684
|
refreshToken: user.refresh_token,
|
|
30678
30685
|
expiredAt: user.token_expires_at,
|
|
30679
30686
|
userId: _this3.user_id,
|
|
30680
|
-
onTokenRefreshed: function onTokenRefreshed(token, refreshToken, expiredAt) {
|
|
30687
|
+
onTokenRefreshed: function onTokenRefreshed(token, refreshToken, expiredAt, oldToken) {
|
|
30681
30688
|
_this3.userData.token = token;
|
|
30682
30689
|
_this3.userData.refresh_token = refreshToken;
|
|
30683
30690
|
_this3.userData.token_expires_at = expiredAt === null || expiredAt === void 0 ? void 0 : expiredAt.toJSON();
|
|
30684
30691
|
_this3.events.emit('token-refreshed', {
|
|
30685
30692
|
token: token,
|
|
30686
30693
|
refreshToken: refreshToken,
|
|
30687
|
-
expiredAt: expiredAt
|
|
30694
|
+
expiredAt: expiredAt,
|
|
30695
|
+
oldToken: oldToken
|
|
30688
30696
|
});
|
|
30697
|
+
_this3.realtimeAdapter.unsusbcribeUserChannelByToken(oldToken);
|
|
30698
|
+
_this3.realtimeAdapter.subscribeUserChannelByToken(token);
|
|
30699
|
+
_this3._delayedSync();
|
|
30689
30700
|
},
|
|
30690
30701
|
getAuthenticationStatus: function getAuthenticationStatus() {
|
|
30691
30702
|
return _this3.user_id != null && _this3.isLogin;
|
|
@@ -33380,7 +33391,7 @@ var ExpiredTokenAdapter = /*#__PURE__*/function () {
|
|
|
33380
33391
|
* userId: string,
|
|
33381
33392
|
* refreshToken: string | null,
|
|
33382
33393
|
* expiredAt: string | null,
|
|
33383
|
-
* onTokenRefreshed: (token: string, refreshToken: string, expiredAt: Date) => void
|
|
33394
|
+
* onTokenRefreshed: (token: string, refreshToken: string, expiredAt: Date, oldToken: string) => void
|
|
33384
33395
|
* getAuthenticationStatus: () => boolean,
|
|
33385
33396
|
* }} param
|
|
33386
33397
|
*/
|
|
@@ -33400,7 +33411,7 @@ var ExpiredTokenAdapter = /*#__PURE__*/function () {
|
|
|
33400
33411
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default()(this, "_expiredAt", null);
|
|
33401
33412
|
/** @type {import('./http').default} */
|
|
33402
33413
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default()(this, "_http", void 0);
|
|
33403
|
-
/** @type {(token: string, refreshToken: string, expiredAt: Date) => void | undefined} */
|
|
33414
|
+
/** @type {(token: string, refreshToken: string, expiredAt: Date, oldToken: string) => void | undefined} */
|
|
33404
33415
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default()(this, "_onTokenRefreshed", void 0);
|
|
33405
33416
|
/** @type {any} */
|
|
33406
33417
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default()(this, "_timerId", void 0);
|
|
@@ -33466,13 +33477,12 @@ var ExpiredTokenAdapter = /*#__PURE__*/function () {
|
|
|
33466
33477
|
var res = r.body.results;
|
|
33467
33478
|
var token = res.token;
|
|
33468
33479
|
_this2._refreshToken = res.refresh_token;
|
|
33480
|
+
// @ts-ignore
|
|
33481
|
+
(_this2$_onTokenRefres = _this2._onTokenRefreshed) === null || _this2$_onTokenRefres === void 0 || _this2$_onTokenRefres.call(_this2, token, _this2._refreshToken, _this2._expiredAt, _this2._http.token);
|
|
33469
33482
|
_this2._http.setToken(res.token);
|
|
33470
33483
|
if (res.token_expires_at != null) {
|
|
33471
33484
|
_this2._expiredAt = new Date(res.token_expires_at);
|
|
33472
33485
|
}
|
|
33473
|
-
|
|
33474
|
-
// @ts-ignore
|
|
33475
|
-
(_this2$_onTokenRefres = _this2._onTokenRefreshed) === null || _this2$_onTokenRefres === void 0 || _this2$_onTokenRefres.call(_this2, token, _this2._refreshToken, _this2._expiredAt);
|
|
33476
33486
|
_this2._setTimer(_this2._expiredAt);
|
|
33477
33487
|
return res;
|
|
33478
33488
|
}));
|
|
@@ -34090,7 +34100,7 @@ var MqttAdapter = /*#__PURE__*/function () {
|
|
|
34090
34100
|
}
|
|
34091
34101
|
|
|
34092
34102
|
/**
|
|
34093
|
-
* @return {Promise<boolean}
|
|
34103
|
+
* @return {Promise<boolean>}
|
|
34094
34104
|
*/
|
|
34095
34105
|
}, {
|
|
34096
34106
|
key: "openConnection",
|
|
@@ -34180,12 +34190,12 @@ var MqttAdapter = /*#__PURE__*/function () {
|
|
|
34180
34190
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
34181
34191
|
args[_key2] = arguments[_key2];
|
|
34182
34192
|
}
|
|
34183
|
-
this.logger('subscribe to', args);
|
|
34184
34193
|
this.subscribtionBuffer.push(args);
|
|
34185
34194
|
while (this.mqtt != null && this.subscribtionBuffer.length > 0) {
|
|
34186
34195
|
var subs = this.subscribtionBuffer.shift();
|
|
34187
34196
|
if (subs != null) {
|
|
34188
34197
|
var _this$mqtt;
|
|
34198
|
+
this.logger('subscribe topic', subs);
|
|
34189
34199
|
(_this$mqtt = this.mqtt).subscribe.apply(_this$mqtt, _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(subs));
|
|
34190
34200
|
}
|
|
34191
34201
|
}
|
|
@@ -34201,6 +34211,7 @@ var MqttAdapter = /*#__PURE__*/function () {
|
|
|
34201
34211
|
var subs = this.unsubscribtionBuffer.shift();
|
|
34202
34212
|
if (subs != null) {
|
|
34203
34213
|
var _this$mqtt2;
|
|
34214
|
+
this.logger('unsubscribe topic', subs);
|
|
34204
34215
|
(_this$mqtt2 = this.mqtt).unsubscribe.apply(_this$mqtt2, _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(subs));
|
|
34205
34216
|
}
|
|
34206
34217
|
}
|
|
@@ -34217,6 +34228,7 @@ var MqttAdapter = /*#__PURE__*/function () {
|
|
|
34217
34228
|
while (this.mqtt != null && this.publishBuffer.length > 0) {
|
|
34218
34229
|
var data = this.publishBuffer.shift();
|
|
34219
34230
|
if (data != null) {
|
|
34231
|
+
this.logger('publish to', data.topic, data.payload, data.options);
|
|
34220
34232
|
this.mqtt.publish(data.topic, data.payload.toString(), data.options);
|
|
34221
34233
|
}
|
|
34222
34234
|
}
|
|
@@ -34498,6 +34510,27 @@ var MqttAdapter = /*#__PURE__*/function () {
|
|
|
34498
34510
|
this.subscribe("".concat(this.core.userData.token, "/n"));
|
|
34499
34511
|
this.subscribe("".concat(this.core.userData.token, "/update"));
|
|
34500
34512
|
}
|
|
34513
|
+
}, {
|
|
34514
|
+
key: "subscribeUserChannelByToken",
|
|
34515
|
+
value: function subscribeUserChannelByToken(token) {
|
|
34516
|
+
this.subscribe("".concat(token, "/c"));
|
|
34517
|
+
this.subscribe("".concat(token, "/n"));
|
|
34518
|
+
this.subscribe("".concat(token, "/update"));
|
|
34519
|
+
}
|
|
34520
|
+
}, {
|
|
34521
|
+
key: "unsubscribeUserChannel",
|
|
34522
|
+
value: function unsubscribeUserChannel() {
|
|
34523
|
+
this.unsubscribe("".concat(this.core.userData.token, "/c"));
|
|
34524
|
+
this.unsubscribe("".concat(this.core.userData.token, "/n"));
|
|
34525
|
+
this.unsubscribe("".concat(this.core.userData.token, "/update"));
|
|
34526
|
+
}
|
|
34527
|
+
}, {
|
|
34528
|
+
key: "unsusbcribeUserChannelByToken",
|
|
34529
|
+
value: function unsusbcribeUserChannelByToken(token) {
|
|
34530
|
+
this.unsubscribe("".concat(token, "/c"));
|
|
34531
|
+
this.unsubscribe("".concat(token, "/n"));
|
|
34532
|
+
this.unsubscribe("".concat(token, "/update"));
|
|
34533
|
+
}
|
|
34501
34534
|
}, {
|
|
34502
34535
|
key: "publishPresence",
|
|
34503
34536
|
value: function publishPresence(userId) {
|
|
@@ -34743,6 +34776,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
34743
34776
|
|
|
34744
34777
|
|
|
34745
34778
|
|
|
34779
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
34780
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
34781
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
34746
34782
|
|
|
34747
34783
|
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
34748
34784
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, "return": function _return(r) { var n = this.s["return"]; return void 0 === n ? Promise.resolve({ value: r, done: !0 }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, "throw": function _throw(r) { var n = this.s["return"]; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
@@ -35146,10 +35182,76 @@ function SyncAdapter(getHttpAdapter, _ref) {
|
|
|
35146
35182
|
return enableSync();
|
|
35147
35183
|
},
|
|
35148
35184
|
synchronize: function synchronize() {
|
|
35149
|
-
|
|
35185
|
+
return _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default.a.mark(function _callee5() {
|
|
35186
|
+
var _result$messages, _result$lastMessageId;
|
|
35187
|
+
var id, result, messages, lastMessageId, _iterator3, _step3, message;
|
|
35188
|
+
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default.a.wrap(function _callee5$(_context5) {
|
|
35189
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
35190
|
+
case 0:
|
|
35191
|
+
id = lastCommentId();
|
|
35192
|
+
_context5.next = 3;
|
|
35193
|
+
return syncFactory.synchronize(id);
|
|
35194
|
+
case 3:
|
|
35195
|
+
result = _context5.sent;
|
|
35196
|
+
messages = (_result$messages = result === null || result === void 0 ? void 0 : result.messages) !== null && _result$messages !== void 0 ? _result$messages : [];
|
|
35197
|
+
lastMessageId = (_result$lastMessageId = result === null || result === void 0 ? void 0 : result.lastMessageId) !== null && _result$lastMessageId !== void 0 ? _result$lastMessageId : -1;
|
|
35198
|
+
_iterator3 = _createForOfIteratorHelper(messages);
|
|
35199
|
+
try {
|
|
35200
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
35201
|
+
message = _step3.value;
|
|
35202
|
+
emitter.emit('message.new', message);
|
|
35203
|
+
}
|
|
35204
|
+
} catch (err) {
|
|
35205
|
+
_iterator3.e(err);
|
|
35206
|
+
} finally {
|
|
35207
|
+
_iterator3.f();
|
|
35208
|
+
}
|
|
35209
|
+
if (lastMessageId > 0) {
|
|
35210
|
+
emitter.emit('last-message-id.new', lastMessageId);
|
|
35211
|
+
}
|
|
35212
|
+
case 9:
|
|
35213
|
+
case "end":
|
|
35214
|
+
return _context5.stop();
|
|
35215
|
+
}
|
|
35216
|
+
}, _callee5);
|
|
35217
|
+
}))();
|
|
35150
35218
|
},
|
|
35151
35219
|
synchronizeEvent: function synchronizeEvent() {
|
|
35152
|
-
|
|
35220
|
+
return _babel_runtime_helpers_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0___default()(/*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default.a.mark(function _callee6() {
|
|
35221
|
+
var result, eventId;
|
|
35222
|
+
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_3___default.a.wrap(function _callee6$(_context6) {
|
|
35223
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
35224
|
+
case 0:
|
|
35225
|
+
_context6.next = 2;
|
|
35226
|
+
return syncEventFactory.synchronize(lastEventId);
|
|
35227
|
+
case 2:
|
|
35228
|
+
result = _context6.sent;
|
|
35229
|
+
try {
|
|
35230
|
+
eventId = result.lastId;
|
|
35231
|
+
if (eventId > getId()) {
|
|
35232
|
+
emitter.emit('last-event-id.new', eventId);
|
|
35233
|
+
result.messageDelivered.forEach(function (it) {
|
|
35234
|
+
return emitter.emit('message.delivered', it);
|
|
35235
|
+
});
|
|
35236
|
+
result.messageDeleted.forEach(function (it) {
|
|
35237
|
+
return emitter.emit('message.deleted', it);
|
|
35238
|
+
});
|
|
35239
|
+
result.messageRead.forEach(function (it) {
|
|
35240
|
+
return emitter.emit('message.read', it);
|
|
35241
|
+
});
|
|
35242
|
+
result.roomCleared.forEach(function (it) {
|
|
35243
|
+
return emitter.emit('room.cleared', it);
|
|
35244
|
+
});
|
|
35245
|
+
}
|
|
35246
|
+
} catch (e) {
|
|
35247
|
+
logger('error when sync event', e.message);
|
|
35248
|
+
}
|
|
35249
|
+
case 4:
|
|
35250
|
+
case "end":
|
|
35251
|
+
return _context6.stop();
|
|
35252
|
+
}
|
|
35253
|
+
}, _callee6);
|
|
35254
|
+
}))();
|
|
35153
35255
|
}
|
|
35154
35256
|
};
|
|
35155
35257
|
}
|
|
@@ -35659,7 +35761,7 @@ var sleep = function sleep() {
|
|
|
35659
35761
|
/*!**************************!*\
|
|
35660
35762
|
!*** ./src/lib/utils.js ***!
|
|
35661
35763
|
\**************************/
|
|
35662
|
-
/*! exports provided: searchAndReplace, escapeHTML, GroupChatBuilder, scrollToBottom */
|
|
35764
|
+
/*! exports provided: searchAndReplace, escapeHTML, GroupChatBuilder, scrollToBottom, delayed */
|
|
35663
35765
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
35664
35766
|
|
|
35665
35767
|
"use strict";
|
|
@@ -35668,6 +35770,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
35668
35770
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "escapeHTML", function() { return escapeHTML; });
|
|
35669
35771
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GroupChatBuilder", function() { return GroupChatBuilder; });
|
|
35670
35772
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scrollToBottom", function() { return scrollToBottom; });
|
|
35773
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delayed", function() { return delayed; });
|
|
35671
35774
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
35672
35775
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
|
|
35673
35776
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/.pnpm/@babel+runtime@7.26.9/node_modules/@babel/runtime/helpers/createClass.js");
|
|
@@ -35771,6 +35874,19 @@ function scrollToBottom(latestCommentId) {
|
|
|
35771
35874
|
document.getElementsByClassName('qcw-comment-form').item(0).getElementsByTagName('textarea').item(0).focus();
|
|
35772
35875
|
});
|
|
35773
35876
|
}
|
|
35877
|
+
function delayed(cb, timeout) {
|
|
35878
|
+
var timer = null;
|
|
35879
|
+
return function () {
|
|
35880
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
35881
|
+
args[_key2] = arguments[_key2];
|
|
35882
|
+
}
|
|
35883
|
+
if (timer != null) clearTimeout(timer);
|
|
35884
|
+
timer = setTimeout(function () {
|
|
35885
|
+
cb.apply(void 0, args);
|
|
35886
|
+
timer = null;
|
|
35887
|
+
}, timeout);
|
|
35888
|
+
};
|
|
35889
|
+
}
|
|
35774
35890
|
|
|
35775
35891
|
/***/ }),
|
|
35776
35892
|
|