videomail-client 13.6.10 → 13.6.12
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/README.md +3 -3
- package/dist/cjs/index.cjs +110 -65
- package/dist/esm/constants.d.ts +1 -1
- package/dist/esm/index.js +26 -48
- package/dist/esm/types/Videomail.d.ts +1 -1
- package/dist/esm/types/error.d.ts +1 -1
- package/dist/esm/types/options.d.ts +1 -1
- package/dist/esm/util/error/VideomailError.d.ts +1 -1
- package/dist/esm/util/html/dimensions/calculateWidth.d.ts +1 -1
- package/dist/esm/wrappers/container.d.ts +1 -1
- package/dist/esm/wrappers/form.d.ts +2 -2
- package/dist/esm/wrappers/visuals/recorder.d.ts +2 -2
- package/dist/esm/wrappers/visuals.d.ts +1 -1
- package/dist/umd/index.js +110 -65
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ There are plenty if you just ask us. And way more will follow, we are rolling ..
|
|
|
59
59
|
|
|
60
60
|
There are many options you can pass onto the VideomailClient constructor. Check out the annotated source code at [src/options.ts](https://github.com/binarykitchen/videomail-client/blob/master/src/options.ts)
|
|
61
61
|
|
|
62
|
-
In most cases, these defaults are good enough. But `
|
|
62
|
+
In most cases, these defaults are good enough. But `whitelistKey` should be changed when you deploy your own site, see <a href="#whitelist">Whitelist</a>.
|
|
63
63
|
|
|
64
64
|
Looking at the examples in the `/src/stories` folder should give you some ideas how to use these options.
|
|
65
65
|
|
|
@@ -92,7 +92,7 @@ Looking at the examples in the `/src/stories` folder should give you some ideas
|
|
|
92
92
|
The constructor accepts a JSON with optional <a href="#options">options</a>. Example:
|
|
93
93
|
|
|
94
94
|
```ts
|
|
95
|
-
const videomailClient = new VideomailClient({
|
|
95
|
+
const videomailClient = new VideomailClient({ whitelistKey: "my whitelist key" });
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
<a name="on"></a>
|
|
@@ -233,7 +233,7 @@ It's emitted in the SUBMITTED event under the videomail object:
|
|
|
233
233
|
"width": 320,
|
|
234
234
|
"height": 240,
|
|
235
235
|
"videomailClientVersion": "2.4.11",
|
|
236
|
-
"
|
|
236
|
+
"whitelistKey": "videomail-client-demo",
|
|
237
237
|
"alias": "some-subject-183622500964",
|
|
238
238
|
"dateCreated": 1541130589811,
|
|
239
239
|
"url": "https://videomail.io/videomail/some-subject-150322500964",
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -6046,7 +6046,7 @@ var __webpack_modules__ = {
|
|
|
6046
6046
|
val = options.strictNullHandling ? null : '';
|
|
6047
6047
|
} else {
|
|
6048
6048
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
6049
|
-
val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
|
|
6049
|
+
if (null !== key) val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
|
|
6050
6050
|
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
6051
6051
|
});
|
|
6052
6052
|
}
|
|
@@ -6054,9 +6054,11 @@ var __webpack_modules__ = {
|
|
|
6054
6054
|
if (part.indexOf('[]=') > -1) val = isArray(val) ? [
|
|
6055
6055
|
val
|
|
6056
6056
|
] : val;
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6057
|
+
if (null !== key) {
|
|
6058
|
+
var existing = has.call(obj, key);
|
|
6059
|
+
if (existing && 'combine' === options.duplicates) obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects);
|
|
6060
|
+
else if (!existing || 'last' === options.duplicates) obj[key] = val;
|
|
6061
|
+
}
|
|
6060
6062
|
}
|
|
6061
6063
|
return obj;
|
|
6062
6064
|
};
|
|
@@ -6070,7 +6072,7 @@ var __webpack_modules__ = {
|
|
|
6070
6072
|
for(var i = chain.length - 1; i >= 0; --i){
|
|
6071
6073
|
var obj;
|
|
6072
6074
|
var root = chain[i];
|
|
6073
|
-
if ('[]' === root && options.parseArrays) obj = options.allowEmptyArrays && ('' === leaf || options.strictNullHandling && null === leaf) ? [] : utils.combine([], leaf);
|
|
6075
|
+
if ('[]' === root && options.parseArrays) obj = utils.isOverflow(leaf) ? leaf : options.allowEmptyArrays && ('' === leaf || options.strictNullHandling && null === leaf) ? [] : utils.combine([], leaf, options.arrayLimit, options.plainObjects);
|
|
6074
6076
|
else {
|
|
6075
6077
|
obj = options.plainObjects ? {
|
|
6076
6078
|
__proto__: null
|
|
@@ -6091,12 +6093,19 @@ var __webpack_modules__ = {
|
|
|
6091
6093
|
}
|
|
6092
6094
|
return leaf;
|
|
6093
6095
|
};
|
|
6094
|
-
var
|
|
6095
|
-
if (!givenKey) return;
|
|
6096
|
+
var splitKeyIntoSegments = function(givenKey, options) {
|
|
6096
6097
|
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
6098
|
+
if (options.depth <= 0) {
|
|
6099
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
6100
|
+
if (!options.allowPrototypes) return;
|
|
6101
|
+
}
|
|
6102
|
+
return [
|
|
6103
|
+
key
|
|
6104
|
+
];
|
|
6105
|
+
}
|
|
6097
6106
|
var brackets = /(\[[^[\]]*])/;
|
|
6098
6107
|
var child = /(\[[^[\]]*])/g;
|
|
6099
|
-
var segment =
|
|
6108
|
+
var segment = brackets.exec(key);
|
|
6100
6109
|
var parent = segment ? key.slice(0, segment.index) : key;
|
|
6101
6110
|
var keys = [];
|
|
6102
6111
|
if (parent) {
|
|
@@ -6106,9 +6115,10 @@ var __webpack_modules__ = {
|
|
|
6106
6115
|
keys.push(parent);
|
|
6107
6116
|
}
|
|
6108
6117
|
var i = 0;
|
|
6109
|
-
while(
|
|
6118
|
+
while(null !== (segment = child.exec(key)) && i < options.depth){
|
|
6110
6119
|
i += 1;
|
|
6111
|
-
|
|
6120
|
+
var segmentContent = segment[1].slice(1, -1);
|
|
6121
|
+
if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
|
|
6112
6122
|
if (!options.allowPrototypes) return;
|
|
6113
6123
|
}
|
|
6114
6124
|
keys.push(segment[1]);
|
|
@@ -6117,6 +6127,12 @@ var __webpack_modules__ = {
|
|
|
6117
6127
|
if (true === options.strictDepth) throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
6118
6128
|
keys.push('[' + key.slice(segment.index) + ']');
|
|
6119
6129
|
}
|
|
6130
|
+
return keys;
|
|
6131
|
+
};
|
|
6132
|
+
var parseKeys = function(givenKey, val, options, valuesParsed) {
|
|
6133
|
+
if (!givenKey) return;
|
|
6134
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
6135
|
+
if (!keys) return;
|
|
6120
6136
|
return parseObject(keys, val, options, valuesParsed);
|
|
6121
6137
|
};
|
|
6122
6138
|
var normalizeParseOptions = function(opts) {
|
|
@@ -6367,8 +6383,23 @@ var __webpack_modules__ = {
|
|
|
6367
6383
|
"./node_modules/qs/lib/utils.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
6368
6384
|
"use strict";
|
|
6369
6385
|
var formats = __webpack_require__("./node_modules/qs/lib/formats.js");
|
|
6386
|
+
var getSideChannel = __webpack_require__("./node_modules/side-channel/index.js");
|
|
6370
6387
|
var has = Object.prototype.hasOwnProperty;
|
|
6371
6388
|
var isArray = Array.isArray;
|
|
6389
|
+
var overflowChannel = getSideChannel();
|
|
6390
|
+
var markOverflow = function(obj, maxIndex) {
|
|
6391
|
+
overflowChannel.set(obj, maxIndex);
|
|
6392
|
+
return obj;
|
|
6393
|
+
};
|
|
6394
|
+
var isOverflow = function(obj) {
|
|
6395
|
+
return overflowChannel.has(obj);
|
|
6396
|
+
};
|
|
6397
|
+
var getMaxIndex = function(obj) {
|
|
6398
|
+
return overflowChannel.get(obj);
|
|
6399
|
+
};
|
|
6400
|
+
var setMaxIndex = function(obj, maxIndex) {
|
|
6401
|
+
overflowChannel.set(obj, maxIndex);
|
|
6402
|
+
};
|
|
6372
6403
|
var hexTable = function() {
|
|
6373
6404
|
var array = [];
|
|
6374
6405
|
for(var i = 0; i < 256; ++i)array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
@@ -6400,12 +6431,32 @@ var __webpack_modules__ = {
|
|
|
6400
6431
|
target,
|
|
6401
6432
|
source
|
|
6402
6433
|
];
|
|
6403
|
-
else if (
|
|
6434
|
+
else if (isOverflow(target)) {
|
|
6435
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
6436
|
+
target[newIndex] = source;
|
|
6437
|
+
setMaxIndex(target, newIndex);
|
|
6438
|
+
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) target[source] = true;
|
|
6404
6439
|
return target;
|
|
6405
6440
|
}
|
|
6406
|
-
if (!target || 'object' != typeof target)
|
|
6407
|
-
|
|
6408
|
-
|
|
6441
|
+
if (!target || 'object' != typeof target) {
|
|
6442
|
+
if (isOverflow(source)) {
|
|
6443
|
+
var sourceKeys = Object.keys(source);
|
|
6444
|
+
var result = options && options.plainObjects ? {
|
|
6445
|
+
__proto__: null,
|
|
6446
|
+
0: target
|
|
6447
|
+
} : {
|
|
6448
|
+
0: target
|
|
6449
|
+
};
|
|
6450
|
+
for(var m = 0; m < sourceKeys.length; m++){
|
|
6451
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
6452
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
6453
|
+
}
|
|
6454
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
6455
|
+
}
|
|
6456
|
+
return [
|
|
6457
|
+
target
|
|
6458
|
+
].concat(source);
|
|
6459
|
+
}
|
|
6409
6460
|
var mergeTarget = target;
|
|
6410
6461
|
if (isArray(target) && !isArray(source)) mergeTarget = arrayToObject(target, options);
|
|
6411
6462
|
if (isArray(target) && isArray(source)) {
|
|
@@ -6515,8 +6566,18 @@ var __webpack_modules__ = {
|
|
|
6515
6566
|
if (!obj || 'object' != typeof obj) return false;
|
|
6516
6567
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
6517
6568
|
};
|
|
6518
|
-
var combine = function(a, b) {
|
|
6519
|
-
|
|
6569
|
+
var combine = function(a, b, arrayLimit, plainObjects) {
|
|
6570
|
+
if (isOverflow(a)) {
|
|
6571
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
6572
|
+
a[newIndex] = b;
|
|
6573
|
+
setMaxIndex(a, newIndex);
|
|
6574
|
+
return a;
|
|
6575
|
+
}
|
|
6576
|
+
var result = [].concat(a, b);
|
|
6577
|
+
if (result.length > arrayLimit) return markOverflow(arrayToObject(result, {
|
|
6578
|
+
plainObjects: plainObjects
|
|
6579
|
+
}), result.length - 1);
|
|
6580
|
+
return result;
|
|
6520
6581
|
};
|
|
6521
6582
|
var maybeMap = function(val, fn) {
|
|
6522
6583
|
if (isArray(val)) {
|
|
@@ -6534,6 +6595,7 @@ var __webpack_modules__ = {
|
|
|
6534
6595
|
decode: decode,
|
|
6535
6596
|
encode: encode,
|
|
6536
6597
|
isBuffer: isBuffer,
|
|
6598
|
+
isOverflow: isOverflow,
|
|
6537
6599
|
isRegExp: isRegExp,
|
|
6538
6600
|
maybeMap: maybeMap,
|
|
6539
6601
|
merge: merge
|
|
@@ -7187,7 +7249,12 @@ var __webpack_modules__ = {
|
|
|
7187
7249
|
this.emit('request', this);
|
|
7188
7250
|
xhr.send(void 0 === data ? null : data);
|
|
7189
7251
|
};
|
|
7190
|
-
|
|
7252
|
+
const proxyAgent = new Proxy(Agent, {
|
|
7253
|
+
apply (target, thisArg, argumentsList) {
|
|
7254
|
+
return new target(...argumentsList);
|
|
7255
|
+
}
|
|
7256
|
+
});
|
|
7257
|
+
request.agent = proxyAgent;
|
|
7191
7258
|
for (const method of [
|
|
7192
7259
|
'GET',
|
|
7193
7260
|
'POST',
|
|
@@ -10504,7 +10571,7 @@ var __webpack_exports__ = {};
|
|
|
10504
10571
|
MP4: "mp4"
|
|
10505
10572
|
};
|
|
10506
10573
|
const constants = {
|
|
10507
|
-
|
|
10574
|
+
WHITELIST_KEY_LABEL: "x-videomail-whitelist-key",
|
|
10508
10575
|
VERSION_LABEL: "videomailClientVersion",
|
|
10509
10576
|
public: {
|
|
10510
10577
|
ENC_TYPE_APP_JSON: "application/json",
|
|
@@ -10664,7 +10731,7 @@ var __webpack_exports__ = {};
|
|
|
10664
10731
|
var client = __webpack_require__("./node_modules/superagent/lib/client.js");
|
|
10665
10732
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10666
10733
|
var package_namespaceObject = {
|
|
10667
|
-
rE: "13.6.
|
|
10734
|
+
rE: "13.6.12"
|
|
10668
10735
|
};
|
|
10669
10736
|
function isAudioEnabled(options) {
|
|
10670
10737
|
return Boolean(options.audio.enabled);
|
|
@@ -13988,10 +14055,10 @@ var __webpack_exports__ = {};
|
|
|
13988
14055
|
}
|
|
13989
14056
|
constructor(message, options, classList, errData){
|
|
13990
14057
|
var _ref;
|
|
13991
|
-
super(message, errData), VideomailError_define_property(this, "title", "Error from videomail-client npm package"), VideomailError_define_property(this, "location", window.location.href), VideomailError_define_property(this, "logLines", void 0), VideomailError_define_property(this, "
|
|
14058
|
+
super(message, errData), VideomailError_define_property(this, "title", "Error from videomail-client npm package"), VideomailError_define_property(this, "location", window.location.href), VideomailError_define_property(this, "logLines", void 0), VideomailError_define_property(this, "whitelistKey", void 0), VideomailError_define_property(this, "cookie", void 0), VideomailError_define_property(this, "err", void 0), VideomailError_define_property(this, "promise", void 0), VideomailError_define_property(this, "reason", void 0), VideomailError_define_property(this, "browser", void 0), VideomailError_define_property(this, "cpu", void 0), VideomailError_define_property(this, "device", void 0), VideomailError_define_property(this, "engine", void 0), VideomailError_define_property(this, "os", void 0), VideomailError_define_property(this, "screen", void 0), VideomailError_define_property(this, "orientation", void 0), VideomailError_define_property(this, "classList", void 0);
|
|
13992
14059
|
this.explanation = null == errData ? void 0 : errData.explanation;
|
|
13993
14060
|
this.logLines = null == errData ? void 0 : errData.logLines;
|
|
13994
|
-
this.
|
|
14061
|
+
this.whitelistKey = options.whitelistKey;
|
|
13995
14062
|
this.classList = classList;
|
|
13996
14063
|
const browser = util_getBrowser(options);
|
|
13997
14064
|
const usefulClientData = browser.getUsefulData();
|
|
@@ -14737,7 +14804,7 @@ var __webpack_exports__ = {};
|
|
|
14737
14804
|
return resource_async_to_generator(function*() {
|
|
14738
14805
|
const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
|
|
14739
14806
|
try {
|
|
14740
|
-
const request = yield client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.
|
|
14807
|
+
const request = yield client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.WHITELIST_KEY_LABEL, this.options.whitelistKey).timeout(this.options.timeouts.connection);
|
|
14741
14808
|
const videomail = request.body;
|
|
14742
14809
|
return videomail;
|
|
14743
14810
|
} catch (exc) {
|
|
@@ -14751,7 +14818,7 @@ var __webpack_exports__ = {};
|
|
|
14751
14818
|
write(method, videomail) {
|
|
14752
14819
|
return resource_async_to_generator(function*() {
|
|
14753
14820
|
const queryParams = {
|
|
14754
|
-
[constants.
|
|
14821
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
14755
14822
|
};
|
|
14756
14823
|
let url = `${this.options.apiUrl}/videomail/`;
|
|
14757
14824
|
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
@@ -14779,7 +14846,7 @@ var __webpack_exports__ = {};
|
|
|
14779
14846
|
reportError(err) {
|
|
14780
14847
|
return resource_async_to_generator(function*() {
|
|
14781
14848
|
const queryParams = {
|
|
14782
|
-
[constants.
|
|
14849
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
14783
14850
|
};
|
|
14784
14851
|
const url = `${this.options.apiUrl}/client-error/`;
|
|
14785
14852
|
try {
|
|
@@ -14798,7 +14865,7 @@ var __webpack_exports__ = {};
|
|
|
14798
14865
|
orientation: err.orientation,
|
|
14799
14866
|
os: err.os,
|
|
14800
14867
|
screen: err.screen,
|
|
14801
|
-
|
|
14868
|
+
whitelistKey: err.whitelistKey,
|
|
14802
14869
|
status: err.status,
|
|
14803
14870
|
title: err.title,
|
|
14804
14871
|
message: err.message,
|
|
@@ -14900,7 +14967,7 @@ var __webpack_exports__ = {};
|
|
|
14900
14967
|
verbose: !PRODUCTION,
|
|
14901
14968
|
apiUrl: "https://videomail.io/api",
|
|
14902
14969
|
socketUrl: "wss://videomail.io",
|
|
14903
|
-
|
|
14970
|
+
whitelistKey: "videomail-client-demo",
|
|
14904
14971
|
enablePause: true,
|
|
14905
14972
|
enableAutoPause: true,
|
|
14906
14973
|
enableSpace: true,
|
|
@@ -16450,7 +16517,7 @@ var __webpack_exports__ = {};
|
|
|
16450
16517
|
return dimension;
|
|
16451
16518
|
}
|
|
16452
16519
|
const dimensions_calculateHeight = calculateHeight;
|
|
16453
|
-
function calculateWidth(responsive,
|
|
16520
|
+
function calculateWidth(responsive, options, videoHeight, ratio) {
|
|
16454
16521
|
const dimension = {
|
|
16455
16522
|
unit: "px"
|
|
16456
16523
|
};
|
|
@@ -16846,14 +16913,11 @@ var __webpack_exports__ = {};
|
|
|
16846
16913
|
return videoWidth && videoWidth > 0;
|
|
16847
16914
|
}
|
|
16848
16915
|
getRawWidth(responsive) {
|
|
16849
|
-
let rawWidth
|
|
16916
|
+
let rawWidth;
|
|
16850
16917
|
const widthDimension = {
|
|
16851
16918
|
unit: "px"
|
|
16852
16919
|
};
|
|
16853
|
-
|
|
16854
|
-
const dimension = this.recorder.calculateWidth(responsive);
|
|
16855
|
-
rawWidth = dimension.value;
|
|
16856
|
-
} else rawWidth = this.options.video.width;
|
|
16920
|
+
rawWidth = responsive ? this.getVideoWidth() : this.options.video.width ? this.options.video.width : this.getVideoWidth();
|
|
16857
16921
|
if (responsive) {
|
|
16858
16922
|
const widthDimension = this.recorder.limitWidth(rawWidth);
|
|
16859
16923
|
rawWidth = null == widthDimension ? void 0 : widthDimension.value;
|
|
@@ -16863,32 +16927,12 @@ var __webpack_exports__ = {};
|
|
|
16863
16927
|
}
|
|
16864
16928
|
getRawHeight(responsive) {
|
|
16865
16929
|
let rawHeight;
|
|
16866
|
-
if (
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
options: this.options
|
|
16873
|
-
});
|
|
16874
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
16875
|
-
message: "Invalid height",
|
|
16876
|
-
explanation: `Calculated raw height of ${rawHeight} cannot be less than 1!`,
|
|
16877
|
-
options: this.options
|
|
16878
|
-
});
|
|
16879
|
-
} else {
|
|
16880
|
-
rawHeight = this.getVideoHeight();
|
|
16881
|
-
if (void 0 === rawHeight) throw error_createError({
|
|
16882
|
-
message: "Bad dimensions",
|
|
16883
|
-
explanation: "Raw video height from DOM element cannot be undefined.",
|
|
16884
|
-
options: this.options
|
|
16885
|
-
});
|
|
16886
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
16887
|
-
message: "Bad dimensions",
|
|
16888
|
-
explanation: "Raw video height from DOM element cannot be less than 1.",
|
|
16889
|
-
options: this.options
|
|
16890
|
-
});
|
|
16891
|
-
}
|
|
16930
|
+
if (responsive) {
|
|
16931
|
+
rawHeight = this.options.video.height || this.getVideoHeight();
|
|
16932
|
+
const ratio = this.recorder.getRatio();
|
|
16933
|
+
const rawWidth = this.getRawWidth(responsive);
|
|
16934
|
+
if (void 0 !== ratio && rawWidth.value) rawHeight = rawWidth.value * ratio;
|
|
16935
|
+
} else rawHeight = this.options.video.height ? this.options.video.height : this.getVideoHeight();
|
|
16892
16936
|
if (responsive) {
|
|
16893
16937
|
const heightDimension = this.recorder.limitHeight(rawHeight);
|
|
16894
16938
|
rawHeight = heightDimension.value;
|
|
@@ -17090,8 +17134,8 @@ var __webpack_exports__ = {};
|
|
|
17090
17134
|
this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
|
|
17091
17135
|
this.sampleProgress = this.frameProgress = void 0;
|
|
17092
17136
|
this.key = args.key;
|
|
17093
|
-
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.
|
|
17094
|
-
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.
|
|
17137
|
+
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.mp4`, true);
|
|
17138
|
+
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.webm`, true);
|
|
17095
17139
|
this.hide();
|
|
17096
17140
|
const widthDimension = this.getRecorderWidth(true);
|
|
17097
17141
|
const heightDimension = this.getRecorderHeight(true);
|
|
@@ -17111,7 +17155,7 @@ var __webpack_exports__ = {};
|
|
|
17111
17155
|
if (!this.connected) {
|
|
17112
17156
|
this.connecting = true;
|
|
17113
17157
|
this.emit("CONNECTING");
|
|
17114
|
-
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.
|
|
17158
|
+
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.WHITELIST_KEY_LABEL)}=${encodeURIComponent(this.options.whitelistKey)}`;
|
|
17115
17159
|
this.options.logger.debug(`Recorder: initializing web socket to ${url2Connect}`);
|
|
17116
17160
|
try {
|
|
17117
17161
|
this.stream = stream_default()(url2Connect, {
|
|
@@ -17843,8 +17887,8 @@ var __webpack_exports__ = {};
|
|
|
17843
17887
|
if (void 0 !== height && this.options.video.width) {
|
|
17844
17888
|
const ratio = this.getRatio();
|
|
17845
17889
|
if (void 0 !== ratio) {
|
|
17846
|
-
const
|
|
17847
|
-
height = Math.min(
|
|
17890
|
+
const idealHeight = this.options.video.width * ratio;
|
|
17891
|
+
height = Math.min(idealHeight, height);
|
|
17848
17892
|
}
|
|
17849
17893
|
}
|
|
17850
17894
|
recorderHeight = {
|
|
@@ -17875,7 +17919,8 @@ var __webpack_exports__ = {};
|
|
|
17875
17919
|
let videoHeight;
|
|
17876
17920
|
if (this.userMedia) videoHeight = this.userMedia.getVideoHeight();
|
|
17877
17921
|
else if (this.recorderElement) videoHeight = this.recorderElement.videoHeight || this.recorderElement.height;
|
|
17878
|
-
|
|
17922
|
+
const ratio = this.getRatio();
|
|
17923
|
+
return dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
17879
17924
|
}
|
|
17880
17925
|
calculateHeight(responsive) {
|
|
17881
17926
|
let videoDimension;
|
|
@@ -17964,7 +18009,7 @@ var __webpack_exports__ = {};
|
|
|
17964
18009
|
height = this.videomail.height;
|
|
17965
18010
|
if (width) ratio = height / width;
|
|
17966
18011
|
}
|
|
17967
|
-
if (!width) width = dimensions_calculateWidth(responsive,
|
|
18012
|
+
if (!width) width = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
17968
18013
|
if (!height) {
|
|
17969
18014
|
let element = this.visuals.getElement();
|
|
17970
18015
|
if (!element) element = document.body;
|
package/dist/esm/constants.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -3555,7 +3555,7 @@ const VideoType = {
|
|
|
3555
3555
|
MP4: "mp4"
|
|
3556
3556
|
};
|
|
3557
3557
|
const constants = {
|
|
3558
|
-
|
|
3558
|
+
WHITELIST_KEY_LABEL: "x-videomail-whitelist-key",
|
|
3559
3559
|
VERSION_LABEL: "videomailClientVersion",
|
|
3560
3560
|
public: {
|
|
3561
3561
|
ENC_TYPE_APP_JSON: "application/json",
|
|
@@ -3563,7 +3563,7 @@ const constants = {
|
|
|
3563
3563
|
}
|
|
3564
3564
|
};
|
|
3565
3565
|
var package_namespaceObject = {
|
|
3566
|
-
rE: "13.6.
|
|
3566
|
+
rE: "13.6.12"
|
|
3567
3567
|
};
|
|
3568
3568
|
function isAudioEnabled(options) {
|
|
3569
3569
|
return Boolean(options.audio.enabled);
|
|
@@ -3693,7 +3693,7 @@ class VideomailError extends error_HTTPVideomailError {
|
|
|
3693
3693
|
title = "Error from videomail-client npm package";
|
|
3694
3694
|
location = window.location.href;
|
|
3695
3695
|
logLines;
|
|
3696
|
-
|
|
3696
|
+
whitelistKey;
|
|
3697
3697
|
cookie;
|
|
3698
3698
|
err;
|
|
3699
3699
|
promise;
|
|
@@ -3722,7 +3722,7 @@ class VideomailError extends error_HTTPVideomailError {
|
|
|
3722
3722
|
super(message, errData);
|
|
3723
3723
|
this.explanation = errData?.explanation;
|
|
3724
3724
|
this.logLines = errData?.logLines;
|
|
3725
|
-
this.
|
|
3725
|
+
this.whitelistKey = options.whitelistKey;
|
|
3726
3726
|
this.classList = classList;
|
|
3727
3727
|
const browser = util_getBrowser(options);
|
|
3728
3728
|
const usefulClientData = browser.getUsefulData();
|
|
@@ -4262,7 +4262,7 @@ class Resource {
|
|
|
4262
4262
|
async get(identifierName, identifierValue) {
|
|
4263
4263
|
const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
|
|
4264
4264
|
try {
|
|
4265
|
-
const request = await superagent("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.
|
|
4265
|
+
const request = await superagent("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.WHITELIST_KEY_LABEL, this.options.whitelistKey).timeout(this.options.timeouts.connection);
|
|
4266
4266
|
const videomail = request.body;
|
|
4267
4267
|
return videomail;
|
|
4268
4268
|
} catch (exc) {
|
|
@@ -4274,7 +4274,7 @@ class Resource {
|
|
|
4274
4274
|
}
|
|
4275
4275
|
async write(method, videomail) {
|
|
4276
4276
|
const queryParams = {
|
|
4277
|
-
[constants.
|
|
4277
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
4278
4278
|
};
|
|
4279
4279
|
let url = `${this.options.apiUrl}/videomail/`;
|
|
4280
4280
|
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
@@ -4296,7 +4296,7 @@ class Resource {
|
|
|
4296
4296
|
}
|
|
4297
4297
|
async reportError(err) {
|
|
4298
4298
|
const queryParams = {
|
|
4299
|
-
[constants.
|
|
4299
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
4300
4300
|
};
|
|
4301
4301
|
const url = `${this.options.apiUrl}/client-error/`;
|
|
4302
4302
|
try {
|
|
@@ -4314,7 +4314,7 @@ class Resource {
|
|
|
4314
4314
|
orientation: err.orientation,
|
|
4315
4315
|
os: err.os,
|
|
4316
4316
|
screen: err.screen,
|
|
4317
|
-
|
|
4317
|
+
whitelistKey: err.whitelistKey,
|
|
4318
4318
|
status: err.status,
|
|
4319
4319
|
title: err.title,
|
|
4320
4320
|
message: err.message,
|
|
@@ -4401,7 +4401,7 @@ const options_options = {
|
|
|
4401
4401
|
verbose: !PRODUCTION,
|
|
4402
4402
|
apiUrl: "https://videomail.io/api",
|
|
4403
4403
|
socketUrl: "wss://videomail.io",
|
|
4404
|
-
|
|
4404
|
+
whitelistKey: "videomail-client-demo",
|
|
4405
4405
|
enablePause: true,
|
|
4406
4406
|
enableAutoPause: true,
|
|
4407
4407
|
enableSpace: true,
|
|
@@ -5774,7 +5774,7 @@ function calculateHeight(responsive, videoWidth, options, ratio, element) {
|
|
|
5774
5774
|
return dimension;
|
|
5775
5775
|
}
|
|
5776
5776
|
const dimensions_calculateHeight = calculateHeight;
|
|
5777
|
-
function calculateWidth(responsive,
|
|
5777
|
+
function calculateWidth(responsive, options, videoHeight, ratio) {
|
|
5778
5778
|
const dimension = {
|
|
5779
5779
|
unit: "px"
|
|
5780
5780
|
};
|
|
@@ -6140,14 +6140,11 @@ class UserMedia extends util_Despot {
|
|
|
6140
6140
|
return videoWidth && videoWidth > 0;
|
|
6141
6141
|
}
|
|
6142
6142
|
getRawWidth(responsive) {
|
|
6143
|
-
let rawWidth
|
|
6143
|
+
let rawWidth;
|
|
6144
6144
|
const widthDimension = {
|
|
6145
6145
|
unit: "px"
|
|
6146
6146
|
};
|
|
6147
|
-
|
|
6148
|
-
const dimension = this.recorder.calculateWidth(responsive);
|
|
6149
|
-
rawWidth = dimension.value;
|
|
6150
|
-
} else rawWidth = this.options.video.width;
|
|
6147
|
+
rawWidth = responsive ? this.getVideoWidth() : this.options.video.width ? this.options.video.width : this.getVideoWidth();
|
|
6151
6148
|
if (responsive) {
|
|
6152
6149
|
const widthDimension = this.recorder.limitWidth(rawWidth);
|
|
6153
6150
|
rawWidth = widthDimension?.value;
|
|
@@ -6157,32 +6154,12 @@ class UserMedia extends util_Despot {
|
|
|
6157
6154
|
}
|
|
6158
6155
|
getRawHeight(responsive) {
|
|
6159
6156
|
let rawHeight;
|
|
6160
|
-
if (
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
options: this.options
|
|
6167
|
-
});
|
|
6168
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
6169
|
-
message: "Invalid height",
|
|
6170
|
-
explanation: `Calculated raw height of ${rawHeight} cannot be less than 1!`,
|
|
6171
|
-
options: this.options
|
|
6172
|
-
});
|
|
6173
|
-
} else {
|
|
6174
|
-
rawHeight = this.getVideoHeight();
|
|
6175
|
-
if (void 0 === rawHeight) throw error_createError({
|
|
6176
|
-
message: "Bad dimensions",
|
|
6177
|
-
explanation: "Raw video height from DOM element cannot be undefined.",
|
|
6178
|
-
options: this.options
|
|
6179
|
-
});
|
|
6180
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
6181
|
-
message: "Bad dimensions",
|
|
6182
|
-
explanation: "Raw video height from DOM element cannot be less than 1.",
|
|
6183
|
-
options: this.options
|
|
6184
|
-
});
|
|
6185
|
-
}
|
|
6157
|
+
if (responsive) {
|
|
6158
|
+
rawHeight = this.options.video.height || this.getVideoHeight();
|
|
6159
|
+
const ratio = this.recorder.getRatio();
|
|
6160
|
+
const rawWidth = this.getRawWidth(responsive);
|
|
6161
|
+
if (void 0 !== ratio && rawWidth.value) rawHeight = rawWidth.value * ratio;
|
|
6162
|
+
} else rawHeight = this.options.video.height ? this.options.video.height : this.getVideoHeight();
|
|
6186
6163
|
if (responsive) {
|
|
6187
6164
|
const heightDimension = this.recorder.limitHeight(rawHeight);
|
|
6188
6165
|
rawHeight = heightDimension.value;
|
|
@@ -6402,8 +6379,8 @@ class Recorder extends util_Despot {
|
|
|
6402
6379
|
this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
|
|
6403
6380
|
this.sampleProgress = this.frameProgress = void 0;
|
|
6404
6381
|
this.key = args.key;
|
|
6405
|
-
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.
|
|
6406
|
-
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.
|
|
6382
|
+
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.mp4`, true);
|
|
6383
|
+
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.webm`, true);
|
|
6407
6384
|
this.hide();
|
|
6408
6385
|
const widthDimension = this.getRecorderWidth(true);
|
|
6409
6386
|
const heightDimension = this.getRecorderHeight(true);
|
|
@@ -6423,7 +6400,7 @@ class Recorder extends util_Despot {
|
|
|
6423
6400
|
if (!this.connected) {
|
|
6424
6401
|
this.connecting = true;
|
|
6425
6402
|
this.emit("CONNECTING");
|
|
6426
|
-
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.
|
|
6403
|
+
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.WHITELIST_KEY_LABEL)}=${encodeURIComponent(this.options.whitelistKey)}`;
|
|
6427
6404
|
this.options.logger.debug(`Recorder: initializing web socket to ${url2Connect}`);
|
|
6428
6405
|
try {
|
|
6429
6406
|
this.stream = websocket_stream(url2Connect, {
|
|
@@ -7139,8 +7116,8 @@ class Recorder extends util_Despot {
|
|
|
7139
7116
|
if (void 0 !== height && this.options.video.width) {
|
|
7140
7117
|
const ratio = this.getRatio();
|
|
7141
7118
|
if (void 0 !== ratio) {
|
|
7142
|
-
const
|
|
7143
|
-
height = Math.min(
|
|
7119
|
+
const idealHeight = this.options.video.width * ratio;
|
|
7120
|
+
height = Math.min(idealHeight, height);
|
|
7144
7121
|
}
|
|
7145
7122
|
}
|
|
7146
7123
|
recorderHeight = {
|
|
@@ -7171,7 +7148,8 @@ class Recorder extends util_Despot {
|
|
|
7171
7148
|
let videoHeight;
|
|
7172
7149
|
if (this.userMedia) videoHeight = this.userMedia.getVideoHeight();
|
|
7173
7150
|
else if (this.recorderElement) videoHeight = this.recorderElement.videoHeight || this.recorderElement.height;
|
|
7174
|
-
|
|
7151
|
+
const ratio = this.getRatio();
|
|
7152
|
+
return dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
7175
7153
|
}
|
|
7176
7154
|
calculateHeight(responsive) {
|
|
7177
7155
|
let videoDimension;
|
|
@@ -7251,7 +7229,7 @@ class Replay extends util_Despot {
|
|
|
7251
7229
|
height = this.videomail.height;
|
|
7252
7230
|
if (width) ratio = height / width;
|
|
7253
7231
|
}
|
|
7254
|
-
if (!width) width = dimensions_calculateWidth(responsive,
|
|
7232
|
+
if (!width) width = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
7255
7233
|
if (!height) {
|
|
7256
7234
|
let element = this.visuals.getElement();
|
|
7257
7235
|
if (!element) element = document.body;
|
|
@@ -8,7 +8,7 @@ export interface VideomailErrorData {
|
|
|
8
8
|
explanation?: string | undefined;
|
|
9
9
|
logLines?: string[] | undefined;
|
|
10
10
|
message: string;
|
|
11
|
-
|
|
11
|
+
whitelistKey?: string | undefined;
|
|
12
12
|
title: string;
|
|
13
13
|
trace?: string | undefined;
|
|
14
14
|
code?: string | undefined;
|
|
@@ -10,7 +10,7 @@ declare class VideomailError extends HTTPVideomailError {
|
|
|
10
10
|
readonly title = "Error from videomail-client npm package";
|
|
11
11
|
readonly location: string;
|
|
12
12
|
logLines?: string[] | undefined;
|
|
13
|
-
|
|
13
|
+
whitelistKey: string | undefined;
|
|
14
14
|
cookie: string[] | undefined;
|
|
15
15
|
err?: Error | undefined;
|
|
16
16
|
promise?: Promise<any> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Dimension } from "../../../types/dimension";
|
|
2
2
|
import { VideomailClientOptions } from "../../../types/options";
|
|
3
|
-
declare function calculateWidth(responsive: boolean,
|
|
3
|
+
declare function calculateWidth(responsive: boolean, options: VideomailClientOptions, videoHeight?: number, ratio?: number): Dimension;
|
|
4
4
|
export default calculateWidth;
|
|
@@ -42,7 +42,7 @@ declare class Container extends Despot {
|
|
|
42
42
|
private hideMySelf;
|
|
43
43
|
private submitVideomail;
|
|
44
44
|
limitWidth(width?: number): import("../types/dimension").Dimension | undefined;
|
|
45
|
-
limitHeight(height: number): import("../types/dimension").Dimension;
|
|
45
|
+
limitHeight(height: number | undefined): import("../types/dimension").Dimension;
|
|
46
46
|
private areVisualsHidden;
|
|
47
47
|
hasElement(): boolean;
|
|
48
48
|
getSubmitButton(): HTMLButtonElement | undefined;
|
|
@@ -112,7 +112,7 @@ declare class Form extends Despot {
|
|
|
112
112
|
sentDateIso?: string;
|
|
113
113
|
sentDateServerPretty?: string;
|
|
114
114
|
serverTimePretty?: string;
|
|
115
|
-
|
|
115
|
+
whitelistKey?: string;
|
|
116
116
|
siteTitle?: string;
|
|
117
117
|
url?: string;
|
|
118
118
|
userKey?: string;
|
|
@@ -251,7 +251,7 @@ declare class Form extends Despot {
|
|
|
251
251
|
sentDateIso?: string;
|
|
252
252
|
sentDateServerPretty?: string;
|
|
253
253
|
serverTimePretty?: string;
|
|
254
|
-
|
|
254
|
+
whitelistKey?: string;
|
|
255
255
|
siteTitle?: string;
|
|
256
256
|
url?: string;
|
|
257
257
|
userKey?: string;
|
|
@@ -103,14 +103,14 @@ declare class Recorder extends Despot {
|
|
|
103
103
|
isUnloaded(): boolean | undefined;
|
|
104
104
|
getRecorderWidth(responsive: boolean): Dimension | undefined;
|
|
105
105
|
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean): Dimension | undefined;
|
|
106
|
-
|
|
106
|
+
getRatio(): number | undefined;
|
|
107
107
|
calculateWidth(responsive: boolean): Dimension;
|
|
108
108
|
calculateHeight(responsive: boolean): Dimension;
|
|
109
109
|
getRawVisualUserMedia(): HTMLVideoElement | null | undefined;
|
|
110
110
|
isConnected(): boolean;
|
|
111
111
|
isConnecting(): boolean;
|
|
112
112
|
limitWidth(width?: number): Dimension | undefined;
|
|
113
|
-
limitHeight(height: number): Dimension;
|
|
113
|
+
limitHeight(height: number | undefined): Dimension;
|
|
114
114
|
isUserMediaLoaded(): boolean | undefined;
|
|
115
115
|
}
|
|
116
116
|
export default Recorder;
|
|
@@ -56,7 +56,7 @@ declare class Visuals extends Despot {
|
|
|
56
56
|
getRecorderWidth(responsive: boolean): Dimension | undefined;
|
|
57
57
|
getRecorderHeight(responsive: boolean, useBoundingClientRect?: boolean): Dimension | undefined;
|
|
58
58
|
limitWidth(width?: number): Dimension | undefined;
|
|
59
|
-
limitHeight(height: number): Dimension;
|
|
59
|
+
limitHeight(height: number | undefined): Dimension;
|
|
60
60
|
getReplay(): Replay;
|
|
61
61
|
getBoundingClientRect(): DOMRect | undefined;
|
|
62
62
|
checkTimer(elapsedTime: number): void;
|
package/dist/umd/index.js
CHANGED
|
@@ -6052,7 +6052,7 @@
|
|
|
6052
6052
|
val = options.strictNullHandling ? null : '';
|
|
6053
6053
|
} else {
|
|
6054
6054
|
key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
|
6055
|
-
val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
|
|
6055
|
+
if (null !== key) val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options, isArray(obj[key]) ? obj[key].length : 0), function(encodedVal) {
|
|
6056
6056
|
return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
|
6057
6057
|
});
|
|
6058
6058
|
}
|
|
@@ -6060,9 +6060,11 @@
|
|
|
6060
6060
|
if (part.indexOf('[]=') > -1) val = isArray(val) ? [
|
|
6061
6061
|
val
|
|
6062
6062
|
] : val;
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6063
|
+
if (null !== key) {
|
|
6064
|
+
var existing = has.call(obj, key);
|
|
6065
|
+
if (existing && 'combine' === options.duplicates) obj[key] = utils.combine(obj[key], val, options.arrayLimit, options.plainObjects);
|
|
6066
|
+
else if (!existing || 'last' === options.duplicates) obj[key] = val;
|
|
6067
|
+
}
|
|
6066
6068
|
}
|
|
6067
6069
|
return obj;
|
|
6068
6070
|
};
|
|
@@ -6076,7 +6078,7 @@
|
|
|
6076
6078
|
for(var i = chain.length - 1; i >= 0; --i){
|
|
6077
6079
|
var obj;
|
|
6078
6080
|
var root = chain[i];
|
|
6079
|
-
if ('[]' === root && options.parseArrays) obj = options.allowEmptyArrays && ('' === leaf || options.strictNullHandling && null === leaf) ? [] : utils.combine([], leaf);
|
|
6081
|
+
if ('[]' === root && options.parseArrays) obj = utils.isOverflow(leaf) ? leaf : options.allowEmptyArrays && ('' === leaf || options.strictNullHandling && null === leaf) ? [] : utils.combine([], leaf, options.arrayLimit, options.plainObjects);
|
|
6080
6082
|
else {
|
|
6081
6083
|
obj = options.plainObjects ? {
|
|
6082
6084
|
__proto__: null
|
|
@@ -6097,12 +6099,19 @@
|
|
|
6097
6099
|
}
|
|
6098
6100
|
return leaf;
|
|
6099
6101
|
};
|
|
6100
|
-
var
|
|
6101
|
-
if (!givenKey) return;
|
|
6102
|
+
var splitKeyIntoSegments = function(givenKey, options) {
|
|
6102
6103
|
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
|
6104
|
+
if (options.depth <= 0) {
|
|
6105
|
+
if (!options.plainObjects && has.call(Object.prototype, key)) {
|
|
6106
|
+
if (!options.allowPrototypes) return;
|
|
6107
|
+
}
|
|
6108
|
+
return [
|
|
6109
|
+
key
|
|
6110
|
+
];
|
|
6111
|
+
}
|
|
6103
6112
|
var brackets = /(\[[^[\]]*])/;
|
|
6104
6113
|
var child = /(\[[^[\]]*])/g;
|
|
6105
|
-
var segment =
|
|
6114
|
+
var segment = brackets.exec(key);
|
|
6106
6115
|
var parent = segment ? key.slice(0, segment.index) : key;
|
|
6107
6116
|
var keys = [];
|
|
6108
6117
|
if (parent) {
|
|
@@ -6112,9 +6121,10 @@
|
|
|
6112
6121
|
keys.push(parent);
|
|
6113
6122
|
}
|
|
6114
6123
|
var i = 0;
|
|
6115
|
-
while(
|
|
6124
|
+
while(null !== (segment = child.exec(key)) && i < options.depth){
|
|
6116
6125
|
i += 1;
|
|
6117
|
-
|
|
6126
|
+
var segmentContent = segment[1].slice(1, -1);
|
|
6127
|
+
if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
|
|
6118
6128
|
if (!options.allowPrototypes) return;
|
|
6119
6129
|
}
|
|
6120
6130
|
keys.push(segment[1]);
|
|
@@ -6123,6 +6133,12 @@
|
|
|
6123
6133
|
if (true === options.strictDepth) throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
|
|
6124
6134
|
keys.push('[' + key.slice(segment.index) + ']');
|
|
6125
6135
|
}
|
|
6136
|
+
return keys;
|
|
6137
|
+
};
|
|
6138
|
+
var parseKeys = function(givenKey, val, options, valuesParsed) {
|
|
6139
|
+
if (!givenKey) return;
|
|
6140
|
+
var keys = splitKeyIntoSegments(givenKey, options);
|
|
6141
|
+
if (!keys) return;
|
|
6126
6142
|
return parseObject(keys, val, options, valuesParsed);
|
|
6127
6143
|
};
|
|
6128
6144
|
var normalizeParseOptions = function(opts) {
|
|
@@ -6373,8 +6389,23 @@
|
|
|
6373
6389
|
"./node_modules/qs/lib/utils.js" (module1, __unused_rspack_exports, __webpack_require__) {
|
|
6374
6390
|
"use strict";
|
|
6375
6391
|
var formats = __webpack_require__("./node_modules/qs/lib/formats.js");
|
|
6392
|
+
var getSideChannel = __webpack_require__("./node_modules/side-channel/index.js");
|
|
6376
6393
|
var has = Object.prototype.hasOwnProperty;
|
|
6377
6394
|
var isArray = Array.isArray;
|
|
6395
|
+
var overflowChannel = getSideChannel();
|
|
6396
|
+
var markOverflow = function(obj, maxIndex) {
|
|
6397
|
+
overflowChannel.set(obj, maxIndex);
|
|
6398
|
+
return obj;
|
|
6399
|
+
};
|
|
6400
|
+
var isOverflow = function(obj) {
|
|
6401
|
+
return overflowChannel.has(obj);
|
|
6402
|
+
};
|
|
6403
|
+
var getMaxIndex = function(obj) {
|
|
6404
|
+
return overflowChannel.get(obj);
|
|
6405
|
+
};
|
|
6406
|
+
var setMaxIndex = function(obj, maxIndex) {
|
|
6407
|
+
overflowChannel.set(obj, maxIndex);
|
|
6408
|
+
};
|
|
6378
6409
|
var hexTable = function() {
|
|
6379
6410
|
var array = [];
|
|
6380
6411
|
for(var i = 0; i < 256; ++i)array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
@@ -6406,12 +6437,32 @@
|
|
|
6406
6437
|
target,
|
|
6407
6438
|
source
|
|
6408
6439
|
];
|
|
6409
|
-
else if (
|
|
6440
|
+
else if (isOverflow(target)) {
|
|
6441
|
+
var newIndex = getMaxIndex(target) + 1;
|
|
6442
|
+
target[newIndex] = source;
|
|
6443
|
+
setMaxIndex(target, newIndex);
|
|
6444
|
+
} else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) target[source] = true;
|
|
6410
6445
|
return target;
|
|
6411
6446
|
}
|
|
6412
|
-
if (!target || 'object' != typeof target)
|
|
6413
|
-
|
|
6414
|
-
|
|
6447
|
+
if (!target || 'object' != typeof target) {
|
|
6448
|
+
if (isOverflow(source)) {
|
|
6449
|
+
var sourceKeys = Object.keys(source);
|
|
6450
|
+
var result = options && options.plainObjects ? {
|
|
6451
|
+
__proto__: null,
|
|
6452
|
+
0: target
|
|
6453
|
+
} : {
|
|
6454
|
+
0: target
|
|
6455
|
+
};
|
|
6456
|
+
for(var m = 0; m < sourceKeys.length; m++){
|
|
6457
|
+
var oldKey = parseInt(sourceKeys[m], 10);
|
|
6458
|
+
result[oldKey + 1] = source[sourceKeys[m]];
|
|
6459
|
+
}
|
|
6460
|
+
return markOverflow(result, getMaxIndex(source) + 1);
|
|
6461
|
+
}
|
|
6462
|
+
return [
|
|
6463
|
+
target
|
|
6464
|
+
].concat(source);
|
|
6465
|
+
}
|
|
6415
6466
|
var mergeTarget = target;
|
|
6416
6467
|
if (isArray(target) && !isArray(source)) mergeTarget = arrayToObject(target, options);
|
|
6417
6468
|
if (isArray(target) && isArray(source)) {
|
|
@@ -6521,8 +6572,18 @@
|
|
|
6521
6572
|
if (!obj || 'object' != typeof obj) return false;
|
|
6522
6573
|
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
6523
6574
|
};
|
|
6524
|
-
var combine = function(a, b) {
|
|
6525
|
-
|
|
6575
|
+
var combine = function(a, b, arrayLimit, plainObjects) {
|
|
6576
|
+
if (isOverflow(a)) {
|
|
6577
|
+
var newIndex = getMaxIndex(a) + 1;
|
|
6578
|
+
a[newIndex] = b;
|
|
6579
|
+
setMaxIndex(a, newIndex);
|
|
6580
|
+
return a;
|
|
6581
|
+
}
|
|
6582
|
+
var result = [].concat(a, b);
|
|
6583
|
+
if (result.length > arrayLimit) return markOverflow(arrayToObject(result, {
|
|
6584
|
+
plainObjects: plainObjects
|
|
6585
|
+
}), result.length - 1);
|
|
6586
|
+
return result;
|
|
6526
6587
|
};
|
|
6527
6588
|
var maybeMap = function(val, fn) {
|
|
6528
6589
|
if (isArray(val)) {
|
|
@@ -6540,6 +6601,7 @@
|
|
|
6540
6601
|
decode: decode,
|
|
6541
6602
|
encode: encode,
|
|
6542
6603
|
isBuffer: isBuffer,
|
|
6604
|
+
isOverflow: isOverflow,
|
|
6543
6605
|
isRegExp: isRegExp,
|
|
6544
6606
|
maybeMap: maybeMap,
|
|
6545
6607
|
merge: merge
|
|
@@ -7193,7 +7255,12 @@
|
|
|
7193
7255
|
this.emit('request', this);
|
|
7194
7256
|
xhr.send(void 0 === data ? null : data);
|
|
7195
7257
|
};
|
|
7196
|
-
|
|
7258
|
+
const proxyAgent = new Proxy(Agent, {
|
|
7259
|
+
apply (target, thisArg, argumentsList) {
|
|
7260
|
+
return new target(...argumentsList);
|
|
7261
|
+
}
|
|
7262
|
+
});
|
|
7263
|
+
request.agent = proxyAgent;
|
|
7197
7264
|
for (const method of [
|
|
7198
7265
|
'GET',
|
|
7199
7266
|
'POST',
|
|
@@ -10510,7 +10577,7 @@
|
|
|
10510
10577
|
MP4: "mp4"
|
|
10511
10578
|
};
|
|
10512
10579
|
const constants = {
|
|
10513
|
-
|
|
10580
|
+
WHITELIST_KEY_LABEL: "x-videomail-whitelist-key",
|
|
10514
10581
|
VERSION_LABEL: "videomailClientVersion",
|
|
10515
10582
|
public: {
|
|
10516
10583
|
ENC_TYPE_APP_JSON: "application/json",
|
|
@@ -10670,7 +10737,7 @@
|
|
|
10670
10737
|
var client = __webpack_require__("./node_modules/superagent/lib/client.js");
|
|
10671
10738
|
var client_default = /*#__PURE__*/ __webpack_require__.n(client);
|
|
10672
10739
|
var package_namespaceObject = {
|
|
10673
|
-
rE: "13.6.
|
|
10740
|
+
rE: "13.6.12"
|
|
10674
10741
|
};
|
|
10675
10742
|
function isAudioEnabled(options) {
|
|
10676
10743
|
return Boolean(options.audio.enabled);
|
|
@@ -13955,7 +14022,7 @@
|
|
|
13955
14022
|
title = "Error from videomail-client npm package";
|
|
13956
14023
|
location = window.location.href;
|
|
13957
14024
|
logLines;
|
|
13958
|
-
|
|
14025
|
+
whitelistKey;
|
|
13959
14026
|
cookie;
|
|
13960
14027
|
err;
|
|
13961
14028
|
promise;
|
|
@@ -13984,7 +14051,7 @@
|
|
|
13984
14051
|
super(message, errData);
|
|
13985
14052
|
this.explanation = errData?.explanation;
|
|
13986
14053
|
this.logLines = errData?.logLines;
|
|
13987
|
-
this.
|
|
14054
|
+
this.whitelistKey = options.whitelistKey;
|
|
13988
14055
|
this.classList = classList;
|
|
13989
14056
|
const browser = util_getBrowser(options);
|
|
13990
14057
|
const usefulClientData = browser.getUsefulData();
|
|
@@ -14637,7 +14704,7 @@
|
|
|
14637
14704
|
async get(identifierName, identifierValue) {
|
|
14638
14705
|
const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
|
|
14639
14706
|
try {
|
|
14640
|
-
const request = await client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.
|
|
14707
|
+
const request = await client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.WHITELIST_KEY_LABEL, this.options.whitelistKey).timeout(this.options.timeouts.connection);
|
|
14641
14708
|
const videomail = request.body;
|
|
14642
14709
|
return videomail;
|
|
14643
14710
|
} catch (exc) {
|
|
@@ -14649,7 +14716,7 @@
|
|
|
14649
14716
|
}
|
|
14650
14717
|
async write(method, videomail) {
|
|
14651
14718
|
const queryParams = {
|
|
14652
|
-
[constants.
|
|
14719
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
14653
14720
|
};
|
|
14654
14721
|
let url = `${this.options.apiUrl}/videomail/`;
|
|
14655
14722
|
if (method === FormMethod.PUT && videomail.key) url += videomail.key;
|
|
@@ -14671,7 +14738,7 @@
|
|
|
14671
14738
|
}
|
|
14672
14739
|
async reportError(err) {
|
|
14673
14740
|
const queryParams = {
|
|
14674
|
-
[constants.
|
|
14741
|
+
[constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
|
|
14675
14742
|
};
|
|
14676
14743
|
const url = `${this.options.apiUrl}/client-error/`;
|
|
14677
14744
|
try {
|
|
@@ -14689,7 +14756,7 @@
|
|
|
14689
14756
|
orientation: err.orientation,
|
|
14690
14757
|
os: err.os,
|
|
14691
14758
|
screen: err.screen,
|
|
14692
|
-
|
|
14759
|
+
whitelistKey: err.whitelistKey,
|
|
14693
14760
|
status: err.status,
|
|
14694
14761
|
title: err.title,
|
|
14695
14762
|
message: err.message,
|
|
@@ -14776,7 +14843,7 @@
|
|
|
14776
14843
|
verbose: !PRODUCTION,
|
|
14777
14844
|
apiUrl: "https://videomail.io/api",
|
|
14778
14845
|
socketUrl: "wss://videomail.io",
|
|
14779
|
-
|
|
14846
|
+
whitelistKey: "videomail-client-demo",
|
|
14780
14847
|
enablePause: true,
|
|
14781
14848
|
enableAutoPause: true,
|
|
14782
14849
|
enableSpace: true,
|
|
@@ -16216,7 +16283,7 @@
|
|
|
16216
16283
|
return dimension;
|
|
16217
16284
|
}
|
|
16218
16285
|
const dimensions_calculateHeight = calculateHeight;
|
|
16219
|
-
function calculateWidth(responsive,
|
|
16286
|
+
function calculateWidth(responsive, options, videoHeight, ratio) {
|
|
16220
16287
|
const dimension = {
|
|
16221
16288
|
unit: "px"
|
|
16222
16289
|
};
|
|
@@ -16595,14 +16662,11 @@
|
|
|
16595
16662
|
return videoWidth && videoWidth > 0;
|
|
16596
16663
|
}
|
|
16597
16664
|
getRawWidth(responsive) {
|
|
16598
|
-
let rawWidth
|
|
16665
|
+
let rawWidth;
|
|
16599
16666
|
const widthDimension = {
|
|
16600
16667
|
unit: "px"
|
|
16601
16668
|
};
|
|
16602
|
-
|
|
16603
|
-
const dimension = this.recorder.calculateWidth(responsive);
|
|
16604
|
-
rawWidth = dimension.value;
|
|
16605
|
-
} else rawWidth = this.options.video.width;
|
|
16669
|
+
rawWidth = responsive ? this.getVideoWidth() : this.options.video.width ? this.options.video.width : this.getVideoWidth();
|
|
16606
16670
|
if (responsive) {
|
|
16607
16671
|
const widthDimension = this.recorder.limitWidth(rawWidth);
|
|
16608
16672
|
rawWidth = widthDimension?.value;
|
|
@@ -16612,32 +16676,12 @@
|
|
|
16612
16676
|
}
|
|
16613
16677
|
getRawHeight(responsive) {
|
|
16614
16678
|
let rawHeight;
|
|
16615
|
-
if (
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16620
|
-
|
|
16621
|
-
options: this.options
|
|
16622
|
-
});
|
|
16623
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
16624
|
-
message: "Invalid height",
|
|
16625
|
-
explanation: `Calculated raw height of ${rawHeight} cannot be less than 1!`,
|
|
16626
|
-
options: this.options
|
|
16627
|
-
});
|
|
16628
|
-
} else {
|
|
16629
|
-
rawHeight = this.getVideoHeight();
|
|
16630
|
-
if (void 0 === rawHeight) throw error_createError({
|
|
16631
|
-
message: "Bad dimensions",
|
|
16632
|
-
explanation: "Raw video height from DOM element cannot be undefined.",
|
|
16633
|
-
options: this.options
|
|
16634
|
-
});
|
|
16635
|
-
if (0 !== rawHeight && rawHeight < 1) throw error_createError({
|
|
16636
|
-
message: "Bad dimensions",
|
|
16637
|
-
explanation: "Raw video height from DOM element cannot be less than 1.",
|
|
16638
|
-
options: this.options
|
|
16639
|
-
});
|
|
16640
|
-
}
|
|
16679
|
+
if (responsive) {
|
|
16680
|
+
rawHeight = this.options.video.height || this.getVideoHeight();
|
|
16681
|
+
const ratio = this.recorder.getRatio();
|
|
16682
|
+
const rawWidth = this.getRawWidth(responsive);
|
|
16683
|
+
if (void 0 !== ratio && rawWidth.value) rawHeight = rawWidth.value * ratio;
|
|
16684
|
+
} else rawHeight = this.options.video.height ? this.options.video.height : this.getVideoHeight();
|
|
16641
16685
|
if (responsive) {
|
|
16642
16686
|
const heightDimension = this.recorder.limitHeight(rawHeight);
|
|
16643
16687
|
rawHeight = heightDimension.value;
|
|
@@ -16857,8 +16901,8 @@
|
|
|
16857
16901
|
this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0;
|
|
16858
16902
|
this.sampleProgress = this.frameProgress = void 0;
|
|
16859
16903
|
this.key = args.key;
|
|
16860
|
-
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.
|
|
16861
|
-
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.
|
|
16904
|
+
if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.mp4`, true);
|
|
16905
|
+
if (args.webm) this.replay.setWebMSource(`${args.webm + constants.WHITELIST_KEY_LABEL}/${this.options.whitelistKey}/videomail.webm`, true);
|
|
16862
16906
|
this.hide();
|
|
16863
16907
|
const widthDimension = this.getRecorderWidth(true);
|
|
16864
16908
|
const heightDimension = this.getRecorderHeight(true);
|
|
@@ -16878,7 +16922,7 @@
|
|
|
16878
16922
|
if (!this.connected) {
|
|
16879
16923
|
this.connecting = true;
|
|
16880
16924
|
this.emit("CONNECTING");
|
|
16881
|
-
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.
|
|
16925
|
+
const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.WHITELIST_KEY_LABEL)}=${encodeURIComponent(this.options.whitelistKey)}`;
|
|
16882
16926
|
this.options.logger.debug(`Recorder: initializing web socket to ${url2Connect}`);
|
|
16883
16927
|
try {
|
|
16884
16928
|
this.stream = stream_default()(url2Connect, {
|
|
@@ -17594,8 +17638,8 @@
|
|
|
17594
17638
|
if (void 0 !== height && this.options.video.width) {
|
|
17595
17639
|
const ratio = this.getRatio();
|
|
17596
17640
|
if (void 0 !== ratio) {
|
|
17597
|
-
const
|
|
17598
|
-
height = Math.min(
|
|
17641
|
+
const idealHeight = this.options.video.width * ratio;
|
|
17642
|
+
height = Math.min(idealHeight, height);
|
|
17599
17643
|
}
|
|
17600
17644
|
}
|
|
17601
17645
|
recorderHeight = {
|
|
@@ -17626,7 +17670,8 @@
|
|
|
17626
17670
|
let videoHeight;
|
|
17627
17671
|
if (this.userMedia) videoHeight = this.userMedia.getVideoHeight();
|
|
17628
17672
|
else if (this.recorderElement) videoHeight = this.recorderElement.videoHeight || this.recorderElement.height;
|
|
17629
|
-
|
|
17673
|
+
const ratio = this.getRatio();
|
|
17674
|
+
return dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
17630
17675
|
}
|
|
17631
17676
|
calculateHeight(responsive) {
|
|
17632
17677
|
let videoDimension;
|
|
@@ -17706,7 +17751,7 @@
|
|
|
17706
17751
|
height = this.videomail.height;
|
|
17707
17752
|
if (width) ratio = height / width;
|
|
17708
17753
|
}
|
|
17709
|
-
if (!width) width = dimensions_calculateWidth(responsive,
|
|
17754
|
+
if (!width) width = dimensions_calculateWidth(responsive, this.options, videoHeight, ratio);
|
|
17710
17755
|
if (!height) {
|
|
17711
17756
|
let element = this.visuals.getElement();
|
|
17712
17757
|
if (!element) element = document.body;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "videomail-client",
|
|
3
|
-
"version": "13.6.
|
|
3
|
+
"version": "13.6.12",
|
|
4
4
|
"description": "A wicked npm package to record videos directly in the browser, wohooo!",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"webcam",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"is-power-of-two": "1.0.0",
|
|
70
70
|
"nanoevents": "9.1.0",
|
|
71
71
|
"serialize-error": "12.0.0",
|
|
72
|
-
"superagent": "10.
|
|
72
|
+
"superagent": "10.3.0",
|
|
73
73
|
"ua-parser-js": "2.0.7",
|
|
74
74
|
"websocket-stream": "5.5.2"
|
|
75
75
|
},
|
|
@@ -91,16 +91,16 @@
|
|
|
91
91
|
"@types/node": "24.10.1",
|
|
92
92
|
"@types/superagent": "8.1.9",
|
|
93
93
|
"@types/ua-parser-js": "0.7.39",
|
|
94
|
-
"@vitest/eslint-plugin": "1.6.
|
|
94
|
+
"@vitest/eslint-plugin": "1.6.6",
|
|
95
95
|
"audit-ci": "7.1.0",
|
|
96
|
-
"chromatic": "13.3.
|
|
96
|
+
"chromatic": "13.3.5",
|
|
97
97
|
"cross-env": "10.1.0",
|
|
98
98
|
"eslint": "9.39.2",
|
|
99
99
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
100
100
|
"eslint-plugin-de-morgan": "2.0.0",
|
|
101
101
|
"eslint-plugin-depend": "1.4.0",
|
|
102
102
|
"eslint-plugin-import-x": "4.16.1",
|
|
103
|
-
"eslint-plugin-package-json": "0.88.
|
|
103
|
+
"eslint-plugin-package-json": "0.88.1",
|
|
104
104
|
"eslint-plugin-promise": "7.2.1",
|
|
105
105
|
"eslint-plugin-regexp": "2.10.0",
|
|
106
106
|
"eslint-plugin-security": "3.0.1",
|
|
@@ -114,12 +114,12 @@
|
|
|
114
114
|
"prettier-plugin-curly": "0.4.1",
|
|
115
115
|
"prettier-plugin-packagejson": "2.5.20",
|
|
116
116
|
"prettier-plugin-sh": "0.18.0",
|
|
117
|
-
"release-it": "19.2.
|
|
117
|
+
"release-it": "19.2.3",
|
|
118
118
|
"storybook": "10.1.11",
|
|
119
119
|
"storybook-html-rsbuild": "3.2.0",
|
|
120
120
|
"type-fest": "5.3.1",
|
|
121
121
|
"typescript": "5.9.3",
|
|
122
|
-
"typescript-eslint": "8.
|
|
122
|
+
"typescript-eslint": "8.52.0",
|
|
123
123
|
"vitest": "4.0.16"
|
|
124
124
|
},
|
|
125
125
|
"engines": {
|