videomail-client 15.7.4 → 15.7.5

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.
@@ -10932,7 +10932,7 @@ var __webpack_exports__ = {};
10932
10932
  var client = __webpack_require__(5734);
10933
10933
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10934
10934
  var package_namespaceObject = {
10935
- rE: "15.7.4"
10935
+ rE: "15.7.5"
10936
10936
  };
10937
10937
  function isAudioEnabled(options) {
10938
10938
  return Boolean(options.audio.enabled);
@@ -14363,7 +14363,7 @@ var __webpack_exports__ = {};
14363
14363
  }
14364
14364
  constructor(message, options, classList, errData){
14365
14365
  var _ref;
14366
- 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);
14366
+ 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, "versions", void 0), VideomailError_define_property(this, "classList", void 0);
14367
14367
  this.explanation = null == errData ? void 0 : errData.explanation;
14368
14368
  this.logLines = null == errData ? void 0 : errData.logLines;
14369
14369
  this.whitelistKey = options.whitelistKey;
@@ -14406,6 +14406,7 @@ var __webpack_exports__ = {};
14406
14406
  const error_VideomailError = VideomailError;
14407
14407
  function createError(errorParams) {
14408
14408
  var _errorParams_classList, _ref;
14409
+ var _options_versions;
14409
14410
  const { exc, options } = errorParams;
14410
14411
  let err = errorParams.err;
14411
14412
  if (!err && exc instanceof Error) err = exc;
@@ -14531,6 +14532,10 @@ var __webpack_exports__ = {};
14531
14532
  videomailError.constraint = err.constraint;
14532
14533
  videomailError.usedConstraints = err.usedConstraints;
14533
14534
  }
