podchat-browser 11.3.2 → 11.4.1
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/changelog.md +7 -2
- package/dist/podchat-11.3.2.js +55921 -55921
- package/dist/{podchat-11.2.3.js → podchat-11.3.3.js} +56842 -56708
- package/dist/{podchat-11.2.1.js → podchat-11.3.4.js} +2722 -833
- package/dist/{podchat-11.2.2.js → podchat-11.4.1.js} +57048 -56947
- package/examples/index.html +62 -4
- package/package.json +3 -3
- package/src/call.module.js +247 -303
- package/src/chat.js +61 -20
- package/config.js +0 -59
- package/dist/podchat-10.14.11.js +0 -71188
- package/dist/podchat-10.14.12.js +0 -71188
- package/dist/podchat-11.1.0.js +0 -72792
|
@@ -26736,7 +26736,7 @@ function config (name) {
|
|
|
26736
26736
|
},{}],188:[function(require,module,exports){
|
|
26737
26737
|
window.PodChat = require('./src/chat.js');
|
|
26738
26738
|
|
|
26739
|
-
},{"./src/chat.js":
|
|
26739
|
+
},{"./src/chat.js":331}],189:[function(require,module,exports){
|
|
26740
26740
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26741
26741
|
var tslib_1 = require("tslib");
|
|
26742
26742
|
var core_1 = require("@sentry/core");
|
|
@@ -26787,7 +26787,7 @@ var BrowserBackend = /** @class */ (function (_super) {
|
|
|
26787
26787
|
}(core_1.BaseBackend));
|
|
26788
26788
|
exports.BrowserBackend = BrowserBackend;
|
|
26789
26789
|
|
|
26790
|
-
},{"./eventbuilder":191,"./transports":207,"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
26790
|
+
},{"./eventbuilder":191,"./transports":207,"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],190:[function(require,module,exports){
|
|
26791
26791
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26792
26792
|
var tslib_1 = require("tslib");
|
|
26793
26793
|
var core_1 = require("@sentry/core");
|
|
@@ -26864,7 +26864,7 @@ var BrowserClient = /** @class */ (function (_super) {
|
|
|
26864
26864
|
}(core_1.BaseClient));
|
|
26865
26865
|
exports.BrowserClient = BrowserClient;
|
|
26866
26866
|
|
|
26867
|
-
},{"./backend":189,"./helpers":193,"./integrations":198,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
26867
|
+
},{"./backend":189,"./helpers":193,"./integrations":198,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],191:[function(require,module,exports){
|
|
26868
26868
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26869
26869
|
var tslib_1 = require("tslib");
|
|
26870
26870
|
var types_1 = require("@sentry/types");
|
|
@@ -26989,7 +26989,7 @@ function eventFromString(input, syntheticException, options) {
|
|
|
26989
26989
|
}
|
|
26990
26990
|
exports.eventFromString = eventFromString;
|
|
26991
26991
|
|
|
26992
|
-
},{"./parsers":202,"./tracekit":204,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
26992
|
+
},{"./parsers":202,"./tracekit":204,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],192:[function(require,module,exports){
|
|
26993
26993
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26994
26994
|
var types_1 = require("@sentry/types");
|
|
26995
26995
|
exports.Severity = types_1.Severity;
|
|
@@ -27199,7 +27199,7 @@ function injectReportDialog(options) {
|
|
|
27199
27199
|
}
|
|
27200
27200
|
exports.injectReportDialog = injectReportDialog;
|
|
27201
27201
|
|
|
27202
|
-
},{"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
27202
|
+
},{"@sentry/core":213,"@sentry/utils":238,"tslib":313}],194:[function(require,module,exports){
|
|
27203
27203
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27204
27204
|
var tslib_1 = require("tslib");
|
|
27205
27205
|
tslib_1.__exportStar(require("./exports"), exports);
|
|
@@ -27217,7 +27217,7 @@ if (_window.Sentry && _window.Sentry.Integrations) {
|
|
|
27217
27217
|
var INTEGRATIONS = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, windowIntegrations), core_1.Integrations), BrowserIntegrations);
|
|
27218
27218
|
exports.Integrations = INTEGRATIONS;
|
|
27219
27219
|
|
|
27220
|
-
},{"./exports":192,"./integrations":198,"./transports":207,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
27220
|
+
},{"./exports":192,"./integrations":198,"./transports":207,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],195:[function(require,module,exports){
|
|
27221
27221
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27222
27222
|
var tslib_1 = require("tslib");
|
|
27223
27223
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
@@ -27487,7 +27487,7 @@ var Breadcrumbs = /** @class */ (function () {
|
|
|
27487
27487
|
}());
|
|
27488
27488
|
exports.Breadcrumbs = Breadcrumbs;
|
|
27489
27489
|
|
|
27490
|
-
},{"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
27490
|
+
},{"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],196:[function(require,module,exports){
|
|
27491
27491
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27492
27492
|
/** Deduplication filter */
|
|
27493
27493
|
var Dedupe = /** @class */ (function () {
|
|
@@ -27857,7 +27857,7 @@ var GlobalHandlers = /** @class */ (function () {
|
|
|
27857
27857
|
}());
|
|
27858
27858
|
exports.GlobalHandlers = GlobalHandlers;
|
|
27859
27859
|
|
|
27860
|
-
},{"../eventbuilder":191,"../helpers":193,"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
27860
|
+
},{"../eventbuilder":191,"../helpers":193,"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],198:[function(require,module,exports){
|
|
27861
27861
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27862
27862
|
var globalhandlers_1 = require("./globalhandlers");
|
|
27863
27863
|
exports.GlobalHandlers = globalhandlers_1.GlobalHandlers;
|
|
@@ -27939,7 +27939,7 @@ var LinkedErrors = /** @class */ (function () {
|
|
|
27939
27939
|
}());
|
|
27940
27940
|
exports.LinkedErrors = LinkedErrors;
|
|
27941
27941
|
|
|
27942
|
-
},{"../parsers":202,"../tracekit":204,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
27942
|
+
},{"../parsers":202,"../tracekit":204,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],200:[function(require,module,exports){
|
|
27943
27943
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27944
27944
|
var tslib_1 = require("tslib");
|
|
27945
27945
|
var utils_1 = require("@sentry/utils");
|
|
@@ -28171,7 +28171,7 @@ var TryCatch = /** @class */ (function () {
|
|
|
28171
28171
|
}());
|
|
28172
28172
|
exports.TryCatch = TryCatch;
|
|
28173
28173
|
|
|
28174
|
-
},{"../helpers":193,"@sentry/utils":238,"tslib":
|
|
28174
|
+
},{"../helpers":193,"@sentry/utils":238,"tslib":313}],201:[function(require,module,exports){
|
|
28175
28175
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28176
28176
|
var tslib_1 = require("tslib");
|
|
28177
28177
|
var core_1 = require("@sentry/core");
|
|
@@ -28215,7 +28215,7 @@ var UserAgent = /** @class */ (function () {
|
|
|
28215
28215
|
}());
|
|
28216
28216
|
exports.UserAgent = UserAgent;
|
|
28217
28217
|
|
|
28218
|
-
},{"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
28218
|
+
},{"@sentry/core":213,"@sentry/utils":238,"tslib":313}],202:[function(require,module,exports){
|
|
28219
28219
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28220
28220
|
var utils_1 = require("@sentry/utils");
|
|
28221
28221
|
var tracekit_1 = require("./tracekit");
|
|
@@ -28540,7 +28540,7 @@ function startSessionTracking() {
|
|
|
28540
28540
|
});
|
|
28541
28541
|
}
|
|
28542
28542
|
|
|
28543
|
-
},{"./client":190,"./helpers":193,"./integrations":198,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
28543
|
+
},{"./client":190,"./helpers":193,"./integrations":198,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],204:[function(require,module,exports){
|
|
28544
28544
|
/**
|
|
28545
28545
|
* This was originally forked from https://github.com/occ/TraceKit, but has since been
|
|
28546
28546
|
* largely modified and is now maintained as part of Sentry JS SDK.
|
|
@@ -28771,7 +28771,7 @@ function extractMessage(ex) {
|
|
|
28771
28771
|
return message;
|
|
28772
28772
|
}
|
|
28773
28773
|
|
|
28774
|
-
},{"tslib":
|
|
28774
|
+
},{"tslib":313}],205:[function(require,module,exports){
|
|
28775
28775
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28776
28776
|
var tslib_1 = require("tslib");
|
|
28777
28777
|
var core_1 = require("@sentry/core");
|
|
@@ -28898,7 +28898,7 @@ var BaseTransport = /** @class */ (function () {
|
|
|
28898
28898
|
}());
|
|
28899
28899
|
exports.BaseTransport = BaseTransport;
|
|
28900
28900
|
|
|
28901
|
-
},{"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
28901
|
+
},{"@sentry/core":213,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],206:[function(require,module,exports){
|
|
28902
28902
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28903
28903
|
var tslib_1 = require("tslib");
|
|
28904
28904
|
var core_1 = require("@sentry/core");
|
|
@@ -29044,7 +29044,7 @@ var FetchTransport = /** @class */ (function (_super) {
|
|
|
29044
29044
|
}(base_1.BaseTransport));
|
|
29045
29045
|
exports.FetchTransport = FetchTransport;
|
|
29046
29046
|
|
|
29047
|
-
},{"./base":205,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
29047
|
+
},{"./base":205,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],207:[function(require,module,exports){
|
|
29048
29048
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29049
29049
|
var base_1 = require("./base");
|
|
29050
29050
|
exports.BaseTransport = base_1.BaseTransport;
|
|
@@ -29117,7 +29117,7 @@ var XHRTransport = /** @class */ (function (_super) {
|
|
|
29117
29117
|
}(base_1.BaseTransport));
|
|
29118
29118
|
exports.XHRTransport = XHRTransport;
|
|
29119
29119
|
|
|
29120
|
-
},{"./base":205,"@sentry/core":213,"@sentry/utils":238,"tslib":
|
|
29120
|
+
},{"./base":205,"@sentry/core":213,"@sentry/utils":238,"tslib":313}],209:[function(require,module,exports){
|
|
29121
29121
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29122
29122
|
// TODO: Remove in the next major release and rely only on @sentry/core SDK_VERSION and SdkInfo metadata
|
|
29123
29123
|
exports.SDK_NAME = 'sentry.javascript.browser';
|
|
@@ -29820,7 +29820,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
29820
29820
|
}());
|
|
29821
29821
|
exports.BaseClient = BaseClient;
|
|
29822
29822
|
|
|
29823
|
-
},{"./integration":214,"@sentry/hub":223,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
29823
|
+
},{"./integration":214,"@sentry/hub":223,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],213:[function(require,module,exports){
|
|
29824
29824
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29825
29825
|
var minimal_1 = require("@sentry/minimal");
|
|
29826
29826
|
exports.addBreadcrumb = minimal_1.addBreadcrumb;
|
|
@@ -29932,7 +29932,7 @@ function setupIntegrations(options) {
|
|
|
29932
29932
|
}
|
|
29933
29933
|
exports.setupIntegrations = setupIntegrations;
|
|
29934
29934
|
|
|
29935
|
-
},{"@sentry/hub":223,"@sentry/utils":238,"tslib":
|
|
29935
|
+
},{"@sentry/hub":223,"@sentry/utils":238,"tslib":313}],215:[function(require,module,exports){
|
|
29936
29936
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29937
29937
|
var originalFunctionToString;
|
|
29938
29938
|
/** Patch toString calls to return proper name for wrapped functions */
|
|
@@ -30142,7 +30142,7 @@ var InboundFilters = /** @class */ (function () {
|
|
|
30142
30142
|
}());
|
|
30143
30143
|
exports.InboundFilters = InboundFilters;
|
|
30144
30144
|
|
|
30145
|
-
},{"@sentry/hub":223,"@sentry/utils":238,"tslib":
|
|
30145
|
+
},{"@sentry/hub":223,"@sentry/utils":238,"tslib":313}],217:[function(require,module,exports){
|
|
30146
30146
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30147
30147
|
var functiontostring_1 = require("./functiontostring");
|
|
30148
30148
|
exports.FunctionToString = functiontostring_1.FunctionToString;
|
|
@@ -30233,7 +30233,7 @@ function eventToSentryRequest(event, api) {
|
|
|
30233
30233
|
}
|
|
30234
30234
|
exports.eventToSentryRequest = eventToSentryRequest;
|
|
30235
30235
|
|
|
30236
|
-
},{"tslib":
|
|
30236
|
+
},{"tslib":313}],219:[function(require,module,exports){
|
|
30237
30237
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30238
30238
|
var hub_1 = require("@sentry/hub");
|
|
30239
30239
|
var utils_1 = require("@sentry/utils");
|
|
@@ -30809,7 +30809,7 @@ function setHubOnCarrier(carrier, hub) {
|
|
|
30809
30809
|
}
|
|
30810
30810
|
exports.setHubOnCarrier = setHubOnCarrier;
|
|
30811
30811
|
|
|
30812
|
-
},{"./scope":224,"./session":225,"@sentry/types":228,"@sentry/utils":238,"tslib":
|
|
30812
|
+
},{"./scope":224,"./session":225,"@sentry/types":228,"@sentry/utils":238,"tslib":313}],223:[function(require,module,exports){
|
|
30813
30813
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30814
30814
|
var scope_1 = require("./scope");
|
|
30815
30815
|
exports.addGlobalEventProcessor = scope_1.addGlobalEventProcessor;
|
|
@@ -31274,7 +31274,7 @@ function addGlobalEventProcessor(callback) {
|
|
|
31274
31274
|
}
|
|
31275
31275
|
exports.addGlobalEventProcessor = addGlobalEventProcessor;
|
|
31276
31276
|
|
|
31277
|
-
},{"@sentry/utils":238,"tslib":
|
|
31277
|
+
},{"@sentry/utils":238,"tslib":313}],225:[function(require,module,exports){
|
|
31278
31278
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31279
31279
|
var types_1 = require("@sentry/types");
|
|
31280
31280
|
var utils_1 = require("@sentry/utils");
|
|
@@ -31707,7 +31707,7 @@ function startTransaction(context, customSamplingContext) {
|
|
|
31707
31707
|
}
|
|
31708
31708
|
exports.startTransaction = startTransaction;
|
|
31709
31709
|
|
|
31710
|
-
},{"@sentry/hub":223,"tslib":
|
|
31710
|
+
},{"@sentry/hub":223,"tslib":313}],228:[function(require,module,exports){
|
|
31711
31711
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31712
31712
|
var loglevel_1 = require("./loglevel");
|
|
31713
31713
|
exports.LogLevel = loglevel_1.LogLevel;
|
|
@@ -32074,7 +32074,7 @@ var Dsn = /** @class */ (function () {
|
|
|
32074
32074
|
}());
|
|
32075
32075
|
exports.Dsn = Dsn;
|
|
32076
32076
|
|
|
32077
|
-
},{"./error":237,"tslib":
|
|
32077
|
+
},{"./error":237,"tslib":313}],237:[function(require,module,exports){
|
|
32078
32078
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32079
32079
|
var tslib_1 = require("tslib");
|
|
32080
32080
|
var polyfill_1 = require("./polyfill");
|
|
@@ -32093,7 +32093,7 @@ var SentryError = /** @class */ (function (_super) {
|
|
|
32093
32093
|
}(Error));
|
|
32094
32094
|
exports.SentryError = SentryError;
|
|
32095
32095
|
|
|
32096
|
-
},{"./polyfill":247,"tslib":
|
|
32096
|
+
},{"./polyfill":247,"tslib":313}],238:[function(require,module,exports){
|
|
32097
32097
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32098
32098
|
var tslib_1 = require("tslib");
|
|
32099
32099
|
tslib_1.__exportStar(require("./async"), exports);
|
|
@@ -32115,7 +32115,7 @@ tslib_1.__exportStar(require("./supports"), exports);
|
|
|
32115
32115
|
tslib_1.__exportStar(require("./syncpromise"), exports);
|
|
32116
32116
|
tslib_1.__exportStar(require("./time"), exports);
|
|
32117
32117
|
|
|
32118
|
-
},{"./async":234,"./browser":235,"./dsn":236,"./error":237,"./instrument":239,"./is":240,"./logger":241,"./memo":242,"./misc":243,"./node":244,"./object":245,"./path":246,"./promisebuffer":248,"./stacktrace":249,"./string":250,"./supports":251,"./syncpromise":252,"./time":253,"tslib":
|
|
32118
|
+
},{"./async":234,"./browser":235,"./dsn":236,"./error":237,"./instrument":239,"./is":240,"./logger":241,"./memo":242,"./misc":243,"./node":244,"./object":245,"./path":246,"./promisebuffer":248,"./stacktrace":249,"./string":250,"./supports":251,"./syncpromise":252,"./time":253,"tslib":313}],239:[function(require,module,exports){
|
|
32119
32119
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32120
32120
|
var tslib_1 = require("tslib");
|
|
32121
32121
|
var is_1 = require("./is");
|
|
@@ -32660,7 +32660,7 @@ function instrumentUnhandledRejection() {
|
|
|
32660
32660
|
};
|
|
32661
32661
|
}
|
|
32662
32662
|
|
|
32663
|
-
},{"./is":240,"./logger":241,"./misc":243,"./object":245,"./stacktrace":249,"./supports":251,"tslib":
|
|
32663
|
+
},{"./is":240,"./logger":241,"./misc":243,"./object":245,"./stacktrace":249,"./supports":251,"tslib":313}],240:[function(require,module,exports){
|
|
32664
32664
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
32665
32665
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
32666
32666
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -33600,7 +33600,7 @@ function dropUndefinedKeys(val) {
|
|
|
33600
33600
|
exports.dropUndefinedKeys = dropUndefinedKeys;
|
|
33601
33601
|
|
|
33602
33602
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
33603
|
-
},{"./browser":235,"./is":240,"./memo":242,"./stacktrace":249,"./string":250,"tslib":
|
|
33603
|
+
},{"./browser":235,"./is":240,"./memo":242,"./stacktrace":249,"./string":250,"tslib":313}],246:[function(require,module,exports){
|
|
33604
33604
|
// Slightly modified (no IE8 support, ES6) and transcribed to TypeScript
|
|
33605
33605
|
// https://raw.githubusercontent.com/calvinmetcalf/rollup-plugin-node-builtins/master/src/es6/path.js
|
|
33606
33606
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -45707,6 +45707,1406 @@ return Dexie;
|
|
|
45707
45707
|
|
|
45708
45708
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
|
|
45709
45709
|
},{"timers":186}],289:[function(require,module,exports){
|
|
45710
|
+
/*! @license DOMPurify 2.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.3/LICENSE */
|
|
45711
|
+
|
|
45712
|
+
(function (global, factory) {
|
|
45713
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
45714
|
+
typeof define === 'function' && define.amd ? define(factory) :
|
|
45715
|
+
(global = global || self, global.DOMPurify = factory());
|
|
45716
|
+
}(this, function () { 'use strict';
|
|
45717
|
+
|
|
45718
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
45719
|
+
|
|
45720
|
+
var hasOwnProperty = Object.hasOwnProperty,
|
|
45721
|
+
setPrototypeOf = Object.setPrototypeOf,
|
|
45722
|
+
isFrozen = Object.isFrozen,
|
|
45723
|
+
getPrototypeOf = Object.getPrototypeOf,
|
|
45724
|
+
getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
45725
|
+
var freeze = Object.freeze,
|
|
45726
|
+
seal = Object.seal,
|
|
45727
|
+
create = Object.create; // eslint-disable-line import/no-mutable-exports
|
|
45728
|
+
|
|
45729
|
+
var _ref = typeof Reflect !== 'undefined' && Reflect,
|
|
45730
|
+
apply = _ref.apply,
|
|
45731
|
+
construct = _ref.construct;
|
|
45732
|
+
|
|
45733
|
+
if (!apply) {
|
|
45734
|
+
apply = function apply(fun, thisValue, args) {
|
|
45735
|
+
return fun.apply(thisValue, args);
|
|
45736
|
+
};
|
|
45737
|
+
}
|
|
45738
|
+
|
|
45739
|
+
if (!freeze) {
|
|
45740
|
+
freeze = function freeze(x) {
|
|
45741
|
+
return x;
|
|
45742
|
+
};
|
|
45743
|
+
}
|
|
45744
|
+
|
|
45745
|
+
if (!seal) {
|
|
45746
|
+
seal = function seal(x) {
|
|
45747
|
+
return x;
|
|
45748
|
+
};
|
|
45749
|
+
}
|
|
45750
|
+
|
|
45751
|
+
if (!construct) {
|
|
45752
|
+
construct = function construct(Func, args) {
|
|
45753
|
+
return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))();
|
|
45754
|
+
};
|
|
45755
|
+
}
|
|
45756
|
+
|
|
45757
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
|
45758
|
+
var arrayPop = unapply(Array.prototype.pop);
|
|
45759
|
+
var arrayPush = unapply(Array.prototype.push);
|
|
45760
|
+
|
|
45761
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
45762
|
+
var stringMatch = unapply(String.prototype.match);
|
|
45763
|
+
var stringReplace = unapply(String.prototype.replace);
|
|
45764
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
45765
|
+
var stringTrim = unapply(String.prototype.trim);
|
|
45766
|
+
|
|
45767
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
|
45768
|
+
|
|
45769
|
+
var typeErrorCreate = unconstruct(TypeError);
|
|
45770
|
+
|
|
45771
|
+
function unapply(func) {
|
|
45772
|
+
return function (thisArg) {
|
|
45773
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
45774
|
+
args[_key - 1] = arguments[_key];
|
|
45775
|
+
}
|
|
45776
|
+
|
|
45777
|
+
return apply(func, thisArg, args);
|
|
45778
|
+
};
|
|
45779
|
+
}
|
|
45780
|
+
|
|
45781
|
+
function unconstruct(func) {
|
|
45782
|
+
return function () {
|
|
45783
|
+
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
45784
|
+
args[_key2] = arguments[_key2];
|
|
45785
|
+
}
|
|
45786
|
+
|
|
45787
|
+
return construct(func, args);
|
|
45788
|
+
};
|
|
45789
|
+
}
|
|
45790
|
+
|
|
45791
|
+
/* Add properties to a lookup table */
|
|
45792
|
+
function addToSet(set, array) {
|
|
45793
|
+
if (setPrototypeOf) {
|
|
45794
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
45795
|
+
// independent of any properties defined on Object.prototype.
|
|
45796
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
45797
|
+
setPrototypeOf(set, null);
|
|
45798
|
+
}
|
|
45799
|
+
|
|
45800
|
+
var l = array.length;
|
|
45801
|
+
while (l--) {
|
|
45802
|
+
var element = array[l];
|
|
45803
|
+
if (typeof element === 'string') {
|
|
45804
|
+
var lcElement = stringToLowerCase(element);
|
|
45805
|
+
if (lcElement !== element) {
|
|
45806
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
45807
|
+
if (!isFrozen(array)) {
|
|
45808
|
+
array[l] = lcElement;
|
|
45809
|
+
}
|
|
45810
|
+
|
|
45811
|
+
element = lcElement;
|
|
45812
|
+
}
|
|
45813
|
+
}
|
|
45814
|
+
|
|
45815
|
+
set[element] = true;
|
|
45816
|
+
}
|
|
45817
|
+
|
|
45818
|
+
return set;
|
|
45819
|
+
}
|
|
45820
|
+
|
|
45821
|
+
/* Shallow clone an object */
|
|
45822
|
+
function clone(object) {
|
|
45823
|
+
var newObject = create(null);
|
|
45824
|
+
|
|
45825
|
+
var property = void 0;
|
|
45826
|
+
for (property in object) {
|
|
45827
|
+
if (apply(hasOwnProperty, object, [property])) {
|
|
45828
|
+
newObject[property] = object[property];
|
|
45829
|
+
}
|
|
45830
|
+
}
|
|
45831
|
+
|
|
45832
|
+
return newObject;
|
|
45833
|
+
}
|
|
45834
|
+
|
|
45835
|
+
/* IE10 doesn't support __lookupGetter__ so lets'
|
|
45836
|
+
* simulate it. It also automatically checks
|
|
45837
|
+
* if the prop is function or getter and behaves
|
|
45838
|
+
* accordingly. */
|
|
45839
|
+
function lookupGetter(object, prop) {
|
|
45840
|
+
while (object !== null) {
|
|
45841
|
+
var desc = getOwnPropertyDescriptor(object, prop);
|
|
45842
|
+
if (desc) {
|
|
45843
|
+
if (desc.get) {
|
|
45844
|
+
return unapply(desc.get);
|
|
45845
|
+
}
|
|
45846
|
+
|
|
45847
|
+
if (typeof desc.value === 'function') {
|
|
45848
|
+
return unapply(desc.value);
|
|
45849
|
+
}
|
|
45850
|
+
}
|
|
45851
|
+
|
|
45852
|
+
object = getPrototypeOf(object);
|
|
45853
|
+
}
|
|
45854
|
+
|
|
45855
|
+
function fallbackValue(element) {
|
|
45856
|
+
console.warn('fallback value for', element);
|
|
45857
|
+
return null;
|
|
45858
|
+
}
|
|
45859
|
+
|
|
45860
|
+
return fallbackValue;
|
|
45861
|
+
}
|
|
45862
|
+
|
|
45863
|
+
var html = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
45864
|
+
|
|
45865
|
+
// SVG
|
|
45866
|
+
var svg = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
45867
|
+
|
|
45868
|
+
var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
45869
|
+
|
|
45870
|
+
// List of SVG elements that are disallowed by default.
|
|
45871
|
+
// We still need to know them so that we can do namespace
|
|
45872
|
+
// checks properly in case one wants to add them to
|
|
45873
|
+
// allow-list.
|
|
45874
|
+
var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'feimage', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
45875
|
+
|
|
45876
|
+
var mathMl = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']);
|
|
45877
|
+
|
|
45878
|
+
// Similarly to SVG, we want to know all MathML elements,
|
|
45879
|
+
// even those that we disallow by default.
|
|
45880
|
+
var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
45881
|
+
|
|
45882
|
+
var text = freeze(['#text']);
|
|
45883
|
+
|
|
45884
|
+
var html$1 = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
|
|
45885
|
+
|
|
45886
|
+
var svg$1 = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
45887
|
+
|
|
45888
|
+
var mathMl$1 = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
45889
|
+
|
|
45890
|
+
var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
45891
|
+
|
|
45892
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
45893
|
+
var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
45894
|
+
var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
|
|
45895
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
|
|
45896
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
45897
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
45898
|
+
);
|
|
45899
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
45900
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
45901
|
+
);
|
|
45902
|
+
|
|
45903
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
45904
|
+
|
|
45905
|
+
function _toConsumableArray$1(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
45906
|
+
|
|
45907
|
+
var getGlobal = function getGlobal() {
|
|
45908
|
+
return typeof window === 'undefined' ? null : window;
|
|
45909
|
+
};
|
|
45910
|
+
|
|
45911
|
+
/**
|
|
45912
|
+
* Creates a no-op policy for internal use only.
|
|
45913
|
+
* Don't export this function outside this module!
|
|
45914
|
+
* @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
|
|
45915
|
+
* @param {Document} document The document object (to determine policy name suffix)
|
|
45916
|
+
* @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
|
|
45917
|
+
* are not supported).
|
|
45918
|
+
*/
|
|
45919
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
|
|
45920
|
+
if ((typeof trustedTypes === 'undefined' ? 'undefined' : _typeof(trustedTypes)) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
45921
|
+
return null;
|
|
45922
|
+
}
|
|
45923
|
+
|
|
45924
|
+
// Allow the callers to control the unique policy name
|
|
45925
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
45926
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
45927
|
+
var suffix = null;
|
|
45928
|
+
var ATTR_NAME = 'data-tt-policy-suffix';
|
|
45929
|
+
if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
|
|
45930
|
+
suffix = document.currentScript.getAttribute(ATTR_NAME);
|
|
45931
|
+
}
|
|
45932
|
+
|
|
45933
|
+
var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
45934
|
+
|
|
45935
|
+
try {
|
|
45936
|
+
return trustedTypes.createPolicy(policyName, {
|
|
45937
|
+
createHTML: function createHTML(html$$1) {
|
|
45938
|
+
return html$$1;
|
|
45939
|
+
}
|
|
45940
|
+
});
|
|
45941
|
+
} catch (_) {
|
|
45942
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
45943
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
45944
|
+
// if TT are enforced.
|
|
45945
|
+
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
|
45946
|
+
return null;
|
|
45947
|
+
}
|
|
45948
|
+
};
|
|
45949
|
+
|
|
45950
|
+
function createDOMPurify() {
|
|
45951
|
+
var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
45952
|
+
|
|
45953
|
+
var DOMPurify = function DOMPurify(root) {
|
|
45954
|
+
return createDOMPurify(root);
|
|
45955
|
+
};
|
|
45956
|
+
|
|
45957
|
+
/**
|
|
45958
|
+
* Version label, exposed for easier checks
|
|
45959
|
+
* if DOMPurify is up to date or not
|
|
45960
|
+
*/
|
|
45961
|
+
DOMPurify.version = '2.3.3';
|
|
45962
|
+
|
|
45963
|
+
/**
|
|
45964
|
+
* Array of elements that DOMPurify removed during sanitation.
|
|
45965
|
+
* Empty if nothing was removed.
|
|
45966
|
+
*/
|
|
45967
|
+
DOMPurify.removed = [];
|
|
45968
|
+
|
|
45969
|
+
if (!window || !window.document || window.document.nodeType !== 9) {
|
|
45970
|
+
// Not running in a browser, provide a factory function
|
|
45971
|
+
// so that you can pass your own Window
|
|
45972
|
+
DOMPurify.isSupported = false;
|
|
45973
|
+
|
|
45974
|
+
return DOMPurify;
|
|
45975
|
+
}
|
|
45976
|
+
|
|
45977
|
+
var originalDocument = window.document;
|
|
45978
|
+
|
|
45979
|
+
var document = window.document;
|
|
45980
|
+
var DocumentFragment = window.DocumentFragment,
|
|
45981
|
+
HTMLTemplateElement = window.HTMLTemplateElement,
|
|
45982
|
+
Node = window.Node,
|
|
45983
|
+
Element = window.Element,
|
|
45984
|
+
NodeFilter = window.NodeFilter,
|
|
45985
|
+
_window$NamedNodeMap = window.NamedNodeMap,
|
|
45986
|
+
NamedNodeMap = _window$NamedNodeMap === undefined ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
|
|
45987
|
+
Text = window.Text,
|
|
45988
|
+
Comment = window.Comment,
|
|
45989
|
+
DOMParser = window.DOMParser,
|
|
45990
|
+
trustedTypes = window.trustedTypes;
|
|
45991
|
+
|
|
45992
|
+
|
|
45993
|
+
var ElementPrototype = Element.prototype;
|
|
45994
|
+
|
|
45995
|
+
var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
45996
|
+
var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
45997
|
+
var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
45998
|
+
var getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
45999
|
+
|
|
46000
|
+
// As per issue #47, the web-components registry is inherited by a
|
|
46001
|
+
// new document created via createHTMLDocument. As per the spec
|
|
46002
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
46003
|
+
// a new empty registry is used when creating a template contents owner
|
|
46004
|
+
// document, so we use that as our parent document to ensure nothing
|
|
46005
|
+
// is inherited.
|
|
46006
|
+
if (typeof HTMLTemplateElement === 'function') {
|
|
46007
|
+
var template = document.createElement('template');
|
|
46008
|
+
if (template.content && template.content.ownerDocument) {
|
|
46009
|
+
document = template.content.ownerDocument;
|
|
46010
|
+
}
|
|
46011
|
+
}
|
|
46012
|
+
|
|
46013
|
+
var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
|
|
46014
|
+
var emptyHTML = trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML('') : '';
|
|
46015
|
+
|
|
46016
|
+
var _document = document,
|
|
46017
|
+
implementation = _document.implementation,
|
|
46018
|
+
createNodeIterator = _document.createNodeIterator,
|
|
46019
|
+
createDocumentFragment = _document.createDocumentFragment,
|
|
46020
|
+
getElementsByTagName = _document.getElementsByTagName;
|
|
46021
|
+
var importNode = originalDocument.importNode;
|
|
46022
|
+
|
|
46023
|
+
|
|
46024
|
+
var documentMode = {};
|
|
46025
|
+
try {
|
|
46026
|
+
documentMode = clone(document).documentMode ? document.documentMode : {};
|
|
46027
|
+
} catch (_) {}
|
|
46028
|
+
|
|
46029
|
+
var hooks = {};
|
|
46030
|
+
|
|
46031
|
+
/**
|
|
46032
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
46033
|
+
*/
|
|
46034
|
+
DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
|
|
46035
|
+
|
|
46036
|
+
var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR,
|
|
46037
|
+
ERB_EXPR$$1 = ERB_EXPR,
|
|
46038
|
+
DATA_ATTR$$1 = DATA_ATTR,
|
|
46039
|
+
ARIA_ATTR$$1 = ARIA_ATTR,
|
|
46040
|
+
IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA,
|
|
46041
|
+
ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
|
|
46042
|
+
var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
|
|
46043
|
+
|
|
46044
|
+
/**
|
|
46045
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
46046
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
46047
|
+
*/
|
|
46048
|
+
|
|
46049
|
+
/* allowed element names */
|
|
46050
|
+
|
|
46051
|
+
var ALLOWED_TAGS = null;
|
|
46052
|
+
var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text)));
|
|
46053
|
+
|
|
46054
|
+
/* Allowed attribute names */
|
|
46055
|
+
var ALLOWED_ATTR = null;
|
|
46056
|
+
var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml)));
|
|
46057
|
+
|
|
46058
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
46059
|
+
var FORBID_TAGS = null;
|
|
46060
|
+
|
|
46061
|
+
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
46062
|
+
var FORBID_ATTR = null;
|
|
46063
|
+
|
|
46064
|
+
/* Decide if ARIA attributes are okay */
|
|
46065
|
+
var ALLOW_ARIA_ATTR = true;
|
|
46066
|
+
|
|
46067
|
+
/* Decide if custom data attributes are okay */
|
|
46068
|
+
var ALLOW_DATA_ATTR = true;
|
|
46069
|
+
|
|
46070
|
+
/* Decide if unknown protocols are okay */
|
|
46071
|
+
var ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
46072
|
+
|
|
46073
|
+
/* Output should be safe for common template engines.
|
|
46074
|
+
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
46075
|
+
*/
|
|
46076
|
+
var SAFE_FOR_TEMPLATES = false;
|
|
46077
|
+
|
|
46078
|
+
/* Decide if document with <html>... should be returned */
|
|
46079
|
+
var WHOLE_DOCUMENT = false;
|
|
46080
|
+
|
|
46081
|
+
/* Track whether config is already set on this instance of DOMPurify. */
|
|
46082
|
+
var SET_CONFIG = false;
|
|
46083
|
+
|
|
46084
|
+
/* Decide if all elements (e.g. style, script) must be children of
|
|
46085
|
+
* document.body. By default, browsers might move them to document.head */
|
|
46086
|
+
var FORCE_BODY = false;
|
|
46087
|
+
|
|
46088
|
+
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
46089
|
+
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
46090
|
+
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
46091
|
+
*/
|
|
46092
|
+
var RETURN_DOM = false;
|
|
46093
|
+
|
|
46094
|
+
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
46095
|
+
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
46096
|
+
var RETURN_DOM_FRAGMENT = false;
|
|
46097
|
+
|
|
46098
|
+
/* If `RETURN_DOM` or `RETURN_DOM_FRAGMENT` is enabled, decide if the returned DOM
|
|
46099
|
+
* `Node` is imported into the current `Document`. If this flag is not enabled the
|
|
46100
|
+
* `Node` will belong (its ownerDocument) to a fresh `HTMLDocument`, created by
|
|
46101
|
+
* DOMPurify.
|
|
46102
|
+
*
|
|
46103
|
+
* This defaults to `true` starting DOMPurify 2.2.0. Note that setting it to `false`
|
|
46104
|
+
* might cause XSS from attacks hidden in closed shadowroots in case the browser
|
|
46105
|
+
* supports Declarative Shadow: DOM https://web.dev/declarative-shadow-dom/
|
|
46106
|
+
*/
|
|
46107
|
+
var RETURN_DOM_IMPORT = true;
|
|
46108
|
+
|
|
46109
|
+
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
46110
|
+
* case Trusted Types are not supported */
|
|
46111
|
+
var RETURN_TRUSTED_TYPE = false;
|
|
46112
|
+
|
|
46113
|
+
/* Output should be free from DOM clobbering attacks? */
|
|
46114
|
+
var SANITIZE_DOM = true;
|
|
46115
|
+
|
|
46116
|
+
/* Keep element content when removing element? */
|
|
46117
|
+
var KEEP_CONTENT = true;
|
|
46118
|
+
|
|
46119
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
46120
|
+
* of importing it into a new Document and returning a sanitized copy */
|
|
46121
|
+
var IN_PLACE = false;
|
|
46122
|
+
|
|
46123
|
+
/* Allow usage of profiles like html, svg and mathMl */
|
|
46124
|
+
var USE_PROFILES = {};
|
|
46125
|
+
|
|
46126
|
+
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
46127
|
+
var FORBID_CONTENTS = null;
|
|
46128
|
+
var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
46129
|
+
|
|
46130
|
+
/* Tags that are safe for data: URIs */
|
|
46131
|
+
var DATA_URI_TAGS = null;
|
|
46132
|
+
var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
46133
|
+
|
|
46134
|
+
/* Attributes safe for values like "javascript:" */
|
|
46135
|
+
var URI_SAFE_ATTRIBUTES = null;
|
|
46136
|
+
var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
46137
|
+
|
|
46138
|
+
var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
46139
|
+
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
46140
|
+
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
46141
|
+
/* Document namespace */
|
|
46142
|
+
var NAMESPACE = HTML_NAMESPACE;
|
|
46143
|
+
var IS_EMPTY_INPUT = false;
|
|
46144
|
+
|
|
46145
|
+
/* Parsing of strict XHTML documents */
|
|
46146
|
+
var PARSER_MEDIA_TYPE = void 0;
|
|
46147
|
+
var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
46148
|
+
var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
46149
|
+
var transformCaseFunc = void 0;
|
|
46150
|
+
|
|
46151
|
+
/* Keep a reference to config to pass to hooks */
|
|
46152
|
+
var CONFIG = null;
|
|
46153
|
+
|
|
46154
|
+
/* Ideally, do not touch anything below this line */
|
|
46155
|
+
/* ______________________________________________ */
|
|
46156
|
+
|
|
46157
|
+
var formElement = document.createElement('form');
|
|
46158
|
+
|
|
46159
|
+
/**
|
|
46160
|
+
* _parseConfig
|
|
46161
|
+
*
|
|
46162
|
+
* @param {Object} cfg optional config literal
|
|
46163
|
+
*/
|
|
46164
|
+
// eslint-disable-next-line complexity
|
|
46165
|
+
var _parseConfig = function _parseConfig(cfg) {
|
|
46166
|
+
if (CONFIG && CONFIG === cfg) {
|
|
46167
|
+
return;
|
|
46168
|
+
}
|
|
46169
|
+
|
|
46170
|
+
/* Shield configuration object from tampering */
|
|
46171
|
+
if (!cfg || (typeof cfg === 'undefined' ? 'undefined' : _typeof(cfg)) !== 'object') {
|
|
46172
|
+
cfg = {};
|
|
46173
|
+
}
|
|
46174
|
+
|
|
46175
|
+
/* Shield configuration object from prototype pollution */
|
|
46176
|
+
cfg = clone(cfg);
|
|
46177
|
+
|
|
46178
|
+
/* Set configuration parameters */
|
|
46179
|
+
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
|
|
46180
|
+
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
|
|
46181
|
+
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
46182
|
+
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
|
|
46183
|
+
FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;
|
|
46184
|
+
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
|
|
46185
|
+
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
|
|
46186
|
+
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
|
46187
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
46188
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
46189
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
46190
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
46191
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
46192
|
+
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
46193
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
46194
|
+
RETURN_DOM_IMPORT = cfg.RETURN_DOM_IMPORT !== false; // Default true
|
|
46195
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
46196
|
+
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
46197
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
46198
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
46199
|
+
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
46200
|
+
IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
|
|
46201
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
46202
|
+
|
|
46203
|
+
PARSER_MEDIA_TYPE =
|
|
46204
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
46205
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
|
|
46206
|
+
|
|
46207
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
46208
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) {
|
|
46209
|
+
return x;
|
|
46210
|
+
} : stringToLowerCase;
|
|
46211
|
+
|
|
46212
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
46213
|
+
ALLOW_DATA_ATTR = false;
|
|
46214
|
+
}
|
|
46215
|
+
|
|
46216
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
46217
|
+
RETURN_DOM = true;
|
|
46218
|
+
}
|
|
46219
|
+
|
|
46220
|
+
/* Parse profile info */
|
|
46221
|
+
if (USE_PROFILES) {
|
|
46222
|
+
ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text)));
|
|
46223
|
+
ALLOWED_ATTR = [];
|
|
46224
|
+
if (USE_PROFILES.html === true) {
|
|
46225
|
+
addToSet(ALLOWED_TAGS, html);
|
|
46226
|
+
addToSet(ALLOWED_ATTR, html$1);
|
|
46227
|
+
}
|
|
46228
|
+
|
|
46229
|
+
if (USE_PROFILES.svg === true) {
|
|
46230
|
+
addToSet(ALLOWED_TAGS, svg);
|
|
46231
|
+
addToSet(ALLOWED_ATTR, svg$1);
|
|
46232
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
46233
|
+
}
|
|
46234
|
+
|
|
46235
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
46236
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
46237
|
+
addToSet(ALLOWED_ATTR, svg$1);
|
|
46238
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
46239
|
+
}
|
|
46240
|
+
|
|
46241
|
+
if (USE_PROFILES.mathMl === true) {
|
|
46242
|
+
addToSet(ALLOWED_TAGS, mathMl);
|
|
46243
|
+
addToSet(ALLOWED_ATTR, mathMl$1);
|
|
46244
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
46245
|
+
}
|
|
46246
|
+
}
|
|
46247
|
+
|
|
46248
|
+
/* Merge configuration parameters */
|
|
46249
|
+
if (cfg.ADD_TAGS) {
|
|
46250
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
46251
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
46252
|
+
}
|
|
46253
|
+
|
|
46254
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
|
|
46255
|
+
}
|
|
46256
|
+
|
|
46257
|
+
if (cfg.ADD_ATTR) {
|
|
46258
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
46259
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
46260
|
+
}
|
|
46261
|
+
|
|
46262
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
|
|
46263
|
+
}
|
|
46264
|
+
|
|
46265
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
46266
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
|
|
46267
|
+
}
|
|
46268
|
+
|
|
46269
|
+
if (cfg.FORBID_CONTENTS) {
|
|
46270
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
46271
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
46272
|
+
}
|
|
46273
|
+
|
|
46274
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
|
|
46275
|
+
}
|
|
46276
|
+
|
|
46277
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
46278
|
+
if (KEEP_CONTENT) {
|
|
46279
|
+
ALLOWED_TAGS['#text'] = true;
|
|
46280
|
+
}
|
|
46281
|
+
|
|
46282
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
46283
|
+
if (WHOLE_DOCUMENT) {
|
|
46284
|
+
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
46285
|
+
}
|
|
46286
|
+
|
|
46287
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
46288
|
+
if (ALLOWED_TAGS.table) {
|
|
46289
|
+
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
46290
|
+
delete FORBID_TAGS.tbody;
|
|
46291
|
+
}
|
|
46292
|
+
|
|
46293
|
+
// Prevent further manipulation of configuration.
|
|
46294
|
+
// Not available in IE8, Safari 5, etc.
|
|
46295
|
+
if (freeze) {
|
|
46296
|
+
freeze(cfg);
|
|
46297
|
+
}
|
|
46298
|
+
|
|
46299
|
+
CONFIG = cfg;
|
|
46300
|
+
};
|
|
46301
|
+
|
|
46302
|
+
var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
46303
|
+
|
|
46304
|
+
var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
|
|
46305
|
+
|
|
46306
|
+
/* Keep track of all possible SVG and MathML tags
|
|
46307
|
+
* so that we can perform the namespace checks
|
|
46308
|
+
* correctly. */
|
|
46309
|
+
var ALL_SVG_TAGS = addToSet({}, svg);
|
|
46310
|
+
addToSet(ALL_SVG_TAGS, svgFilters);
|
|
46311
|
+
addToSet(ALL_SVG_TAGS, svgDisallowed);
|
|
46312
|
+
|
|
46313
|
+
var ALL_MATHML_TAGS = addToSet({}, mathMl);
|
|
46314
|
+
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
|
|
46315
|
+
|
|
46316
|
+
/**
|
|
46317
|
+
*
|
|
46318
|
+
*
|
|
46319
|
+
* @param {Element} element a DOM element whose namespace is being checked
|
|
46320
|
+
* @returns {boolean} Return false if the element has a
|
|
46321
|
+
* namespace that a spec-compliant parser would never
|
|
46322
|
+
* return. Return true otherwise.
|
|
46323
|
+
*/
|
|
46324
|
+
var _checkValidNamespace = function _checkValidNamespace(element) {
|
|
46325
|
+
var parent = getParentNode(element);
|
|
46326
|
+
|
|
46327
|
+
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
46328
|
+
// can be null. We just simulate parent in this case.
|
|
46329
|
+
if (!parent || !parent.tagName) {
|
|
46330
|
+
parent = {
|
|
46331
|
+
namespaceURI: HTML_NAMESPACE,
|
|
46332
|
+
tagName: 'template'
|
|
46333
|
+
};
|
|
46334
|
+
}
|
|
46335
|
+
|
|
46336
|
+
var tagName = stringToLowerCase(element.tagName);
|
|
46337
|
+
var parentTagName = stringToLowerCase(parent.tagName);
|
|
46338
|
+
|
|
46339
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
46340
|
+
// The only way to switch from HTML namespace to SVG
|
|
46341
|
+
// is via <svg>. If it happens via any other tag, then
|
|
46342
|
+
// it should be killed.
|
|
46343
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
46344
|
+
return tagName === 'svg';
|
|
46345
|
+
}
|
|
46346
|
+
|
|
46347
|
+
// The only way to switch from MathML to SVG is via
|
|
46348
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
46349
|
+
// text integration points.
|
|
46350
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
46351
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
46352
|
+
}
|
|
46353
|
+
|
|
46354
|
+
// We only allow elements that are defined in SVG
|
|
46355
|
+
// spec. All others are disallowed in SVG namespace.
|
|
46356
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
46357
|
+
}
|
|
46358
|
+
|
|
46359
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
46360
|
+
// The only way to switch from HTML namespace to MathML
|
|
46361
|
+
// is via <math>. If it happens via any other tag, then
|
|
46362
|
+
// it should be killed.
|
|
46363
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
46364
|
+
return tagName === 'math';
|
|
46365
|
+
}
|
|
46366
|
+
|
|
46367
|
+
// The only way to switch from SVG to MathML is via
|
|
46368
|
+
// <math> and HTML integration points
|
|
46369
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
46370
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
46371
|
+
}
|
|
46372
|
+
|
|
46373
|
+
// We only allow elements that are defined in MathML
|
|
46374
|
+
// spec. All others are disallowed in MathML namespace.
|
|
46375
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
46376
|
+
}
|
|
46377
|
+
|
|
46378
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
46379
|
+
// The only way to switch from SVG to HTML is via
|
|
46380
|
+
// HTML integration points, and from MathML to HTML
|
|
46381
|
+
// is via MathML text integration points
|
|
46382
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
46383
|
+
return false;
|
|
46384
|
+
}
|
|
46385
|
+
|
|
46386
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
46387
|
+
return false;
|
|
46388
|
+
}
|
|
46389
|
+
|
|
46390
|
+
// Certain elements are allowed in both SVG and HTML
|
|
46391
|
+
// namespace. We need to specify them explicitly
|
|
46392
|
+
// so that they don't get erronously deleted from
|
|
46393
|
+
// HTML namespace.
|
|
46394
|
+
var commonSvgAndHTMLElements = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
46395
|
+
|
|
46396
|
+
// We disallow tags that are specific for MathML
|
|
46397
|
+
// or SVG and should never appear in HTML namespace
|
|
46398
|
+
return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
46399
|
+
}
|
|
46400
|
+
|
|
46401
|
+
// The code should never reach this place (this means
|
|
46402
|
+
// that the element somehow got namespace that is not
|
|
46403
|
+
// HTML, SVG or MathML). Return false just in case.
|
|
46404
|
+
return false;
|
|
46405
|
+
};
|
|
46406
|
+
|
|
46407
|
+
/**
|
|
46408
|
+
* _forceRemove
|
|
46409
|
+
*
|
|
46410
|
+
* @param {Node} node a DOM node
|
|
46411
|
+
*/
|
|
46412
|
+
var _forceRemove = function _forceRemove(node) {
|
|
46413
|
+
arrayPush(DOMPurify.removed, { element: node });
|
|
46414
|
+
try {
|
|
46415
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
46416
|
+
node.parentNode.removeChild(node);
|
|
46417
|
+
} catch (_) {
|
|
46418
|
+
try {
|
|
46419
|
+
node.outerHTML = emptyHTML;
|
|
46420
|
+
} catch (_) {
|
|
46421
|
+
node.remove();
|
|
46422
|
+
}
|
|
46423
|
+
}
|
|
46424
|
+
};
|
|
46425
|
+
|
|
46426
|
+
/**
|
|
46427
|
+
* _removeAttribute
|
|
46428
|
+
*
|
|
46429
|
+
* @param {String} name an Attribute name
|
|
46430
|
+
* @param {Node} node a DOM node
|
|
46431
|
+
*/
|
|
46432
|
+
var _removeAttribute = function _removeAttribute(name, node) {
|
|
46433
|
+
try {
|
|
46434
|
+
arrayPush(DOMPurify.removed, {
|
|
46435
|
+
attribute: node.getAttributeNode(name),
|
|
46436
|
+
from: node
|
|
46437
|
+
});
|
|
46438
|
+
} catch (_) {
|
|
46439
|
+
arrayPush(DOMPurify.removed, {
|
|
46440
|
+
attribute: null,
|
|
46441
|
+
from: node
|
|
46442
|
+
});
|
|
46443
|
+
}
|
|
46444
|
+
|
|
46445
|
+
node.removeAttribute(name);
|
|
46446
|
+
|
|
46447
|
+
// We void attribute values for unremovable "is"" attributes
|
|
46448
|
+
if (name === 'is' && !ALLOWED_ATTR[name]) {
|
|
46449
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
46450
|
+
try {
|
|
46451
|
+
_forceRemove(node);
|
|
46452
|
+
} catch (_) {}
|
|
46453
|
+
} else {
|
|
46454
|
+
try {
|
|
46455
|
+
node.setAttribute(name, '');
|
|
46456
|
+
} catch (_) {}
|
|
46457
|
+
}
|
|
46458
|
+
}
|
|
46459
|
+
};
|
|
46460
|
+
|
|
46461
|
+
/**
|
|
46462
|
+
* _initDocument
|
|
46463
|
+
*
|
|
46464
|
+
* @param {String} dirty a string of dirty markup
|
|
46465
|
+
* @return {Document} a DOM, filled with the dirty markup
|
|
46466
|
+
*/
|
|
46467
|
+
var _initDocument = function _initDocument(dirty) {
|
|
46468
|
+
/* Create a HTML document */
|
|
46469
|
+
var doc = void 0;
|
|
46470
|
+
var leadingWhitespace = void 0;
|
|
46471
|
+
|
|
46472
|
+
if (FORCE_BODY) {
|
|
46473
|
+
dirty = '<remove></remove>' + dirty;
|
|
46474
|
+
} else {
|
|
46475
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
46476
|
+
var matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
46477
|
+
leadingWhitespace = matches && matches[0];
|
|
46478
|
+
}
|
|
46479
|
+
|
|
46480
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
|
|
46481
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
46482
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
46483
|
+
}
|
|
46484
|
+
|
|
46485
|
+
var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
46486
|
+
/*
|
|
46487
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
46488
|
+
* DOMParser not work for svg when has multiple root element.
|
|
46489
|
+
*/
|
|
46490
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
46491
|
+
try {
|
|
46492
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
46493
|
+
} catch (_) {}
|
|
46494
|
+
}
|
|
46495
|
+
|
|
46496
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
46497
|
+
if (!doc || !doc.documentElement) {
|
|
46498
|
+
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
46499
|
+
try {
|
|
46500
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload;
|
|
46501
|
+
} catch (_) {
|
|
46502
|
+
// Syntax error if dirtyPayload is invalid xml
|
|
46503
|
+
}
|
|
46504
|
+
}
|
|
46505
|
+
|
|
46506
|
+
var body = doc.body || doc.documentElement;
|
|
46507
|
+
|
|
46508
|
+
if (dirty && leadingWhitespace) {
|
|
46509
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
46510
|
+
}
|
|
46511
|
+
|
|
46512
|
+
/* Work on whole document or just its body */
|
|
46513
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
46514
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
46515
|
+
}
|
|
46516
|
+
|
|
46517
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
46518
|
+
};
|
|
46519
|
+
|
|
46520
|
+
/**
|
|
46521
|
+
* _createIterator
|
|
46522
|
+
*
|
|
46523
|
+
* @param {Document} root document/fragment to create iterator for
|
|
46524
|
+
* @return {Iterator} iterator instance
|
|
46525
|
+
*/
|
|
46526
|
+
var _createIterator = function _createIterator(root) {
|
|
46527
|
+
return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
|
|
46528
|
+
};
|
|
46529
|
+
|
|
46530
|
+
/**
|
|
46531
|
+
* _isClobbered
|
|
46532
|
+
*
|
|
46533
|
+
* @param {Node} elm element to check for clobbering attacks
|
|
46534
|
+
* @return {Boolean} true if clobbered, false if safe
|
|
46535
|
+
*/
|
|
46536
|
+
var _isClobbered = function _isClobbered(elm) {
|
|
46537
|
+
if (elm instanceof Text || elm instanceof Comment) {
|
|
46538
|
+
return false;
|
|
46539
|
+
}
|
|
46540
|
+
|
|
46541
|
+
if (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function') {
|
|
46542
|
+
return true;
|
|
46543
|
+
}
|
|
46544
|
+
|
|
46545
|
+
return false;
|
|
46546
|
+
};
|
|
46547
|
+
|
|
46548
|
+
/**
|
|
46549
|
+
* _isNode
|
|
46550
|
+
*
|
|
46551
|
+
* @param {Node} obj object to check whether it's a DOM node
|
|
46552
|
+
* @return {Boolean} true is object is a DOM node
|
|
46553
|
+
*/
|
|
46554
|
+
var _isNode = function _isNode(object) {
|
|
46555
|
+
return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? object instanceof Node : object && (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
|
|
46556
|
+
};
|
|
46557
|
+
|
|
46558
|
+
/**
|
|
46559
|
+
* _executeHook
|
|
46560
|
+
* Execute user configurable hooks
|
|
46561
|
+
*
|
|
46562
|
+
* @param {String} entryPoint Name of the hook's entry point
|
|
46563
|
+
* @param {Node} currentNode node to work on with the hook
|
|
46564
|
+
* @param {Object} data additional hook parameters
|
|
46565
|
+
*/
|
|
46566
|
+
var _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
46567
|
+
if (!hooks[entryPoint]) {
|
|
46568
|
+
return;
|
|
46569
|
+
}
|
|
46570
|
+
|
|
46571
|
+
arrayForEach(hooks[entryPoint], function (hook) {
|
|
46572
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
46573
|
+
});
|
|
46574
|
+
};
|
|
46575
|
+
|
|
46576
|
+
/**
|
|
46577
|
+
* _sanitizeElements
|
|
46578
|
+
*
|
|
46579
|
+
* @protect nodeName
|
|
46580
|
+
* @protect textContent
|
|
46581
|
+
* @protect removeChild
|
|
46582
|
+
*
|
|
46583
|
+
* @param {Node} currentNode to check for permission to exist
|
|
46584
|
+
* @return {Boolean} true if node was killed, false if left alive
|
|
46585
|
+
*/
|
|
46586
|
+
var _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
46587
|
+
var content = void 0;
|
|
46588
|
+
|
|
46589
|
+
/* Execute a hook if present */
|
|
46590
|
+
_executeHook('beforeSanitizeElements', currentNode, null);
|
|
46591
|
+
|
|
46592
|
+
/* Check if element is clobbered or can clobber */
|
|
46593
|
+
if (_isClobbered(currentNode)) {
|
|
46594
|
+
_forceRemove(currentNode);
|
|
46595
|
+
return true;
|
|
46596
|
+
}
|
|
46597
|
+
|
|
46598
|
+
/* Check if tagname contains Unicode */
|
|
46599
|
+
if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) {
|
|
46600
|
+
_forceRemove(currentNode);
|
|
46601
|
+
return true;
|
|
46602
|
+
}
|
|
46603
|
+
|
|
46604
|
+
/* Now let's check the element's type and name */
|
|
46605
|
+
var tagName = transformCaseFunc(currentNode.nodeName);
|
|
46606
|
+
|
|
46607
|
+
/* Execute a hook if present */
|
|
46608
|
+
_executeHook('uponSanitizeElement', currentNode, {
|
|
46609
|
+
tagName: tagName,
|
|
46610
|
+
allowedTags: ALLOWED_TAGS
|
|
46611
|
+
});
|
|
46612
|
+
|
|
46613
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
46614
|
+
if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
46615
|
+
_forceRemove(currentNode);
|
|
46616
|
+
return true;
|
|
46617
|
+
}
|
|
46618
|
+
|
|
46619
|
+
/* Mitigate a problem with templates inside select */
|
|
46620
|
+
if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
|
|
46621
|
+
_forceRemove(currentNode);
|
|
46622
|
+
return true;
|
|
46623
|
+
}
|
|
46624
|
+
|
|
46625
|
+
/* Remove element if anything forbids its presence */
|
|
46626
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
46627
|
+
/* Keep content except for bad-listed elements */
|
|
46628
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
46629
|
+
var parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
46630
|
+
var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
46631
|
+
|
|
46632
|
+
if (childNodes && parentNode) {
|
|
46633
|
+
var childCount = childNodes.length;
|
|
46634
|
+
|
|
46635
|
+
for (var i = childCount - 1; i >= 0; --i) {
|
|
46636
|
+
parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
|
|
46637
|
+
}
|
|
46638
|
+
}
|
|
46639
|
+
}
|
|
46640
|
+
|
|
46641
|
+
_forceRemove(currentNode);
|
|
46642
|
+
return true;
|
|
46643
|
+
}
|
|
46644
|
+
|
|
46645
|
+
/* Check whether element has a valid namespace */
|
|
46646
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
46647
|
+
_forceRemove(currentNode);
|
|
46648
|
+
return true;
|
|
46649
|
+
}
|
|
46650
|
+
|
|
46651
|
+
if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
|
|
46652
|
+
_forceRemove(currentNode);
|
|
46653
|
+
return true;
|
|
46654
|
+
}
|
|
46655
|
+
|
|
46656
|
+
/* Sanitize element content to be template-safe */
|
|
46657
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
|
|
46658
|
+
/* Get the element's text content */
|
|
46659
|
+
content = currentNode.textContent;
|
|
46660
|
+
content = stringReplace(content, MUSTACHE_EXPR$$1, ' ');
|
|
46661
|
+
content = stringReplace(content, ERB_EXPR$$1, ' ');
|
|
46662
|
+
if (currentNode.textContent !== content) {
|
|
46663
|
+
arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
|
|
46664
|
+
currentNode.textContent = content;
|
|
46665
|
+
}
|
|
46666
|
+
}
|
|
46667
|
+
|
|
46668
|
+
/* Execute a hook if present */
|
|
46669
|
+
_executeHook('afterSanitizeElements', currentNode, null);
|
|
46670
|
+
|
|
46671
|
+
return false;
|
|
46672
|
+
};
|
|
46673
|
+
|
|
46674
|
+
/**
|
|
46675
|
+
* _isValidAttribute
|
|
46676
|
+
*
|
|
46677
|
+
* @param {string} lcTag Lowercase tag name of containing element.
|
|
46678
|
+
* @param {string} lcName Lowercase attribute name.
|
|
46679
|
+
* @param {string} value Attribute value.
|
|
46680
|
+
* @return {Boolean} Returns true if `value` is valid, otherwise false.
|
|
46681
|
+
*/
|
|
46682
|
+
// eslint-disable-next-line complexity
|
|
46683
|
+
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
46684
|
+
/* Make sure attribute cannot clobber */
|
|
46685
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
46686
|
+
return false;
|
|
46687
|
+
}
|
|
46688
|
+
|
|
46689
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
46690
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
46691
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
46692
|
+
We don't need to check the value; it's always URI safe. */
|
|
46693
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
46694
|
+
return false;
|
|
46695
|
+
|
|
46696
|
+
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
46697
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$$1, stringReplace(value, ATTR_WHITESPACE$$1, ''))) ; else if (!value) ; else {
|
|
46698
|
+
return false;
|
|
46699
|
+
}
|
|
46700
|
+
|
|
46701
|
+
return true;
|
|
46702
|
+
};
|
|
46703
|
+
|
|
46704
|
+
/**
|
|
46705
|
+
* _sanitizeAttributes
|
|
46706
|
+
*
|
|
46707
|
+
* @protect attributes
|
|
46708
|
+
* @protect nodeName
|
|
46709
|
+
* @protect removeAttribute
|
|
46710
|
+
* @protect setAttribute
|
|
46711
|
+
*
|
|
46712
|
+
* @param {Node} currentNode to sanitize
|
|
46713
|
+
*/
|
|
46714
|
+
var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
46715
|
+
var attr = void 0;
|
|
46716
|
+
var value = void 0;
|
|
46717
|
+
var lcName = void 0;
|
|
46718
|
+
var l = void 0;
|
|
46719
|
+
/* Execute a hook if present */
|
|
46720
|
+
_executeHook('beforeSanitizeAttributes', currentNode, null);
|
|
46721
|
+
|
|
46722
|
+
var attributes = currentNode.attributes;
|
|
46723
|
+
|
|
46724
|
+
/* Check if we have attributes; if not we might have a text node */
|
|
46725
|
+
|
|
46726
|
+
if (!attributes) {
|
|
46727
|
+
return;
|
|
46728
|
+
}
|
|
46729
|
+
|
|
46730
|
+
var hookEvent = {
|
|
46731
|
+
attrName: '',
|
|
46732
|
+
attrValue: '',
|
|
46733
|
+
keepAttr: true,
|
|
46734
|
+
allowedAttributes: ALLOWED_ATTR
|
|
46735
|
+
};
|
|
46736
|
+
l = attributes.length;
|
|
46737
|
+
|
|
46738
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
46739
|
+
while (l--) {
|
|
46740
|
+
attr = attributes[l];
|
|
46741
|
+
var _attr = attr,
|
|
46742
|
+
name = _attr.name,
|
|
46743
|
+
namespaceURI = _attr.namespaceURI;
|
|
46744
|
+
|
|
46745
|
+
value = stringTrim(attr.value);
|
|
46746
|
+
lcName = transformCaseFunc(name);
|
|
46747
|
+
|
|
46748
|
+
/* Execute a hook if present */
|
|
46749
|
+
hookEvent.attrName = lcName;
|
|
46750
|
+
hookEvent.attrValue = value;
|
|
46751
|
+
hookEvent.keepAttr = true;
|
|
46752
|
+
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
46753
|
+
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
46754
|
+
value = hookEvent.attrValue;
|
|
46755
|
+
/* Did the hooks approve of the attribute? */
|
|
46756
|
+
if (hookEvent.forceKeepAttr) {
|
|
46757
|
+
continue;
|
|
46758
|
+
}
|
|
46759
|
+
|
|
46760
|
+
/* Remove attribute */
|
|
46761
|
+
_removeAttribute(name, currentNode);
|
|
46762
|
+
|
|
46763
|
+
/* Did the hooks approve of the attribute? */
|
|
46764
|
+
if (!hookEvent.keepAttr) {
|
|
46765
|
+
continue;
|
|
46766
|
+
}
|
|
46767
|
+
|
|
46768
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
46769
|
+
if (regExpTest(/\/>/i, value)) {
|
|
46770
|
+
_removeAttribute(name, currentNode);
|
|
46771
|
+
continue;
|
|
46772
|
+
}
|
|
46773
|
+
|
|
46774
|
+
/* Sanitize attribute content to be template-safe */
|
|
46775
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
46776
|
+
value = stringReplace(value, MUSTACHE_EXPR$$1, ' ');
|
|
46777
|
+
value = stringReplace(value, ERB_EXPR$$1, ' ');
|
|
46778
|
+
}
|
|
46779
|
+
|
|
46780
|
+
/* Is `value` valid for this attribute? */
|
|
46781
|
+
var lcTag = transformCaseFunc(currentNode.nodeName);
|
|
46782
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
46783
|
+
continue;
|
|
46784
|
+
}
|
|
46785
|
+
|
|
46786
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
46787
|
+
try {
|
|
46788
|
+
if (namespaceURI) {
|
|
46789
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
46790
|
+
} else {
|
|
46791
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
46792
|
+
currentNode.setAttribute(name, value);
|
|
46793
|
+
}
|
|
46794
|
+
|
|
46795
|
+
arrayPop(DOMPurify.removed);
|
|
46796
|
+
} catch (_) {}
|
|
46797
|
+
}
|
|
46798
|
+
|
|
46799
|
+
/* Execute a hook if present */
|
|
46800
|
+
_executeHook('afterSanitizeAttributes', currentNode, null);
|
|
46801
|
+
};
|
|
46802
|
+
|
|
46803
|
+
/**
|
|
46804
|
+
* _sanitizeShadowDOM
|
|
46805
|
+
*
|
|
46806
|
+
* @param {DocumentFragment} fragment to iterate over recursively
|
|
46807
|
+
*/
|
|
46808
|
+
var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
46809
|
+
var shadowNode = void 0;
|
|
46810
|
+
var shadowIterator = _createIterator(fragment);
|
|
46811
|
+
|
|
46812
|
+
/* Execute a hook if present */
|
|
46813
|
+
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
|
46814
|
+
|
|
46815
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
46816
|
+
/* Execute a hook if present */
|
|
46817
|
+
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
|
46818
|
+
|
|
46819
|
+
/* Sanitize tags and elements */
|
|
46820
|
+
if (_sanitizeElements(shadowNode)) {
|
|
46821
|
+
continue;
|
|
46822
|
+
}
|
|
46823
|
+
|
|
46824
|
+
/* Deep shadow DOM detected */
|
|
46825
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
|
46826
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
46827
|
+
}
|
|
46828
|
+
|
|
46829
|
+
/* Check attributes, sanitize if necessary */
|
|
46830
|
+
_sanitizeAttributes(shadowNode);
|
|
46831
|
+
}
|
|
46832
|
+
|
|
46833
|
+
/* Execute a hook if present */
|
|
46834
|
+
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
|
46835
|
+
};
|
|
46836
|
+
|
|
46837
|
+
/**
|
|
46838
|
+
* Sanitize
|
|
46839
|
+
* Public method providing core sanitation functionality
|
|
46840
|
+
*
|
|
46841
|
+
* @param {String|Node} dirty string or DOM node
|
|
46842
|
+
* @param {Object} configuration object
|
|
46843
|
+
*/
|
|
46844
|
+
// eslint-disable-next-line complexity
|
|
46845
|
+
DOMPurify.sanitize = function (dirty, cfg) {
|
|
46846
|
+
var body = void 0;
|
|
46847
|
+
var importedNode = void 0;
|
|
46848
|
+
var currentNode = void 0;
|
|
46849
|
+
var oldNode = void 0;
|
|
46850
|
+
var returnNode = void 0;
|
|
46851
|
+
/* Make sure we have a string to sanitize.
|
|
46852
|
+
DO NOT return early, as this will return the wrong type if
|
|
46853
|
+
the user has requested a DOM object rather than a string */
|
|
46854
|
+
IS_EMPTY_INPUT = !dirty;
|
|
46855
|
+
if (IS_EMPTY_INPUT) {
|
|
46856
|
+
dirty = '<!-->';
|
|
46857
|
+
}
|
|
46858
|
+
|
|
46859
|
+
/* Stringify, in case dirty is an object */
|
|
46860
|
+
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
46861
|
+
// eslint-disable-next-line no-negated-condition
|
|
46862
|
+
if (typeof dirty.toString !== 'function') {
|
|
46863
|
+
throw typeErrorCreate('toString is not a function');
|
|
46864
|
+
} else {
|
|
46865
|
+
dirty = dirty.toString();
|
|
46866
|
+
if (typeof dirty !== 'string') {
|
|
46867
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
46868
|
+
}
|
|
46869
|
+
}
|
|
46870
|
+
}
|
|
46871
|
+
|
|
46872
|
+
/* Check we can run. Otherwise fall back or ignore */
|
|
46873
|
+
if (!DOMPurify.isSupported) {
|
|
46874
|
+
if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
|
|
46875
|
+
if (typeof dirty === 'string') {
|
|
46876
|
+
return window.toStaticHTML(dirty);
|
|
46877
|
+
}
|
|
46878
|
+
|
|
46879
|
+
if (_isNode(dirty)) {
|
|
46880
|
+
return window.toStaticHTML(dirty.outerHTML);
|
|
46881
|
+
}
|
|
46882
|
+
}
|
|
46883
|
+
|
|
46884
|
+
return dirty;
|
|
46885
|
+
}
|
|
46886
|
+
|
|
46887
|
+
/* Assign config vars */
|
|
46888
|
+
if (!SET_CONFIG) {
|
|
46889
|
+
_parseConfig(cfg);
|
|
46890
|
+
}
|
|
46891
|
+
|
|
46892
|
+
/* Clean up removed elements */
|
|
46893
|
+
DOMPurify.removed = [];
|
|
46894
|
+
|
|
46895
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
46896
|
+
if (typeof dirty === 'string') {
|
|
46897
|
+
IN_PLACE = false;
|
|
46898
|
+
}
|
|
46899
|
+
|
|
46900
|
+
if (IN_PLACE) ; else if (dirty instanceof Node) {
|
|
46901
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
46902
|
+
elements being stripped by the parser */
|
|
46903
|
+
body = _initDocument('<!---->');
|
|
46904
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
46905
|
+
if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
|
|
46906
|
+
/* Node is already a body, use as is */
|
|
46907
|
+
body = importedNode;
|
|
46908
|
+
} else if (importedNode.nodeName === 'HTML') {
|
|
46909
|
+
body = importedNode;
|
|
46910
|
+
} else {
|
|
46911
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
46912
|
+
body.appendChild(importedNode);
|
|
46913
|
+
}
|
|
46914
|
+
} else {
|
|
46915
|
+
/* Exit directly if we have nothing to do */
|
|
46916
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
46917
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
46918
|
+
dirty.indexOf('<') === -1) {
|
|
46919
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
46920
|
+
}
|
|
46921
|
+
|
|
46922
|
+
/* Initialize the document to work on */
|
|
46923
|
+
body = _initDocument(dirty);
|
|
46924
|
+
|
|
46925
|
+
/* Check we have a DOM node from the data */
|
|
46926
|
+
if (!body) {
|
|
46927
|
+
return RETURN_DOM ? null : emptyHTML;
|
|
46928
|
+
}
|
|
46929
|
+
}
|
|
46930
|
+
|
|
46931
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
46932
|
+
if (body && FORCE_BODY) {
|
|
46933
|
+
_forceRemove(body.firstChild);
|
|
46934
|
+
}
|
|
46935
|
+
|
|
46936
|
+
/* Get node iterator */
|
|
46937
|
+
var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
|
|
46938
|
+
|
|
46939
|
+
/* Now start iterating over the created document */
|
|
46940
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
46941
|
+
/* Fix IE's strange behavior with manipulated textNodes #89 */
|
|
46942
|
+
if (currentNode.nodeType === 3 && currentNode === oldNode) {
|
|
46943
|
+
continue;
|
|
46944
|
+
}
|
|
46945
|
+
|
|
46946
|
+
/* Sanitize tags and elements */
|
|
46947
|
+
if (_sanitizeElements(currentNode)) {
|
|
46948
|
+
continue;
|
|
46949
|
+
}
|
|
46950
|
+
|
|
46951
|
+
/* Shadow DOM detected, sanitize it */
|
|
46952
|
+
if (currentNode.content instanceof DocumentFragment) {
|
|
46953
|
+
_sanitizeShadowDOM(currentNode.content);
|
|
46954
|
+
}
|
|
46955
|
+
|
|
46956
|
+
/* Check attributes, sanitize if necessary */
|
|
46957
|
+
_sanitizeAttributes(currentNode);
|
|
46958
|
+
|
|
46959
|
+
oldNode = currentNode;
|
|
46960
|
+
}
|
|
46961
|
+
|
|
46962
|
+
oldNode = null;
|
|
46963
|
+
|
|
46964
|
+
/* If we sanitized `dirty` in-place, return it. */
|
|
46965
|
+
if (IN_PLACE) {
|
|
46966
|
+
return dirty;
|
|
46967
|
+
}
|
|
46968
|
+
|
|
46969
|
+
/* Return sanitized string or DOM */
|
|
46970
|
+
if (RETURN_DOM) {
|
|
46971
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
46972
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
46973
|
+
|
|
46974
|
+
while (body.firstChild) {
|
|
46975
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
46976
|
+
returnNode.appendChild(body.firstChild);
|
|
46977
|
+
}
|
|
46978
|
+
} else {
|
|
46979
|
+
returnNode = body;
|
|
46980
|
+
}
|
|
46981
|
+
|
|
46982
|
+
if (RETURN_DOM_IMPORT) {
|
|
46983
|
+
/*
|
|
46984
|
+
AdoptNode() is not used because internal state is not reset
|
|
46985
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
46986
|
+
in theory but we would rather not risk another attack vector.
|
|
46987
|
+
The state that is cloned by importNode() is explicitly defined
|
|
46988
|
+
by the specs.
|
|
46989
|
+
*/
|
|
46990
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
46991
|
+
}
|
|
46992
|
+
|
|
46993
|
+
return returnNode;
|
|
46994
|
+
}
|
|
46995
|
+
|
|
46996
|
+
var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
46997
|
+
|
|
46998
|
+
/* Sanitize final string template-safe */
|
|
46999
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
47000
|
+
serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$$1, ' ');
|
|
47001
|
+
serializedHTML = stringReplace(serializedHTML, ERB_EXPR$$1, ' ');
|
|
47002
|
+
}
|
|
47003
|
+
|
|
47004
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
47005
|
+
};
|
|
47006
|
+
|
|
47007
|
+
/**
|
|
47008
|
+
* Public method to set the configuration once
|
|
47009
|
+
* setConfig
|
|
47010
|
+
*
|
|
47011
|
+
* @param {Object} cfg configuration object
|
|
47012
|
+
*/
|
|
47013
|
+
DOMPurify.setConfig = function (cfg) {
|
|
47014
|
+
_parseConfig(cfg);
|
|
47015
|
+
SET_CONFIG = true;
|
|
47016
|
+
};
|
|
47017
|
+
|
|
47018
|
+
/**
|
|
47019
|
+
* Public method to remove the configuration
|
|
47020
|
+
* clearConfig
|
|
47021
|
+
*
|
|
47022
|
+
*/
|
|
47023
|
+
DOMPurify.clearConfig = function () {
|
|
47024
|
+
CONFIG = null;
|
|
47025
|
+
SET_CONFIG = false;
|
|
47026
|
+
};
|
|
47027
|
+
|
|
47028
|
+
/**
|
|
47029
|
+
* Public method to check if an attribute value is valid.
|
|
47030
|
+
* Uses last set config, if any. Otherwise, uses config defaults.
|
|
47031
|
+
* isValidAttribute
|
|
47032
|
+
*
|
|
47033
|
+
* @param {string} tag Tag name of containing element.
|
|
47034
|
+
* @param {string} attr Attribute name.
|
|
47035
|
+
* @param {string} value Attribute value.
|
|
47036
|
+
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
|
47037
|
+
*/
|
|
47038
|
+
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
47039
|
+
/* Initialize shared config vars if necessary. */
|
|
47040
|
+
if (!CONFIG) {
|
|
47041
|
+
_parseConfig({});
|
|
47042
|
+
}
|
|
47043
|
+
|
|
47044
|
+
var lcTag = transformCaseFunc(tag);
|
|
47045
|
+
var lcName = transformCaseFunc(attr);
|
|
47046
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
47047
|
+
};
|
|
47048
|
+
|
|
47049
|
+
/**
|
|
47050
|
+
* AddHook
|
|
47051
|
+
* Public method to add DOMPurify hooks
|
|
47052
|
+
*
|
|
47053
|
+
* @param {String} entryPoint entry point for the hook to add
|
|
47054
|
+
* @param {Function} hookFunction function to execute
|
|
47055
|
+
*/
|
|
47056
|
+
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
47057
|
+
if (typeof hookFunction !== 'function') {
|
|
47058
|
+
return;
|
|
47059
|
+
}
|
|
47060
|
+
|
|
47061
|
+
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
47062
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
47063
|
+
};
|
|
47064
|
+
|
|
47065
|
+
/**
|
|
47066
|
+
* RemoveHook
|
|
47067
|
+
* Public method to remove a DOMPurify hook at a given entryPoint
|
|
47068
|
+
* (pops it from the stack of hooks if more are present)
|
|
47069
|
+
*
|
|
47070
|
+
* @param {String} entryPoint entry point for the hook to remove
|
|
47071
|
+
*/
|
|
47072
|
+
DOMPurify.removeHook = function (entryPoint) {
|
|
47073
|
+
if (hooks[entryPoint]) {
|
|
47074
|
+
arrayPop(hooks[entryPoint]);
|
|
47075
|
+
}
|
|
47076
|
+
};
|
|
47077
|
+
|
|
47078
|
+
/**
|
|
47079
|
+
* RemoveHooks
|
|
47080
|
+
* Public method to remove all DOMPurify hooks at a given entryPoint
|
|
47081
|
+
*
|
|
47082
|
+
* @param {String} entryPoint entry point for the hooks to remove
|
|
47083
|
+
*/
|
|
47084
|
+
DOMPurify.removeHooks = function (entryPoint) {
|
|
47085
|
+
if (hooks[entryPoint]) {
|
|
47086
|
+
hooks[entryPoint] = [];
|
|
47087
|
+
}
|
|
47088
|
+
};
|
|
47089
|
+
|
|
47090
|
+
/**
|
|
47091
|
+
* RemoveAllHooks
|
|
47092
|
+
* Public method to remove all DOMPurify hooks
|
|
47093
|
+
*
|
|
47094
|
+
*/
|
|
47095
|
+
DOMPurify.removeAllHooks = function () {
|
|
47096
|
+
hooks = {};
|
|
47097
|
+
};
|
|
47098
|
+
|
|
47099
|
+
return DOMPurify;
|
|
47100
|
+
}
|
|
47101
|
+
|
|
47102
|
+
var purify = createDOMPurify();
|
|
47103
|
+
|
|
47104
|
+
return purify;
|
|
47105
|
+
|
|
47106
|
+
}));
|
|
47107
|
+
|
|
47108
|
+
|
|
47109
|
+
},{}],290:[function(require,module,exports){
|
|
45710
47110
|
/* jshint node: true */
|
|
45711
47111
|
'use strict';
|
|
45712
47112
|
|
|
@@ -45814,7 +47214,7 @@ var freeice = function(opts) {
|
|
|
45814
47214
|
};
|
|
45815
47215
|
|
|
45816
47216
|
module.exports = freeice;
|
|
45817
|
-
},{"./stun.json":
|
|
47217
|
+
},{"./stun.json":291,"./turn.json":292,"normalice":300}],291:[function(require,module,exports){
|
|
45818
47218
|
module.exports=[
|
|
45819
47219
|
"stun.l.google.com:19302",
|
|
45820
47220
|
"stun1.l.google.com:19302",
|
|
@@ -45831,10 +47231,10 @@ module.exports=[
|
|
|
45831
47231
|
"stun.voxgratia.org"
|
|
45832
47232
|
]
|
|
45833
47233
|
|
|
45834
|
-
},{}],
|
|
47234
|
+
},{}],292:[function(require,module,exports){
|
|
45835
47235
|
module.exports=[]
|
|
45836
47236
|
|
|
45837
|
-
},{}],
|
|
47237
|
+
},{}],293:[function(require,module,exports){
|
|
45838
47238
|
var WildEmitter = require('wildemitter');
|
|
45839
47239
|
|
|
45840
47240
|
function getMaxVolume (analyser, fftBins) {
|
|
@@ -45979,9 +47379,9 @@ module.exports = function(stream, options) {
|
|
|
45979
47379
|
return harker;
|
|
45980
47380
|
}
|
|
45981
47381
|
|
|
45982
|
-
},{"wildemitter":
|
|
47382
|
+
},{"wildemitter":329}],294:[function(require,module,exports){
|
|
45983
47383
|
arguments[4][132][0].apply(exports,arguments)
|
|
45984
|
-
},{"dup":132}],
|
|
47384
|
+
},{"dup":132}],295:[function(require,module,exports){
|
|
45985
47385
|
(function (global){(function (){
|
|
45986
47386
|
// https://github.com/maxogden/websocket-stream/blob/48dc3ddf943e5ada668c31ccd94e9186f02fafbd/ws-fallback.js
|
|
45987
47387
|
|
|
@@ -46002,10 +47402,10 @@ if (typeof WebSocket !== 'undefined') {
|
|
|
46002
47402
|
module.exports = ws
|
|
46003
47403
|
|
|
46004
47404
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
46005
|
-
},{}],
|
|
47405
|
+
},{}],296:[function(require,module,exports){
|
|
46006
47406
|
// Does nothing at all.
|
|
46007
47407
|
|
|
46008
|
-
},{}],
|
|
47408
|
+
},{}],297:[function(require,module,exports){
|
|
46009
47409
|
/*
|
|
46010
47410
|
* (C) Copyright 2014-2015 Kurento (http://kurento.org/)
|
|
46011
47411
|
*
|
|
@@ -46926,7 +48326,7 @@ exports.WebRtcPeerSendonly = WebRtcPeerSendonly
|
|
|
46926
48326
|
exports.WebRtcPeerSendrecv = WebRtcPeerSendrecv
|
|
46927
48327
|
exports.hark = harkUtils
|
|
46928
48328
|
|
|
46929
|
-
},{"events":100,"freeice":
|
|
48329
|
+
},{"events":100,"freeice":290,"hark":293,"inherits":294,"kurento-browser-extensions":296,"merge":299,"sdp-translator":309,"ua-parser-js":314,"uuid/v4":317}],298:[function(require,module,exports){
|
|
46930
48330
|
/*
|
|
46931
48331
|
* (C) Copyright 2014 Kurento (http://kurento.org/)
|
|
46932
48332
|
*
|
|
@@ -46958,7 +48358,7 @@ var WebRtcPeer = require('./WebRtcPeer');
|
|
|
46958
48358
|
|
|
46959
48359
|
exports.WebRtcPeer = WebRtcPeer;
|
|
46960
48360
|
|
|
46961
|
-
},{"./WebRtcPeer":
|
|
48361
|
+
},{"./WebRtcPeer":297}],299:[function(require,module,exports){
|
|
46962
48362
|
/*!
|
|
46963
48363
|
* @name JavaScript/NodeJS Merge v1.2.1
|
|
46964
48364
|
* @author yeikos
|
|
@@ -47136,7 +48536,7 @@ exports.WebRtcPeer = WebRtcPeer;
|
|
|
47136
48536
|
}
|
|
47137
48537
|
|
|
47138
48538
|
})(typeof module === 'object' && module && typeof module.exports === 'object' && module.exports);
|
|
47139
|
-
},{}],
|
|
48539
|
+
},{}],300:[function(require,module,exports){
|
|
47140
48540
|
/**
|
|
47141
48541
|
# normalice
|
|
47142
48542
|
|
|
@@ -47198,7 +48598,7 @@ module.exports = function(input) {
|
|
|
47198
48598
|
return output;
|
|
47199
48599
|
};
|
|
47200
48600
|
|
|
47201
|
-
},{}],
|
|
48601
|
+
},{}],301:[function(require,module,exports){
|
|
47202
48602
|
(function () {
|
|
47203
48603
|
/*
|
|
47204
48604
|
* Async module to handle async messaging
|
|
@@ -47911,7 +49311,7 @@ module.exports = function(input) {
|
|
|
47911
49311
|
}
|
|
47912
49312
|
})();
|
|
47913
49313
|
|
|
47914
|
-
},{"../utility/utility.js":
|
|
49314
|
+
},{"../utility/utility.js":303,"./socket.js":302}],302:[function(require,module,exports){
|
|
47915
49315
|
(function() {
|
|
47916
49316
|
/*
|
|
47917
49317
|
* Socket Module to connect and handle Socket functionalities
|
|
@@ -48132,7 +49532,7 @@ module.exports = function(input) {
|
|
|
48132
49532
|
|
|
48133
49533
|
})();
|
|
48134
49534
|
|
|
48135
|
-
},{"isomorphic-ws":
|
|
49535
|
+
},{"isomorphic-ws":295}],303:[function(require,module,exports){
|
|
48136
49536
|
(function (global){(function (){
|
|
48137
49537
|
(function() {
|
|
48138
49538
|
/**
|
|
@@ -48360,7 +49760,7 @@ module.exports = function(input) {
|
|
|
48360
49760
|
})();
|
|
48361
49761
|
|
|
48362
49762
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
48363
|
-
},{}],
|
|
49763
|
+
},{}],304:[function(require,module,exports){
|
|
48364
49764
|
var grammar = module.exports = {
|
|
48365
49765
|
v: [{
|
|
48366
49766
|
name: 'version',
|
|
@@ -48619,7 +50019,7 @@ Object.keys(grammar).forEach(function (key) {
|
|
|
48619
50019
|
});
|
|
48620
50020
|
});
|
|
48621
50021
|
|
|
48622
|
-
},{}],
|
|
50022
|
+
},{}],305:[function(require,module,exports){
|
|
48623
50023
|
var parser = require('./parser');
|
|
48624
50024
|
var writer = require('./writer');
|
|
48625
50025
|
|
|
@@ -48629,7 +50029,7 @@ exports.parseFmtpConfig = parser.parseFmtpConfig;
|
|
|
48629
50029
|
exports.parsePayloads = parser.parsePayloads;
|
|
48630
50030
|
exports.parseRemoteCandidates = parser.parseRemoteCandidates;
|
|
48631
50031
|
|
|
48632
|
-
},{"./parser":
|
|
50032
|
+
},{"./parser":306,"./writer":307}],306:[function(require,module,exports){
|
|
48633
50033
|
var toIntIfInt = function (v) {
|
|
48634
50034
|
return String(Number(v)) === v ? Number(v) : v;
|
|
48635
50035
|
};
|
|
@@ -48724,7 +50124,7 @@ exports.parseRemoteCandidates = function (str) {
|
|
|
48724
50124
|
return candidates;
|
|
48725
50125
|
};
|
|
48726
50126
|
|
|
48727
|
-
},{"./grammar":
|
|
50127
|
+
},{"./grammar":304}],307:[function(require,module,exports){
|
|
48728
50128
|
var grammar = require('./grammar');
|
|
48729
50129
|
|
|
48730
50130
|
// customized util.format - discards excess arguments and can void middle ones
|
|
@@ -48840,7 +50240,7 @@ module.exports = function (session, opts) {
|
|
|
48840
50240
|
return sdp.join('\r\n') + '\r\n';
|
|
48841
50241
|
};
|
|
48842
50242
|
|
|
48843
|
-
},{"./grammar":
|
|
50243
|
+
},{"./grammar":304}],308:[function(require,module,exports){
|
|
48844
50244
|
/* Copyright @ 2015 Atlassian Pty Ltd
|
|
48845
50245
|
*
|
|
48846
50246
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -48881,7 +50281,7 @@ module.exports = function arrayEquals(array) {
|
|
|
48881
50281
|
};
|
|
48882
50282
|
|
|
48883
50283
|
|
|
48884
|
-
},{}],
|
|
50284
|
+
},{}],309:[function(require,module,exports){
|
|
48885
50285
|
/* Copyright @ 2015 Atlassian Pty Ltd
|
|
48886
50286
|
*
|
|
48887
50287
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -48899,7 +50299,7 @@ module.exports = function arrayEquals(array) {
|
|
|
48899
50299
|
|
|
48900
50300
|
exports.Interop = require('./interop');
|
|
48901
50301
|
|
|
48902
|
-
},{"./interop":
|
|
50302
|
+
},{"./interop":310}],310:[function(require,module,exports){
|
|
48903
50303
|
/* Copyright @ 2015 Atlassian Pty Ltd
|
|
48904
50304
|
*
|
|
48905
50305
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -49784,7 +51184,7 @@ Interop.prototype.toUnifiedPlan = function(desc) {
|
|
|
49784
51184
|
//#endregion
|
|
49785
51185
|
};
|
|
49786
51186
|
|
|
49787
|
-
},{"./array-equals":
|
|
51187
|
+
},{"./array-equals":308,"./transform":311}],311:[function(require,module,exports){
|
|
49788
51188
|
/* Copyright @ 2015 Atlassian Pty Ltd
|
|
49789
51189
|
*
|
|
49790
51190
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -49898,7 +51298,7 @@ exports.parse = function(sdp) {
|
|
|
49898
51298
|
};
|
|
49899
51299
|
|
|
49900
51300
|
|
|
49901
|
-
},{"sdp-transform":
|
|
51301
|
+
},{"sdp-transform":305}],312:[function(require,module,exports){
|
|
49902
51302
|
/* eslint-env node */
|
|
49903
51303
|
'use strict';
|
|
49904
51304
|
|
|
@@ -50659,7 +52059,7 @@ SDPUtils.isValidSDP = function (blob) {
|
|
|
50659
52059
|
if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object') {
|
|
50660
52060
|
module.exports = SDPUtils;
|
|
50661
52061
|
}
|
|
50662
|
-
},{}],
|
|
52062
|
+
},{}],313:[function(require,module,exports){
|
|
50663
52063
|
(function (global){(function (){
|
|
50664
52064
|
/*! *****************************************************************************
|
|
50665
52065
|
Copyright (c) Microsoft Corporation.
|
|
@@ -50947,7 +52347,7 @@ var __createBinding;
|
|
|
50947
52347
|
});
|
|
50948
52348
|
|
|
50949
52349
|
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
50950
|
-
},{}],
|
|
52350
|
+
},{}],314:[function(require,module,exports){
|
|
50951
52351
|
/*!
|
|
50952
52352
|
* UAParser.js v0.7.24
|
|
50953
52353
|
* Lightweight JavaScript-based User-Agent string parser
|
|
@@ -51886,7 +53286,7 @@ var __createBinding;
|
|
|
51886
53286
|
|
|
51887
53287
|
})(typeof window === 'object' ? window : this);
|
|
51888
53288
|
|
|
51889
|
-
},{}],
|
|
53289
|
+
},{}],315:[function(require,module,exports){
|
|
51890
53290
|
/**
|
|
51891
53291
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
51892
53292
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
@@ -51914,7 +53314,7 @@ function bytesToUuid(buf, offset) {
|
|
|
51914
53314
|
|
|
51915
53315
|
module.exports = bytesToUuid;
|
|
51916
53316
|
|
|
51917
|
-
},{}],
|
|
53317
|
+
},{}],316:[function(require,module,exports){
|
|
51918
53318
|
// Unique ID creation requires a high quality random # generator. In the
|
|
51919
53319
|
// browser this is a little complicated due to unknown quality of Math.random()
|
|
51920
53320
|
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
@@ -51950,7 +53350,7 @@ if (getRandomValues) {
|
|
|
51950
53350
|
};
|
|
51951
53351
|
}
|
|
51952
53352
|
|
|
51953
|
-
},{}],
|
|
53353
|
+
},{}],317:[function(require,module,exports){
|
|
51954
53354
|
var rng = require('./lib/rng');
|
|
51955
53355
|
var bytesToUuid = require('./lib/bytesToUuid');
|
|
51956
53356
|
|
|
@@ -51981,7 +53381,7 @@ function v4(options, buf, offset) {
|
|
|
51981
53381
|
|
|
51982
53382
|
module.exports = v4;
|
|
51983
53383
|
|
|
51984
|
-
},{"./lib/bytesToUuid":
|
|
53384
|
+
},{"./lib/bytesToUuid":315,"./lib/rng":316}],318:[function(require,module,exports){
|
|
51985
53385
|
/*
|
|
51986
53386
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
51987
53387
|
*
|
|
@@ -52002,7 +53402,7 @@ var _adapter_factory = require('./adapter_factory.js');
|
|
|
52002
53402
|
var adapter = (0, _adapter_factory.adapterFactory)({ window: typeof window === 'undefined' ? undefined : window });
|
|
52003
53403
|
exports.default = adapter;
|
|
52004
53404
|
|
|
52005
|
-
},{"./adapter_factory.js":
|
|
53405
|
+
},{"./adapter_factory.js":319}],319:[function(require,module,exports){
|
|
52006
53406
|
'use strict';
|
|
52007
53407
|
|
|
52008
53408
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -52167,7 +53567,7 @@ function adapterFactory() {
|
|
|
52167
53567
|
|
|
52168
53568
|
// Browser shims.
|
|
52169
53569
|
|
|
52170
|
-
},{"./chrome/chrome_shim":
|
|
53570
|
+
},{"./chrome/chrome_shim":320,"./common_shim":323,"./firefox/firefox_shim":324,"./safari/safari_shim":327,"./utils":328,"sdp":312}],320:[function(require,module,exports){
|
|
52171
53571
|
/*
|
|
52172
53572
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
52173
53573
|
*
|
|
@@ -52916,7 +54316,7 @@ function fixNegotiationNeeded(window, browserDetails) {
|
|
|
52916
54316
|
});
|
|
52917
54317
|
}
|
|
52918
54318
|
|
|
52919
|
-
},{"../utils.js":
|
|
54319
|
+
},{"../utils.js":328,"./getdisplaymedia":321,"./getusermedia":322}],321:[function(require,module,exports){
|
|
52920
54320
|
/*
|
|
52921
54321
|
* Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
|
|
52922
54322
|
*
|
|
@@ -52967,7 +54367,7 @@ function shimGetDisplayMedia(window, getSourceId) {
|
|
|
52967
54367
|
};
|
|
52968
54368
|
}
|
|
52969
54369
|
|
|
52970
|
-
},{}],
|
|
54370
|
+
},{}],322:[function(require,module,exports){
|
|
52971
54371
|
/*
|
|
52972
54372
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
52973
54373
|
*
|
|
@@ -53172,7 +54572,7 @@ function shimGetUserMedia(window, browserDetails) {
|
|
|
53172
54572
|
}
|
|
53173
54573
|
}
|
|
53174
54574
|
|
|
53175
|
-
},{"../utils.js":
|
|
54575
|
+
},{"../utils.js":328}],323:[function(require,module,exports){
|
|
53176
54576
|
/*
|
|
53177
54577
|
* Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
|
|
53178
54578
|
*
|
|
@@ -53560,7 +54960,7 @@ function shimAddIceCandidateNullOrEmpty(window, browserDetails) {
|
|
|
53560
54960
|
};
|
|
53561
54961
|
}
|
|
53562
54962
|
|
|
53563
|
-
},{"./utils":
|
|
54963
|
+
},{"./utils":328,"sdp":312}],324:[function(require,module,exports){
|
|
53564
54964
|
/*
|
|
53565
54965
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
53566
54966
|
*
|
|
@@ -53895,7 +55295,7 @@ function shimCreateAnswer(window) {
|
|
|
53895
55295
|
};
|
|
53896
55296
|
}
|
|
53897
55297
|
|
|
53898
|
-
},{"../utils":
|
|
55298
|
+
},{"../utils":328,"./getdisplaymedia":325,"./getusermedia":326}],325:[function(require,module,exports){
|
|
53899
55299
|
/*
|
|
53900
55300
|
* Copyright (c) 2018 The adapter.js project authors. All Rights Reserved.
|
|
53901
55301
|
*
|
|
@@ -53934,7 +55334,7 @@ function shimGetDisplayMedia(window, preferredMediaSource) {
|
|
|
53934
55334
|
};
|
|
53935
55335
|
}
|
|
53936
55336
|
|
|
53937
|
-
},{}],
|
|
55337
|
+
},{}],326:[function(require,module,exports){
|
|
53938
55338
|
/*
|
|
53939
55339
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
53940
55340
|
*
|
|
@@ -54011,7 +55411,7 @@ function shimGetUserMedia(window, browserDetails) {
|
|
|
54011
55411
|
}
|
|
54012
55412
|
}
|
|
54013
55413
|
|
|
54014
|
-
},{"../utils":
|
|
55414
|
+
},{"../utils":328}],327:[function(require,module,exports){
|
|
54015
55415
|
/*
|
|
54016
55416
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
54017
55417
|
*
|
|
@@ -54380,7 +55780,7 @@ function shimAudioContext(window) {
|
|
|
54380
55780
|
window.AudioContext = window.webkitAudioContext;
|
|
54381
55781
|
}
|
|
54382
55782
|
|
|
54383
|
-
},{"../utils":
|
|
55783
|
+
},{"../utils":328}],328:[function(require,module,exports){
|
|
54384
55784
|
/*
|
|
54385
55785
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
54386
55786
|
*
|
|
@@ -54651,7 +56051,7 @@ function filterStats(result, track, outbound) {
|
|
|
54651
56051
|
return filteredResult;
|
|
54652
56052
|
}
|
|
54653
56053
|
|
|
54654
|
-
},{}],
|
|
56054
|
+
},{}],329:[function(require,module,exports){
|
|
54655
56055
|
/*
|
|
54656
56056
|
WildEmitter.js is a slim little event emitter by @henrikjoreteg largely based
|
|
54657
56057
|
on @visionmedia's Emitter from UI Kit.
|
|
@@ -54808,7 +56208,7 @@ WildEmitter.mixin = function (constructor) {
|
|
|
54808
56208
|
|
|
54809
56209
|
WildEmitter.mixin(WildEmitter);
|
|
54810
56210
|
|
|
54811
|
-
},{}],
|
|
56211
|
+
},{}],330:[function(require,module,exports){
|
|
54812
56212
|
(function () {
|
|
54813
56213
|
/**
|
|
54814
56214
|
* Global Variables
|
|
@@ -54828,6 +56228,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
54828
56228
|
|
|
54829
56229
|
|
|
54830
56230
|
var Utility = params.Utility,
|
|
56231
|
+
currentModuleInstance = this,
|
|
54831
56232
|
Sentry = params.Sentry,
|
|
54832
56233
|
asyncClient = params.asyncClient,
|
|
54833
56234
|
chatEvents = params.chatEvents,
|
|
@@ -54940,6 +56341,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
54940
56341
|
START_SCREEN_SHARE: 123,
|
|
54941
56342
|
END_SCREEN_SHARE: 124,
|
|
54942
56343
|
DELETE_FROM_CALL_HISTORY: 125,
|
|
56344
|
+
DESTINATED_RECORD_CALL: 126,
|
|
54943
56345
|
MUTUAL_GROUPS: 130,
|
|
54944
56346
|
CREATE_TAG: 140,
|
|
54945
56347
|
EDIT_TAG: 141,
|
|
@@ -54948,6 +56350,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
54948
56350
|
REMOVE_TAG_PARTICIPANT: 144,
|
|
54949
56351
|
GET_TAG_LIST: 145,
|
|
54950
56352
|
DELETE_MESSAGE_THREAD: 151,
|
|
56353
|
+
EXPORT_CHAT: 152,
|
|
54951
56354
|
ERROR: 999
|
|
54952
56355
|
},
|
|
54953
56356
|
inviteeVOidTypes = {
|
|
@@ -54999,20 +56402,25 @@ WildEmitter.mixin(WildEmitter);
|
|
|
54999
56402
|
currentCallId = null,
|
|
55000
56403
|
shouldReconnectCallTimeout = null,
|
|
55001
56404
|
callTopics = {},
|
|
56405
|
+
screenShareState = {
|
|
56406
|
+
started: false,
|
|
56407
|
+
imOwner: false
|
|
56408
|
+
},
|
|
55002
56409
|
callClientType = {
|
|
55003
56410
|
WEB: 1,
|
|
55004
56411
|
ANDROID: 2,
|
|
55005
56412
|
DESKTOP: 3
|
|
55006
56413
|
},
|
|
55007
56414
|
webpeers = {},
|
|
56415
|
+
callUsers = {},
|
|
55008
56416
|
webpeersMetadata = {},
|
|
55009
56417
|
callRequestController = {
|
|
55010
56418
|
callRequestReceived: false,
|
|
55011
56419
|
callEstablishedInMySide: false,
|
|
55012
56420
|
iCanAcceptTheCall: function () {
|
|
55013
56421
|
return callRequestController.callRequestReceived && callRequestController.callEstablishedInMySide;
|
|
55014
|
-
|
|
55015
|
-
|
|
56422
|
+
},
|
|
56423
|
+
cameraPaused: true
|
|
55016
56424
|
},
|
|
55017
56425
|
uiRemoteMedias = {},
|
|
55018
56426
|
callStopQueue = {
|
|
@@ -55246,7 +56654,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55246
56654
|
},
|
|
55247
56655
|
|
|
55248
56656
|
endCall = function (params, callback) {
|
|
55249
|
-
consoleLogging && console.log('endCall called...');
|
|
56657
|
+
consoleLogging && console.log('[SDK][endCall] called...');
|
|
55250
56658
|
|
|
55251
56659
|
var endCallData = {
|
|
55252
56660
|
chatMessageVOType: chatMessageVOTypes.END_CALL_REQUEST,
|
|
@@ -55285,6 +56693,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55285
56693
|
}
|
|
55286
56694
|
});
|
|
55287
56695
|
},
|
|
56696
|
+
|
|
55288
56697
|
/*
|
|
55289
56698
|
* Call Functionalities
|
|
55290
56699
|
*/
|
|
@@ -55292,25 +56701,36 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55292
56701
|
if (callDivId) {
|
|
55293
56702
|
var callParentDiv,
|
|
55294
56703
|
callVideo = (typeof params.video === 'boolean') ? params.video : true,
|
|
55295
|
-
callMute = (typeof params.mute === 'boolean') ? params.mute : false
|
|
55296
|
-
sendingTopic = params.sendingTopic,
|
|
55297
|
-
receiveTopic = params.receiveTopic;
|
|
56704
|
+
callMute = (typeof params.mute === 'boolean') ? params.mute : false;
|
|
56705
|
+
//sendingTopic = params.sendingTopic,
|
|
56706
|
+
//receiveTopic = params.receiveTopic;
|
|
56707
|
+
|
|
56708
|
+
if(params.clientsList && params.clientsList.length) {
|
|
56709
|
+
for(var i in params.clientsList) {
|
|
56710
|
+
callStateController.setupCallParticipant(params.clientsList[i]);
|
|
56711
|
+
//callStateController.callUsers.push(params.clientsList[i]);
|
|
56712
|
+
}
|
|
56713
|
+
}
|
|
56714
|
+
|
|
56715
|
+
callStateController.setupScreenSharingObject(params.screenShare);
|
|
55298
56716
|
|
|
55299
|
-
callTopics['sendVideoTopic'] = 'Vi-' + sendingTopic;
|
|
56717
|
+
/*callTopics['sendVideoTopic'] = 'Vi-' + sendingTopic;
|
|
55300
56718
|
callTopics['sendAudioTopic'] = 'Vo-' + sendingTopic;
|
|
56719
|
+
callTopics['screenShare'] = params.screenShare;
|
|
55301
56720
|
//callTopics['receiveVideoTopic'] = 'Vi-' + receiveTopic;
|
|
55302
56721
|
//callTopics['receiveAudioTopic'] = 'Vo-' + receiveTopic;
|
|
55303
56722
|
callTopics['receive'] = [];
|
|
55304
56723
|
callTopics['receive'].push({
|
|
55305
56724
|
"VideoTopic": 'Vi-' + receiveTopic,
|
|
55306
56725
|
"AudioTopic": 'Vo-' + receiveTopic
|
|
55307
|
-
})
|
|
56726
|
+
});*/
|
|
55308
56727
|
|
|
55309
|
-
webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
56728
|
+
/*webpeersMetadata[callTopics['sendVideoTopic']] = {
|
|
55310
56729
|
interval: null,
|
|
55311
56730
|
receivedSdpAnswer: false,
|
|
55312
56731
|
connectionQualityInterval: null,
|
|
55313
56732
|
poorConnectionCount: 0,
|
|
56733
|
+
poorConnectionResolvedCount: 0,
|
|
55314
56734
|
isConnectionPoor: false
|
|
55315
56735
|
};
|
|
55316
56736
|
webpeersMetadata[callTopics['sendAudioTopic']] = {
|
|
@@ -55318,6 +56738,15 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55318
56738
|
receivedSdpAnswer: false,
|
|
55319
56739
|
connectionQualityInterval: null,
|
|
55320
56740
|
poorConnectionCount: 0,
|
|
56741
|
+
poorConnectionResolvedCount: 0,
|
|
56742
|
+
isConnectionPoor: false
|
|
56743
|
+
};
|
|
56744
|
+
webpeersMetadata[callTopics['screenShare']] = {
|
|
56745
|
+
interval: null,
|
|
56746
|
+
receivedSdpAnswer: false,
|
|
56747
|
+
connectionQualityInterval: null,
|
|
56748
|
+
poorConnectionCount: 0,
|
|
56749
|
+
poorConnectionResolvedCount: 0,
|
|
55321
56750
|
isConnectionPoor: false
|
|
55322
56751
|
};
|
|
55323
56752
|
|
|
@@ -55330,11 +56759,11 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55330
56759
|
interval: null,
|
|
55331
56760
|
receivedSdpAnswer: false
|
|
55332
56761
|
};
|
|
55333
|
-
}
|
|
56762
|
+
}*/
|
|
55334
56763
|
|
|
55335
|
-
callParentDiv = document.getElementById(callDivId);
|
|
56764
|
+
//callParentDiv = document.getElementById(callDivId);
|
|
55336
56765
|
|
|
55337
|
-
|
|
56766
|
+
/*// Local Video Tag
|
|
55338
56767
|
if (callVideo && !uiRemoteMedias[callTopics['sendVideoTopic']]) {
|
|
55339
56768
|
uiRemoteMedias[callTopics['sendVideoTopic']] = document.createElement('video');
|
|
55340
56769
|
var el = uiRemoteMedias[callTopics['sendVideoTopic']];
|
|
@@ -55380,10 +56809,11 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55380
56809
|
callMute && el.setAttribute('muted', '');
|
|
55381
56810
|
el.setAttribute('controls', '');
|
|
55382
56811
|
}
|
|
55383
|
-
}
|
|
56812
|
+
}*/
|
|
55384
56813
|
|
|
55385
|
-
|
|
55386
|
-
|
|
56814
|
+
callback && callback(generateCallUIList());
|
|
56815
|
+
|
|
56816
|
+
/*for(var i in callTopics['receive']) {
|
|
55387
56817
|
uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['AudioTopic']])
|
|
55388
56818
|
callVideo && uiRemoteElements.push(uiRemoteMedias[callTopics['receive'][i]['VideoTopic']])
|
|
55389
56819
|
}
|
|
@@ -55404,18 +56834,19 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55404
56834
|
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
55405
56835
|
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
55406
56836
|
uiRemoteElements: uiRemoteElements
|
|
55407
|
-
|
|
55408
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]
|
|
56837
|
+
/!* 'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
56838
|
+
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
55409
56839
|
});
|
|
55410
56840
|
} else {
|
|
55411
56841
|
callback && callback({
|
|
55412
56842
|
'uiLocalVideo': uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
55413
56843
|
'uiLocalAudio': uiRemoteMedias[callTopics['sendAudioTopic']],
|
|
55414
56844
|
uiRemoteElements: uiRemoteElements
|
|
55415
|
-
|
|
55416
|
-
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]
|
|
56845
|
+
/!*'uiRemoteVideo': uiRemoteMedias[callTopics['receiveVideoTopic']],
|
|
56846
|
+
'uiRemoteAudio': uiRemoteMedias[callTopics['receiveAudioTopic']]*!/
|
|
55417
56847
|
});
|
|
55418
|
-
}
|
|
56848
|
+
}*/
|
|
56849
|
+
|
|
55419
56850
|
|
|
55420
56851
|
callStateController.createSessionInChat(Object.assign(params, {
|
|
55421
56852
|
callVideo: callVideo,
|
|
@@ -55440,34 +56871,32 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55440
56871
|
}
|
|
55441
56872
|
},
|
|
55442
56873
|
|
|
55443
|
-
|
|
55444
|
-
|
|
55445
|
-
|
|
55446
|
-
|
|
55447
|
-
|
|
55448
|
-
|
|
55449
|
-
|
|
55450
|
-
|
|
55451
|
-
}, function (res) {
|
|
55452
|
-
if (res.done === 'TRUE') {
|
|
55453
|
-
callStopQueue.callStarted = true;
|
|
55454
|
-
generateAndSendSdpOffers(params, [callTopics['sendVideoTopic'], callTopics['receiveVideoTopic'], callTopics['sendAudioTopic'], callTopics['receiveAudioTopic']]);
|
|
55455
|
-
} else if (res.done === 'SKIP') {
|
|
55456
|
-
callStopQueue.callStarted = true;
|
|
55457
|
-
generateAndSendSdpOffers(params, [callTopics['sendVideoTopic'], callTopics['receiveVideoTopic'], callTopics['sendAudioTopic'], callTopics['receiveAudioTopic']]);
|
|
55458
|
-
} else {
|
|
55459
|
-
consoleLogging && console.log('CREATE_SESSION faced a problem', res);
|
|
55460
|
-
endCall({
|
|
55461
|
-
callId: currentCallId
|
|
55462
|
-
});
|
|
56874
|
+
generateCallUIList = function () {
|
|
56875
|
+
var me = chatMessaging.userInfo.Id;
|
|
56876
|
+
var callUIElements = {};
|
|
56877
|
+
for(var i in callUsers) {
|
|
56878
|
+
callUIElements[i] = {
|
|
56879
|
+
container: callUsers[i].htmlElements.container,
|
|
56880
|
+
video: callUsers[i].htmlElements[callUsers[i].videoTopicName],
|
|
56881
|
+
audio: callUsers[i].htmlElements[callUsers[i].audioTopicName]
|
|
55463
56882
|
}
|
|
55464
|
-
|
|
55465
|
-
|
|
56883
|
+
|
|
56884
|
+
/* callUIElements[i].container = callUsers[i].htmlElements.container;
|
|
56885
|
+
callUIElements[i].video = callUsers[i].htmlElements[callUsers[i].videoTopicName];
|
|
56886
|
+
callUIElements[i].audio = callUsers[i].htmlElements[callUsers[i].audioTopicName];
|
|
56887
|
+
*/
|
|
56888
|
+
//callUIElements[i] = callUsers[i].htmlElements;
|
|
56889
|
+
}
|
|
56890
|
+
return {
|
|
56891
|
+
uiElements: callUIElements,
|
|
56892
|
+
};
|
|
56893
|
+
},
|
|
55466
56894
|
|
|
55467
56895
|
callStateController = {
|
|
55468
56896
|
createSessionInChat: function (params) {
|
|
55469
56897
|
currentCallParams = params;
|
|
55470
56898
|
var callController = this;
|
|
56899
|
+
consoleLogging && console.log("createSessionInChat:inside", params);
|
|
55471
56900
|
sendCallMessage({
|
|
55472
56901
|
id: 'CREATE_SESSION',
|
|
55473
56902
|
brokerAddress: params.brokerAddress,
|
|
@@ -55494,18 +56923,144 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55494
56923
|
*/
|
|
55495
56924
|
startCall: function (params) {
|
|
55496
56925
|
var callController = this;
|
|
55497
|
-
|
|
55498
|
-
|
|
55499
|
-
|
|
55500
|
-
|
|
55501
|
-
|
|
56926
|
+
for(var i in callUsers) {
|
|
56927
|
+
if(i === 'screenShare')
|
|
56928
|
+
continue;
|
|
56929
|
+
|
|
56930
|
+
if(callUsers[i].video) {
|
|
56931
|
+
callController.startParticipantVideo(i);
|
|
56932
|
+
}
|
|
56933
|
+
if(!callUsers[i].mute) {
|
|
56934
|
+
callController.startParticipantAudio(i);
|
|
56935
|
+
}
|
|
56936
|
+
/*if (params.callVideo) {
|
|
56937
|
+
callController.startParticipantVideo(i);
|
|
56938
|
+
}*/
|
|
56939
|
+
/*if(params.callAudio) {
|
|
56940
|
+
callController.startParticipantAudio(i);
|
|
56941
|
+
}*/
|
|
55502
56942
|
}
|
|
55503
|
-
|
|
55504
|
-
|
|
55505
|
-
|
|
55506
|
-
|
|
55507
|
-
|
|
56943
|
+
},
|
|
56944
|
+
setupCallParticipant: function (participant) {
|
|
56945
|
+
var user = participant;
|
|
56946
|
+
user.topicMetaData = {};
|
|
56947
|
+
user.peers = {};
|
|
56948
|
+
if(user.userId === chatMessaging.userInfo.id) {
|
|
56949
|
+
user.direction = 'send';
|
|
56950
|
+
} else {
|
|
56951
|
+
user.direction = 'receive';
|
|
55508
56952
|
}
|
|
56953
|
+
user.videoTopicName = 'Vi-' + user.topicSend;
|
|
56954
|
+
user.audioTopicName = 'Vo-' + user.topicSend;
|
|
56955
|
+
user.topicMetaData[user.videoTopicName] = {
|
|
56956
|
+
interval: null,
|
|
56957
|
+
receivedSdpAnswer: false,
|
|
56958
|
+
connectionQualityInterval: null,
|
|
56959
|
+
poorConnectionCount: 0,
|
|
56960
|
+
poorConnectionResolvedCount: 0,
|
|
56961
|
+
isConnectionPoor: false
|
|
56962
|
+
};
|
|
56963
|
+
user.topicMetaData[user.audioTopicName] = {
|
|
56964
|
+
interval: null,
|
|
56965
|
+
receivedSdpAnswer: false,
|
|
56966
|
+
connectionQualityInterval: null,
|
|
56967
|
+
poorConnectionCount: 0,
|
|
56968
|
+
poorConnectionResolvedCount: 0,
|
|
56969
|
+
isConnectionPoor: false
|
|
56970
|
+
};
|
|
56971
|
+
callUsers[user.userId] = user;
|
|
56972
|
+
this.appendUserToCallDiv(user.userId, this.generateHTMLElements(user.userId));
|
|
56973
|
+
},
|
|
56974
|
+
setupScreenSharingObject: function (topic) {
|
|
56975
|
+
var obj = {
|
|
56976
|
+
video: true,
|
|
56977
|
+
};
|
|
56978
|
+
obj.topicMetaData = {};
|
|
56979
|
+
obj.peers = {};
|
|
56980
|
+
if(screenShareState.imOwner) {
|
|
56981
|
+
obj.direction = 'send';
|
|
56982
|
+
} else {
|
|
56983
|
+
obj.direction = 'receive'
|
|
56984
|
+
}
|
|
56985
|
+
obj.videoTopicName = topic;
|
|
56986
|
+
obj.topicMetaData[obj.videoTopicName] = {
|
|
56987
|
+
interval: null,
|
|
56988
|
+
receivedSdpAnswer: false,
|
|
56989
|
+
connectionQualityInterval: null,
|
|
56990
|
+
poorConnectionCount: 0,
|
|
56991
|
+
poorConnectionResolvedCount: 0,
|
|
56992
|
+
isConnectionPoor: false
|
|
56993
|
+
};
|
|
56994
|
+
callUsers['screenShare'] = obj;
|
|
56995
|
+
this.generateHTMLElements('screenShare')
|
|
56996
|
+
},
|
|
56997
|
+
appendUserToCallDiv: function (userId) {
|
|
56998
|
+
if(!callDivId) {
|
|
56999
|
+
consoleLogging && console.log('No Call DIV has been declared!');
|
|
57000
|
+
return;
|
|
57001
|
+
}
|
|
57002
|
+
var user = callUsers[userId]
|
|
57003
|
+
var callParentDiv = document.getElementById(callDivId);
|
|
57004
|
+
if(user.video) {
|
|
57005
|
+
console.log("appendUserToCallDiv1", user, document.getElementById("callParticipantWrapper-" + userId), document.getElementById("uiRemoteVideo-" + user.videoTopicName))
|
|
57006
|
+
if(!document.getElementById("callParticipantWrapper-" + userId)) {
|
|
57007
|
+
if (!document.getElementById("uiRemoteVideo-" + user.videoTopicName)) {
|
|
57008
|
+
user.htmlElements.container.appendChild(user.htmlElements[user.videoTopicName])
|
|
57009
|
+
}
|
|
57010
|
+
}
|
|
57011
|
+
else {
|
|
57012
|
+
document.getElementById("callParticipantWrapper-" + userId).append(user.htmlElements[user.videoTopicName])
|
|
57013
|
+
}
|
|
57014
|
+
}
|
|
57015
|
+
if(typeof user.mute !== "undefined" && !user.mute){
|
|
57016
|
+
if(!document.getElementById("callParticipantWrapper-" + userId)) {
|
|
57017
|
+
if(!document.getElementById("uiRemoteAudio-" + user.videoTopicName)) {
|
|
57018
|
+
user.htmlElements.container.appendChild(user.htmlElements[user.audioTopicName])
|
|
57019
|
+
}
|
|
57020
|
+
} else {
|
|
57021
|
+
document.getElementById("callParticipantWrapper-" + userId).append(user.htmlElements[user.audioTopicName])
|
|
57022
|
+
}
|
|
57023
|
+
}
|
|
57024
|
+
|
|
57025
|
+
if(!document.getElementById("callParticipantWrapper-" + userId))
|
|
57026
|
+
callParentDiv.appendChild(user.htmlElements.container);
|
|
57027
|
+
},
|
|
57028
|
+
generateHTMLElements: function (userId) {
|
|
57029
|
+
var user = callUsers[userId]
|
|
57030
|
+
if(!user.htmlElements) {
|
|
57031
|
+
user.htmlElements = {
|
|
57032
|
+
container: document.createElement('div')
|
|
57033
|
+
};
|
|
57034
|
+
var el = user.htmlElements.container;
|
|
57035
|
+
el.setAttribute('id', 'callParticipantWrapper-' + userId);
|
|
57036
|
+
el.classList.add('participant');
|
|
57037
|
+
el.classList.add('wrapper');
|
|
57038
|
+
el.classList.add('user-' + userId);
|
|
57039
|
+
el.classList.add((userId === chatMessaging.userInfo.id ? 'local' : 'remote'));
|
|
57040
|
+
}
|
|
57041
|
+
|
|
57042
|
+
if (user.video && !user.htmlElements[user.videoTopicName]) {
|
|
57043
|
+
user.htmlElements[user.videoTopicName] = document.createElement('video');
|
|
57044
|
+
var el = user.htmlElements[user.videoTopicName];
|
|
57045
|
+
el.setAttribute('id', 'uiRemoteVideo-' + user.videoTopicName);
|
|
57046
|
+
el.setAttribute('class', callVideoTagClassName);
|
|
57047
|
+
el.setAttribute('playsinline', '');
|
|
57048
|
+
el.setAttribute('muted', '');
|
|
57049
|
+
el.setAttribute('width', callVideoMinWidth + 'px');
|
|
57050
|
+
el.setAttribute('height', callVideoMinHeight + 'px');
|
|
57051
|
+
}
|
|
57052
|
+
|
|
57053
|
+
if (typeof user.mute !== 'undefined' && !user.mute && !user.htmlElements[user.audioTopicName]) {
|
|
57054
|
+
user.htmlElements[user.audioTopicName] = document.createElement('audio');
|
|
57055
|
+
var el = user.htmlElements[user.audioTopicName];
|
|
57056
|
+
el.setAttribute('id', 'uiRemoteAudio-' + user.audioTopicName);
|
|
57057
|
+
el.setAttribute('class', callAudioTagClassName);
|
|
57058
|
+
el.setAttribute('autoplay', '');
|
|
57059
|
+
el.setAttribute('muted', '');
|
|
57060
|
+
el.setAttribute('controls', '');
|
|
57061
|
+
}
|
|
57062
|
+
|
|
57063
|
+
return user.htmlElements;
|
|
55509
57064
|
},
|
|
55510
57065
|
/**
|
|
55511
57066
|
* When call started we can add participants
|
|
@@ -55531,77 +57086,88 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55531
57086
|
return;
|
|
55532
57087
|
}
|
|
55533
57088
|
},
|
|
55534
|
-
|
|
55535
|
-
this.removeTopic(
|
|
55536
|
-
},
|
|
55537
|
-
startMyAudio: function () {
|
|
55538
|
-
this.createTopic(callTopics['sendAudioTopic'], 'audio', 'send');
|
|
57089
|
+
stopParticipantAudio: function (userId) {
|
|
57090
|
+
this.removeTopic(userId, callUsers[userId].peers[userId].audioTopicName);
|
|
55539
57091
|
},
|
|
55540
|
-
|
|
55541
|
-
this.
|
|
57092
|
+
startParticipantAudio: function (userId) {
|
|
57093
|
+
this.createTopic(userId, callUsers[userId].audioTopicName, 'audio', callUsers[userId].direction);
|
|
55542
57094
|
},
|
|
55543
|
-
|
|
55544
|
-
this.
|
|
57095
|
+
stopParticipantVideo: function (userId) {
|
|
57096
|
+
this.removeTopic(userId, callUsers[userId].peers[userId].videoTopicName);
|
|
55545
57097
|
},
|
|
55546
|
-
|
|
55547
|
-
this.
|
|
57098
|
+
startParticipantVideo: function (userId) {
|
|
57099
|
+
this.createTopic(userId, callUsers[userId].videoTopicName, 'video', callUsers[userId].direction);
|
|
55548
57100
|
},
|
|
55549
|
-
|
|
55550
|
-
|
|
55551
|
-
|
|
55552
|
-
stopParticipantVideo: function (topic) {
|
|
55553
|
-
this.removeTopic(topic);
|
|
55554
|
-
},
|
|
55555
|
-
startParticipantVideo: function (topic) {
|
|
55556
|
-
this.createTopic(topic, 'video', 'receive');
|
|
55557
|
-
},
|
|
55558
|
-
createTopic: function (topic, mediaType, direction) {
|
|
55559
|
-
var options = this.getSdpOfferOptions(topic, mediaType, direction);
|
|
55560
|
-
this.generateTopicPeer(topic, mediaType, direction, options);
|
|
55561
|
-
},
|
|
55562
|
-
removeTopic: function (topic) {
|
|
55563
|
-
for(var i in webpeers) {
|
|
55564
|
-
if(i === topic) {
|
|
55565
|
-
webpeers[i].dispose();
|
|
55566
|
-
webpeers[i] = null;
|
|
55567
|
-
}
|
|
57101
|
+
createTopic: function (userId, topic, mediaType, direction, shareScreen) {
|
|
57102
|
+
if(callUsers[userId] && callUsers[userId].peers[topic]) {
|
|
57103
|
+
return;
|
|
55568
57104
|
}
|
|
57105
|
+
shareScreen = typeof shareScreen !== 'undefined' ? shareScreen : false;
|
|
57106
|
+
this.getSdpOfferOptions(userId, topic, mediaType, direction, shareScreen).then(function (options){
|
|
57107
|
+
callStateController.generateTopicPeer(userId, topic, mediaType, direction, options);
|
|
57108
|
+
});
|
|
55569
57109
|
},
|
|
55570
|
-
|
|
55571
|
-
|
|
55572
|
-
|
|
55573
|
-
|
|
55574
|
-
|
|
55575
|
-
height: callVideoMinHeight,
|
|
55576
|
-
framerate: 15
|
|
55577
|
-
}
|
|
57110
|
+
removeTopic: function (userId, topic) {
|
|
57111
|
+
if(callUsers[userId].peers[topic]) {
|
|
57112
|
+
this.removeConnectionQualityInterval(userId, topic);
|
|
57113
|
+
callUsers[userId].peers[topic].dispose();
|
|
57114
|
+
callUsers[userId].peers[topic] = null;
|
|
55578
57115
|
}
|
|
55579
|
-
|
|
55580
|
-
|
|
55581
|
-
|
|
55582
|
-
|
|
55583
|
-
|
|
55584
|
-
|
|
57116
|
+
},
|
|
57117
|
+
getSdpOfferOptions: function (userId, topic, mediaType, direction, shareScreen) {
|
|
57118
|
+
return new Promise(function (resolve, reject) {
|
|
57119
|
+
var mediaConstraints = {audio: (mediaType === 'audio'), video: (mediaType === 'video')};
|
|
57120
|
+
|
|
57121
|
+
if(direction === 'send' && mediaType === 'video') {
|
|
57122
|
+
mediaConstraints.video = {
|
|
57123
|
+
width: callVideoMinWidth,
|
|
57124
|
+
height: callVideoMinHeight,
|
|
57125
|
+
framerate: 15
|
|
55585
57126
|
}
|
|
55586
|
-
|
|
55587
|
-
|
|
55588
|
-
|
|
55589
|
-
|
|
55590
|
-
|
|
55591
|
-
|
|
55592
|
-
|
|
55593
|
-
|
|
55594
|
-
})
|
|
57127
|
+
}
|
|
57128
|
+
|
|
57129
|
+
var options = {
|
|
57130
|
+
mediaConstraints: mediaConstraints,
|
|
57131
|
+
iceTransportPolicy: 'relay',
|
|
57132
|
+
onicecandidate: (candidate) => {
|
|
57133
|
+
if (callUsers[userId].topicMetaData[topic].interval !== null) {
|
|
57134
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval);
|
|
55595
57135
|
}
|
|
55596
|
-
|
|
55597
|
-
|
|
55598
|
-
|
|
55599
|
-
|
|
57136
|
+
callUsers[userId].topicMetaData[topic].interval = setInterval(function () {
|
|
57137
|
+
if (callUsers[userId].topicMetaData[topic].sdpAnswerReceived === true) {
|
|
57138
|
+
callUsers[userId].topicMetaData[topic].sdpAnswerReceived = false;
|
|
57139
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval);
|
|
57140
|
+
sendCallMessage({
|
|
57141
|
+
id: 'ADD_ICE_CANDIDATE',
|
|
57142
|
+
topic: topic,
|
|
57143
|
+
candidateDto: candidate
|
|
57144
|
+
})
|
|
57145
|
+
}
|
|
57146
|
+
}, 500, {candidate: candidate});
|
|
57147
|
+
},
|
|
57148
|
+
configuration: {
|
|
57149
|
+
iceServers: callStateController.getTurnServer(currentCallParams)
|
|
57150
|
+
}
|
|
57151
|
+
};
|
|
57152
|
+
|
|
57153
|
+
options[(direction === 'send' ? 'localVideo' : 'remoteVideo')] = callUsers[userId].htmlElements[topic];
|
|
57154
|
+
|
|
57155
|
+
if(direction === 'send' && mediaType === 'video' && shareScreen) {
|
|
57156
|
+
navigator.mediaDevices.getDisplayMedia().then(function (result) {
|
|
57157
|
+
options.videoStream = result;
|
|
57158
|
+
options.sendSource = 'screen';
|
|
57159
|
+
// options[(direction === 'send' ? 'localVideo' : 'remoteVideo')] = uiRemoteMedias[topic];
|
|
57160
|
+
resolve(options);
|
|
57161
|
+
}).catch(function (error) {
|
|
57162
|
+
console.error("[SDK][navigator.mediaDevices.getDisplayMedia]", error);
|
|
57163
|
+
explainUserMediaError(error, 'video', 'screen');
|
|
57164
|
+
//resolve(options);
|
|
57165
|
+
});
|
|
57166
|
+
} else {
|
|
57167
|
+
resolve(options);
|
|
55600
57168
|
}
|
|
55601
|
-
|
|
55602
|
-
|
|
55603
|
-
consoleLogging && console.log("getSdpOfferOptions:", "topic: ", topic, "mediaType: ", mediaType, "direction: ", direction, "options: ", options)
|
|
55604
|
-
return options;
|
|
57169
|
+
consoleLogging && console.log("[SDK][getSdpOfferOptions] ", "topic: ", topic, "mediaType: ", mediaType, "direction: ", direction, "options: ", options);
|
|
57170
|
+
});
|
|
55605
57171
|
},
|
|
55606
57172
|
getTurnServer: function (params) {
|
|
55607
57173
|
if (!!params.turnAddress && params.turnAddress.length > 0) {
|
|
@@ -55624,90 +57190,16 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55624
57190
|
];
|
|
55625
57191
|
}
|
|
55626
57192
|
},
|
|
55627
|
-
|
|
55628
|
-
|
|
55629
|
-
|
|
55630
|
-
|
|
55631
|
-
webpeers[topic].peerConnection.onconnectionstatechange = function () {
|
|
55632
|
-
console.log("on connection state change, ", "peer: ", topic, "peerConnection.connectionState: ", webpeers[topic].peerConnection.connectionState);
|
|
55633
|
-
if (webpeers[topic].peerConnection.connectionState === 'disconnected') {
|
|
55634
|
-
console.log(topic, 'peerConnection.onconnectionstatechange: disconnected');
|
|
55635
|
-
|
|
55636
|
-
callController.removeConnectionQualityInterval(topic);
|
|
55637
|
-
}
|
|
55638
|
-
|
|
55639
|
-
if (webpeers[topic].peerConnection.connectionState === "failed") {
|
|
55640
|
-
chatEvents.fireEvent('callEvents', {
|
|
55641
|
-
type: 'CALL_STATUS',
|
|
55642
|
-
errorCode: 7000,
|
|
55643
|
-
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
55644
|
-
errorInfo: webpeers[topic]
|
|
55645
|
-
});
|
|
55646
|
-
setTimeout(function () {
|
|
55647
|
-
if(chatMessaging.chatState) {
|
|
55648
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
55649
|
-
}
|
|
55650
|
-
}, 7000);
|
|
55651
|
-
|
|
55652
|
-
callController.removeConnectionQualityInterval(topic);
|
|
55653
|
-
}
|
|
55654
|
-
|
|
55655
|
-
if(webpeers[topic].peerConnection.connectionState === 'connected') {
|
|
55656
|
-
if(mediaType === 'video' && direction === 'send') {
|
|
55657
|
-
webpeersMetadata[topic]['connectionQualityInterval'] = setInterval(function() {
|
|
55658
|
-
callController.checkConnectionQuality(topic, mediaType, direction)
|
|
55659
|
-
}, 1000);
|
|
55660
|
-
}
|
|
55661
|
-
}
|
|
55662
|
-
}
|
|
55663
|
-
|
|
55664
|
-
webpeers[topic].peerConnection.oniceconnectionstatechange = function () {
|
|
55665
|
-
console.log("on ice connection state change: ", topic, webpeers[topic].peerConnection.iceConnectionState);
|
|
55666
|
-
if (webpeers[topic].peerConnection.iceConnectionState === 'disconnected') {
|
|
55667
|
-
console.log(topic, 'peerConnection.oniceconnectionstatechange disconnected');
|
|
55668
|
-
chatEvents.fireEvent('callEvents', {
|
|
55669
|
-
type: 'CALL_STATUS',
|
|
55670
|
-
errorCode: 7000,
|
|
55671
|
-
errorMessage: `Call Peer (${topic}) is disconnected!`,
|
|
55672
|
-
errorInfo: webpeers[topic]
|
|
55673
|
-
});
|
|
55674
|
-
|
|
55675
|
-
console.log('Internet connection failed, Reconnect your call, topic:', topic);
|
|
55676
|
-
}
|
|
55677
|
-
|
|
55678
|
-
if (webpeers[topic].peerConnection.iceConnectionState === "failed") {
|
|
55679
|
-
chatEvents.fireEvent('callEvents', {
|
|
55680
|
-
type: 'CALL_STATUS',
|
|
55681
|
-
errorCode: 7000,
|
|
55682
|
-
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
55683
|
-
errorInfo: webpeers[topic]
|
|
55684
|
-
});
|
|
55685
|
-
if(chatMessaging.chatState) {
|
|
55686
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
55687
|
-
} else {
|
|
55688
|
-
setTimeout(function () {
|
|
55689
|
-
if(chatMessaging.chatState) {
|
|
55690
|
-
callController.shouldReconnectTopic(topic, mediaType, direction);
|
|
55691
|
-
}
|
|
55692
|
-
}, 7000);
|
|
55693
|
-
}
|
|
55694
|
-
}
|
|
55695
|
-
|
|
55696
|
-
if (webpeers[topic].peerConnection.iceConnectionState === "connected") {
|
|
55697
|
-
callRequestController.callEstablishedInMySide = true;
|
|
55698
|
-
chatEvents.fireEvent('callEvents', {
|
|
55699
|
-
type: 'CALL_STATUS',
|
|
55700
|
-
errorCode: 7000,
|
|
55701
|
-
errorMessage: `Call Peer (${topic}) has connected!`,
|
|
55702
|
-
errorInfo: webpeers[topic]
|
|
55703
|
-
});
|
|
55704
|
-
}
|
|
57193
|
+
checkConnectionQuality: function (userId, topic) {
|
|
57194
|
+
if(!callUsers[userId] || !callUsers[userId].peers[topic] || !callUsers[userId].peers[topic].peerConnection) {
|
|
57195
|
+
callStateController.removeConnectionQualityInterval(userId, topic);
|
|
57196
|
+
return;
|
|
55705
57197
|
}
|
|
55706
|
-
|
|
55707
|
-
checkConnectionQuality: function (topic) {
|
|
55708
|
-
webpeers[topic].peerConnection.getStats(null).then(stats => {
|
|
57198
|
+
callUsers[userId].peers[topic].peerConnection.getStats(null).then(stats => {
|
|
55709
57199
|
//console.log(' watchRTCPeerConnection:: window.setInterval then(stats:', stats)
|
|
55710
57200
|
//let statsOutput = "";
|
|
57201
|
+
var user = callUsers[userId],
|
|
57202
|
+
userMetadata = user.topicMetaData[topic]
|
|
55711
57203
|
|
|
55712
57204
|
stats.forEach(report => {
|
|
55713
57205
|
if(report && report.type && report.type === 'remote-inbound-rtp') {
|
|
@@ -55717,34 +57209,52 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55717
57209
|
// Now the statistics for this report; we intentially drop the ones we
|
|
55718
57210
|
// sorted to the top above
|
|
55719
57211
|
if(!report['roundTripTime'] || report['roundTripTime'] > 1) {
|
|
55720
|
-
if(
|
|
57212
|
+
if(userMetadata.poorConnectionCount === 10) {
|
|
57213
|
+
chatEvents.fireEvent('callEvents', {
|
|
57214
|
+
type: 'POOR_VIDEO_CONNECTION',
|
|
57215
|
+
subType: 'LONG_TIME',
|
|
57216
|
+
message: 'Poor connection for a long time',
|
|
57217
|
+
metadata: {
|
|
57218
|
+
elementId: "uiRemoteVideo-" + topic,
|
|
57219
|
+
topic: topic
|
|
57220
|
+
}
|
|
57221
|
+
});
|
|
57222
|
+
}
|
|
57223
|
+
if(userMetadata.poorConnectionCount > 3 && !userMetadata.isConnectionPoor) {
|
|
55721
57224
|
//alert('Poor connection detected...');
|
|
55722
|
-
consoleLogging && console.log('Poor connection detected...');
|
|
57225
|
+
consoleLogging && console.log('[SDK][checkConnectionQuality] Poor connection detected...');
|
|
55723
57226
|
chatEvents.fireEvent('callEvents', {
|
|
55724
57227
|
type: 'POOR_VIDEO_CONNECTION',
|
|
57228
|
+
subType: 'SHORT_TIME',
|
|
55725
57229
|
message: 'Poor connection detected',
|
|
57230
|
+
metadata: {
|
|
57231
|
+
elementId: "uiRemoteVideo-" + topic,
|
|
57232
|
+
topic: topic,
|
|
57233
|
+
userId: userId
|
|
57234
|
+
}
|
|
57235
|
+
});
|
|
57236
|
+
userMetadata.isConnectionPoor = true;
|
|
57237
|
+
userMetadata.poorConnectionCount = 0;
|
|
57238
|
+
userMetadata.poorConnectionResolvedCount = 0;
|
|
57239
|
+
} else {
|
|
57240
|
+
callUsers[userId].topicMetaData[topic].poorConnectionCount++;
|
|
57241
|
+
}
|
|
57242
|
+
} else if(report['roundTripTime'] || report['roundTripTime'] < 1) {
|
|
57243
|
+
if(userMetadata.poorConnectionResolvedCount > 3 && userMetadata.isConnectionPoor) {
|
|
57244
|
+
userMetadata.poorConnectionResolvedCount = 0;
|
|
57245
|
+
userMetadata.poorConnectionCount = 0;
|
|
57246
|
+
userMetadata.isConnectionPoor = false;
|
|
57247
|
+
chatEvents.fireEvent('callEvents', {
|
|
57248
|
+
type: 'POOR_VIDEO_CONNECTION_RESOLVED',
|
|
57249
|
+
message: 'Poor connection resolved',
|
|
55726
57250
|
metadata: {
|
|
55727
57251
|
elementId: "uiRemoteVideo-" + topic,
|
|
55728
57252
|
topic: topic
|
|
55729
57253
|
}
|
|
55730
57254
|
});
|
|
55731
|
-
webpeersMetadata[topic].isConnectionPoor = true;
|
|
55732
|
-
webpeersMetadata[topic].poorConnectionCount = 0;
|
|
55733
57255
|
} else {
|
|
55734
|
-
|
|
57256
|
+
userMetadata.poorConnectionResolvedCount++;
|
|
55735
57257
|
}
|
|
55736
|
-
|
|
55737
|
-
} else if((report['roundTripTime'] || report['roundTripTime'] < 1) && webpeersMetadata[topic].isConnectionPoor) {
|
|
55738
|
-
webpeersMetadata[topic].poorConnectionCount = 0;
|
|
55739
|
-
webpeersMetadata[topic].isConnectionPoor = false;
|
|
55740
|
-
chatEvents.fireEvent('callEvents', {
|
|
55741
|
-
type: 'POOR_VIDEO_CONNECTION_RESOLVED',
|
|
55742
|
-
message: 'Poor connection resolved',
|
|
55743
|
-
metadata: {
|
|
55744
|
-
elementId: "uiRemoteVideo-" + topic,
|
|
55745
|
-
topic: topic
|
|
55746
|
-
}
|
|
55747
|
-
});
|
|
55748
57258
|
}
|
|
55749
57259
|
|
|
55750
57260
|
/*Object.keys(report).forEach(function (statName) {
|
|
@@ -55758,72 +57268,35 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55758
57268
|
//document.querySelector(".stats-box").innerHTML = statsOutput;
|
|
55759
57269
|
});
|
|
55760
57270
|
},
|
|
55761
|
-
|
|
55762
|
-
//isConnectionPoor
|
|
55763
|
-
webpeersMetadata[topic]['poorConnectionCount'] = 0;
|
|
55764
|
-
clearInterval(webpeersMetadata[topic]['connectionQualityInterval']);
|
|
55765
|
-
},
|
|
55766
|
-
shouldReconnectTopic: function (topic, mediaType, direction) {
|
|
55767
|
-
var callController = this;
|
|
55768
|
-
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
55769
|
-
if (webpeers[topic].peerConnection.iceConnectionState != 'connected') {
|
|
55770
|
-
chatEvents.fireEvent('callEvents', {
|
|
55771
|
-
type: 'CALL_STATUS',
|
|
55772
|
-
errorCode: 7000,
|
|
55773
|
-
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
55774
|
-
errorInfo: webpeers[topic]
|
|
55775
|
-
});
|
|
55776
|
-
|
|
55777
|
-
sendCallMessage({
|
|
55778
|
-
id: 'STOP',
|
|
55779
|
-
topic: topic
|
|
55780
|
-
}, function (result) {
|
|
55781
|
-
if (result.done === 'TRUE') {
|
|
55782
|
-
//handleCallSocketOpen(currentCallParams);
|
|
55783
|
-
/*webpeers[topic].dispose();
|
|
55784
|
-
webpeers[topic] = null;*/
|
|
55785
|
-
callController.removeTopic(topic);
|
|
55786
|
-
callController.createTopic(topic, mediaType, direction);
|
|
55787
|
-
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
55788
|
-
} else if (result.done === 'SKIP') {
|
|
55789
|
-
//handleCallSocketOpen(currentCallParams);
|
|
55790
|
-
/*webpeers[topic].dispose();
|
|
55791
|
-
webpeers[topic] = null;*/
|
|
55792
|
-
callController.removeTopic(topic);
|
|
55793
|
-
callController.createTopic(topic, mediaType, direction);
|
|
55794
|
-
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
55795
|
-
} else {
|
|
55796
|
-
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
55797
|
-
endCall({
|
|
55798
|
-
callId: currentCallId
|
|
55799
|
-
});
|
|
55800
|
-
callStop();
|
|
55801
|
-
}
|
|
55802
|
-
});
|
|
55803
|
-
}
|
|
55804
|
-
}
|
|
55805
|
-
},
|
|
55806
|
-
generateTopicPeer: function (topic, mediaType, direction, options) {
|
|
57271
|
+
generateTopicPeer: function (userId, topic, mediaType, direction, options) {
|
|
55807
57272
|
var WebRtcFunction = direction === 'send' ? 'WebRtcPeerSendonly' : 'WebRtcPeerRecvonly',
|
|
55808
|
-
|
|
57273
|
+
callController = this,
|
|
57274
|
+
user = callUsers[userId],
|
|
57275
|
+
topicElement = user.htmlElements[topic],
|
|
57276
|
+
topicMetaData = user.topicMetaData[topic];
|
|
55809
57277
|
|
|
55810
|
-
|
|
57278
|
+
callUsers[userId].peers[topic] = new KurentoUtils.WebRtcPeer[WebRtcFunction](options, function (err) {
|
|
55811
57279
|
if (err) {
|
|
55812
|
-
console.error("[start/webRtc " + direction + " " + mediaType + " Peer] Error: " + explainUserMediaError(err, mediaType));
|
|
57280
|
+
console.error("[SDK][start/webRtc " + direction + " " + mediaType + " Peer] Error: " + explainUserMediaError(err, mediaType));
|
|
55813
57281
|
return;
|
|
55814
57282
|
}
|
|
55815
57283
|
|
|
55816
|
-
callController.watchRTCPeerConnection(topic, mediaType, direction);
|
|
57284
|
+
callController.watchRTCPeerConnection(userId, topic, mediaType, direction);
|
|
55817
57285
|
|
|
55818
|
-
if(direction === 'send')
|
|
55819
|
-
startMedia(
|
|
57286
|
+
if(direction === 'send') {
|
|
57287
|
+
startMedia(topicElement);
|
|
57288
|
+
if(callRequestController.cameraPaused) {
|
|
57289
|
+
currentModuleInstance.pauseCamera();
|
|
57290
|
+
}
|
|
57291
|
+
}
|
|
55820
57292
|
|
|
55821
|
-
|
|
57293
|
+
callUsers[userId].peers[topic].generateOffer((err, sdpOffer) => {
|
|
55822
57294
|
if (err) {
|
|
55823
|
-
console.error("[start/WebRc " + direction + " " + mediaType + " Peer/generateOffer] " + err);
|
|
57295
|
+
console.error("[SDK][start/WebRc " + direction + " " + mediaType + " Peer/generateOffer] " + err);
|
|
55824
57296
|
return;
|
|
55825
57297
|
}
|
|
55826
57298
|
|
|
57299
|
+
sdpOffer = callController.setMediaBitrates(sdpOffer);
|
|
55827
57300
|
sendCallMessage({
|
|
55828
57301
|
id: (direction === 'send' ? 'SEND_SDP_OFFER' : 'RECIVE_SDP_OFFER'),
|
|
55829
57302
|
sdpOffer: sdpOffer,
|
|
@@ -55834,456 +57307,331 @@ WildEmitter.mixin(WildEmitter);
|
|
|
55834
57307
|
});
|
|
55835
57308
|
});
|
|
55836
57309
|
});
|
|
55837
|
-
}
|
|
55838
|
-
|
|
55839
|
-
|
|
55840
|
-
|
|
55841
|
-
|
|
55842
|
-
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
55843
|
-
if (webpeers[topic] && webpeers[topic].peerConnection.iceConnectionState != 'connected') {
|
|
55844
|
-
|
|
55845
|
-
chatEvents.fireEvent('callEvents', {
|
|
55846
|
-
type: 'CALL_STATUS',
|
|
55847
|
-
errorCode: 7000,
|
|
55848
|
-
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
55849
|
-
errorInfo: webpeers[topic]
|
|
55850
|
-
});
|
|
55851
|
-
|
|
55852
|
-
sendCallMessage({
|
|
55853
|
-
id: 'STOP',
|
|
55854
|
-
topic: topic
|
|
55855
|
-
}, function (result) {
|
|
55856
|
-
if (result.done === 'TRUE') {
|
|
55857
|
-
//handleCallSocketOpen(currentCallParams);
|
|
55858
|
-
/!*webpeers[topic].dispose();
|
|
55859
|
-
webpeers[topic] = null;*!/
|
|
55860
|
-
generateAndSendSdpOffers(currentCallParams, [topic]);
|
|
55861
|
-
|
|
55862
|
-
} else if (result.done === 'SKIP') {
|
|
55863
|
-
//handleCallSocketOpen(currentCallParams);
|
|
55864
|
-
/!*webpeers[topic].dispose();
|
|
55865
|
-
webpeers[topic] = null;*!/
|
|
55866
|
-
generateAndSendSdpOffers(currentCallParams, [topic]);
|
|
55867
|
-
} else {
|
|
55868
|
-
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
55869
|
-
endCall({
|
|
55870
|
-
callId: currentCallId
|
|
55871
|
-
});
|
|
55872
|
-
callStop();
|
|
55873
|
-
}
|
|
55874
|
-
});
|
|
55875
|
-
}
|
|
55876
|
-
}
|
|
55877
|
-
},
|
|
55878
|
-
|
|
55879
|
-
generateAndSendSdpOffers = function (params, topics) {
|
|
55880
|
-
var turnServers = [];
|
|
57310
|
+
},
|
|
57311
|
+
watchRTCPeerConnection: function (userId, topic, mediaType, direction) {
|
|
57312
|
+
consoleLogging && console.log("[SDK][watchRTCPeerConnection] called with: ", userId, topic, mediaType, direction);
|
|
57313
|
+
var callController = this,
|
|
57314
|
+
user = callUsers[userId];
|
|
55881
57315
|
|
|
55882
|
-
|
|
55883
|
-
var serversTemp = params.turnAddress.split(',');
|
|
57316
|
+
consoleLogging && console.log("[SDK][watchRTCPeerConnection] called with: ", callUsers, user);
|
|
55884
57317
|
|
|
55885
|
-
|
|
55886
|
-
|
|
55887
|
-
|
|
55888
|
-
"urls": "turn:" + serversTemp[0],
|
|
55889
|
-
"username": "mkhorrami",
|
|
55890
|
-
"credential": "mkh_123456"
|
|
57318
|
+
user.peers[topic].peerConnection.onconnectionstatechange = function () {
|
|
57319
|
+
if(!user || !user.peers || !user.peers[topic]) {
|
|
57320
|
+
return; //avoid log errors
|
|
55891
57321
|
}
|
|
55892
|
-
|
|
55893
|
-
|
|
55894
|
-
|
|
55895
|
-
//{"urls": "stun:" + callTurnIp + ":3478"},
|
|
55896
|
-
{
|
|
55897
|
-
"urls": "turn:" + callTurnIp + ":3478",
|
|
55898
|
-
"username": "mkhorrami",
|
|
55899
|
-
"credential": "mkh_123456"
|
|
57322
|
+
consoleLogging && console.log("[SDK][peerConnection.onconnectionstatechange] ", "peer: ", topic, " peerConnection.connectionState: ", user.peers[topic].peerConnection.connectionState);
|
|
57323
|
+
if (user.peers[topic].peerConnection.connectionState === 'disconnected') {
|
|
57324
|
+
callController.removeConnectionQualityInterval(userId, topic);
|
|
55900
57325
|
}
|
|
55901
|
-
];
|
|
55902
|
-
}
|
|
55903
57326
|
|
|
55904
|
-
|
|
55905
|
-
|
|
55906
|
-
|
|
55907
|
-
|
|
55908
|
-
|
|
55909
|
-
|
|
55910
|
-
iceTransportPolicy: 'relay',
|
|
55911
|
-
onicecandidate: (candidate) => {
|
|
55912
|
-
if (webpeersMetadata[callTopics['receiveVideoTopic']].interval !== null) {
|
|
55913
|
-
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
55914
|
-
}
|
|
55915
|
-
webpeersMetadata[callTopics['receiveVideoTopic']].interval = setInterval(function () {
|
|
55916
|
-
if (webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived === true) {
|
|
55917
|
-
webpeersMetadata[callTopics['receiveVideoTopic']].sdpAnswerReceived = false;
|
|
55918
|
-
clearInterval(webpeersMetadata[callTopics['receiveVideoTopic']].interval);
|
|
55919
|
-
sendCallMessage({
|
|
55920
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
55921
|
-
topic: callTopics['receiveVideoTopic'],
|
|
55922
|
-
candidateDto: candidate
|
|
55923
|
-
})
|
|
55924
|
-
}
|
|
55925
|
-
}, 500, {candidate: candidate});
|
|
55926
|
-
},
|
|
55927
|
-
configuration: {
|
|
55928
|
-
iceServers: turnServers
|
|
55929
|
-
}
|
|
55930
|
-
};
|
|
55931
|
-
|
|
55932
|
-
webpeers[callTopics['receiveVideoTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(receiveVideoOptions, function (err) {
|
|
55933
|
-
if (err) {
|
|
55934
|
-
console.error("[start/webRtcReceiveVideoPeer] Error: " + explainUserMediaError(err, 'video'));
|
|
55935
|
-
return;
|
|
55936
|
-
}
|
|
55937
|
-
|
|
55938
|
-
watchRTCPeerConnection(callTopics['receiveVideoTopic']);
|
|
55939
|
-
|
|
55940
|
-
webpeers[callTopics['receiveVideoTopic']].generateOffer((err, sdpOffer) => {
|
|
55941
|
-
if (err) {
|
|
55942
|
-
console.error("[start/WebRtcVideoPeerReceiveOnly/generateOffer] " + err);
|
|
55943
|
-
return;
|
|
55944
|
-
}
|
|
55945
|
-
|
|
55946
|
-
sendCallMessage({
|
|
55947
|
-
id: 'RECIVE_SDP_OFFER',
|
|
55948
|
-
sdpOffer: sdpOffer,
|
|
55949
|
-
useComedia: true,
|
|
55950
|
-
useSrtp: false,
|
|
55951
|
-
topic: callTopics['receiveVideoTopic'],
|
|
55952
|
-
mediaType: 2
|
|
55953
|
-
});
|
|
57327
|
+
if (user.peers[topic].peerConnection.connectionState === "failed") {
|
|
57328
|
+
chatEvents.fireEvent('callEvents', {
|
|
57329
|
+
type: 'CALL_STATUS',
|
|
57330
|
+
errorCode: 7000,
|
|
57331
|
+
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
57332
|
+
errorInfo: user.peers[topic]
|
|
55954
57333
|
});
|
|
55955
|
-
|
|
55956
|
-
}
|
|
57334
|
+
// setTimeout(function () {
|
|
55957
57335
|
|
|
55958
|
-
|
|
55959
|
-
|
|
55960
|
-
localVideo: uiRemoteMedias[callTopics['sendVideoTopic']],
|
|
55961
|
-
mediaConstraints: {
|
|
55962
|
-
audio: false,
|
|
55963
|
-
video: {
|
|
55964
|
-
width: callVideoMinWidth,
|
|
55965
|
-
height: callVideoMinHeight,
|
|
55966
|
-
framerate: 15
|
|
55967
|
-
}
|
|
55968
|
-
},
|
|
55969
|
-
iceTransportPolicy: 'relay',
|
|
55970
|
-
onicecandidate: (candidate) => {
|
|
55971
|
-
if (webpeersMetadata[callTopics['sendVideoTopic']].interval !== null) {
|
|
55972
|
-
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
55973
|
-
}
|
|
55974
|
-
webpeersMetadata[callTopics['sendVideoTopic']].interval = setInterval(function () {
|
|
55975
|
-
if (webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived === true) {
|
|
55976
|
-
webpeersMetadata[callTopics['sendVideoTopic']].sdpAnswerReceived = false;
|
|
55977
|
-
clearInterval(webpeersMetadata[callTopics['sendVideoTopic']].interval);
|
|
55978
|
-
sendCallMessage({
|
|
55979
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
55980
|
-
topic: callTopics['sendVideoTopic'],
|
|
55981
|
-
candidateDto: candidate
|
|
55982
|
-
})
|
|
55983
|
-
}
|
|
55984
|
-
}, 500, {candidate: candidate});
|
|
55985
|
-
|
|
55986
|
-
},
|
|
55987
|
-
configuration: {
|
|
55988
|
-
iceServers: turnServers
|
|
57336
|
+
if(chatMessaging.chatState) {
|
|
57337
|
+
callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
55989
57338
|
}
|
|
55990
|
-
|
|
55991
|
-
|
|
55992
|
-
|
|
55993
|
-
webpeers[callTopics['sendVideoTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerSendonly(sendVideoOptions, function (err) {
|
|
55994
|
-
if (err) {
|
|
55995
|
-
sendCallSocketError("[start/WebRtcVideoPeerSendOnly] Error: " + explainUserMediaError(err, 'video'));
|
|
55996
|
-
//callStop();
|
|
55997
|
-
return;
|
|
55998
|
-
}
|
|
57339
|
+
// }, 7000);
|
|
57340
|
+
//callController.removeConnectionQualityInterval(userId, topic);
|
|
57341
|
+
}
|
|
55999
57342
|
|
|
56000
|
-
|
|
56001
|
-
|
|
57343
|
+
if(user.peers[topic].peerConnection.connectionState === 'connected') {
|
|
57344
|
+
if(mediaType === 'video' && direction === 'send') {
|
|
57345
|
+
user.topicMetaData[topic].connectionQualityInterval = setInterval(function() {
|
|
57346
|
+
callController.checkConnectionQuality(userId, topic, mediaType, direction)
|
|
57347
|
+
}, 1000);
|
|
57348
|
+
}
|
|
57349
|
+
}
|
|
57350
|
+
}
|
|
56002
57351
|
|
|
56003
|
-
|
|
56004
|
-
|
|
56005
|
-
|
|
56006
|
-
|
|
56007
|
-
return;
|
|
56008
|
-
}
|
|
57352
|
+
user.peers[topic].peerConnection.oniceconnectionstatechange = function () {
|
|
57353
|
+
if(!user || !user.peers || !user.peers[topic]) {
|
|
57354
|
+
return; //avoid log errors
|
|
57355
|
+
}
|
|
56009
57356
|
|
|
56010
|
-
|
|
56011
|
-
|
|
56012
|
-
|
|
56013
|
-
|
|
56014
|
-
|
|
56015
|
-
|
|
56016
|
-
|
|
57357
|
+
consoleLogging && console.log("[SDK][oniceconnectionstatechange] ", "peer: ", topic, " peerConnection.connectionState: ", user.peers[topic].peerConnection.iceConnectionState);
|
|
57358
|
+
if (user.peers[topic].peerConnection.iceConnectionState === 'disconnected') {
|
|
57359
|
+
chatEvents.fireEvent('callEvents', {
|
|
57360
|
+
type: 'CALL_STATUS',
|
|
57361
|
+
errorCode: 7000,
|
|
57362
|
+
errorMessage: `Call Peer (${topic}) is disconnected!`,
|
|
57363
|
+
errorInfo: user.peers[topic]
|
|
56017
57364
|
});
|
|
56018
|
-
}, 2000);
|
|
56019
|
-
}
|
|
56020
|
-
}
|
|
56021
57365
|
|
|
56022
|
-
|
|
56023
|
-
|
|
56024
|
-
if(topics.indexOf(callTopics['receiveAudioTopic']) !== -1) {
|
|
56025
|
-
const receiveAudioOptions = {
|
|
56026
|
-
remoteVideo: uiRemoteMedias[callTopics['receiveAudioTopic']],
|
|
56027
|
-
mediaConstraints: {audio: true, video: false},
|
|
56028
|
-
iceTransportPolicy: 'relay',
|
|
56029
|
-
onicecandidate: (candidate) => {
|
|
56030
|
-
if (webpeersMetadata[callTopics['receiveAudioTopic']].interval !== null) {
|
|
56031
|
-
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
56032
|
-
}
|
|
56033
|
-
webpeersMetadata[callTopics['receiveAudioTopic']].interval = setInterval(function () {
|
|
56034
|
-
if (webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived === true) {
|
|
56035
|
-
webpeersMetadata[callTopics['receiveAudioTopic']].sdpAnswerReceived = false;
|
|
56036
|
-
clearInterval(webpeersMetadata[callTopics['receiveAudioTopic']].interval);
|
|
56037
|
-
sendCallMessage({
|
|
56038
|
-
id: 'ADD_ICE_CANDIDATE',
|
|
56039
|
-
topic: callTopics['receiveAudioTopic'],
|
|
56040
|
-
candidateDto: candidate,
|
|
56041
|
-
})
|
|
56042
|
-
}
|
|
56043
|
-
}, 500, {candidate: candidate});
|
|
56044
|
-
},
|
|
56045
|
-
configuration: {
|
|
56046
|
-
iceServers: turnServers
|
|
56047
|
-
}
|
|
56048
|
-
};
|
|
57366
|
+
consoleLogging && console.log('[SDK][oniceconnectionstatechange]:[disconnected] Internet connection failed, Reconnect your call, topic:', topic);
|
|
57367
|
+
}
|
|
56049
57368
|
|
|
56050
|
-
|
|
56051
|
-
|
|
56052
|
-
|
|
56053
|
-
|
|
57369
|
+
if (user.peers[topic].peerConnection.iceConnectionState === "failed") {
|
|
57370
|
+
chatEvents.fireEvent('callEvents', {
|
|
57371
|
+
type: 'CALL_STATUS',
|
|
57372
|
+
errorCode: 7000,
|
|
57373
|
+
errorMessage: `Call Peer (${topic}) has failed!`,
|
|
57374
|
+
errorInfo: user.peers[topic]
|
|
57375
|
+
});
|
|
57376
|
+
if(chatMessaging.chatState) {
|
|
57377
|
+
callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
57378
|
+
//callController.removeConnectionQualityInterval(userId, topic);
|
|
56054
57379
|
}
|
|
57380
|
+
// } else {
|
|
57381
|
+
// setTimeout(function () {
|
|
57382
|
+
// if(chatMessaging.chatState) {
|
|
57383
|
+
// callController.shouldReconnectTopic(userId, topic, mediaType, direction);
|
|
57384
|
+
// }
|
|
57385
|
+
// }, 7000);
|
|
57386
|
+
// }
|
|
57387
|
+
}
|
|
56055
57388
|
|
|
56056
|
-
|
|
56057
|
-
|
|
56058
|
-
|
|
56059
|
-
|
|
56060
|
-
|
|
56061
|
-
|
|
56062
|
-
|
|
56063
|
-
sendCallMessage({
|
|
56064
|
-
id: 'RECIVE_SDP_OFFER',
|
|
56065
|
-
sdpOffer: sdpOffer,
|
|
56066
|
-
useComedia: false,
|
|
56067
|
-
useSrtp: false,
|
|
56068
|
-
mediaType: 1,
|
|
56069
|
-
topic: callTopics['receiveAudioTopic']
|
|
56070
|
-
});
|
|
57389
|
+
if (user.peers[topic].peerConnection.iceConnectionState === "connected") {
|
|
57390
|
+
callRequestController.callEstablishedInMySide = true;
|
|
57391
|
+
chatEvents.fireEvent('callEvents', {
|
|
57392
|
+
type: 'CALL_STATUS',
|
|
57393
|
+
errorCode: 7000,
|
|
57394
|
+
errorMessage: `Call Peer (${topic}) has connected!`,
|
|
57395
|
+
errorInfo: user.peers[topic]
|
|
56071
57396
|
});
|
|
56072
|
-
}
|
|
57397
|
+
}
|
|
56073
57398
|
}
|
|
57399
|
+
},
|
|
57400
|
+
shouldReconnectTopic: function (userId, topic, mediaType, direction) {
|
|
57401
|
+
var callController = this, iceConnectionState = callUsers[userId].peers[topic].peerConnection.iceConnectionState;
|
|
57402
|
+
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
57403
|
+
if (callUsers[userId]
|
|
57404
|
+
&& callUsers[userId].peers[topic]
|
|
57405
|
+
&& iceConnectionState != 'connected') {
|
|
57406
|
+
chatEvents.fireEvent('callEvents', {
|
|
57407
|
+
type: 'CALL_STATUS',
|
|
57408
|
+
errorCode: 7000,
|
|
57409
|
+
errorMessage: `Call Peer (${topic}) is not in connected state, Restarting call in progress ...!`,
|
|
57410
|
+
errorInfo: callUsers[userId].peers[topic]
|
|
57411
|
+
});
|
|
56074
57412
|
|
|
56075
|
-
|
|
56076
|
-
|
|
56077
|
-
|
|
56078
|
-
|
|
56079
|
-
|
|
56080
|
-
|
|
56081
|
-
|
|
56082
|
-
|
|
56083
|
-
}
|
|
56084
|
-
|
|
56085
|
-
|
|
56086
|
-
|
|
56087
|
-
|
|
56088
|
-
|
|
56089
|
-
|
|
56090
|
-
|
|
56091
|
-
|
|
56092
|
-
})
|
|
56093
|
-
}
|
|
56094
|
-
}, 500, {candidate: candidate});
|
|
56095
|
-
},
|
|
56096
|
-
configuration: {
|
|
56097
|
-
iceServers: turnServers
|
|
56098
|
-
}
|
|
56099
|
-
};
|
|
56100
|
-
|
|
56101
|
-
setTimeout(function () {
|
|
56102
|
-
webpeers[callTopics['sendAudioTopic']] = new KurentoUtils.WebRtcPeer.WebRtcPeerSendonly(sendAudioOptions, function (err) {
|
|
56103
|
-
if (err) {
|
|
56104
|
-
sendCallSocketError("[start/WebRtcAudioPeerSendOnly] Error: " + explainUserMediaError(err, 'audio'));
|
|
56105
|
-
//callStop();
|
|
56106
|
-
return;
|
|
56107
|
-
}
|
|
56108
|
-
watchRTCPeerConnection(callTopics['sendAudioTopic']);
|
|
56109
|
-
startMedia(uiRemoteMedias[callTopics['sendAudioTopic']]);
|
|
56110
|
-
|
|
56111
|
-
webpeers[callTopics['sendAudioTopic']].generateOffer((err, sdpOffer) => {
|
|
56112
|
-
if (err) {
|
|
56113
|
-
sendCallSocketError("[start/WebRtcAudioPeerSendOnly/generateOffer] Error: " + err);
|
|
56114
|
-
//callStop();
|
|
56115
|
-
return;
|
|
56116
|
-
}
|
|
56117
|
-
sendCallMessage({
|
|
56118
|
-
id: 'SEND_SDP_OFFER',
|
|
56119
|
-
topic: callTopics['sendAudioTopic'],
|
|
56120
|
-
sdpOffer: sdpOffer,
|
|
56121
|
-
mediaType: 1
|
|
57413
|
+
sendCallMessage({
|
|
57414
|
+
id: 'STOP',
|
|
57415
|
+
topic: topic
|
|
57416
|
+
}, function (result) {
|
|
57417
|
+
if (result.done === 'TRUE') {
|
|
57418
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval)
|
|
57419
|
+
callController.removeTopic(userId, topic);
|
|
57420
|
+
callController.createTopic(userId, topic, mediaType, direction, userId === 'screenShare');
|
|
57421
|
+
} else if (result.done === 'SKIP') {
|
|
57422
|
+
clearInterval(callUsers[userId].topicMetaData[topic].interval)
|
|
57423
|
+
callController.removeTopic(userId, topic);
|
|
57424
|
+
callController.createTopic(userId, topic, mediaType, direction, userId === 'screenShare');
|
|
57425
|
+
//generateAndSendSdpOffers(currentCallParams, [topicName]);
|
|
57426
|
+
} else {
|
|
57427
|
+
consoleLogging && console.log('STOP topic faced a problem', result);
|
|
57428
|
+
endCall({
|
|
57429
|
+
callId: currentCallId
|
|
56122
57430
|
});
|
|
56123
|
-
|
|
57431
|
+
callStop();
|
|
57432
|
+
}
|
|
56124
57433
|
});
|
|
56125
|
-
}
|
|
57434
|
+
}
|
|
56126
57435
|
}
|
|
56127
|
-
}
|
|
57436
|
+
},
|
|
57437
|
+
maybeReconnectAllTopics: function (){
|
|
57438
|
+
if(!callUsers || !Object.keys(callUsers).length || !callRequestController.callEstablishedInMySide)
|
|
57439
|
+
return;
|
|
56128
57440
|
|
|
56129
|
-
|
|
56130
|
-
|
|
56131
|
-
|
|
56132
|
-
|
|
56133
|
-
|
|
56134
|
-
|
|
56135
|
-
|
|
56136
|
-
|
|
56137
|
-
|
|
57441
|
+
for(var i in callUsers) {
|
|
57442
|
+
var videoTopic = callUsers[i].videoTopicName, audioTopic = callUsers[i].audioTopicName;
|
|
57443
|
+
if(callUsers[i] && callUsers[i].peers[videoTopic] && callUsers[i].peers[videoTopic].peerConnection.connectionState === 'failed'){
|
|
57444
|
+
this.shouldReconnectTopic(i, videoTopic, 'video', callUsers[i].direction)
|
|
57445
|
+
}
|
|
57446
|
+
if(callUsers[i] && callUsers[i].peers[audioTopic] && callUsers[i].peers[audioTopic].peerConnection.connectionState === 'failed'){
|
|
57447
|
+
this.shouldReconnectTopic(i, audioTopic, 'audio', callUsers[i].direction)
|
|
57448
|
+
}
|
|
57449
|
+
}
|
|
57450
|
+
},
|
|
57451
|
+
removeConnectionQualityInterval: function (userId, topic) {
|
|
57452
|
+
callUsers[userId].topicMetaData[topic]['poorConnectionCount'] = 0;
|
|
57453
|
+
clearInterval(callUsers[userId].topicMetaData[topic]['connectionQualityInterval']);
|
|
57454
|
+
},
|
|
57455
|
+
removeStreamFromWebRTC : function (userId, topic) {
|
|
57456
|
+
if(callUsers[userId].htmlElements[topic]){
|
|
57457
|
+
const stream = callUsers[userId].htmlElements[topic].srcObject;
|
|
57458
|
+
if (!!stream) {
|
|
57459
|
+
const tracks = stream.getTracks();
|
|
57460
|
+
|
|
57461
|
+
if (!!tracks) {
|
|
57462
|
+
tracks.forEach(function (track) {
|
|
57463
|
+
track.stop();
|
|
57464
|
+
});
|
|
56138
57465
|
}
|
|
56139
57466
|
|
|
56140
|
-
|
|
56141
|
-
|
|
56142
|
-
if (webpeers[peer].peerConnection.iceConnectionState == 'disconnected') {
|
|
56143
|
-
console.log( peer , '>>>>>>>>>>>>> disconnected');
|
|
56144
|
-
chatEvents.fireEvent('callEvents', {
|
|
56145
|
-
type: 'CALL_STATUS',
|
|
56146
|
-
errorCode: 7000,
|
|
56147
|
-
errorMessage: `Call Peer (${peer}) is disconnected!`,
|
|
56148
|
-
errorInfo: webpeers[peer]
|
|
56149
|
-
});
|
|
57467
|
+
callUsers[userId].htmlElements[topic].srcObject = null;
|
|
57468
|
+
}
|
|
56150
57469
|
|
|
56151
|
-
|
|
56152
|
-
|
|
56153
|
-
|
|
57470
|
+
callUsers[userId].htmlElements[topic].remove();
|
|
57471
|
+
delete (callUsers[userId].htmlElements[topic]);
|
|
57472
|
+
}
|
|
57473
|
+
},
|
|
57474
|
+
addScreenShareToCall: function (direction, shareScreen) {
|
|
57475
|
+
if(direction !== callUsers["screenShare"].direction) {
|
|
57476
|
+
callUsers['screenShare'].direction = direction
|
|
57477
|
+
}
|
|
57478
|
+
var callController = this,
|
|
57479
|
+
screenShare = callUsers["screenShare"];
|
|
57480
|
+
if(!screenShare.peers[screenShare.videoTopicName]) {
|
|
57481
|
+
// Local Video Tag
|
|
57482
|
+
if(!screenShare.htmlElements[screenShare.videoTopicName]) {
|
|
57483
|
+
callStateController.generateHTMLElements('screenShare');
|
|
57484
|
+
}
|
|
57485
|
+
setTimeout(function () {
|
|
57486
|
+
callStateController.appendUserToCallDiv('screenShare');
|
|
57487
|
+
callStateController.createTopic('screenShare', screenShare.videoTopicName, "video", direction, shareScreen);
|
|
57488
|
+
});
|
|
57489
|
+
chatEvents.fireEvent('callEvents', {
|
|
57490
|
+
type: 'CALL_DIVS',
|
|
57491
|
+
result: generateCallUIList()
|
|
57492
|
+
});
|
|
57493
|
+
} else {
|
|
57494
|
+
callStateController.removeTopic('screenShare', screenShare.videoTopicName);
|
|
57495
|
+
callStateController.createTopic('screenShare', screenShare.videoTopicName, "video", direction, shareScreen);
|
|
57496
|
+
startMedia(screenShare.htmlElements[screenShare.videoTopicName])
|
|
57497
|
+
}
|
|
57498
|
+
},
|
|
57499
|
+
removeScreenShareFromCall: function (topic) {
|
|
57500
|
+
var callController = this,
|
|
57501
|
+
screenShare = callUsers["screenShare"];
|
|
57502
|
+
if(screenShare.peers[screenShare.videoTopicName]) {
|
|
57503
|
+
// Local Video Tag
|
|
57504
|
+
|
|
57505
|
+
//removeStreamFromWebRTC(callTopics['screenShare']);
|
|
57506
|
+
callStateController.removeStreamFromWebRTC('screenShare', screenShare.videoTopicName)
|
|
57507
|
+
callStateController.removeTopic('screenShare', screenShare.videoTopicName);
|
|
57508
|
+
chatEvents.fireEvent('callEvents', {
|
|
57509
|
+
type: 'CALL_DIVS',
|
|
57510
|
+
result: generateCallUIList()
|
|
57511
|
+
});
|
|
57512
|
+
}
|
|
57513
|
+
},
|
|
57514
|
+
removeAllCallParticipants: function () {
|
|
57515
|
+
var removeAllUsersPromise = new Promise(function (resolve, reject) {
|
|
57516
|
+
for (var i in callUsers) {
|
|
57517
|
+
var user = callUsers[i];
|
|
57518
|
+
if (user) {
|
|
57519
|
+
if(user.videoTopicName && user.peers[user.videoTopicName]) {
|
|
57520
|
+
clearInterval(callUsers[i].topicMetaData[user.videoTopicName].interval);
|
|
57521
|
+
callStateController.removeConnectionQualityInterval(i, user.videoTopicName);
|
|
57522
|
+
callStateController.removeStreamFromWebRTC(i, user.videoTopicName);
|
|
57523
|
+
callUsers[i].peers[user.videoTopicName].dispose();
|
|
57524
|
+
delete callUsers[i].peers[user.videoTopicName];
|
|
56154
57525
|
|
|
56155
|
-
setTimeout(function () {
|
|
56156
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56157
|
-
}, 6000);
|
|
56158
|
-
|
|
56159
|
-
alert('Internet connection failed, Reconnect your call');
|
|
56160
|
-
/!*shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
56161
|
-
shouldReconnectCallTimeout = setTimeout(function () {
|
|
56162
|
-
shouldReconnectCall();
|
|
56163
|
-
}, 7000);*!/
|
|
56164
57526
|
}
|
|
57527
|
+
if(user.audioTopicName && user.peers[user.audioTopicName]) {
|
|
57528
|
+
clearInterval(callUsers[i].topicMetaData[user.audioTopicName].interval);
|
|
57529
|
+
callStateController.removeConnectionQualityInterval(i, user.audioTopicName);
|
|
57530
|
+
callStateController.removeStreamFromWebRTC(i, user.audioTopicName);
|
|
56165
57531
|
|
|
56166
|
-
|
|
56167
|
-
|
|
56168
|
-
type: 'CALL_STATUS',
|
|
56169
|
-
errorCode: 7000,
|
|
56170
|
-
errorMessage: `Call Peer (${peer}) has failed!`,
|
|
56171
|
-
errorInfo: webpeers[peer]
|
|
56172
|
-
});
|
|
57532
|
+
callUsers[i].peers[user.audioTopicName].dispose();
|
|
57533
|
+
delete callUsers[i].peers[user.audioTopicName];
|
|
56173
57534
|
}
|
|
57535
|
+
setTimeout(function (){
|
|
57536
|
+
if(callUsers[i]){
|
|
57537
|
+
callUsers[i].peers = {};
|
|
57538
|
+
callUsers[i].topicMetaData = {};
|
|
57539
|
+
callUsers[i].htmlElements = {};
|
|
57540
|
+
callUsers[i] = null;
|
|
57541
|
+
}
|
|
56174
57542
|
|
|
56175
|
-
|
|
56176
|
-
|
|
56177
|
-
type: 'CALL_STATUS',
|
|
56178
|
-
errorCode: 7000,
|
|
56179
|
-
errorMessage: `Call Peer (${peer}) has connected!`,
|
|
56180
|
-
errorInfo: webpeers[peer]
|
|
56181
|
-
});
|
|
56182
|
-
|
|
56183
|
-
setTimeout(function () {
|
|
56184
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56185
|
-
}, 2000);
|
|
56186
|
-
|
|
56187
|
-
setTimeout(function () {
|
|
56188
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56189
|
-
}, 6000);
|
|
56190
|
-
}
|
|
57543
|
+
resolve()
|
|
57544
|
+
}, 200);
|
|
56191
57545
|
}
|
|
56192
57546
|
}
|
|
56193
|
-
}
|
|
56194
|
-
}, 6000);*!/
|
|
57547
|
+
});
|
|
56195
57548
|
|
|
56196
|
-
|
|
56197
|
-
|
|
56198
|
-
|
|
56199
|
-
|
|
56200
|
-
|
|
56201
|
-
|
|
56202
|
-
|
|
56203
|
-
|
|
56204
|
-
}, 12000);
|
|
56205
|
-
setTimeout(function () {
|
|
56206
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56207
|
-
}, 20000);
|
|
56208
|
-
},
|
|
57549
|
+
removeAllUsersPromise.then(function (){
|
|
57550
|
+
callUsers = {};
|
|
57551
|
+
});
|
|
57552
|
+
},
|
|
57553
|
+
removeFromCallUI: function (topic) {
|
|
57554
|
+
var videoElement = 'Vi-' + topic,
|
|
57555
|
+
audioElement = 'Vo-' + topic,
|
|
57556
|
+
userId = this.findUserIdByTopic(videoElement);
|
|
56209
57557
|
|
|
56210
|
-
|
|
56211
|
-
|
|
56212
|
-
if (webpeers[topic]) {
|
|
56213
|
-
webpeers[topic].peerConnection.onconnectionstatechange = function () {
|
|
56214
|
-
console.log("on connection state change, ", "peer: ", topic, "peerConnection.connectionState: ", webpeers[topic].peerConnection.connectionState);
|
|
56215
|
-
if (webpeers[topic].peerConnection.connectionState == 'disconnected') {
|
|
56216
|
-
console.log(topic, 'peerConnection.onconnectionstatechange: disconnected');
|
|
56217
|
-
}
|
|
57558
|
+
if (topic.length > 0 && callUsers[userId].htmlElements[videoElement]) {
|
|
57559
|
+
this.removeStreamFromWebRTC(userId,videoElement);
|
|
56218
57560
|
}
|
|
56219
57561
|
|
|
56220
|
-
|
|
56221
|
-
|
|
56222
|
-
|
|
56223
|
-
|
|
56224
|
-
|
|
56225
|
-
|
|
56226
|
-
|
|
56227
|
-
|
|
56228
|
-
|
|
56229
|
-
});
|
|
56230
|
-
|
|
56231
|
-
/!*setTimeout(function () {
|
|
56232
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56233
|
-
}, 2000);*!/
|
|
56234
|
-
|
|
56235
|
-
/!*setTimeout(function () {
|
|
56236
|
-
restartMedia(callTopics['sendVideoTopic'])
|
|
56237
|
-
}, 6000);*!/
|
|
56238
|
-
|
|
56239
|
-
console.log('Internet connection failed, Reconnect your call, topic:', topic);
|
|
56240
|
-
//shouldReconnectCallTimeout && clearTimeout(shouldReconnectCallTimeout);
|
|
56241
|
-
/!*shouldReconnectCallTimeout = setTimeout(function () {
|
|
56242
|
-
shouldReconnectCall(topic);
|
|
56243
|
-
}, 7000);*!/
|
|
57562
|
+
if (topic.length > 0 && callUsers[userId].htmlElements[videoElement]) {
|
|
57563
|
+
this.removeStreamFromWebRTC(userId, audioElement);
|
|
57564
|
+
}
|
|
57565
|
+
},
|
|
57566
|
+
findUserIdByTopic: function (topic) {
|
|
57567
|
+
for(var i in callUsers) {
|
|
57568
|
+
if (callUsers[i].videoTopicName === topic || callUsers[i].audioTopicName === topic) {
|
|
57569
|
+
//peer = callUsers[i].peers[jsonMessage.topic];
|
|
57570
|
+
return i;
|
|
56244
57571
|
}
|
|
57572
|
+
}
|
|
57573
|
+
},
|
|
57574
|
+
activateParticipantStream: function (userId, mediaType, direction, topicNameKey, sendTopic, mediaKey) {
|
|
57575
|
+
if(callUsers[userId]) {
|
|
57576
|
+
callUsers[userId][mediaKey] = (mediaKey !== 'mute');
|
|
57577
|
+
callUsers[userId][topicNameKey] = (mediaType === 'audio'? 'Vo-': 'Vi-') + sendTopic;
|
|
56245
57578
|
|
|
56246
|
-
|
|
56247
|
-
|
|
56248
|
-
|
|
56249
|
-
|
|
56250
|
-
|
|
56251
|
-
|
|
56252
|
-
|
|
56253
|
-
|
|
56254
|
-
|
|
56255
|
-
|
|
56256
|
-
|
|
56257
|
-
|
|
56258
|
-
|
|
56259
|
-
|
|
56260
|
-
|
|
56261
|
-
|
|
56262
|
-
|
|
57579
|
+
var user = callUsers[userId];
|
|
57580
|
+
callStateController.appendUserToCallDiv(userId, callStateController.generateHTMLElements(userId));
|
|
57581
|
+
setTimeout(function () {
|
|
57582
|
+
callStateController.createTopic(userId, user[topicNameKey], mediaType, direction);
|
|
57583
|
+
})
|
|
57584
|
+
}
|
|
57585
|
+
},
|
|
57586
|
+
deactivateParticipantStream: function (userId, topicNameKey, mediaKey) {
|
|
57587
|
+
callUsers[userId][mediaKey] = false;
|
|
57588
|
+
var user = callUsers[userId];
|
|
57589
|
+
clearInterval(callUsers[userId].topicMetaData[user[topicNameKey]].interval)
|
|
57590
|
+
callStateController.removeTopic(userId, user[topicNameKey]);
|
|
57591
|
+
callStateController.removeStreamFromWebRTC(userId, user[topicNameKey]);
|
|
57592
|
+
},
|
|
57593
|
+
setMediaBitrates: function (sdp) {
|
|
57594
|
+
return this.setMediaBitrate(this.setMediaBitrate(sdp, "video", 400), "audio", 50);
|
|
57595
|
+
},
|
|
57596
|
+
setMediaBitrate: function (sdp, media, bitrate) {
|
|
57597
|
+
var lines = sdp.split("\n");
|
|
57598
|
+
var line = -1;
|
|
57599
|
+
for (var i = 0; i < lines.length; i++) {
|
|
57600
|
+
if (lines[i].indexOf("m=" + media) === 0) {
|
|
57601
|
+
line = i;
|
|
57602
|
+
break;
|
|
56263
57603
|
}
|
|
57604
|
+
}
|
|
57605
|
+
if (line === -1) {
|
|
57606
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Could not find the m line for", media);
|
|
57607
|
+
return sdp;
|
|
57608
|
+
}
|
|
57609
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Found the m line for", media, "at line", line);
|
|
56264
57610
|
|
|
56265
|
-
|
|
56266
|
-
|
|
56267
|
-
chatEvents.fireEvent('callEvents', {
|
|
56268
|
-
type: 'CALL_STATUS',
|
|
56269
|
-
errorCode: 7000,
|
|
56270
|
-
errorMessage: `Call Peer (${topic}) has connected!`,
|
|
56271
|
-
errorInfo: webpeers[topic]
|
|
56272
|
-
});
|
|
57611
|
+
// Pass the m line
|
|
57612
|
+
line++;
|
|
56273
57613
|
|
|
56274
|
-
|
|
56275
|
-
|
|
56276
|
-
|
|
57614
|
+
// Skip i and c lines
|
|
57615
|
+
/* while (lines[line].indexOf("i=") === 0 || lines[line].indexOf("c=") === 0) {
|
|
57616
|
+
line++;
|
|
57617
|
+
}*/
|
|
56277
57618
|
|
|
56278
|
-
|
|
56279
|
-
|
|
56280
|
-
|
|
56281
|
-
|
|
57619
|
+
// If we're on a b line, replace it
|
|
57620
|
+
if (lines[line].indexOf("b") === 0) {
|
|
57621
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Replaced b line at line", line);
|
|
57622
|
+
lines[line] = "b=AS:" + bitrate;
|
|
57623
|
+
return lines.join("\n");
|
|
56282
57624
|
}
|
|
56283
|
-
}
|
|
56284
57625
|
|
|
57626
|
+
// Add a new b line
|
|
57627
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] Adding new b line before line", line);
|
|
57628
|
+
var newLines = lines.slice(0, line);
|
|
57629
|
+
newLines.push("b=AS:" + bitrate + "\r");
|
|
57630
|
+
newLines = newLines.concat(lines.slice(line, lines.length));
|
|
57631
|
+
consoleLogging && console.debug("[SDK][setMediaBitrate] output: ", newLines.join("\n"));
|
|
57632
|
+
return newLines.join("\n")
|
|
57633
|
+
},
|
|
56285
57634
|
},
|
|
56286
|
-
*/
|
|
56287
57635
|
|
|
56288
57636
|
sendCallSocketError = function (message) {
|
|
56289
57637
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -56298,7 +57646,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56298
57646
|
});
|
|
56299
57647
|
},
|
|
56300
57648
|
|
|
56301
|
-
explainUserMediaError = function (err, deviceType) {
|
|
57649
|
+
explainUserMediaError = function (err, deviceType, deviceSource) {
|
|
56302
57650
|
chatEvents.fireEvent('callEvents', {
|
|
56303
57651
|
type: 'CALL_ERROR',
|
|
56304
57652
|
code: 7000,
|
|
@@ -56335,10 +57683,10 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56335
57683
|
chatEvents.fireEvent('callEvents', {
|
|
56336
57684
|
type: 'CALL_ERROR',
|
|
56337
57685
|
code: 7000,
|
|
56338
|
-
message: (deviceType === 'video' ? 'Webcam' : 'Mice') + " permission has been denied by the user"
|
|
57686
|
+
message: (deviceType === 'video' ? (deviceSource === 'screen'? 'ScreenShare' : 'Webcam') : 'Mice') + " permission has been denied by the user"
|
|
56339
57687
|
});
|
|
56340
|
-
alert((deviceType === 'video' ? 'Webcam' : 'Mice') + " permission has been denied by the user");
|
|
56341
|
-
return (deviceType === 'video' ? 'Webcam' : 'Mice') + " permission has been denied by the user";
|
|
57688
|
+
alert((deviceType === 'video' ? (deviceSource === 'screen'? 'ScreenShare' : 'Webcam') : 'Mice') + " permission has been denied by the user");
|
|
57689
|
+
return (deviceType === 'video' ? (deviceSource === 'screen'? 'ScreenShare' : 'Webcam') : 'Mice') + " permission has been denied by the user";
|
|
56342
57690
|
} else if (n === 'TypeError') {
|
|
56343
57691
|
chatEvents.fireEvent('callEvents', {
|
|
56344
57692
|
type: 'CALL_ERROR',
|
|
@@ -56363,19 +57711,19 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56363
57711
|
},
|
|
56364
57712
|
|
|
56365
57713
|
startMedia = function (media) {
|
|
56366
|
-
consoleLogging && console.log("startMedia
|
|
57714
|
+
consoleLogging && console.log("[SDK][startMedia] called with: ", media);
|
|
56367
57715
|
media.play().catch((err) => {
|
|
56368
57716
|
if (err.name === 'NotAllowedError') {
|
|
56369
57717
|
chatEvents.fireEvent('callEvents', {
|
|
56370
57718
|
type: 'CALL_ERROR',
|
|
56371
57719
|
code: 7000,
|
|
56372
|
-
message: "[
|
|
57720
|
+
message: "[startMedia] Browser doesn't allow playing media: " + err
|
|
56373
57721
|
});
|
|
56374
57722
|
} else {
|
|
56375
57723
|
chatEvents.fireEvent('callEvents', {
|
|
56376
57724
|
type: 'CALL_ERROR',
|
|
56377
57725
|
code: 7000,
|
|
56378
|
-
message: "[
|
|
57726
|
+
message: "[startMedia] Error in media.play(): " + err
|
|
56379
57727
|
});
|
|
56380
57728
|
}
|
|
56381
57729
|
});
|
|
@@ -56383,9 +57731,9 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56383
57731
|
|
|
56384
57732
|
restartMedia = function (videoTopicParam) {
|
|
56385
57733
|
if (currentCallParams && Object.keys(currentCallParams).length) {
|
|
56386
|
-
consoleLogging && console.log('Sending Key Frame ...');
|
|
57734
|
+
consoleLogging && console.log('[SDK] Sending Key Frame ...');
|
|
56387
57735
|
|
|
56388
|
-
var videoTopic = !!videoTopicParam ? videoTopicParam : callTopics['sendVideoTopic'];
|
|
57736
|
+
var videoTopic = !!videoTopicParam ? videoTopicParam : callUsers[chatMessaging.userInfo.id].videoTopicName;//callTopics['sendVideoTopic'];
|
|
56389
57737
|
let videoElement = document.getElementById(`uiRemoteVideo-${videoTopic}`);
|
|
56390
57738
|
|
|
56391
57739
|
if (videoElement) {
|
|
@@ -56439,19 +57787,20 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56439
57787
|
},
|
|
56440
57788
|
|
|
56441
57789
|
handleProcessSdpAnswer = function (jsonMessage) {
|
|
56442
|
-
|
|
57790
|
+
var userId = callStateController.findUserIdByTopic(jsonMessage.topic),
|
|
57791
|
+
peer = callUsers[userId].peers[jsonMessage.topic];
|
|
56443
57792
|
|
|
56444
|
-
if (
|
|
57793
|
+
if (peer == null) {
|
|
56445
57794
|
chatEvents.fireEvent('callEvents', {
|
|
56446
57795
|
type: 'CALL_ERROR',
|
|
56447
57796
|
code: 7000,
|
|
56448
57797
|
message: "[handleProcessSdpAnswer] Skip, no WebRTC Peer",
|
|
56449
|
-
error:
|
|
57798
|
+
error: peer
|
|
56450
57799
|
});
|
|
56451
57800
|
return;
|
|
56452
57801
|
}
|
|
56453
57802
|
|
|
56454
|
-
|
|
57803
|
+
peer.processAnswer(jsonMessage.sdpAnswer, (err) => {
|
|
56455
57804
|
if (err) {
|
|
56456
57805
|
sendCallSocketError("[handleProcessSdpAnswer] Error: " + err);
|
|
56457
57806
|
|
|
@@ -56464,26 +57813,35 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56464
57813
|
return;
|
|
56465
57814
|
}
|
|
56466
57815
|
|
|
56467
|
-
if (
|
|
56468
|
-
|
|
57816
|
+
if (callUsers[userId].topicMetaData[jsonMessage.topic].interval !== null) {
|
|
57817
|
+
callUsers[userId].topicMetaData[jsonMessage.topic].sdpAnswerReceived = true;
|
|
57818
|
+
}
|
|
57819
|
+
consoleLogging && console.log("[SDK][handleProcessSdpAnswer]", jsonMessage, jsonMessage.topic)
|
|
57820
|
+
startMedia(callUsers[userId].htmlElements[jsonMessage.topic]);
|
|
57821
|
+
if(userId === 'screenShare') {
|
|
57822
|
+
restartMediaOnKeyFrame("screenShare", 2000);
|
|
57823
|
+
restartMediaOnKeyFrame("screenShare", 4000);
|
|
57824
|
+
restartMediaOnKeyFrame("screenShare", 8000);
|
|
57825
|
+
restartMediaOnKeyFrame("screenShare", 12000);
|
|
56469
57826
|
}
|
|
56470
|
-
startMedia(uiRemoteMedias[jsonMessage.topic]);
|
|
56471
57827
|
});
|
|
56472
57828
|
},
|
|
56473
57829
|
|
|
56474
57830
|
handleAddIceCandidate = function (jsonMessage) {
|
|
56475
|
-
|
|
56476
|
-
|
|
57831
|
+
var userId = callStateController.findUserIdByTopic(jsonMessage.topic);
|
|
57832
|
+
|
|
57833
|
+
let peer = callUsers[userId].peers[jsonMessage.topic];
|
|
57834
|
+
if (peer == null) {
|
|
56477
57835
|
chatEvents.fireEvent('callEvents', {
|
|
56478
57836
|
type: 'CALL_ERROR',
|
|
56479
57837
|
code: 7000,
|
|
56480
57838
|
message: "[handleAddIceCandidate] Skip, no WebRTC Peer",
|
|
56481
|
-
error: JSON.stringify(
|
|
57839
|
+
error: JSON.stringify(peer)
|
|
56482
57840
|
});
|
|
56483
57841
|
return;
|
|
56484
57842
|
}
|
|
56485
57843
|
|
|
56486
|
-
|
|
57844
|
+
peer.addIceCandidate(jsonMessage.candidate, (err) => {
|
|
56487
57845
|
if (err) {
|
|
56488
57846
|
console.error("[handleAddIceCandidate] " + err);
|
|
56489
57847
|
|
|
@@ -56522,19 +57880,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56522
57880
|
},
|
|
56523
57881
|
|
|
56524
57882
|
callStop = function () {
|
|
56525
|
-
|
|
56526
|
-
|
|
56527
|
-
for (var media in uiRemoteMedias) {
|
|
56528
|
-
removeStreamFromWebRTC(media);
|
|
56529
|
-
}
|
|
56530
|
-
|
|
56531
|
-
for (var i in webpeers) {
|
|
56532
|
-
if (webpeers[i]) {
|
|
56533
|
-
callStateController.removeConnectionQualityInterval(i);
|
|
56534
|
-
webpeers[i].dispose();
|
|
56535
|
-
webpeers[i] = null;
|
|
56536
|
-
}
|
|
56537
|
-
}
|
|
57883
|
+
callStateController.removeAllCallParticipants();
|
|
56538
57884
|
|
|
56539
57885
|
if (callStopQueue.callStarted) {
|
|
56540
57886
|
sendCallMessage({
|
|
@@ -56543,45 +57889,56 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56543
57889
|
callStopQueue.callStarted = false;
|
|
56544
57890
|
}
|
|
56545
57891
|
|
|
57892
|
+
callRequestController.cameraPaused = false;
|
|
56546
57893
|
callRequestController.callEstablishedInMySide = false;
|
|
56547
57894
|
callRequestController.callRequestReceived = false;
|
|
56548
57895
|
currentCallParams = {};
|
|
56549
57896
|
currentCallId = null;
|
|
56550
57897
|
},
|
|
56551
57898
|
|
|
56552
|
-
|
|
56553
|
-
|
|
57899
|
+
/*
|
|
57900
|
+
removeStreamFromWebRTC = function (RTCStream) {
|
|
57901
|
+
var callParentDiv = document.getElementById(callDivId);
|
|
56554
57902
|
|
|
56555
|
-
|
|
56556
|
-
|
|
56557
|
-
|
|
56558
|
-
|
|
57903
|
+
if (uiRemoteMedias.hasOwnProperty(RTCStream)) {
|
|
57904
|
+
const stream = uiRemoteMedias[RTCStream].srcObject;
|
|
57905
|
+
if (!!stream) {
|
|
57906
|
+
const tracks = stream.getTracks();
|
|
56559
57907
|
|
|
56560
|
-
|
|
56561
|
-
|
|
56562
|
-
|
|
56563
|
-
|
|
56564
|
-
|
|
57908
|
+
if (!!tracks) {
|
|
57909
|
+
tracks.forEach(function (track) {
|
|
57910
|
+
track.stop();
|
|
57911
|
+
});
|
|
57912
|
+
}
|
|
56565
57913
|
|
|
56566
|
-
|
|
56567
|
-
|
|
57914
|
+
uiRemoteMedias[RTCStream].srcObject = null;
|
|
57915
|
+
}
|
|
56568
57916
|
|
|
56569
|
-
|
|
56570
|
-
|
|
56571
|
-
|
|
56572
|
-
|
|
57917
|
+
uiRemoteMedias[RTCStream].remove();
|
|
57918
|
+
delete (uiRemoteMedias[RTCStream]);
|
|
57919
|
+
}
|
|
57920
|
+
},
|
|
56573
57921
|
|
|
56574
|
-
removeFromCallUI = function (topic) {
|
|
56575
|
-
var videoElement = 'Vi-' + topic;
|
|
56576
|
-
var audioElement = 'Vo-' + topic;
|
|
56577
57922
|
|
|
56578
|
-
|
|
56579
|
-
|
|
56580
|
-
|
|
57923
|
+
removeFromCallUI = function (topic) {
|
|
57924
|
+
var videoElement = 'Vi-' + topic;
|
|
57925
|
+
var audioElement = 'Vo-' + topic;
|
|
56581
57926
|
|
|
56582
|
-
|
|
56583
|
-
|
|
56584
|
-
|
|
57927
|
+
if (topic.length > 0 && uiRemoteMedias.hasOwnProperty(videoElement)) {
|
|
57928
|
+
removeStreamFromWebRTC(videoElement);
|
|
57929
|
+
}
|
|
57930
|
+
|
|
57931
|
+
if (topic.length > 0 && uiRemoteMedias.hasOwnProperty(audioElement)) {
|
|
57932
|
+
removeStreamFromWebRTC(audioElement);
|
|
57933
|
+
}
|
|
57934
|
+
},
|
|
57935
|
+
*/
|
|
57936
|
+
|
|
57937
|
+
restartMediaOnKeyFrame = function (userId, timeout) {
|
|
57938
|
+
setTimeout(function () {
|
|
57939
|
+
if(typeof callUsers[userId] !== "undefined" && callUsers[userId])
|
|
57940
|
+
restartMedia(callUsers[userId].videoTopicName);
|
|
57941
|
+
}, timeout);
|
|
56585
57942
|
};
|
|
56586
57943
|
|
|
56587
57944
|
this.updateToken = function (newToken) {
|
|
@@ -56607,18 +57964,38 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56607
57964
|
break;
|
|
56608
57965
|
|
|
56609
57966
|
case 'GET_KEY_FRAME':
|
|
56610
|
-
|
|
56611
|
-
|
|
57967
|
+
if(callUsers && callUsers[chatMessaging.userInfo.id] && callUsers[chatMessaging.userInfo.id].video) {
|
|
57968
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 2000);
|
|
57969
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 4000);
|
|
57970
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 8000);
|
|
57971
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 12000);
|
|
57972
|
+
}
|
|
57973
|
+
if(callUsers && callUsers['screenShare']
|
|
57974
|
+
&& callUsers['screenShare'].video
|
|
57975
|
+
&& screenShareState.started
|
|
57976
|
+
&& screenShareState.imOwner) {
|
|
57977
|
+
restartMediaOnKeyFrame('screenShare', 2000);
|
|
57978
|
+
restartMediaOnKeyFrame('screenShare', 4000);
|
|
57979
|
+
restartMediaOnKeyFrame('screenShare', 8000);
|
|
57980
|
+
restartMediaOnKeyFrame('screenShare', 12000);
|
|
57981
|
+
}
|
|
57982
|
+
|
|
57983
|
+
/* setTimeout(function () {
|
|
57984
|
+
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
57985
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
56612
57986
|
}, 2000);
|
|
56613
57987
|
setTimeout(function () {
|
|
56614
|
-
|
|
57988
|
+
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
57989
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
56615
57990
|
}, 4000);
|
|
56616
57991
|
setTimeout(function () {
|
|
56617
|
-
|
|
57992
|
+
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
57993
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
56618
57994
|
}, 8000);
|
|
56619
57995
|
setTimeout(function () {
|
|
56620
|
-
|
|
56621
|
-
|
|
57996
|
+
if(typeof callUsers[chatMessaging.userInfo.id] === "undefined" || !callUsers[chatMessaging.userInfo.id])
|
|
57997
|
+
restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
57998
|
+
}, 12000);*/
|
|
56622
57999
|
break;
|
|
56623
58000
|
|
|
56624
58001
|
case 'FREEZED':
|
|
@@ -56658,7 +58035,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56658
58035
|
break;
|
|
56659
58036
|
|
|
56660
58037
|
default:
|
|
56661
|
-
console.warn("[onmessage] Invalid message, id: " + jsonMessage.id, jsonMessage);
|
|
58038
|
+
console.warn("[SDK][onmessage] Invalid message, id: " + jsonMessage.id, jsonMessage);
|
|
56662
58039
|
if (jsonMessage.match(/NOT CREATE SESSION/g)) {
|
|
56663
58040
|
if (currentCallParams && Object.keys(currentCallParams)) {
|
|
56664
58041
|
//handleCallSocketOpen(currentCallParams);
|
|
@@ -56670,7 +58047,11 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56670
58047
|
};
|
|
56671
58048
|
|
|
56672
58049
|
this.asyncInitialized = function (async) {
|
|
56673
|
-
asyncClient = async
|
|
58050
|
+
asyncClient = async;
|
|
58051
|
+
|
|
58052
|
+
asyncClient.on('asyncReady', function (){
|
|
58053
|
+
callStateController.maybeReconnectAllTopics();
|
|
58054
|
+
})
|
|
56674
58055
|
};
|
|
56675
58056
|
|
|
56676
58057
|
this.handleChatMessages = function(type, chatMessageVOTypes, messageContent, contentCount, threadId, uniqueId) {
|
|
@@ -56774,13 +58155,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56774
58155
|
result: messageContent
|
|
56775
58156
|
});
|
|
56776
58157
|
|
|
56777
|
-
|
|
56778
|
-
if (webpeers[peer]) {
|
|
56779
|
-
webpeers[peer].dispose();
|
|
56780
|
-
delete webpeers[peer];
|
|
56781
|
-
}
|
|
56782
|
-
}
|
|
56783
|
-
webpeers = {};
|
|
58158
|
+
//callStateController.removeAllCallParticipants();
|
|
56784
58159
|
|
|
56785
58160
|
if (typeof messageContent === 'object'
|
|
56786
58161
|
&& messageContent.hasOwnProperty('chatDataDto')
|
|
@@ -56793,8 +58168,10 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56793
58168
|
mute: messageContent.clientDTO.mute,
|
|
56794
58169
|
sendingTopic: messageContent.clientDTO.topicSend,
|
|
56795
58170
|
receiveTopic: messageContent.clientDTO.topicReceive,
|
|
58171
|
+
screenShare: messageContent.chatDataDto.screenShare,
|
|
56796
58172
|
brokerAddress: messageContent.chatDataDto.brokerAddressWeb,
|
|
56797
58173
|
turnAddress: messageContent.chatDataDto.turnAddress,
|
|
58174
|
+
clientsList: messageContent.otherClientDtoList
|
|
56798
58175
|
}, function (callDivs) {
|
|
56799
58176
|
chatEvents.fireEvent('callEvents', {
|
|
56800
58177
|
type: 'CALL_DIVS',
|
|
@@ -56881,8 +58258,9 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56881
58258
|
type: 'CALL_PARTICIPANT_CONNECTED',
|
|
56882
58259
|
result: messageContent
|
|
56883
58260
|
});
|
|
56884
|
-
|
|
56885
|
-
restartMedia(
|
|
58261
|
+
//callTopics['sendVideoTopic']
|
|
58262
|
+
//restartMedia(callUsers[chatMessaging.userInfo.id].videoTopicName);
|
|
58263
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 100)
|
|
56886
58264
|
|
|
56887
58265
|
break;
|
|
56888
58266
|
|
|
@@ -56932,7 +58310,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56932
58310
|
});
|
|
56933
58311
|
|
|
56934
58312
|
if (!!messageContent[0].sendTopic) {
|
|
56935
|
-
removeFromCallUI(messageContent[0].sendTopic);
|
|
58313
|
+
//removeFromCallUI(messageContent[0].sendTopic);
|
|
58314
|
+
callStateController.removeFromCallUI(messageContent[0].sendTopic)
|
|
56936
58315
|
}
|
|
56937
58316
|
|
|
56938
58317
|
break;
|
|
@@ -56960,8 +58339,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
56960
58339
|
result: messageContent
|
|
56961
58340
|
});
|
|
56962
58341
|
|
|
56963
|
-
restartMedia(callTopics['sendVideoTopic']);
|
|
56964
|
-
|
|
58342
|
+
//restartMedia(callTopics['sendVideoTopic']);
|
|
58343
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 100)
|
|
56965
58344
|
break;
|
|
56966
58345
|
|
|
56967
58346
|
/**
|
|
@@ -57003,6 +58382,24 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57003
58382
|
case chatMessageVOTypes.MUTE_CALL_PARTICIPANT:
|
|
57004
58383
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57005
58384
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58385
|
+
} else {
|
|
58386
|
+
if(Array.isArray(messageContent)){
|
|
58387
|
+
for(var i in messageContent) {
|
|
58388
|
+
callStateController.deactivateParticipantStream(
|
|
58389
|
+
messageContent[i].userId,
|
|
58390
|
+
'audioTopicName',
|
|
58391
|
+
'mute'
|
|
58392
|
+
)
|
|
58393
|
+
/*if(callUsers[messageContent[i].userId]) {
|
|
58394
|
+
callUsers[messageContent[i].userId].mute = true;
|
|
58395
|
+
|
|
58396
|
+
var user = callUsers[messageContent[i].userId];
|
|
58397
|
+
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.audioTopicName].interval)
|
|
58398
|
+
callStateController.removeTopic(messageContent[i].userId, user.audioTopicName);
|
|
58399
|
+
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.audioTopicName);
|
|
58400
|
+
}*/
|
|
58401
|
+
}
|
|
58402
|
+
}
|
|
57006
58403
|
}
|
|
57007
58404
|
|
|
57008
58405
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -57018,6 +58415,30 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57018
58415
|
case chatMessageVOTypes.UNMUTE_CALL_PARTICIPANT:
|
|
57019
58416
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57020
58417
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58418
|
+
} else {
|
|
58419
|
+
if(Array.isArray(messageContent)) {
|
|
58420
|
+
for(var i in messageContent) {
|
|
58421
|
+
callStateController.activateParticipantStream(
|
|
58422
|
+
messageContent[i].userId,
|
|
58423
|
+
'audio',
|
|
58424
|
+
'receive',
|
|
58425
|
+
'audioTopicName',
|
|
58426
|
+
messageContent[i].sendTopic,
|
|
58427
|
+
'mute'
|
|
58428
|
+
);
|
|
58429
|
+
/*if(callUsers[messageContent[i].userId]) {
|
|
58430
|
+
callUsers[messageContent[i].userId].mute = false;
|
|
58431
|
+
callUsers[messageContent[i].userId].audioTopicName = 'Vo-' + messageContent[i].sendTopic;
|
|
58432
|
+
|
|
58433
|
+
var user = callUsers[messageContent[i].userId];
|
|
58434
|
+
callStateController.appendUserToCallDiv(messageContent[i].userId, callStateController.generateHTMLElements(messageContent[i].userId));
|
|
58435
|
+
setTimeout(function () {
|
|
58436
|
+
callStateController.createTopic(messageContent[i].userId, user.audioTopicName, 'audio', 'receive');
|
|
58437
|
+
|
|
58438
|
+
})
|
|
58439
|
+
}*/
|
|
58440
|
+
}
|
|
58441
|
+
}
|
|
57021
58442
|
}
|
|
57022
58443
|
|
|
57023
58444
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -57058,8 +58479,38 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57058
58479
|
case chatMessageVOTypes.TURN_ON_VIDEO_CALL:
|
|
57059
58480
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57060
58481
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58482
|
+
} else {
|
|
58483
|
+
if(Array.isArray(messageContent)) {
|
|
58484
|
+
for(var i in messageContent) {
|
|
58485
|
+
callStateController.activateParticipantStream(
|
|
58486
|
+
messageContent[i].userId,
|
|
58487
|
+
'video',
|
|
58488
|
+
'receive',
|
|
58489
|
+
'videoTopicName',
|
|
58490
|
+
messageContent[i].sendTopic,
|
|
58491
|
+
'video'
|
|
58492
|
+
);
|
|
58493
|
+
/*if(callUsers[messageContent[i].userId]) {
|
|
58494
|
+
callUsers[messageContent[i].userId].video = true;
|
|
58495
|
+
callUsers[messageContent[i].userId].videoTopicName = 'Vi-' + messageContent[i].sendTopic;
|
|
58496
|
+
|
|
58497
|
+
var user = callUsers[messageContent[i].userId];
|
|
58498
|
+
callStateController.appendUserToCallDiv(messageContent[i].userId, callStateController.generateHTMLElements(messageContent[i].userId));
|
|
58499
|
+
setTimeout(function () {
|
|
58500
|
+
callStateController.createTopic(messageContent[i].userId, user.videoTopicName, 'video', 'receive');
|
|
58501
|
+
})
|
|
58502
|
+
}*/
|
|
58503
|
+
}
|
|
58504
|
+
}
|
|
57061
58505
|
}
|
|
57062
58506
|
|
|
58507
|
+
setTimeout(function () {
|
|
58508
|
+
chatEvents.fireEvent('callEvents', {
|
|
58509
|
+
type: 'CALL_DIVS',
|
|
58510
|
+
result: generateCallUIList()
|
|
58511
|
+
});
|
|
58512
|
+
})
|
|
58513
|
+
|
|
57063
58514
|
chatEvents.fireEvent('callEvents', {
|
|
57064
58515
|
type: 'TURN_ON_VIDEO_CALL',
|
|
57065
58516
|
result: messageContent
|
|
@@ -57073,8 +58524,32 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57073
58524
|
case chatMessageVOTypes.TURN_OFF_VIDEO_CALL:
|
|
57074
58525
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57075
58526
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58527
|
+
} else {
|
|
58528
|
+
if(Array.isArray(messageContent)){
|
|
58529
|
+
for(var i in messageContent) {
|
|
58530
|
+
callStateController.deactivateParticipantStream(
|
|
58531
|
+
messageContent[i].userId,
|
|
58532
|
+
'videoTopicName',
|
|
58533
|
+
'video'
|
|
58534
|
+
)
|
|
58535
|
+
/* if(callUsers[messageContent[i].userId]) {
|
|
58536
|
+
callUsers[messageContent[i].userId].video = false;
|
|
58537
|
+
var user = callUsers[messageContent[i].userId];
|
|
58538
|
+
clearInterval(callUsers[messageContent[i].userId].topicMetaData[user.videoTopicName].interval)
|
|
58539
|
+
callStateController.removeTopic(messageContent[i].userId, user.videoTopicName);
|
|
58540
|
+
callStateController.removeStreamFromWebRTC(messageContent[i].userId, user.videoTopicName);
|
|
58541
|
+
}*/
|
|
58542
|
+
}
|
|
58543
|
+
}
|
|
57076
58544
|
}
|
|
57077
58545
|
|
|
58546
|
+
setTimeout(function () {
|
|
58547
|
+
chatEvents.fireEvent('callEvents', {
|
|
58548
|
+
type: 'CALL_DIVS',
|
|
58549
|
+
result: generateCallUIList()
|
|
58550
|
+
});
|
|
58551
|
+
})
|
|
58552
|
+
|
|
57078
58553
|
chatEvents.fireEvent('callEvents', {
|
|
57079
58554
|
type: 'TURN_OFF_VIDEO_CALL',
|
|
57080
58555
|
result: messageContent
|
|
@@ -57095,8 +58570,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57095
58570
|
result: messageContent
|
|
57096
58571
|
});
|
|
57097
58572
|
|
|
57098
|
-
restartMedia(callTopics['sendVideoTopic']);
|
|
57099
|
-
|
|
58573
|
+
//restartMedia(callTopics['sendVideoTopic']);
|
|
58574
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 100)
|
|
57100
58575
|
break;
|
|
57101
58576
|
|
|
57102
58577
|
/**
|
|
@@ -57118,8 +58593,20 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57118
58593
|
* Type 123 Start Screen Share
|
|
57119
58594
|
*/
|
|
57120
58595
|
case chatMessageVOTypes.START_SCREEN_SHARE:
|
|
58596
|
+
if(!callRequestController.callEstablishedInMySide)
|
|
58597
|
+
return;
|
|
58598
|
+
|
|
58599
|
+
screenShareState.started = true;
|
|
58600
|
+
if(messageContent.screenOwner.id === chatMessaging.userInfo.id) {
|
|
58601
|
+
screenShareState.imOwner = true;
|
|
58602
|
+
} else {
|
|
58603
|
+
screenShareState.imOwner = false;
|
|
58604
|
+
}
|
|
58605
|
+
|
|
57121
58606
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57122
58607
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58608
|
+
} else if(!screenShareState.imOwner) {
|
|
58609
|
+
callStateController.addScreenShareToCall("receive", false)
|
|
57123
58610
|
}
|
|
57124
58611
|
|
|
57125
58612
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -57133,8 +58620,14 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57133
58620
|
* Type 124 End Screen Share
|
|
57134
58621
|
*/
|
|
57135
58622
|
case chatMessageVOTypes.END_SCREEN_SHARE:
|
|
58623
|
+
screenShareState.imOwner = false;
|
|
58624
|
+
screenShareState.started = false;
|
|
58625
|
+
|
|
57136
58626
|
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
57137
58627
|
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58628
|
+
} else if (!screenShareState.imOwner) {
|
|
58629
|
+
consoleLogging && console.log("[SDK][END_SCREEN_SHARE], im not owner of screen");
|
|
58630
|
+
callStateController.removeScreenShareFromCall();
|
|
57138
58631
|
}
|
|
57139
58632
|
|
|
57140
58633
|
chatEvents.fireEvent('callEvents', {
|
|
@@ -57157,6 +58650,25 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57157
58650
|
result: messageContent
|
|
57158
58651
|
});
|
|
57159
58652
|
|
|
58653
|
+
break;
|
|
58654
|
+
/**
|
|
58655
|
+
* Type 126 Destinated Record Call Request
|
|
58656
|
+
*/
|
|
58657
|
+
case chatMessageVOTypes.DESTINATED_RECORD_CALL:
|
|
58658
|
+
if(!callRequestController.callEstablishedInMySide)
|
|
58659
|
+
return;
|
|
58660
|
+
|
|
58661
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
58662
|
+
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount));
|
|
58663
|
+
}
|
|
58664
|
+
|
|
58665
|
+
chatEvents.fireEvent('callEvents', {
|
|
58666
|
+
type: 'START_RECORDING_CALL',
|
|
58667
|
+
result: messageContent
|
|
58668
|
+
});
|
|
58669
|
+
|
|
58670
|
+
//restartMedia(callTopics['sendVideoTopic']);
|
|
58671
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 100)
|
|
57160
58672
|
break;
|
|
57161
58673
|
}
|
|
57162
58674
|
}
|
|
@@ -57219,6 +58731,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57219
58731
|
return;
|
|
57220
58732
|
}
|
|
57221
58733
|
|
|
58734
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : false;
|
|
57222
58735
|
callRequestController.callRequestReceived = true;
|
|
57223
58736
|
callRequestController.callEstablishedInMySide = true;
|
|
57224
58737
|
|
|
@@ -57352,6 +58865,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57352
58865
|
|
|
57353
58866
|
content.videoCall = content.video;
|
|
57354
58867
|
|
|
58868
|
+
callRequestController.cameraPaused = (typeof params.cameraPaused === 'boolean') ? params.cameraPaused : callRequestController.cameraPaused;
|
|
58869
|
+
|
|
57355
58870
|
if (params.clientType && typeof params.clientType === 'string' && callClientTypes[params.clientType.toUpperCase()] > 0) {
|
|
57356
58871
|
content.clientType = callClientTypes[params.clientType.toUpperCase()];
|
|
57357
58872
|
} else {
|
|
@@ -57414,7 +58929,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57414
58929
|
chatMessageVOType: chatMessageVOTypes.RECORD_CALL,
|
|
57415
58930
|
typeCode: params.typeCode,
|
|
57416
58931
|
pushMsgType: 3,
|
|
57417
|
-
token: token
|
|
58932
|
+
token: token,
|
|
58933
|
+
content: {}
|
|
57418
58934
|
};
|
|
57419
58935
|
|
|
57420
58936
|
if (params) {
|
|
@@ -57427,6 +58943,13 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57427
58943
|
});
|
|
57428
58944
|
return;
|
|
57429
58945
|
}
|
|
58946
|
+
|
|
58947
|
+
if(params.destinated === true) {
|
|
58948
|
+
recordCallData.chatMessageVOType = chatMessageVOTypes.DESTINATED_RECORD_CALL;
|
|
58949
|
+
recordCallData.content.recordType = typeof +params.recordType === 'number' ? params.recordType : 1;
|
|
58950
|
+
recordCallData.content.tags = Array.isArray(params.tags) ? params.tags : null;
|
|
58951
|
+
recordCallData.content.threadId = typeof +params.threadId === 'number' ? params.threadId : null;
|
|
58952
|
+
}
|
|
57430
58953
|
} else {
|
|
57431
58954
|
chatEvents.fireEvent('error', {
|
|
57432
58955
|
code: 999,
|
|
@@ -57437,7 +58960,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57437
58960
|
|
|
57438
58961
|
return chatMessaging.sendMessage(recordCallData, {
|
|
57439
58962
|
onResult: function (result) {
|
|
57440
|
-
restartMedia(callTopics['sendVideoTopic']);
|
|
58963
|
+
//restartMedia(callTopics['sendVideoTopic']);
|
|
58964
|
+
restartMediaOnKeyFrame(chatMessaging.userInfo.id, 100)
|
|
57441
58965
|
callback && callback(result);
|
|
57442
58966
|
}
|
|
57443
58967
|
});
|
|
@@ -57502,8 +59026,26 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57502
59026
|
return;
|
|
57503
59027
|
}
|
|
57504
59028
|
|
|
59029
|
+
/*if(screenShareState.started) {
|
|
59030
|
+
chatEvents.fireEvent('error', {
|
|
59031
|
+
code: 999,
|
|
59032
|
+
message: "ScreenShare has already started"
|
|
59033
|
+
});
|
|
59034
|
+
console.log("ScreenShare has already started");
|
|
59035
|
+
return
|
|
59036
|
+
}*/
|
|
59037
|
+
|
|
57505
59038
|
return chatMessaging.sendMessage(sendData, {
|
|
57506
59039
|
onResult: function (result) {
|
|
59040
|
+
consoleLogging && console.log("[sdk][startScreenShare][onResult]: ", result);
|
|
59041
|
+
if(!result.hasError) {
|
|
59042
|
+
var direction = 'send', shareScreen = true;
|
|
59043
|
+
if(screenShareState.started && !screenShareState.imOwner) {
|
|
59044
|
+
direction = 'receive';
|
|
59045
|
+
shareScreen = false;
|
|
59046
|
+
}
|
|
59047
|
+
callStateController.addScreenShareToCall(direction, shareScreen);
|
|
59048
|
+
}
|
|
57507
59049
|
callback && callback(result);
|
|
57508
59050
|
}
|
|
57509
59051
|
});
|
|
@@ -57535,6 +59077,20 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57535
59077
|
return;
|
|
57536
59078
|
}
|
|
57537
59079
|
|
|
59080
|
+
if(!screenShareState.imOwner) {
|
|
59081
|
+
chatEvents.fireEvent('error', {
|
|
59082
|
+
code: 999,
|
|
59083
|
+
message: 'You can not end others screen sharing!'
|
|
59084
|
+
});
|
|
59085
|
+
return;
|
|
59086
|
+
}
|
|
59087
|
+
|
|
59088
|
+
if(!callUsers['screenShare'].peers[callUsers['screenShare'].videoTopicName]) {
|
|
59089
|
+
consoleLogging && console.log('[SDK][endScreenShare] No screenShare connection available');
|
|
59090
|
+
} else {
|
|
59091
|
+
callStateController.removeScreenShareFromCall();
|
|
59092
|
+
}
|
|
59093
|
+
|
|
57538
59094
|
return chatMessaging.sendMessage(sendData, {
|
|
57539
59095
|
onResult: function (result) {
|
|
57540
59096
|
callback && callback(result);
|
|
@@ -57854,6 +59410,15 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57854
59410
|
sendMessageParams.content = params.userIds;
|
|
57855
59411
|
}
|
|
57856
59412
|
}
|
|
59413
|
+
callStateController.deactivateParticipantStream(
|
|
59414
|
+
chatMessaging.userInfo.id,
|
|
59415
|
+
'audioTopicName',
|
|
59416
|
+
'mute'
|
|
59417
|
+
)
|
|
59418
|
+
/*
|
|
59419
|
+
callStateController.removeTopic(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
59420
|
+
callStateController.removeStreamFromWebRTC(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].audioTopicName)
|
|
59421
|
+
*/
|
|
57857
59422
|
|
|
57858
59423
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
57859
59424
|
onResult: function (result) {
|
|
@@ -57895,6 +59460,26 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57895
59460
|
sendMessageParams.content = params.userIds;
|
|
57896
59461
|
}
|
|
57897
59462
|
}
|
|
59463
|
+
var myId = chatMessaging.userInfo.id;
|
|
59464
|
+
|
|
59465
|
+
callStateController.activateParticipantStream(
|
|
59466
|
+
myId,
|
|
59467
|
+
'audio',
|
|
59468
|
+
'send',
|
|
59469
|
+
'audioTopicName',
|
|
59470
|
+
callUsers[myId].topicSend,
|
|
59471
|
+
'mute'
|
|
59472
|
+
);
|
|
59473
|
+
/*if(callUsers[myId]) {
|
|
59474
|
+
callUsers[myId].mute = false;
|
|
59475
|
+
callUsers[myId].audioTopicName = 'Vo-' + callUsers[myId].topicSend;
|
|
59476
|
+
|
|
59477
|
+
var user = callUsers[myId];
|
|
59478
|
+
callStateController.appendUserToCallDiv(myId, callStateController.generateHTMLElements(myId));
|
|
59479
|
+
setTimeout(function () {
|
|
59480
|
+
callStateController.createTopic(myId, user.audioTopicName, 'audio', 'send');
|
|
59481
|
+
})
|
|
59482
|
+
}*/
|
|
57898
59483
|
|
|
57899
59484
|
return chatMessaging.sendMessage(sendMessageParams, {
|
|
57900
59485
|
onResult: function (result) {
|
|
@@ -57908,6 +59493,19 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57908
59493
|
// TODO : What is the result?!
|
|
57909
59494
|
var messageContent = result.result;
|
|
57910
59495
|
returnData.result = messageContent;
|
|
59496
|
+
|
|
59497
|
+
/*for(var i in result.result) {
|
|
59498
|
+
if(callUsers[result.result[i].userId]) {
|
|
59499
|
+
callUsers[result.result[i].userId].mute = false;
|
|
59500
|
+
callUsers[result.result[i].userId].audioTopicName = 'Vo-' + result.result[i].sendTopic;
|
|
59501
|
+
|
|
59502
|
+
var user = callUsers[result.result[i].userId];
|
|
59503
|
+
callStateController.appendUserToCallDiv(result.result[i].userId, callStateController.generateHTMLElements(result.result[i].userId));
|
|
59504
|
+
setTimeout(function () {
|
|
59505
|
+
callStateController.createTopic(result.result[i].userId, user.audioTopicName, 'audio', 'send');
|
|
59506
|
+
})
|
|
59507
|
+
}
|
|
59508
|
+
}*/
|
|
57911
59509
|
}
|
|
57912
59510
|
callback && callback(returnData);
|
|
57913
59511
|
}
|
|
@@ -57942,6 +59540,29 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57942
59540
|
|
|
57943
59541
|
return chatMessaging.sendMessage(turnOnVideoData, {
|
|
57944
59542
|
onResult: function (result) {
|
|
59543
|
+
if(!result.hasError && Array.isArray(result.result)) {
|
|
59544
|
+
for(var i in result.result) {
|
|
59545
|
+
callStateController.activateParticipantStream(
|
|
59546
|
+
result.result[i].userId,
|
|
59547
|
+
'video',
|
|
59548
|
+
'send',
|
|
59549
|
+
'videoTopicName',
|
|
59550
|
+
result.result[i].sendTopic,
|
|
59551
|
+
'video'
|
|
59552
|
+
);
|
|
59553
|
+
/*if(callUsers[result.result[i].userId]) {
|
|
59554
|
+
callUsers[result.result[i].userId].video = true;
|
|
59555
|
+
callUsers[result.result[i].userId].mute = result.result[i].mute;
|
|
59556
|
+
callUsers[result.result[i].userId].videoTopicName = 'Vi-' + result.result[i].sendTopic;
|
|
59557
|
+
|
|
59558
|
+
var user = callUsers[result.result[i].userId];
|
|
59559
|
+
callStateController.appendUserToCallDiv(result.result[i].userId, callStateController.generateHTMLElements(result.result[i].userId));
|
|
59560
|
+
setTimeout(function () {
|
|
59561
|
+
callStateController.createTopic(result.result[i].userId, user.videoTopicName, 'video', 'send');
|
|
59562
|
+
})
|
|
59563
|
+
}*/
|
|
59564
|
+
}
|
|
59565
|
+
}
|
|
57945
59566
|
callback && callback(result);
|
|
57946
59567
|
}
|
|
57947
59568
|
});
|
|
@@ -57973,6 +59594,16 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57973
59594
|
return;
|
|
57974
59595
|
}
|
|
57975
59596
|
|
|
59597
|
+
callStateController.deactivateParticipantStream(
|
|
59598
|
+
chatMessaging.userInfo.id,
|
|
59599
|
+
'videoTopicName',
|
|
59600
|
+
'video'
|
|
59601
|
+
)
|
|
59602
|
+
/*
|
|
59603
|
+
callStateController.removeTopic(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].videoTopicName)
|
|
59604
|
+
callStateController.removeStreamFromWebRTC(chatMessaging.userInfo.id, callUsers[chatMessaging.userInfo.id].videoTopicName)
|
|
59605
|
+
*/
|
|
59606
|
+
|
|
57976
59607
|
return chatMessaging.sendMessage(turnOffVideoData, {
|
|
57977
59608
|
onResult: function (result) {
|
|
57978
59609
|
callback && callback(result);
|
|
@@ -57980,6 +59611,53 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57980
59611
|
});
|
|
57981
59612
|
};
|
|
57982
59613
|
|
|
59614
|
+
/**
|
|
59615
|
+
* Pauses camera-send without closing its topic
|
|
59616
|
+
* @param params
|
|
59617
|
+
* @param callback
|
|
59618
|
+
*/
|
|
59619
|
+
this.pauseCamera = function (params, callback) {
|
|
59620
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
59621
|
+
|
|
59622
|
+
if(!Object.keys(callUsers).length || !me.videoTopicName || !me.peers[me.videoTopicName])
|
|
59623
|
+
return;
|
|
59624
|
+
|
|
59625
|
+
me.peers[me.videoTopicName].getLocalStream().getTracks()[0].enabled = false;
|
|
59626
|
+
callback && callback();
|
|
59627
|
+
};
|
|
59628
|
+
|
|
59629
|
+
this.resumeCamera = function (params, callback) {
|
|
59630
|
+
var me = callUsers[chatMessaging.userInfo.id]
|
|
59631
|
+
if(!Object.keys(callUsers).length || !me.videoTopicName || !me.peers[me.videoTopicName])
|
|
59632
|
+
return;
|
|
59633
|
+
|
|
59634
|
+
me.peers[me.videoTopicName].getLocalStream().getTracks()[0].enabled = true;
|
|
59635
|
+
callback && callback();
|
|
59636
|
+
};
|
|
59637
|
+
|
|
59638
|
+
/**
|
|
59639
|
+
* Pauses mice-send without closing its topic
|
|
59640
|
+
* @param params
|
|
59641
|
+
* @param callback
|
|
59642
|
+
*/
|
|
59643
|
+
this.pauseMice = function (params, callback) {
|
|
59644
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
59645
|
+
if(!Object.keys(callUsers).length || !me.audioTopicName || !me.peers[me.audioTopicName])
|
|
59646
|
+
return;
|
|
59647
|
+
|
|
59648
|
+
me.peers[me.audioTopicName].getLocalStream().getTracks()[0].enabled = false;
|
|
59649
|
+
callback && callback();
|
|
59650
|
+
};
|
|
59651
|
+
|
|
59652
|
+
this.resumeMice = function (params, callback) {
|
|
59653
|
+
var me = callUsers[chatMessaging.userInfo.id];
|
|
59654
|
+
if(!Object.keys(callUsers).length || !me.audioTopicName || !me.peers[me.audioTopicName])
|
|
59655
|
+
return;
|
|
59656
|
+
|
|
59657
|
+
me.peers[me.audioTopicName].getLocalStream().getTracks()[0].enabled = true;
|
|
59658
|
+
callback && callback();
|
|
59659
|
+
};
|
|
59660
|
+
|
|
57983
59661
|
this.resizeCallVideo = function (params, callback) {
|
|
57984
59662
|
if (params) {
|
|
57985
59663
|
if (!!params.width && +params.width > 0) {
|
|
@@ -57990,13 +59668,19 @@ WildEmitter.mixin(WildEmitter);
|
|
|
57990
59668
|
callVideoMinHeight = +params.height;
|
|
57991
59669
|
}
|
|
57992
59670
|
|
|
57993
|
-
|
|
59671
|
+
if(!callUsers[chatMessaging.userInfo.id]){
|
|
59672
|
+
consoleLogging && console.log("Error in resizeCallVideo(), call not started ");
|
|
59673
|
+
return;
|
|
59674
|
+
}
|
|
59675
|
+
|
|
59676
|
+
var userObject = callUsers[chatMessaging.userInfo.id]
|
|
59677
|
+
userObject.peers[userObject.videoTopicName].getLocalStream().getTracks()[0].applyConstraints({
|
|
57994
59678
|
"width": callVideoMinWidth,
|
|
57995
59679
|
"height": callVideoMinHeight
|
|
57996
59680
|
})
|
|
57997
59681
|
.then((res) => {
|
|
57998
|
-
|
|
57999
|
-
|
|
59682
|
+
userObject.htmlElements[userObject.videoTopicName].style.width = callVideoMinWidth + 'px';
|
|
59683
|
+
userObject.htmlElements[userObject.videoTopicName].style.height = callVideoMinHeight + 'px';
|
|
58000
59684
|
callback && callback();
|
|
58001
59685
|
})
|
|
58002
59686
|
.catch((e) => {
|
|
@@ -58029,7 +59713,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
58029
59713
|
}
|
|
58030
59714
|
})();
|
|
58031
59715
|
|
|
58032
|
-
},{"kurento-utils":
|
|
59716
|
+
},{"kurento-utils":298,"webrtc-adapter":318}],331:[function(require,module,exports){
|
|
58033
59717
|
'use strict';
|
|
58034
59718
|
|
|
58035
59719
|
(function () {
|
|
@@ -58222,6 +59906,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
58222
59906
|
START_SCREEN_SHARE: 123,
|
|
58223
59907
|
END_SCREEN_SHARE: 124,
|
|
58224
59908
|
DELETE_FROM_CALL_HISTORY: 125,
|
|
59909
|
+
DESTINATED_RECORD_CALL: 126,
|
|
58225
59910
|
MUTUAL_GROUPS: 130,
|
|
58226
59911
|
CREATE_TAG: 140,
|
|
58227
59912
|
EDIT_TAG: 141,
|
|
@@ -58230,6 +59915,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
58230
59915
|
REMOVE_TAG_PARTICIPANT: 144,
|
|
58231
59916
|
GET_TAG_LIST: 145,
|
|
58232
59917
|
DELETE_MESSAGE_THREAD: 151,
|
|
59918
|
+
EXPORT_CHAT: 152,
|
|
58233
59919
|
ERROR: 999
|
|
58234
59920
|
},
|
|
58235
59921
|
inviteeVOidTypes = {
|
|
@@ -60985,6 +62671,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
60985
62671
|
case chatMessageVOTypes.TURN_OFF_VIDEO_CALL:
|
|
60986
62672
|
case chatMessageVOTypes.ACTIVE_CALL_PARTICIPANTS:
|
|
60987
62673
|
case chatMessageVOTypes.CALL_SESSION_CREATED:
|
|
62674
|
+
case chatMessageVOTypes.DESTINATED_RECORD_CALL:
|
|
60988
62675
|
callModule.handleChatMessages(type, chatMessageVOTypes, messageContent, contentCount, threadId, uniqueId);
|
|
60989
62676
|
break;
|
|
60990
62677
|
|
|
@@ -61279,6 +62966,16 @@ WildEmitter.mixin(WildEmitter);
|
|
|
61279
62966
|
|
|
61280
62967
|
break;
|
|
61281
62968
|
|
|
62969
|
+
/**
|
|
62970
|
+
* Type 152 Gives us a json to export for user
|
|
62971
|
+
*/
|
|
62972
|
+
case chatMessageVOTypes.EXPORT_CHAT:
|
|
62973
|
+
if (chatMessaging.messagesCallbacks[uniqueId]) {
|
|
62974
|
+
chatMessaging.messagesCallbacks[uniqueId](Utility.createReturnData(false, '', 0, messageContent, contentCount, uniqueId));
|
|
62975
|
+
}
|
|
62976
|
+
|
|
62977
|
+
break;
|
|
62978
|
+
|
|
61282
62979
|
/**
|
|
61283
62980
|
* Type 999 All unknown errors
|
|
61284
62981
|
*/
|
|
@@ -66695,9 +68392,6 @@ WildEmitter.mixin(WildEmitter);
|
|
|
66695
68392
|
}
|
|
66696
68393
|
},
|
|
66697
68394
|
|
|
66698
|
-
|
|
66699
|
-
|
|
66700
|
-
|
|
66701
68395
|
/**
|
|
66702
68396
|
* Delete Cache Database
|
|
66703
68397
|
*
|
|
@@ -67167,6 +68861,8 @@ WildEmitter.mixin(WildEmitter);
|
|
|
67167
68861
|
putInChatWaitQueue(params.message, function () {
|
|
67168
68862
|
callback && callback();
|
|
67169
68863
|
});
|
|
68864
|
+
} else {
|
|
68865
|
+
callback && callback();
|
|
67170
68866
|
}
|
|
67171
68867
|
},
|
|
67172
68868
|
|
|
@@ -67339,7 +69035,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
67339
69035
|
callbacks: callbacks
|
|
67340
69036
|
}, function () {
|
|
67341
69037
|
callback && callback();
|
|
67342
|
-
});
|
|
69038
|
+
}, true);
|
|
67343
69039
|
});
|
|
67344
69040
|
break;
|
|
67345
69041
|
}
|
|
@@ -69410,7 +71106,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
69410
71106
|
callbacks: callbacks
|
|
69411
71107
|
}, function () {
|
|
69412
71108
|
chatSendQueueHandler();
|
|
69413
|
-
});
|
|
71109
|
+
}, true);
|
|
69414
71110
|
};
|
|
69415
71111
|
|
|
69416
71112
|
this.deliver = function (params) {
|
|
@@ -71525,6 +73221,157 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71525
73221
|
removeRoleFromUser(params, callback);
|
|
71526
73222
|
};
|
|
71527
73223
|
|
|
73224
|
+
function requestExportChat(stackArr, wantedCount, stepCount, offset, sendData) {
|
|
73225
|
+
sendData.content.offset = offset;
|
|
73226
|
+
sendData.content.count = stepCount;
|
|
73227
|
+
return new Promise(function(resolve, reject){
|
|
73228
|
+
return chatMessaging.sendMessage(sendData, {
|
|
73229
|
+
onResult: function (result) {
|
|
73230
|
+
var returnData = {
|
|
73231
|
+
hasError: result.hasError,
|
|
73232
|
+
cache: false,
|
|
73233
|
+
errorMessage: result.errorMessage,
|
|
73234
|
+
errorCode: result.errorCode
|
|
73235
|
+
};
|
|
73236
|
+
|
|
73237
|
+
if (!returnData.hasError) {
|
|
73238
|
+
for(var i in result.result) {
|
|
73239
|
+
stackArr.push(result.result[i]);
|
|
73240
|
+
}
|
|
73241
|
+
|
|
73242
|
+
consoleLogging && console.log("[SDK][exportChat] a step passed...");
|
|
73243
|
+
wantedCount = wantedCount > result.contentCount ? result.contentCount : wantedCount;
|
|
73244
|
+
setTimeout(function () {
|
|
73245
|
+
chatEvents.fireEvent('threadEvents', {
|
|
73246
|
+
type: 'EXPORT_CHAT',
|
|
73247
|
+
subType: 'IN_PROGRESS',
|
|
73248
|
+
threadId: sendData.subjectId,
|
|
73249
|
+
percent: Math.floor((stackArr.length / wantedCount) * 100)
|
|
73250
|
+
});
|
|
73251
|
+
|
|
73252
|
+
if(stackArr.length < wantedCount) {
|
|
73253
|
+
stepCount = wantedCount - stackArr.length < stepCount ? wantedCount - stackArr.length : stepCount;
|
|
73254
|
+
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData));
|
|
73255
|
+
} else {
|
|
73256
|
+
resolve(stackArr);
|
|
73257
|
+
}
|
|
73258
|
+
});
|
|
73259
|
+
/*returnData.result = result;*/
|
|
73260
|
+
/*var messageContent = result.result,
|
|
73261
|
+
messageLength = messageContent.length,
|
|
73262
|
+
resultData = {
|
|
73263
|
+
participants: formatDataToMakeAssistantHistoryList(messageContent),
|
|
73264
|
+
contentCount: result.contentCount,
|
|
73265
|
+
hasNext: (sendData.content.offset + sendData.content.count < result.contentCount && messageLength > 0),
|
|
73266
|
+
nextOffset: sendData.content.offset * 1 + messageLength * 1
|
|
73267
|
+
};
|
|
73268
|
+
|
|
73269
|
+
returnData.result = resultData;*/
|
|
73270
|
+
} else {
|
|
73271
|
+
consoleLogging && console.log("[SDK][exportChat] Problem in one step... . Rerunning the request.", wantedCount, stepCount, stackArr.length, sendData, result);
|
|
73272
|
+
resolve(requestExportChat(stackArr, wantedCount, stepCount, stackArr.length, sendData))
|
|
73273
|
+
}
|
|
73274
|
+
}
|
|
73275
|
+
});
|
|
73276
|
+
})
|
|
73277
|
+
}
|
|
73278
|
+
|
|
73279
|
+
this.exportChat = function (params, callback) {
|
|
73280
|
+
var stackArr = [], wantedCount = 10000, stepCount = 500, offset = 0;
|
|
73281
|
+
var sendData = {
|
|
73282
|
+
chatMessageVOType: chatMessageVOTypes.EXPORT_CHAT,
|
|
73283
|
+
typeCode: params.typeCode,
|
|
73284
|
+
content: {
|
|
73285
|
+
offset: +params.offset > 0 ? +params.offset : offset,
|
|
73286
|
+
count: +params.count > 0 ? +params.count : wantedCount,//config.getHistoryCount,
|
|
73287
|
+
},
|
|
73288
|
+
subjectId: params.threadId
|
|
73289
|
+
};
|
|
73290
|
+
|
|
73291
|
+
if (+params.fromTime > 0 && +params.fromTime < 9999999999999) {
|
|
73292
|
+
sendData.content.fromTime = +params.fromTime;
|
|
73293
|
+
}
|
|
73294
|
+
|
|
73295
|
+
if (+params.toTime > 0 && +params.toTime < 9999999999999) {
|
|
73296
|
+
sendData.content.toTime = +params.toTime;
|
|
73297
|
+
}
|
|
73298
|
+
|
|
73299
|
+
if(+params.wantedCount > 0) {
|
|
73300
|
+
wantedCount = params.wantedCount;
|
|
73301
|
+
}
|
|
73302
|
+
|
|
73303
|
+
if(+params.stepCount > 0) {
|
|
73304
|
+
stepCount = params.stepCount;
|
|
73305
|
+
}
|
|
73306
|
+
|
|
73307
|
+
if(+params.offset > 0) {
|
|
73308
|
+
offset = params.offset;
|
|
73309
|
+
}
|
|
73310
|
+
|
|
73311
|
+
if (params.messageType && typeof params.messageType.toUpperCase() !== 'undefined' && chatMessageTypes[params.messageType.toUpperCase()] > 0) {
|
|
73312
|
+
sendData.content.messageType = chatMessageTypes[params.messageType.toUpperCase()];
|
|
73313
|
+
}
|
|
73314
|
+
|
|
73315
|
+
if(wantedCount < stepCount)
|
|
73316
|
+
stepCount = wantedCount;
|
|
73317
|
+
|
|
73318
|
+
consoleLogging && console.log("[SDK][exportChat] Starting...");
|
|
73319
|
+
requestExportChat(stackArr, wantedCount, stepCount, offset, sendData).then(function (result) {
|
|
73320
|
+
consoleLogging && console.log("[SDK][exportChat] Export done..., Now converting...");
|
|
73321
|
+
|
|
73322
|
+
var exportedFilename = 'export-' + params.threadId + '.csv',
|
|
73323
|
+
responseType = params.responseType !== null ? params.responseType : "blob",
|
|
73324
|
+
autoStartDownload = params.autoStartDownload !== null ? params.autoStartDownload : true
|
|
73325
|
+
|
|
73326
|
+
var blob = new Blob([Utility.convertToCSV(result)], { type: 'text/csv;charset=utf-8;' });
|
|
73327
|
+
chatEvents.fireEvent('threadEvents', {
|
|
73328
|
+
type: 'EXPORT_CHAT',
|
|
73329
|
+
subType: 'DONE',
|
|
73330
|
+
threadId: sendData.subjectId,
|
|
73331
|
+
result: blob
|
|
73332
|
+
});
|
|
73333
|
+
|
|
73334
|
+
/*if (navigator.msSaveBlob) { // IE 10+
|
|
73335
|
+
if(params.autoStartDownload) {
|
|
73336
|
+
navigator.msSaveBlob(blob, exportedFilename);
|
|
73337
|
+
}
|
|
73338
|
+
callback && callback({
|
|
73339
|
+
hasError: false,
|
|
73340
|
+
type: 'blob',
|
|
73341
|
+
result: blob
|
|
73342
|
+
});
|
|
73343
|
+
} else {*/
|
|
73344
|
+
if(responseType === 'link') {
|
|
73345
|
+
var link = document.createElement("a"),
|
|
73346
|
+
url = URL.createObjectURL(blob);
|
|
73347
|
+
//if (link.download !== undefined) { // feature detection
|
|
73348
|
+
// Browsers that support HTML5 download attribute
|
|
73349
|
+
link.setAttribute("href", url);
|
|
73350
|
+
link.setAttribute("download", exportedFilename);
|
|
73351
|
+
if(autoStartDownload) {
|
|
73352
|
+
link.style.visibility = 'hidden';
|
|
73353
|
+
document.body.appendChild(link);
|
|
73354
|
+
link.click();
|
|
73355
|
+
document.body.removeChild(link);
|
|
73356
|
+
}
|
|
73357
|
+
//}
|
|
73358
|
+
callback && callback({
|
|
73359
|
+
hasError: false,
|
|
73360
|
+
type: 'link',
|
|
73361
|
+
result: link
|
|
73362
|
+
});
|
|
73363
|
+
} else {
|
|
73364
|
+
callback && callback({
|
|
73365
|
+
hasError: false,
|
|
73366
|
+
type: 'blob',
|
|
73367
|
+
result: blob
|
|
73368
|
+
});
|
|
73369
|
+
}
|
|
73370
|
+
//}
|
|
73371
|
+
callback = undefined;
|
|
73372
|
+
});
|
|
73373
|
+
}
|
|
73374
|
+
|
|
71528
73375
|
this.startCall = callModule.startCall;
|
|
71529
73376
|
|
|
71530
73377
|
this.startGroupCall = callModule.startGroupCall;
|
|
@@ -71565,6 +73412,14 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71565
73412
|
|
|
71566
73413
|
this.turnOffVideoCall = callModule.turnOffVideoCall;
|
|
71567
73414
|
|
|
73415
|
+
this.pauseCamera = callModule.pauseCamera;
|
|
73416
|
+
|
|
73417
|
+
this.resumeCamera = callModule.resumeCamera;
|
|
73418
|
+
|
|
73419
|
+
this.pauseMice = callModule.pauseMice;
|
|
73420
|
+
|
|
73421
|
+
this.resumeMice = callModule.resumeMice;
|
|
73422
|
+
|
|
71568
73423
|
this.resizeCallVideo = callModule.resizeCallVideo;
|
|
71569
73424
|
|
|
71570
73425
|
this.restartMedia = callModule.restartMedia;
|
|
@@ -71807,7 +73662,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71807
73662
|
}
|
|
71808
73663
|
})();
|
|
71809
73664
|
|
|
71810
|
-
},{"./call.module.js":
|
|
73665
|
+
},{"./call.module.js":330,"./events.module.js":332,"./messaging.module.js":333,"./utility/utility.js":334,"@sentry/browser":194,"dexie":288,"podasync-ws-only":301}],332:[function(require,module,exports){
|
|
71811
73666
|
(function () {
|
|
71812
73667
|
/**
|
|
71813
73668
|
* Global Variables
|
|
@@ -71817,6 +73672,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71817
73672
|
//if (typeof (require) !== 'undefined' && typeof (exports) !== 'undefined') {} else {}
|
|
71818
73673
|
|
|
71819
73674
|
var Sentry = params.Sentry,
|
|
73675
|
+
currentModuleInstance = this,
|
|
71820
73676
|
Utility = params.Utility,
|
|
71821
73677
|
consoleLogging = params.consoleLogging,
|
|
71822
73678
|
token = params.token,
|
|
@@ -71928,11 +73784,12 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71928
73784
|
}
|
|
71929
73785
|
})();
|
|
71930
73786
|
|
|
71931
|
-
},{}],
|
|
73787
|
+
},{}],333:[function(require,module,exports){
|
|
71932
73788
|
(function () {
|
|
71933
73789
|
/**
|
|
71934
73790
|
* Global Variables
|
|
71935
73791
|
*/
|
|
73792
|
+
var DOMPurify;
|
|
71936
73793
|
|
|
71937
73794
|
/**
|
|
71938
73795
|
* Communicates with chat server
|
|
@@ -71940,7 +73797,11 @@ WildEmitter.mixin(WildEmitter);
|
|
|
71940
73797
|
* @constructor
|
|
71941
73798
|
*/
|
|
71942
73799
|
function ChatMessaging(params) {
|
|
71943
|
-
|
|
73800
|
+
if (typeof (require) !== 'undefined' && typeof (exports) !== 'undefined') {
|
|
73801
|
+
DOMPurify = require('dompurify');
|
|
73802
|
+
} else {
|
|
73803
|
+
DOMPurify = window.DOMPurify;
|
|
73804
|
+
}
|
|
71944
73805
|
|
|
71945
73806
|
var currentModuleInstance = this,
|
|
71946
73807
|
asyncClient = params.asyncClient,
|
|
@@ -72043,6 +73904,9 @@ WildEmitter.mixin(WildEmitter);
|
|
|
72043
73904
|
messageVO.content = JSON.stringify(params.content);
|
|
72044
73905
|
} else {
|
|
72045
73906
|
messageVO.content = params.content;
|
|
73907
|
+
if(DOMPurify.isSupported) {
|
|
73908
|
+
messageVO.content = DOMPurify.sanitize(messageVO.content, {ALLOWED_TAGS: []});
|
|
73909
|
+
}
|
|
72046
73910
|
}
|
|
72047
73911
|
}
|
|
72048
73912
|
|
|
@@ -72232,7 +74096,7 @@ WildEmitter.mixin(WildEmitter);
|
|
|
72232
74096
|
}
|
|
72233
74097
|
})();
|
|
72234
74098
|
|
|
72235
|
-
},{}],
|
|
74099
|
+
},{"dompurify":289}],334:[function(require,module,exports){
|
|
72236
74100
|
(function (global){(function (){
|
|
72237
74101
|
(function() {
|
|
72238
74102
|
|
|
@@ -72781,6 +74645,31 @@ WildEmitter.mixin(WildEmitter);
|
|
|
72781
74645
|
console.log("Error happened at Utility.jsonParser function()", e);
|
|
72782
74646
|
}
|
|
72783
74647
|
};
|
|
74648
|
+
|
|
74649
|
+
/**
|
|
74650
|
+
* Export given json to csv
|
|
74651
|
+
*
|
|
74652
|
+
* @param objArray
|
|
74653
|
+
* @return {string}
|
|
74654
|
+
*/
|
|
74655
|
+
this.convertToCSV = function(objArray) {
|
|
74656
|
+
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
|
|
74657
|
+
var str = '';
|
|
74658
|
+
|
|
74659
|
+
for (var i = 0; i < array.length; i++) {
|
|
74660
|
+
var line = '';
|
|
74661
|
+
for (var index in array[i]) {
|
|
74662
|
+
if (line != '') line += ','
|
|
74663
|
+
|
|
74664
|
+
line += index;
|
|
74665
|
+
line += ": " + (typeof array[i][index] !== 'string' ? JSON.stringify(array[i][index]).replaceAll(",", ".") : array[i][index]);
|
|
74666
|
+
}
|
|
74667
|
+
|
|
74668
|
+
str += line + '\r\n';
|
|
74669
|
+
}
|
|
74670
|
+
|
|
74671
|
+
return str;
|
|
74672
|
+
}
|
|
72784
74673
|
}
|
|
72785
74674
|
|
|
72786
74675
|
if (typeof module !== 'undefined' && typeof module.exports != 'undefined') {
|