14535
+ videomailError.versions = {
14536
+ videomailClient: package_namespaceObject.rE,
14537
+ videomailNinjaFormPlugin: null == (_options_versions = options.versions) ? void 0 : _options_versions.videomailNinjaFormPlugin
14538
+ };
14534
14539
  if (options.reportErrors) {
14535
14540
  const resource = new src_resource(options);
14536
14541
  resource.reportError(videomailError).catch((reason)=>{
@@ -15175,7 +15180,6 @@ var __webpack_exports__ = {};
15175
15180
  }
15176
15181
  reportError(err) {
15177
15182
  return resource_async_to_generator(function*() {
15178
- var _this_options_versions;
15179
15183
  const queryParams = {
15180
15184
  [constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
15181
15185
  };
@@ -15203,11 +15207,7 @@ var __webpack_exports__ = {};
15203
15207
  stack: err.stack,
15204
15208
  supportedConstraints,
15205
15209
  enumerateDevices,
15206
- usedConstraints: err.usedConstraints,
15207
- versions: {
15208
- videomailClient: package_namespaceObject.rE,
15209
- videomailNinjaFormPlugin: null == (_this_options_versions = this.options.versions) ? void 0 : _this_options_versions.videomailNinjaFormPlugin
15210
- }
15210
+ usedConstraints: err.usedConstraints
15211
15211
  };
15212
15212
  yield client_default()(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
15213
15213
  }).call(this);
@@ -15424,7 +15424,7 @@ var __webpack_exports__ = {};
15424
15424
  class CollectLogger {
15425
15425
  lifo(level, parameters) {
15426
15426
  const line = parameters.join();
15427
- if (this.stack.length > this.options.logStackSize) this.stack.pop();
15427
+ if (this.stack.length >= this.options.logStackSize) this.stack.shift();
15428
15428
  this.stack.push(`[${level}] ${line}`);
15429
15429
  return line;
15430
15430
  }
@@ -16950,6 +16950,10 @@ var __webpack_exports__ = {};
16950
16950
  return dimension;
16951
16951
  }
16952
16952
  const dimensions_calculateWidth = calculateWidth;
16953
+ function isAutomatedUserAgent(userAgent = navigator.userAgent) {
16954
+ return /bot|crawler|spider|headlesschrome|phantomjs|puppeteer|playwright/iu.test(userAgent);
16955
+ }
16956
+ const util_isAutomatedUserAgent = isAutomatedUserAgent;
16953
16957
  function esm_define_property(obj, key, value) {
16954
16958
  if (key in obj) Object.defineProperty(obj, key, {
16955
16959
  value: value,
@@ -17642,6 +17646,11 @@ var __webpack_exports__ = {};
17642
17646
  }
17643
17647
  initSocket(cb) {
17644
17648
  if (!this.connected) {
17649
+ if (util_isAutomatedUserAgent()) {
17650
+ this.connecting = false;
17651
+ this.options.logger.debug("Recorder: skipping web socket connection for an automated crawler");
17652
+ return;
17653
+ }
17645
17654
  this.connecting = true;
17646
17655
  this.connectionFailed = false;
17647
17656
  this.connectingStartedAt = Date.now();
@@ -17719,10 +17728,12 @@ var __webpack_exports__ = {};
17719
17728
  const neverConnected = this.connecting && !this.connected;
17720
17729
  this.clearConnectionTimeout();
17721
17730
  this.connecting = this.connected = false;
17722
- if (neverConnected) this.failConnection({
17723
- url2Connect,
17724
- cause: "closed"
17725
- });
17731
+ if (neverConnected) window.setTimeout(()=>{
17732
+ this.failConnection({
17733
+ url2Connect,
17734
+ cause: "closed"
17735
+ });
17736
+ }, 0);
17726
17737
  else if (this.userMediaLoaded) this.initSocket();
17727
17738
  });
17728
17739
  this.stream.on("connect", ()=>{
package/dist/esm/index.js CHANGED
@@ -3620,7 +3620,7 @@ const constants = {
3620
3620
  }
3621
3621
  };
3622
3622
  var package_namespaceObject = {
3623
- rE: "15.7.4"
3623
+ rE: "15.7.5"
3624
3624
  };
3625
3625
  function isAudioEnabled(options) {
3626
3626
  return Boolean(options.audio.enabled);
@@ -3788,7 +3788,7 @@ class VideomailError extends error_HTTPVideomailError {
3788
3788
  return this.classList;
3789
3789
  }
3790
3790
  constructor(message, options, classList, errData){
3791
- 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);
3791
+ 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, "versions", void 0), VideomailError_define_property(this, "classList", void 0);
3792
3792
  this.explanation = errData?.explanation;
3793
3793
  this.logLines = errData?.logLines;
3794
3794
  this.whitelistKey = options.whitelistKey;
@@ -3955,6 +3955,10 @@ function createError(errorParams) {
3955
3955
  videomailError.constraint = err.constraint;
3956
3956
  videomailError.usedConstraints = err.usedConstraints;
3957
3957
  }
3958
+ videomailError.versions = {
3959
+ videomailClient: package_namespaceObject.rE,
3960
+ videomailNinjaFormPlugin: options.versions?.videomailNinjaFormPlugin
3961
+ };
3958
3962
  if (options.reportErrors) {
3959
3963
  const resource = new src_resource(options);
3960
3964
  resource.reportError(videomailError).catch((reason)=>{
@@ -4432,11 +4436,7 @@ class Resource {
4432
4436
  stack: err.stack,
4433
4437
  supportedConstraints,
4434
4438
  enumerateDevices,
4435
- usedConstraints: err.usedConstraints,
4436
- versions: {
4437
- videomailClient: package_namespaceObject.rE,
4438
- videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
4439
- }
4439
+ usedConstraints: err.usedConstraints
4440
4440
  };
4441
4441
  await superagent(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
4442
4442
  }
@@ -4644,7 +4644,7 @@ function CollectLogger_define_property(obj, key, value) {
4644
4644
  class CollectLogger {
4645
4645
  lifo(level, parameters) {
4646
4646
  const line = parameters.join();
4647
- if (this.stack.length > this.options.logStackSize) this.stack.pop();
4647
+ if (this.stack.length >= this.options.logStackSize) this.stack.shift();
4648
4648
  this.stack.push(`[${level}] ${line}`);
4649
4649
  return line;
4650
4650
  }
@@ -6057,6 +6057,10 @@ function calculateWidth(responsive, options, videoHeight, ratio) {
6057
6057
  return dimension;
6058
6058
  }
6059
6059
  const dimensions_calculateWidth = calculateWidth;
6060
+ function isAutomatedUserAgent(userAgent = navigator.userAgent) {
6061
+ return /bot|crawler|spider|headlesschrome|phantomjs|puppeteer|playwright/iu.test(userAgent);
6062
+ }
6063
+ const util_isAutomatedUserAgent = isAutomatedUserAgent;
6060
6064
  function AudioRecorder_define_property(obj, key, value) {
6061
6065
  if (key in obj) Object.defineProperty(obj, key, {
6062
6066
  value: value,
@@ -6703,6 +6707,11 @@ class Recorder extends util_Despot {
6703
6707
  }
6704
6708
  initSocket(cb) {
6705
6709
  if (!this.connected) {
6710
+ if (util_isAutomatedUserAgent()) {
6711
+ this.connecting = false;
6712
+ this.options.logger.debug("Recorder: skipping web socket connection for an automated crawler");
6713
+ return;
6714
+ }
6706
6715
  this.connecting = true;
6707
6716
  this.connectionFailed = false;
6708
6717
  this.connectingStartedAt = Date.now();
@@ -6780,10 +6789,12 @@ class Recorder extends util_Despot {
6780
6789
  const neverConnected = this.connecting && !this.connected;
6781
6790
  this.clearConnectionTimeout();
6782
6791
  this.connecting = this.connected = false;
6783
- if (neverConnected) this.failConnection({
6784
- url2Connect,
6785
- cause: "closed"
6786
- });
6792
+ if (neverConnected) window.setTimeout(()=>{
6793
+ this.failConnection({
6794
+ url2Connect,
6795
+ cause: "closed"
6796
+ });
6797
+ }, 0);
6787
6798
  else if (this.userMediaLoaded) this.initSocket();
6788
6799
  });
6789
6800
  this.stream.on("connect", ()=>{
@@ -1,5 +1,11 @@
1
1
  import { ErrorObject } from "serialize-error";
2
2
  import type { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
3
+ export interface VideomailErrorVersions {
4
+ videomailNinjaFormPlugin?: string | undefined;
5
+ videomailClient: string;
6
+ videomailUI?: string | undefined;
7
+ videomailServer?: string | undefined;
8
+ }
3
9
  export interface VideomailErrorData {
4
10
  cause?: any;
5
11
  promise?: any;
@@ -15,17 +21,12 @@ export interface VideomailErrorData {
15
21
  status?: number | undefined;
16
22
  stack?: string | undefined;
17
23
  type?: string | undefined;
24
+ versions?: VideomailErrorVersions | undefined;
18
25
  blockedURI?: string | undefined;
19
26
  effectiveDirective?: string | undefined;
20
27
  violatedDirective?: string | undefined;
21
28
  originalPolicy?: string | undefined;
22
29
  }
23
- interface VideomailErrorVersions {
24
- videomailNinjaFormPlugin?: string | undefined;
25
- videomailClient: string;
26
- videomailUI?: string | undefined;
27
- videomailServer?: string | undefined;
28
- }
29
30
  export interface FullVideomailErrorData extends VideomailErrorData {
30
31
  browser: IBrowser;
31
32
  cookie?: string[] | undefined;
@@ -36,7 +37,6 @@ export interface FullVideomailErrorData extends VideomailErrorData {
36
37
  orientation?: string | undefined;
37
38
  os?: IOS | undefined;
38
39
  screen: string;
39
- versions?: VideomailErrorVersions | undefined;
40
40
  clientIp?: string | null | undefined;
41
41
  userAgent?: string | null | undefined;
42
42
  isBot?: boolean | undefined;
@@ -44,4 +44,3 @@ export interface FullVideomailErrorData extends VideomailErrorData {
44
44
  enumerateDevices?: MediaDeviceInfo[] | undefined;
45
45
  usedConstraints?: MediaStreamConstraints | undefined;
46
46
  }
47
- export {};
@@ -1,4 +1,5 @@
1
1
  import { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
2
+ import { VideomailErrorVersions } from "../../types/error.js";
2
3
  import { VideomailClientOptions } from "../../types/options.js";
3
4
  import HTTPVideomailError from "./HTTPVideomailError.js";
4
5
  export interface ErrData extends ErrorOptions {
@@ -22,6 +23,7 @@ declare class VideomailError extends HTTPVideomailError {
22
23
  os?: IOS | undefined;
23
24
  screen: string;
24
25
  orientation?: string | undefined;
26
+ versions?: VideomailErrorVersions | undefined;
25
27
  private readonly classList?;
26
28
  static readonly PERMISSION_DENIED = "PERMISSION_DENIED";
27
29
  static readonly NOT_ALLOWED_ERROR = "NotAllowedError";
@@ -0,0 +1,2 @@
1
+ declare function isAutomatedUserAgent(userAgent?: string): boolean;
2
+ export default isAutomatedUserAgent;
package/dist/umd/index.js CHANGED
@@ -10938,7 +10938,7 @@
10938
10938
  var client = __webpack_require__(5734);
10939
10939
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10940
10940
  var package_namespaceObject = {
10941
- rE: "15.7.4"
10941
+ rE: "15.7.5"
10942
10942
  };
10943
10943
  function isAudioEnabled(options) {
10944
10944
  return Boolean(options.audio.enabled);
@@ -14345,6 +14345,7 @@
14345
14345
  os;
14346
14346
  screen;
14347
14347
  orientation;
14348
+ versions;
14348
14349
  classList;
14349
14350
  static PERMISSION_DENIED = "PERMISSION_DENIED";
14350
14351
  static NOT_ALLOWED_ERROR = "NotAllowedError";
@@ -14523,6 +14524,10 @@
14523
14524
  videomailError.constraint = err.constraint;
14524
14525
  videomailError.usedConstraints = err.usedConstraints;
14525
14526
  }
14527
+ videomailError.versions = {
14528
+ videomailClient: package_namespaceObject.rE,
14529
+ videomailNinjaFormPlugin: options.versions?.videomailNinjaFormPlugin
14530
+ };
14526
14531
  if (options.reportErrors) {
14527
14532
  const resource = new src_resource(options);
14528
14533
  resource.reportError(videomailError).catch((reason)=>{
@@ -15093,11 +15098,7 @@
15093
15098
  stack: err.stack,
15094
15099
  supportedConstraints,
15095
15100
  enumerateDevices,
15096
- usedConstraints: err.usedConstraints,
15097
- versions: {
15098
- videomailClient: package_namespaceObject.rE,
15099
- videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
15100
- }
15101
+ usedConstraints: err.usedConstraints
15101
15102
  };
15102
15103
  await client_default()(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
15103
15104
  }
@@ -15298,7 +15299,7 @@
15298
15299
  }
15299
15300
  lifo(level, parameters) {
15300
15301
  const line = parameters.join();
15301
- if (this.stack.length > this.options.logStackSize) this.stack.pop();
15302
+ if (this.stack.length >= this.options.logStackSize) this.stack.shift();
15302
15303
  this.stack.push(`[${level}] ${line}`);
15303
15304
  return line;
15304
15305
  }
@@ -16715,6 +16716,10 @@
16715
16716
  return dimension;
16716
16717
  }
16717
16718
  const dimensions_calculateWidth = calculateWidth;
16719
+ function isAutomatedUserAgent(userAgent = navigator.userAgent) {
16720
+ return /bot|crawler|spider|headlesschrome|phantomjs|puppeteer|playwright/iu.test(userAgent);
16721
+ }
16722
+ const util_isAutomatedUserAgent = isAutomatedUserAgent;
16718
16723
  function _define_property(obj, key, value) {
16719
16724
  if (key in obj) Object.defineProperty(obj, key, {
16720
16725
  value: value,
@@ -17412,6 +17417,11 @@
17412
17417
  }
17413
17418
  initSocket(cb) {
17414
17419
  if (!this.connected) {
17420
+ if (util_isAutomatedUserAgent()) {
17421
+ this.connecting = false;
17422
+ this.options.logger.debug("Recorder: skipping web socket connection for an automated crawler");
17423
+ return;
17424
+ }
17415
17425
  this.connecting = true;
17416
17426
  this.connectionFailed = false;
17417
17427
  this.connectingStartedAt = Date.now();
@@ -17489,10 +17499,12 @@
17489
17499
  const neverConnected = this.connecting && !this.connected;
17490
17500
  this.clearConnectionTimeout();
17491
17501
  this.connecting = this.connected = false;
17492
- if (neverConnected) this.failConnection({
17493
- url2Connect,
17494
- cause: "closed"
17495
- });
17502
+ if (neverConnected) window.setTimeout(()=>{
17503
+ this.failConnection({
17504
+ url2Connect,
17505
+ cause: "closed"
17506
+ });
17507
+ }, 0);
17496
17508
  else if (this.userMediaLoaded) this.initSocket();
17497
17509
  });
17498
17510
  this.stream.on("connect", ()=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "15.7.4",
3
+ "version": "15.7.5",
4
4
  "description": "A wicked npm package to record videos directly in the browser, for Deaf and Sign Language!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -113,7 +113,7 @@
113
113
  "prettier-plugin-jsdoc": "1.8.1",
114
114
  "prettier-plugin-packagejson": "3.0.2",
115
115
  "prettier-plugin-sh": "0.19.0",
116
- "release-it": "21.0.2",
116
+ "release-it": "21.0.3",
117
117
  "storybook": "10.6.0",
118
118
  "storybook-html-rsbuild": "3.4.2",
119
119
  "type-fest": "5.9.0",