videomail-client 15.3.2 → 15.4.0

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.
Files changed (48) hide show
  1. package/dist/cjs/index.cjs +50 -12
  2. package/dist/esm/client.d.ts +5 -5
  3. package/dist/esm/index.d.ts +20 -20
  4. package/dist/esm/index.js +45 -7
  5. package/dist/esm/options.d.ts +1 -1
  6. package/dist/esm/resource.d.ts +5 -5
  7. package/dist/esm/types/Delivery.d.ts +1 -1
  8. package/dist/esm/types/Videomail.d.ts +7 -7
  9. package/dist/esm/types/error.d.ts +3 -3
  10. package/dist/esm/types/events/index.d.ts +2 -2
  11. package/dist/esm/types/events/params.d.ts +3 -3
  12. package/dist/esm/types/options.d.ts +1 -1
  13. package/dist/esm/types/thread.d.ts +1 -1
  14. package/dist/esm/util/Browser.d.ts +3 -3
  15. package/dist/esm/util/CollectLogger.d.ts +1 -1
  16. package/dist/esm/util/Despot.d.ts +13 -13
  17. package/dist/esm/util/error/VideomailError.d.ts +2 -2
  18. package/dist/esm/util/error/createError.d.ts +3 -3
  19. package/dist/esm/util/getBrowser.d.ts +2 -2
  20. package/dist/esm/util/getCapacitorDeviceMetadata.d.ts +1 -1
  21. package/dist/esm/util/html/dimensions/calculateHeight.d.ts +2 -2
  22. package/dist/esm/util/html/dimensions/calculateWidth.d.ts +2 -2
  23. package/dist/esm/util/html/dimensions/figureMinHeight.d.ts +1 -1
  24. package/dist/esm/util/html/dimensions/getRatio.d.ts +1 -1
  25. package/dist/esm/util/html/dimensions/limitHeight.d.ts +2 -2
  26. package/dist/esm/util/html/dimensions/limitWidth.d.ts +2 -2
  27. package/dist/esm/util/html/dimensions/useFullWidth.d.ts +1 -1
  28. package/dist/esm/util/html/media/AudioRecorder.d.ts +2 -2
  29. package/dist/esm/util/html/media/canPlayType.d.ts +1 -1
  30. package/dist/esm/util/options/audio.d.ts +1 -1
  31. package/dist/esm/util/options/mergeWithDefaultOptions.d.ts +1 -1
  32. package/dist/esm/wrappers/buttons.d.ts +3 -3
  33. package/dist/esm/wrappers/container.d.ts +8 -8
  34. package/dist/esm/wrappers/form.d.ts +12 -12
  35. package/dist/esm/wrappers/visuals/inside/recorder/countdown.d.ts +2 -2
  36. package/dist/esm/wrappers/visuals/inside/recorder/facingMode.d.ts +3 -3
  37. package/dist/esm/wrappers/visuals/inside/recorder/pausedNote.d.ts +2 -2
  38. package/dist/esm/wrappers/visuals/inside/recorder/recordNote.d.ts +1 -1
  39. package/dist/esm/wrappers/visuals/inside/recorder/recordTimer.d.ts +3 -3
  40. package/dist/esm/wrappers/visuals/inside/recorderInsides.d.ts +3 -3
  41. package/dist/esm/wrappers/visuals/notifier.d.ts +4 -4
  42. package/dist/esm/wrappers/visuals/recorder.d.ts +11 -7
  43. package/dist/esm/wrappers/visuals/replay.d.ts +5 -5
  44. package/dist/esm/wrappers/visuals/userMedia.d.ts +5 -5
  45. package/dist/esm/wrappers/visuals.d.ts +9 -9
  46. package/dist/umd/index.js +50 -10
  47. package/package.json +13 -13
  48. /package/dist/cjs/{1~236.cjs → 236~1.cjs} +0 -0
@@ -617,7 +617,7 @@ var __webpack_modules__ = {
617
617
  function makeThrottle(fps) {
618
618
  var delay = 1000 / fps;
619
619
  var lastTime = Date.now();
620
- if (fps <= 0 || fps === 1 / 0) return returnTrue;
620
+ if (fps <= 0 || 1 / 0 === fps) return returnTrue;
621
621
  var half = Math.ceil(1000 / 60) / 2;
622
622
  return function() {
623
623
  var now = Date.now();
@@ -5466,7 +5466,7 @@ var __webpack_modules__ = {
5466
5466
  for(; nBits > 0; m = 256 * m + buffer[offset + i], i += d, nBits -= 8);
5467
5467
  if (0 === e) e = 1 - eBias;
5468
5468
  else {
5469
- if (e === eMax) return m ? NaN : 1 / 0 * (s ? -1 : 1);
5469
+ if (e === eMax) return m ? 0 / 0 : (s ? -1 : 1) * 2e308;
5470
5470
  m += Math.pow(2, mLen);
5471
5471
  e -= eBias;
5472
5472
  }
@@ -5482,7 +5482,7 @@ var __webpack_modules__ = {
5482
5482
  var d = isLE ? 1 : -1;
5483
5483
  var s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0;
5484
5484
  value = Math.abs(value);
5485
- if (isNaN(value) || value === 1 / 0) {
5485
+ if (isNaN(value) || 1 / 0 === value) {
5486
5486
  m = isNaN(value) ? 1 : 0;
5487
5487
  e = eMax;
5488
5488
  } else {
@@ -5791,7 +5791,7 @@ var __webpack_modules__ = {
5791
5791
  return O.__proto__;
5792
5792
  } : null);
5793
5793
  function addNumericSeparator(num, str) {
5794
- if (num === 1 / 0 || num === -1 / 0 || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) return str;
5794
+ if (1 / 0 === num || -1 / 0 === num || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) return str;
5795
5795
  var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
5796
5796
  if ('number' == typeof num) {
5797
5797
  var int = num < 0 ? -$floor(-num) : $floor(num);
@@ -5819,7 +5819,7 @@ var __webpack_modules__ = {
5819
5819
  module.exports = function inspect_(obj, options, depth, seen) {
5820
5820
  var opts = options || {};
5821
5821
  if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) throw new TypeError('option "quoteStyle" must be "single" or "double"');
5822
- if (has(opts, 'maxStringLength') && ('number' == typeof opts.maxStringLength ? opts.maxStringLength < 0 && opts.maxStringLength !== 1 / 0 : null !== opts.maxStringLength)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
5822
+ if (has(opts, 'maxStringLength') && ('number' == typeof opts.maxStringLength ? opts.maxStringLength < 0 && 1 / 0 !== opts.maxStringLength : null !== opts.maxStringLength)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
5823
5823
  var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
5824
5824
  if ('boolean' != typeof customInspect && 'symbol' !== customInspect) throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
5825
5825
  if (has(opts, 'indent') && null !== opts.indent && '\t' !== opts.indent && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
@@ -6486,7 +6486,7 @@ var __webpack_modules__ = {
6486
6486
  };
6487
6487
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
6488
6488
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
6489
- var limit = options.parameterLimit === 1 / 0 ? void 0 : options.parameterLimit;
6489
+ var limit = 1 / 0 === options.parameterLimit ? void 0 : options.parameterLimit;
6490
6490
  var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && void 0 !== limit ? limit + 1 : limit);
6491
6491
  if (options.throwOnLimitExceeded && void 0 !== limit && parts.length > limit) throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (1 === limit ? '' : 's') + ' allowed.');
6492
6492
  var skipIndex = -1;
@@ -11071,7 +11071,7 @@ var __webpack_modules__ = {
11071
11071
  var client = __webpack_require__(5734);
11072
11072
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11073
11073
  var package_namespaceObject = {
11074
- rE: "15.3.2"
11074
+ rE: "15.4.0"
11075
11075
  };
11076
11076
  function isAudioEnabled(options) {
11077
11077
  return Boolean(options.audio.enabled);
@@ -17744,6 +17744,30 @@ var __webpack_modules__ = {
17744
17744
  window.clearTimeout(this.retryTimeout);
17745
17745
  this.retryTimeout = void 0;
17746
17746
  }
17747
+ clearConnectionTimeout() {
17748
+ if (!this.connectionTimeout) return;
17749
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
17750
+ window.clearTimeout(this.connectionTimeout);
17751
+ this.connectionTimeout = void 0;
17752
+ }
17753
+ failConnection(params) {
17754
+ if (this.connectionFailed || this.connected || this.unloaded) return;
17755
+ this.connectionFailed = true;
17756
+ this.connecting = false;
17757
+ this.clearConnectionTimeout();
17758
+ if (this.stream) {
17759
+ this.stream.destroy();
17760
+ this.stream = void 0;
17761
+ }
17762
+ const err = error_createError({
17763
+ message: "Unable to connect to the server",
17764
+ explanation: params.explanation,
17765
+ options: this.options
17766
+ });
17767
+ this.emit("ERROR", {
17768
+ err
17769
+ });
17770
+ }
17747
17771
  calculateFrameProgress() {
17748
17772
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
17749
17773
  }
@@ -17816,6 +17840,7 @@ var __webpack_modules__ = {
17816
17840
  initSocket(cb) {
17817
17841
  if (!this.connected) {
17818
17842
  this.connecting = true;
17843
+ this.connectionFailed = false;
17819
17844
  this.emit("CONNECTING");
17820
17845
  let url2Connect;
17821
17846
  try {
@@ -17870,17 +17895,28 @@ var __webpack_modules__ = {
17870
17895
  });
17871
17896
  }
17872
17897
  if (this.stream) {
17873
- this.stream.on("close", (err)=>{
17898
+ const connectionTimeoutMs = this.options.timeouts.connection;
17899
+ this.connectionTimeout = window.setTimeout(()=>{
17900
+ this.failConnection({
17901
+ url2Connect,
17902
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
17903
+ });
17904
+ }, connectionTimeoutMs);
17905
+ this.stream.on("close", ()=>{
17874
17906
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
17907
+ const neverConnected = this.connecting && !this.connected;
17908
+ this.clearConnectionTimeout();
17875
17909
  this.connecting = this.connected = false;
17876
- if (err) this.emit("ERROR", {
17877
- err
17910
+ if (neverConnected) this.failConnection({
17911
+ url2Connect,
17912
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
17878
17913
  });
17879
17914
  else if (this.userMediaLoaded) this.initSocket();
17880
17915
  });
17881
17916
  this.stream.on("connect", ()=>{
17882
17917
  var _this_stream;
17883
17918
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
17919
+ this.clearConnectionTimeout();
17884
17920
  const isClosing = (null == (_this_stream = this.stream) ? void 0 : _this_stream.socket.readyState) === WebSocket.CLOSING;
17885
17921
  if (!this.connected && !isClosing && !this.unloaded) {
17886
17922
  this.connected = true;
@@ -18245,6 +18281,8 @@ var __webpack_modules__ = {
18245
18281
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
18246
18282
  this.reset();
18247
18283
  this.clearUserMediaTimeout();
18284
+ this.clearConnectionTimeout();
18285
+ this.connecting = false;
18248
18286
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
18249
18287
  if (this.submitting) ;
18250
18288
  else if (this.stream) {
@@ -18656,7 +18694,7 @@ var __webpack_modules__ = {
18656
18694
  return this.userMediaLoaded;
18657
18695
  }
18658
18696
  constructor(visuals, replay, options){
18659
- super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18697
+ super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
18660
18698
  this.visuals = visuals;
18661
18699
  this.replay = replay;
18662
18700
  this.facingMode = options.video.facingMode;
@@ -20236,7 +20274,7 @@ __webpack_require__.m = __webpack_modules__;
20236
20274
  }, []));
20237
20275
  })();
20238
20276
  (()=>{
20239
- __webpack_require__.u = (chunkId)=>"1~" + chunkId + ".cjs";
20277
+ __webpack_require__.u = (chunkId)=>"" + chunkId + "~1.cjs";
20240
20278
  })();
20241
20279
  (()=>{
20242
20280
  __webpack_require__.g = (()=>{
@@ -1,6 +1,6 @@
1
- import { PartialVideomailClientOptions } from "./types/options";
2
- import { Videomail } from "./types/Videomail";
3
- import Despot from "./util/Despot";
1
+ import { PartialVideomailClientOptions } from "./types/options.js";
2
+ import { Videomail } from "./types/Videomail.js";
3
+ import Despot from "./util/Despot.js";
4
4
  export interface StartOverParams {
5
5
  keepHidden?: boolean | undefined;
6
6
  }
@@ -23,8 +23,8 @@ declare class VideomailClient extends Despot {
23
23
  hide(): void;
24
24
  getByAlias(alias: string): Promise<Videomail>;
25
25
  getByKey(key: string): Promise<Videomail>;
26
- getThreadByAlias(alias: string): Promise<import(".").VideomailThread>;
27
- getThreadByKey(key: string): Promise<import(".").VideomailThread>;
26
+ getThreadByAlias(alias: string): Promise<import("./index.js").VideomailThread>;
27
+ getThreadByKey(key: string): Promise<import("./index.js").VideomailThread>;
28
28
  isDirty(): boolean;
29
29
  isBuilt(): boolean;
30
30
  isRecording(): boolean;
@@ -1,21 +1,21 @@
1
- import { VideoType } from "./types/VideoType";
2
- export { VideomailClient } from "./client";
3
- export type { BrowserStats } from "./types/BrowserStats";
4
- export type { VideomailCommand } from "./types/command";
5
- export type { VideomailCommandArgs } from "./types/command";
6
- export type { DeliveryRecord } from "./types/Delivery";
7
- export type { CapacitorDeviceMetadata } from "./types/device";
8
- export type { EmailAddress, EmailAddresses } from "./types/EmailAddress";
9
- export type { FullVideomailErrorData, VideomailErrorData } from "./types/error";
10
- export type { VideomailEvents } from "./types/events";
11
- export type * from "./types/events/params";
12
- export type { VideomailIdentifier } from "./types/identifier";
13
- export type { VideomailClientOptions } from "./types/options";
14
- export type { ReactionKey, ReactionLabel, ReactionPrettyByUserKey, ReactionsByUserKey, ReactionsPrettyByUserKey, ReactionType, } from "./types/reaction";
15
- export { Reactions } from "./types/reaction";
16
- export type { RecordingStats } from "./types/RecordingStats";
17
- export type { VideomailThread } from "./types/thread";
18
- export type { PartialVideomail, Videomail } from "./types/Videomail";
19
- export type { VideoTypeType } from "./types/VideoType";
20
- export { default as getCapacitorDeviceMetadata } from "./util/getCapacitorDeviceMetadata";
1
+ import { VideoType } from "./types/VideoType.js";
2
+ export { VideomailClient } from "./client.js";
3
+ export type { BrowserStats } from "./types/BrowserStats.js";
4
+ export type { VideomailCommand } from "./types/command.js";
5
+ export type { VideomailCommandArgs } from "./types/command.js";
6
+ export type { DeliveryRecord } from "./types/Delivery.js";
7
+ export type { CapacitorDeviceMetadata } from "./types/device.js";
8
+ export type { EmailAddress, EmailAddresses } from "./types/EmailAddress.js";
9
+ export type { FullVideomailErrorData, VideomailErrorData } from "./types/error.js";
10
+ export type { VideomailEvents } from "./types/events/index.js";
11
+ export type * from "./types/events/params.js";
12
+ export type { VideomailIdentifier } from "./types/identifier.js";
13
+ export type { VideomailClientOptions } from "./types/options.js";
14
+ export type { ReactionKey, ReactionLabel, ReactionPrettyByUserKey, ReactionsByUserKey, ReactionsPrettyByUserKey, ReactionType, } from "./types/reaction.js";
15
+ export { Reactions } from "./types/reaction.js";
16
+ export type { RecordingStats } from "./types/RecordingStats.js";
17
+ export type { VideomailThread } from "./types/thread.js";
18
+ export type { PartialVideomail, Videomail } from "./types/Videomail.js";
19
+ export type { VideoTypeType } from "./types/VideoType.js";
20
+ export { default as getCapacitorDeviceMetadata } from "./util/getCapacitorDeviceMetadata.js";
21
21
  export { VideoType };
package/dist/esm/index.js CHANGED
@@ -2186,7 +2186,7 @@ __webpack_require__.add({
2186
2186
  for(; nBits > 0; m = 256 * m + buffer[offset + i], i += d, nBits -= 8);
2187
2187
  if (0 === e) e = 1 - eBias;
2188
2188
  else {
2189
- if (e === eMax) return m ? NaN : 1 / 0 * (s ? -1 : 1);
2189
+ if (e === eMax) return m ? 0 / 0 : (s ? -1 : 1) * 2e308;
2190
2190
  m += Math.pow(2, mLen);
2191
2191
  e -= eBias;
2192
2192
  }
@@ -2202,7 +2202,7 @@ __webpack_require__.add({
2202
2202
  var d = isLE ? 1 : -1;
2203
2203
  var s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0;
2204
2204
  value = Math.abs(value);
2205
- if (isNaN(value) || value === 1 / 0) {
2205
+ if (isNaN(value) || 1 / 0 === value) {
2206
2206
  m = isNaN(value) ? 1 : 0;
2207
2207
  e = eMax;
2208
2208
  } else {
@@ -3621,7 +3621,7 @@ const constants = {
3621
3621
  }
3622
3622
  };
3623
3623
  var package_namespaceObject = {
3624
- rE: "15.3.2"
3624
+ rE: "15.4.0"
3625
3625
  };
3626
3626
  function isAudioEnabled(options) {
3627
3627
  return Boolean(options.audio.enabled);
@@ -6636,6 +6636,30 @@ class Recorder extends util_Despot {
6636
6636
  window.clearTimeout(this.retryTimeout);
6637
6637
  this.retryTimeout = void 0;
6638
6638
  }
6639
+ clearConnectionTimeout() {
6640
+ if (!this.connectionTimeout) return;
6641
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
6642
+ window.clearTimeout(this.connectionTimeout);
6643
+ this.connectionTimeout = void 0;
6644
+ }
6645
+ failConnection(params) {
6646
+ if (this.connectionFailed || this.connected || this.unloaded) return;
6647
+ this.connectionFailed = true;
6648
+ this.connecting = false;
6649
+ this.clearConnectionTimeout();
6650
+ if (this.stream) {
6651
+ this.stream.destroy();
6652
+ this.stream = void 0;
6653
+ }
6654
+ const err = error_createError({
6655
+ message: "Unable to connect to the server",
6656
+ explanation: params.explanation,
6657
+ options: this.options
6658
+ });
6659
+ this.emit("ERROR", {
6660
+ err
6661
+ });
6662
+ }
6639
6663
  calculateFrameProgress() {
6640
6664
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
6641
6665
  }
@@ -6707,6 +6731,7 @@ class Recorder extends util_Despot {
6707
6731
  initSocket(cb) {
6708
6732
  if (!this.connected) {
6709
6733
  this.connecting = true;
6734
+ this.connectionFailed = false;
6710
6735
  this.emit("CONNECTING");
6711
6736
  let url2Connect;
6712
6737
  try {
@@ -6761,16 +6786,27 @@ class Recorder extends util_Despot {
6761
6786
  });
6762
6787
  }
6763
6788
  if (this.stream) {
6764
- this.stream.on("close", (err)=>{
6789
+ const connectionTimeoutMs = this.options.timeouts.connection;
6790
+ this.connectionTimeout = window.setTimeout(()=>{
6791
+ this.failConnection({
6792
+ url2Connect,
6793
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
6794
+ });
6795
+ }, connectionTimeoutMs);
6796
+ this.stream.on("close", ()=>{
6765
6797
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
6798
+ const neverConnected = this.connecting && !this.connected;
6799
+ this.clearConnectionTimeout();
6766
6800
  this.connecting = this.connected = false;
6767
- if (err) this.emit("ERROR", {
6768
- err
6801
+ if (neverConnected) this.failConnection({
6802
+ url2Connect,
6803
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
6769
6804
  });
6770
6805
  else if (this.userMediaLoaded) this.initSocket();
6771
6806
  });
6772
6807
  this.stream.on("connect", ()=>{
6773
6808
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
6809
+ this.clearConnectionTimeout();
6774
6810
  const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
6775
6811
  if (!this.connected && !isClosing && !this.unloaded) {
6776
6812
  this.connected = true;
@@ -7129,6 +7165,8 @@ class Recorder extends util_Despot {
7129
7165
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
7130
7166
  this.reset();
7131
7167
  this.clearUserMediaTimeout();
7168
+ this.clearConnectionTimeout();
7169
+ this.connecting = false;
7132
7170
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
7133
7171
  if (this.submitting) ;
7134
7172
  else if (this.stream) {
@@ -7531,7 +7569,7 @@ class Recorder extends util_Despot {
7531
7569
  return this.userMediaLoaded;
7532
7570
  }
7533
7571
  constructor(visuals, replay, options){
7534
- super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
7572
+ super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "connectionTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "connectionFailed", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0);
7535
7573
  this.visuals = visuals;
7536
7574
  this.replay = replay;
7537
7575
  this.facingMode = options.video.facingMode;
@@ -1,3 +1,3 @@
1
- import { VideomailClientOptions } from "./types/options";
1
+ import { VideomailClientOptions } from "./types/options.js";
2
2
  declare const options: VideomailClientOptions;
3
3
  export default options;
@@ -1,9 +1,9 @@
1
1
  import Response from "superagent/lib/node/response";
2
- import { VideomailClientOptions } from "./types/options";
3
- import { VideomailThread } from "./types/thread";
4
- import { PartialVideomail, Videomail } from "./types/Videomail";
5
- import VideomailError from "./util/error/VideomailError";
6
- import { FormInputs } from "./wrappers/form";
2
+ import { VideomailClientOptions } from "./types/options.js";
3
+ import { VideomailThread } from "./types/thread.js";
4
+ import { PartialVideomail, Videomail } from "./types/Videomail.js";
5
+ import VideomailError from "./util/error/VideomailError.js";
6
+ import { FormInputs } from "./wrappers/form.js";
7
7
  declare class Resource {
8
8
  private readonly options;
9
9
  private readonly timezoneId;
@@ -1,4 +1,4 @@
1
- import { EmailAddress } from "./EmailAddress";
1
+ import { EmailAddress } from "./EmailAddress.js";
2
2
  interface DeliveryReport {
3
3
  userKey: string | false;
4
4
  }
@@ -1,11 +1,11 @@
1
1
  import { PartialDeep } from "type-fest";
2
- import { BrowserStats } from "./BrowserStats";
3
- import { DeliveryRecord } from "./Delivery";
4
- import { EmailAddress, EmailAddresses } from "./EmailAddress";
5
- import { ReactionsByUserKey, ReactionsPrettyByUserKey } from "./reaction";
6
- import { RecordingStats } from "./RecordingStats";
7
- import { UserKey } from "./user";
8
- import VideoFormat from "./VideoFormat";
2
+ import { BrowserStats } from "./BrowserStats.js";
3
+ import { DeliveryRecord } from "./Delivery.js";
4
+ import { EmailAddress, EmailAddresses } from "./EmailAddress.js";
5
+ import { ReactionsByUserKey, ReactionsPrettyByUserKey } from "./reaction.js";
6
+ import { RecordingStats } from "./RecordingStats.js";
7
+ import { UserKey } from "./user.js";
8
+ import VideoFormat from "./VideoFormat.js";
9
9
  export interface Videomail {
10
10
  url: string;
11
11
  subject?: string;
@@ -1,6 +1,6 @@
1
1
  import { ErrorObject } from "serialize-error";
2
2
  import type { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
3
- import { CapacitorDeviceMetadata } from "./device";
3
+ import { CapacitorDeviceMetadata } from "./device.js";
4
4
  export interface VideomailErrorData {
5
5
  cause?: any;
6
6
  promise?: any;
@@ -42,8 +42,8 @@ export interface FullVideomailErrorData extends VideomailErrorData {
42
42
  userAgent?: string | null | undefined;
43
43
  isBot?: boolean | undefined;
44
44
  capacitorDevice: CapacitorDeviceMetadata;
45
- supportedConstraints: MediaTrackSupportedConstraints;
46
- enumerateDevices: MediaDeviceInfo[];
45
+ supportedConstraints?: MediaTrackSupportedConstraints | undefined;
46
+ enumerateDevices?: MediaDeviceInfo[] | undefined;
47
47
  usedConstraints?: MediaStreamConstraints | undefined;
48
48
  }
49
49
  export {};
@@ -1,5 +1,5 @@
1
- import { FormReadyParams } from "../../wrappers/container";
2
- import { VideomailErrorParams, VideomailInvalidParams, VideomailPreviewParams, VideomailProgressParams, VideomailRecordingParams, VideomailStoppedParams, VideomailStoppingParams, VideomailSubmittedParams, VideomailUserMediaReadyParams, VideomailValidatingParams } from "./params";
1
+ import { FormReadyParams } from "../../wrappers/container.js";
2
+ import { VideomailErrorParams, VideomailInvalidParams, VideomailPreviewParams, VideomailProgressParams, VideomailRecordingParams, VideomailStoppedParams, VideomailStoppingParams, VideomailSubmittedParams, VideomailUserMediaReadyParams, VideomailValidatingParams } from "./params.js";
3
3
  export interface VideomailEvents {
4
4
  ASKING_WEBCAM_PERMISSION: () => void;
5
5
  BEGIN_AUDIO_ENCODING: () => void;
@@ -1,7 +1,7 @@
1
1
  import Response from "superagent/lib/node/response";
2
- import VideomailError from "../../util/error/VideomailError";
3
- import { RecordingStats } from "../RecordingStats";
4
- import { Videomail } from "../Videomail";
2
+ import VideomailError from "../../util/error/VideomailError.js";
3
+ import { RecordingStats } from "../RecordingStats.js";
4
+ import { Videomail } from "../Videomail.js";
5
5
  export interface VideomailUserMediaReadyParams {
6
6
  switchingFacingMode?: ConstrainDOMString | undefined;
7
7
  recordWhenReady?: boolean | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PartialDeep } from "type-fest";
2
- import { PartialVideomail, Videomail } from "./Videomail";
2
+ import { PartialVideomail, Videomail } from "./Videomail.js";
3
3
  export interface VideomailClientOptions {
4
4
  logger: {
5
5
  debug: (message: unknown) => void;
@@ -1,2 +1,2 @@
1
- import { Videomail } from "./Videomail";
1
+ import { Videomail } from "./Videomail.js";
2
2
  export type VideomailThread = Videomail[];
@@ -1,5 +1,5 @@
1
- import { BrowserStats } from "../types/BrowserStats";
2
- import { VideomailClientOptions } from "../types/options";
1
+ import { BrowserStats } from "../types/BrowserStats.js";
2
+ import { VideomailClientOptions } from "../types/options.js";
3
3
  declare class Browser {
4
4
  private readonly options;
5
5
  private readonly result;
@@ -16,7 +16,7 @@ declare class Browser {
16
16
  isMobile(): boolean;
17
17
  isOkSafari(): boolean;
18
18
  getVideoType(video: HTMLVideoElement): "mp4" | "webm";
19
- getNoAccessIssue(): import("./error/VideomailError").default;
19
+ getNoAccessIssue(): import("./error/VideomailError.js").default;
20
20
  getUsefulData(): BrowserStats;
21
21
  }
22
22
  export default Browser;
@@ -1,4 +1,4 @@
1
- import { VideomailClientOptions } from "../types/options";
1
+ import { VideomailClientOptions } from "../types/options.js";
2
2
  declare class CollectLogger {
3
3
  private readonly browser;
4
4
  private readonly logger;
@@ -1,5 +1,5 @@
1
- import { VideomailEvents } from "../types/events";
2
- import { VideomailClientOptions } from "../types/options";
1
+ import { VideomailEvents } from "../types/events/index.js";
2
+ import { VideomailClientOptions } from "../types/options.js";
3
3
  declare class Despot {
4
4
  private readonly name;
5
5
  protected options: VideomailClientOptions;
@@ -20,37 +20,37 @@ declare class Despot {
20
20
  DISABLING_AUDIO: (() => void)[];
21
21
  DISCONNECTED: (() => void)[];
22
22
  ENABLING_AUDIO: (() => void)[];
23
- ERROR: ((params: import("..").VideomailErrorParams) => void)[];
23
+ ERROR: ((params: import("../index.js").VideomailErrorParams) => void)[];
24
24
  EVENT_EMITTED: (() => void)[];
25
25
  FIRST_FRAME_SENT: (() => void)[];
26
- FORM_READY: ((params: import("../wrappers/container").FormReadyParams) => void)[];
26
+ FORM_READY: ((params: import("../wrappers/container.js").FormReadyParams) => void)[];
27
27
  GOING_BACK: (() => void)[];
28
28
  HIDE: (() => void)[];
29
- INVALID: ((params: import("..").VideomailInvalidParams) => void)[];
29
+ INVALID: ((params: import("../index.js").VideomailInvalidParams) => void)[];
30
30
  INVISIBLE: (() => void)[];
31
31
  LOADED_META_DATA: (() => void)[];
32
32
  LOADING_USER_MEDIA: (() => void)[];
33
33
  NOTIFYING: (() => void)[];
34
34
  PAUSED: (() => void)[];
35
- PREVIEW: ((params?: import("..").VideomailPreviewParams) => void)[];
35
+ PREVIEW: ((params?: import("../index.js").VideomailPreviewParams) => void)[];
36
36
  PREVIEW_SHOWN: (() => void)[];
37
- PROGRESS: ((params: import("..").VideomailProgressParams) => void)[];
38
- RECORDING: ((params: import("..").VideomailRecordingParams) => void)[];
37
+ PROGRESS: ((params: import("../index.js").VideomailProgressParams) => void)[];
38
+ RECORDING: ((params: import("../index.js").VideomailRecordingParams) => void)[];
39
39
  REPLAY_SHOWN: (() => void)[];
40
40
  RESETTING: (() => void)[];
41
41
  RESUMING: (() => void)[];
42
42
  SENDING_FIRST_FRAME: (() => void)[];
43
43
  SERVER_READY: (() => void)[];
44
44
  STARTING_OVER: (() => void)[];
45
- STOPPED: ((params: import("..").VideomailStoppedParams) => void)[];
46
- STOPPING: ((params: import("..").VideomailStoppingParams) => void)[];
47
- SUBMITTED: ((params: import("..").VideomailSubmittedParams) => void)[];
45
+ STOPPED: ((params: import("../index.js").VideomailStoppedParams) => void)[];
46
+ STOPPING: ((params: import("../index.js").VideomailStoppingParams) => void)[];
47
+ SUBMITTED: ((params: import("../index.js").VideomailSubmittedParams) => void)[];
48
48
  SUBMITTING: (() => void)[];
49
49
  SWITCH_FACING_MODE: (() => void)[];
50
50
  UNLOADING: (() => void)[];
51
- USER_MEDIA_READY: ((params: import("..").VideomailUserMediaReadyParams) => void)[];
51
+ USER_MEDIA_READY: ((params: import("../index.js").VideomailUserMediaReadyParams) => void)[];
52
52
  VALID: (() => void)[];
53
- VALIDATING: ((params?: import("..").VideomailValidatingParams) => void)[];
53
+ VALIDATING: ((params?: import("../index.js").VideomailValidatingParams) => void)[];
54
54
  VISIBLE: (() => void)[];
55
55
  WINDOW_RESIZE: ((source: string) => void)[];
56
56
  }>[E];
@@ -1,6 +1,6 @@
1
1
  import { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
2
- import { VideomailClientOptions } from "../../types/options";
3
- import HTTPVideomailError from "./HTTPVideomailError";
2
+ import { VideomailClientOptions } from "../../types/options.js";
3
+ import HTTPVideomailError from "./HTTPVideomailError.js";
4
4
  export interface ErrData extends ErrorOptions {
5
5
  explanation: string | undefined;
6
6
  logLines?: string[] | undefined;
@@ -1,6 +1,6 @@
1
- import { VideomailClientOptions } from "../../types/options";
2
- import HTTPVideomailError from "./HTTPVideomailError";
3
- import VideomailError from "./VideomailError";
1
+ import { VideomailClientOptions } from "../../types/options.js";
2
+ import HTTPVideomailError from "./HTTPVideomailError.js";
3
+ import VideomailError from "./VideomailError.js";
4
4
  interface ErrorParams {
5
5
  err?: HTTPVideomailError;
6
6
  exc?: unknown;
@@ -1,4 +1,4 @@
1
- import { VideomailClientOptions } from "../types/options";
2
- import Browser from "./Browser";
1
+ import { VideomailClientOptions } from "../types/options.js";
2
+ import Browser from "./Browser.js";
3
3
  declare function getBrowser(localOptions: VideomailClientOptions): Browser;
4
4
  export default getBrowser;
@@ -1,3 +1,3 @@
1
- import { CapacitorDeviceMetadata } from "../types/device";
1
+ import { CapacitorDeviceMetadata } from "../types/device.js";
2
2
  declare function getCapacitorDeviceMetadata(): Promise<CapacitorDeviceMetadata>;
3
3
  export default getCapacitorDeviceMetadata;
@@ -1,4 +1,4 @@
1
- import { Dimension } from "../../../types/dimension";
2
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { Dimension } from "../../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../../types/options.js";
3
3
  declare function calculateHeight(responsive: boolean, videoWidth: number | undefined, options: VideomailClientOptions, ratio?: number, element?: HTMLElement | null): Dimension;
4
4
  export default calculateHeight;
@@ -1,4 +1,4 @@
1
- import { Dimension } from "../../../types/dimension";
2
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { Dimension } from "../../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../../types/options.js";
3
3
  declare function calculateWidth(responsive: boolean, options: VideomailClientOptions, videoHeight?: number, ratio?: number): Dimension;
4
4
  export default calculateWidth;
@@ -1,3 +1,3 @@
1
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { VideomailClientOptions } from "../../../types/options.js";
2
2
  declare function figureMinHeight(height: number | undefined, options: VideomailClientOptions): number | undefined;
3
3
  export default figureMinHeight;
@@ -1,3 +1,3 @@
1
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { VideomailClientOptions } from "../../../types/options.js";
2
2
  declare function getRatio(options: VideomailClientOptions, videoHeight?: number, videoWidth?: number): number;
3
3
  export default getRatio;
@@ -1,4 +1,4 @@
1
- import { Dimension } from "../../../types/dimension";
2
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { Dimension } from "../../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../../types/options.js";
3
3
  declare function limitHeight(height: number | undefined, options: VideomailClientOptions, calledFrom: string): Dimension;
4
4
  export default limitHeight;
@@ -1,4 +1,4 @@
1
- import { Dimension } from "../../../types/dimension";
2
- import { VideomailClientOptions } from "../../../types/options";
1
+ import { Dimension } from "../../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../../types/options.js";
3
3
  declare function limitWidth(element: HTMLElement, options: VideomailClientOptions, width?: number): Dimension;
4
4
  export default limitWidth;
@@ -1,3 +1,3 @@
1
- import { Dimension } from "../../../types/dimension";
1
+ import { Dimension } from "../../../types/dimension.js";
2
2
  declare function useFullWidth(mobileBreakPoint?: number): Dimension | undefined;
3
3
  export default useFullWidth;
@@ -1,6 +1,6 @@
1
1
  import AudioSample from "audio-sample";
2
- import { VideomailClientOptions } from "../../../types/options";
3
- import UserMedia from "../../../wrappers/visuals/userMedia";
2
+ import { VideomailClientOptions } from "../../../types/options.js";
3
+ import UserMedia from "../../../wrappers/visuals/userMedia.js";
4
4
  export type AudioProcessCB = (audioSample: AudioSample) => void;
5
5
  declare class AudioRecorder {
6
6
  private scriptProcessor?;
@@ -1,3 +1,3 @@
1
- import { VideoTypeType } from "./../../../types/VideoType";
1
+ import { VideoTypeType } from "./../../../types/VideoType.js";
2
2
  declare function canPlayType(video: HTMLVideoElement, type: VideoTypeType): false | "maybe" | "probably";
3
3
  export default canPlayType;
@@ -1,4 +1,4 @@
1
- import { VideomailClientOptions } from "../../types/options";
1
+ import { VideomailClientOptions } from "../../types/options.js";
2
2
  declare function isAudioEnabled(options: VideomailClientOptions): boolean;
3
3
  declare function setAudioEnabled(enabled: boolean, options: VideomailClientOptions): VideomailClientOptions;
4
4
  declare function isAutoPauseEnabled(options: VideomailClientOptions): boolean;
@@ -1,3 +1,3 @@
1
- import { PartialVideomailClientOptions, VideomailClientOptions } from "../../types/options";
1
+ import { PartialVideomailClientOptions, VideomailClientOptions } from "../../types/options.js";
2
2
  declare function mergeWithDefaultOptions(options?: PartialVideomailClientOptions): VideomailClientOptions;
3
3
  export default mergeWithDefaultOptions;
@@ -1,6 +1,6 @@
1
- import { VideomailClientOptions } from "../types/options";
2
- import Despot from "../util/Despot";
3
- import Container from "./container";
1
+ import { VideomailClientOptions } from "../types/options.js";
2
+ import Despot from "../util/Despot.js";
3
+ import Container from "./container.js";
4
4
  declare class Buttons extends Despot {
5
5
  private readonly container;
6
6
  private buttonsElement?;
@@ -1,9 +1,9 @@
1
1
  import "./../styles/main.styl";
2
- import { ShowParams, StartOverParams } from "../client";
3
- import { VideomailClientOptions } from "../types/options";
4
- import { Videomail } from "../types/Videomail";
5
- import Despot from "../util/Despot";
6
- import { FormInputs, FormMethodType } from "./form";
2
+ import { ShowParams, StartOverParams } from "../client.js";
3
+ import { VideomailClientOptions } from "../types/options.js";
4
+ import { Videomail } from "../types/Videomail.js";
5
+ import Despot from "../util/Despot.js";
6
+ import { FormInputs, FormMethodType } from "./form.js";
7
7
  interface BuildOptions {
8
8
  playerOnly?: boolean;
9
9
  replayParentElementId?: string | undefined;
@@ -41,8 +41,8 @@ declare class Container extends Despot {
41
41
  private unloadChildren;
42
42
  private hideMySelf;
43
43
  private submitVideomail;
44
- limitWidth(width?: number): import("../types/dimension").Dimension | undefined;
45
- limitHeight(height: number | undefined): import("../types/dimension").Dimension;
44
+ limitWidth(width?: number): import("../types/dimension.js").Dimension | undefined;
45
+ limitHeight(height: number | undefined): import("../types/dimension.js").Dimension;
46
46
  private areVisualsHidden;
47
47
  hasElement(): boolean;
48
48
  getSubmitButton(): HTMLButtonElement | undefined;
@@ -70,7 +70,7 @@ declare class Container extends Despot {
70
70
  isBuilt(): boolean;
71
71
  isReplayShown(): boolean;
72
72
  isDirty(): boolean;
73
- getReplay(): import("./visuals/replay").default;
73
+ getReplay(): import("./visuals/replay.js").default;
74
74
  isOutsideElementOf(element: HTMLElement): boolean;
75
75
  loadForm(videomail: Videomail): void;
76
76
  enableAudio(): void;
@@ -1,7 +1,7 @@
1
- import { VideomailClientOptions } from "../types/options";
2
- import { Videomail } from "../types/Videomail";
3
- import Despot from "../util/Despot";
4
- import Container from "./container";
1
+ import { VideomailClientOptions } from "../types/options.js";
2
+ import { Videomail } from "../types/Videomail.js";
3
+ import Despot from "../util/Despot.js";
4
+ import Container from "./container.js";
5
5
  export type FormInputs = Record<string, string>;
6
6
  export declare const FormMethod: {
7
7
  readonly POST: "post";
@@ -20,11 +20,11 @@ declare class Form extends Despot {
20
20
  url?: string;
21
21
  subject?: string;
22
22
  body?: string;
23
- from?: import("..").EmailAddress;
23
+ from?: import("../index.js").EmailAddress;
24
24
  fromNickName?: string | null;
25
- to?: import("..").EmailAddresses | undefined;
26
- bcc?: import("..").EmailAddresses | undefined;
27
- cc?: import("..").EmailAddresses | undefined;
25
+ to?: import("../index.js").EmailAddresses | undefined;
26
+ bcc?: import("../index.js").EmailAddresses | undefined;
27
+ cc?: import("../index.js").EmailAddresses | undefined;
28
28
  alias?: string;
29
29
  replyAllUrl?: string;
30
30
  replyUrl?: string;
@@ -206,11 +206,11 @@ declare class Form extends Despot {
206
206
  url?: string;
207
207
  subject?: string;
208
208
  body?: string;
209
- from?: import("..").EmailAddress;
209
+ from?: import("../index.js").EmailAddress;
210
210
  fromNickName?: string | null;
211
- to?: import("..").EmailAddresses | undefined;
212
- bcc?: import("..").EmailAddresses | undefined;
213
- cc?: import("..").EmailAddresses | undefined;
211
+ to?: import("../index.js").EmailAddresses | undefined;
212
+ bcc?: import("../index.js").EmailAddresses | undefined;
213
+ cc?: import("../index.js").EmailAddresses | undefined;
214
214
  alias?: string;
215
215
  replyAllUrl?: string;
216
216
  replyUrl?: string;
@@ -1,5 +1,5 @@
1
- import { VideomailClientOptions } from "../../../../types/options";
2
- import Visuals from "../../../visuals";
1
+ import { VideomailClientOptions } from "../../../../types/options.js";
2
+ import Visuals from "../../../visuals.js";
3
3
  declare class Countdown {
4
4
  private readonly visuals;
5
5
  private readonly options;
@@ -1,6 +1,6 @@
1
- import { VideomailClientOptions } from "../../../../types/options";
2
- import Despot from "../../../../util/Despot";
3
- import Visuals from "../../../visuals";
1
+ import { VideomailClientOptions } from "../../../../types/options.js";
2
+ import Despot from "../../../../util/Despot.js";
3
+ import Visuals from "../../../visuals.js";
4
4
  declare class FacingMode extends Despot {
5
5
  private readonly visuals;
6
6
  private facingModeElement?;
@@ -1,5 +1,5 @@
1
- import { VideomailClientOptions } from "../../../../types/options";
2
- import Visuals from "../../../visuals";
1
+ import { VideomailClientOptions } from "../../../../types/options.js";
2
+ import Visuals from "../../../visuals.js";
3
3
  declare class PausedNote {
4
4
  private readonly visuals;
5
5
  private readonly options;
@@ -1,4 +1,4 @@
1
- import Visuals from "../../../visuals";
1
+ import Visuals from "../../../visuals.js";
2
2
  declare class RecordNote {
3
3
  private readonly visuals;
4
4
  private recordNoteElement;
@@ -1,6 +1,6 @@
1
- import { VideomailClientOptions } from "../../../../types/options";
2
- import Visuals from "../../../visuals";
3
- import RecordNote from "./recordNote";
1
+ import { VideomailClientOptions } from "../../../../types/options.js";
2
+ import Visuals from "../../../visuals.js";
3
+ import RecordNote from "./recordNote.js";
4
4
  declare class RecordTimer {
5
5
  private readonly visuals;
6
6
  private readonly recordNote;
@@ -1,6 +1,6 @@
1
- import { VideomailClientOptions } from "../../../types/options";
2
- import Despot from "../../../util/Despot";
3
- import Visuals from "../../visuals";
1
+ import { VideomailClientOptions } from "../../../types/options.js";
2
+ import Despot from "../../../util/Despot.js";
3
+ import Visuals from "../../visuals.js";
4
4
  declare class RecorderInsides extends Despot {
5
5
  private readonly recordNote;
6
6
  private readonly recordTimer;
@@ -1,7 +1,7 @@
1
- import { VideomailClientOptions } from "../../types/options";
2
- import Despot from "../../util/Despot";
3
- import VideomailError from "../../util/error/VideomailError";
4
- import Visuals from "../visuals";
1
+ import { VideomailClientOptions } from "../../types/options.js";
2
+ import Despot from "../../util/Despot.js";
3
+ import VideomailError from "../../util/error/VideomailError.js";
4
+ import Visuals from "../visuals.js";
5
5
  interface MessageOptions {
6
6
  problem?: boolean;
7
7
  }
@@ -1,10 +1,10 @@
1
- import { Dimension } from "../../types/dimension";
2
- import { VideomailClientOptions } from "../../types/options";
3
- import { RecordingStats } from "../../types/RecordingStats";
4
- import Despot from "../../util/Despot";
5
- import { UnloadParams } from "../container";
6
- import Visuals from "../visuals";
7
- import Replay from "./replay";
1
+ import { Dimension } from "../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../types/options.js";
3
+ import { RecordingStats } from "../../types/RecordingStats.js";
4
+ import Despot from "../../util/Despot.js";
5
+ import { UnloadParams } from "../container.js";
6
+ import Visuals from "../visuals.js";
7
+ import Replay from "./replay.js";
8
8
  export interface StopParams {
9
9
  limitReached?: boolean;
10
10
  }
@@ -25,6 +25,7 @@ declare class Recorder extends Despot {
25
25
  private userMedia?;
26
26
  private userMediaTimeout?;
27
27
  private retryTimeout?;
28
+ private connectionTimeout?;
28
29
  private frameProgress?;
29
30
  private sampleProgress?;
30
31
  private canvas?;
@@ -37,6 +38,7 @@ declare class Recorder extends Despot {
37
38
  private stream?;
38
39
  private connecting;
39
40
  private connected;
41
+ private connectionFailed;
40
42
  private blocking;
41
43
  private built;
42
44
  private key?;
@@ -53,6 +55,8 @@ declare class Recorder extends Despot {
53
55
  show(): void;
54
56
  private onUserMediaReady;
55
57
  private clearRetryTimeout;
58
+ private clearConnectionTimeout;
59
+ private failConnection;
56
60
  private calculateFrameProgress;
57
61
  private calculateSampleProgress;
58
62
  private updateOverallProgress;
@@ -1,8 +1,8 @@
1
- import { VideomailClientOptions } from "../../types/options";
2
- import { Videomail } from "../../types/Videomail";
3
- import Despot from "../../util/Despot";
4
- import { UnloadParams } from "../container";
5
- import Visuals from "../visuals";
1
+ import { VideomailClientOptions } from "../../types/options.js";
2
+ import { Videomail } from "../../types/Videomail.js";
3
+ import Despot from "../../util/Despot.js";
4
+ import { UnloadParams } from "../container.js";
5
+ import Visuals from "../visuals.js";
6
6
  declare class Replay extends Despot {
7
7
  private readonly visuals;
8
8
  private built;
@@ -1,8 +1,8 @@
1
- import { Dimension } from "../../types/dimension";
2
- import { VideomailClientOptions } from "../../types/options";
3
- import Despot from "../../util/Despot";
4
- import { AudioProcessCB } from "../../util/html/media/AudioRecorder";
5
- import Recorder from "./recorder";
1
+ import { Dimension } from "../../types/dimension.js";
2
+ import { VideomailClientOptions } from "../../types/options.js";
3
+ import Despot from "../../util/Despot.js";
4
+ import { AudioProcessCB } from "../../util/html/media/AudioRecorder.js";
5
+ import Recorder from "./recorder.js";
6
6
  interface StopParams {
7
7
  aboutToInitialize: boolean;
8
8
  switchingFacingMode: any;
@@ -1,11 +1,11 @@
1
- import { ShowParams } from "../client";
2
- import { Dimension } from "../types/dimension";
3
- import { VideomailClientOptions } from "../types/options";
4
- import Despot from "../util/Despot";
5
- import VideomailError from "../util/error/VideomailError";
6
- import Container, { UnloadParams } from "./container";
7
- import Recorder, { StopParams } from "./visuals/recorder";
8
- import Replay from "./visuals/replay";
1
+ import { ShowParams } from "../client.js";
2
+ import { Dimension } from "../types/dimension.js";
3
+ import { VideomailClientOptions } from "../types/options.js";
4
+ import Despot from "../util/Despot.js";
5
+ import VideomailError from "../util/error/VideomailError.js";
6
+ import Container, { UnloadParams } from "./container.js";
7
+ import Recorder, { StopParams } from "./visuals/recorder.js";
8
+ import Replay from "./visuals/replay.js";
9
9
  declare class Visuals extends Despot {
10
10
  private readonly container;
11
11
  private readonly replay;
@@ -42,7 +42,7 @@ declare class Visuals extends Despot {
42
42
  recordOrStop(): void;
43
43
  getRecorder(): Recorder;
44
44
  validate(): boolean;
45
- getRecordingStats(): import("..").RecordingStats | undefined;
45
+ getRecordingStats(): import("../index.js").RecordingStats | undefined;
46
46
  getAudioSampleRate(): number | undefined;
47
47
  isPaused(): boolean | undefined;
48
48
  error(err: VideomailError): void;
package/dist/umd/index.js CHANGED
@@ -738,7 +738,7 @@
738
738
  function makeThrottle(fps) {
739
739
  var delay = 1000 / fps;
740
740
  var lastTime = Date.now();
741
- if (fps <= 0 || fps === 1 / 0) return returnTrue;
741
+ if (fps <= 0 || 1 / 0 === fps) return returnTrue;
742
742
  var half = Math.ceil(1000 / 60) / 2;
743
743
  return function() {
744
744
  var now = Date.now();
@@ -5587,7 +5587,7 @@
5587
5587
  for(; nBits > 0; m = 256 * m + buffer[offset + i], i += d, nBits -= 8);
5588
5588
  if (0 === e) e = 1 - eBias;
5589
5589
  else {
5590
- if (e === eMax) return m ? NaN : 1 / 0 * (s ? -1 : 1);
5590
+ if (e === eMax) return m ? 0 / 0 : (s ? -1 : 1) * 2e308;
5591
5591
  m += Math.pow(2, mLen);
5592
5592
  e -= eBias;
5593
5593
  }
@@ -5603,7 +5603,7 @@
5603
5603
  var d = isLE ? 1 : -1;
5604
5604
  var s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0;
5605
5605
  value = Math.abs(value);
5606
- if (isNaN(value) || value === 1 / 0) {
5606
+ if (isNaN(value) || 1 / 0 === value) {
5607
5607
  m = isNaN(value) ? 1 : 0;
5608
5608
  e = eMax;
5609
5609
  } else {
@@ -5912,7 +5912,7 @@
5912
5912
  return O.__proto__;
5913
5913
  } : null);
5914
5914
  function addNumericSeparator(num, str) {
5915
- if (num === 1 / 0 || num === -1 / 0 || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) return str;
5915
+ if (1 / 0 === num || -1 / 0 === num || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) return str;
5916
5916
  var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
5917
5917
  if ('number' == typeof num) {
5918
5918
  var int = num < 0 ? -$floor(-num) : $floor(num);
@@ -5940,7 +5940,7 @@
5940
5940
  module1.exports = function inspect_(obj, options, depth, seen) {
5941
5941
  var opts = options || {};
5942
5942
  if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) throw new TypeError('option "quoteStyle" must be "single" or "double"');
5943
- if (has(opts, 'maxStringLength') && ('number' == typeof opts.maxStringLength ? opts.maxStringLength < 0 && opts.maxStringLength !== 1 / 0 : null !== opts.maxStringLength)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
5943
+ if (has(opts, 'maxStringLength') && ('number' == typeof opts.maxStringLength ? opts.maxStringLength < 0 && 1 / 0 !== opts.maxStringLength : null !== opts.maxStringLength)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
5944
5944
  var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
5945
5945
  if ('boolean' != typeof customInspect && 'symbol' !== customInspect) throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
5946
5946
  if (has(opts, 'indent') && null !== opts.indent && '\t' !== opts.indent && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
@@ -6607,7 +6607,7 @@
6607
6607
  };
6608
6608
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
6609
6609
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
6610
- var limit = options.parameterLimit === 1 / 0 ? void 0 : options.parameterLimit;
6610
+ var limit = 1 / 0 === options.parameterLimit ? void 0 : options.parameterLimit;
6611
6611
  var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && void 0 !== limit ? limit + 1 : limit);
6612
6612
  if (options.throwOnLimitExceeded && void 0 !== limit && parts.length > limit) throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (1 === limit ? '' : 's') + ' allowed.');
6613
6613
  var skipIndex = -1;
@@ -11495,7 +11495,7 @@
11495
11495
  var client = __webpack_require__(5734);
11496
11496
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
11497
11497
  var package_namespaceObject = {
11498
- rE: "15.3.2"
11498
+ rE: "15.4.0"
11499
11499
  };
11500
11500
  function isAudioEnabled(options) {
11501
11501
  return Boolean(options.audio.enabled);
@@ -17789,6 +17789,7 @@
17789
17789
  userMedia;
17790
17790
  userMediaTimeout;
17791
17791
  retryTimeout;
17792
+ connectionTimeout;
17792
17793
  frameProgress;
17793
17794
  sampleProgress;
17794
17795
  canvas;
@@ -17801,6 +17802,7 @@
17801
17802
  stream;
17802
17803
  connecting = false;
17803
17804
  connected = false;
17805
+ connectionFailed = false;
17804
17806
  blocking = false;
17805
17807
  built = false;
17806
17808
  key;
@@ -17901,6 +17903,30 @@
17901
17903
  window.clearTimeout(this.retryTimeout);
17902
17904
  this.retryTimeout = void 0;
17903
17905
  }
17906
+ clearConnectionTimeout() {
17907
+ if (!this.connectionTimeout) return;
17908
+ this.options.logger.debug("Recorder: clearConnectionTimeout()");
17909
+ window.clearTimeout(this.connectionTimeout);
17910
+ this.connectionTimeout = void 0;
17911
+ }
17912
+ failConnection(params) {
17913
+ if (this.connectionFailed || this.connected || this.unloaded) return;
17914
+ this.connectionFailed = true;
17915
+ this.connecting = false;
17916
+ this.clearConnectionTimeout();
17917
+ if (this.stream) {
17918
+ this.stream.destroy();
17919
+ this.stream = void 0;
17920
+ }
17921
+ const err = error_createError({
17922
+ message: "Unable to connect to the server",
17923
+ explanation: params.explanation,
17924
+ options: this.options
17925
+ });
17926
+ this.emit("ERROR", {
17927
+ err
17928
+ });
17929
+ }
17904
17930
  calculateFrameProgress() {
17905
17931
  return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`;
17906
17932
  }
@@ -17972,6 +17998,7 @@
17972
17998
  initSocket(cb) {
17973
17999
  if (!this.connected) {
17974
18000
  this.connecting = true;
18001
+ this.connectionFailed = false;
17975
18002
  this.emit("CONNECTING");
17976
18003
  let url2Connect;
17977
18004
  try {
@@ -18026,16 +18053,27 @@
18026
18053
  });
18027
18054
  }
18028
18055
  if (this.stream) {
18029
- this.stream.on("close", (err)=>{
18056
+ const connectionTimeoutMs = this.options.timeouts.connection;
18057
+ this.connectionTimeout = window.setTimeout(()=>{
18058
+ this.failConnection({
18059
+ url2Connect,
18060
+ explanation: `The server at ${url2Connect} did not respond within ${connectionTimeoutMs}ms. Please check your internet connection and try again. If the problem persists, contact us.`
18061
+ });
18062
+ }, connectionTimeoutMs);
18063
+ this.stream.on("close", ()=>{
18030
18064
  this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`);
18065
+ const neverConnected = this.connecting && !this.connected;
18066
+ this.clearConnectionTimeout();
18031
18067
  this.connecting = this.connected = false;
18032
- if (err) this.emit("ERROR", {
18033
- err
18068
+ if (neverConnected) this.failConnection({
18069
+ url2Connect,
18070
+ explanation: `The connection to ${url2Connect} was refused or could not be reached. Please check your internet connection and try again. If the problem persists, contact us.`
18034
18071
  });
18035
18072
  else if (this.userMediaLoaded) this.initSocket();
18036
18073
  });
18037
18074
  this.stream.on("connect", ()=>{
18038
18075
  this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`);
18076
+ this.clearConnectionTimeout();
18039
18077
  const isClosing = this.stream?.socket.readyState === WebSocket.CLOSING;
18040
18078
  if (!this.connected && !isClosing && !this.unloaded) {
18041
18079
  this.connected = true;
@@ -18394,6 +18432,8 @@
18394
18432
  this.options.logger.debug(`Recorder: unload()${prettyCause}`);
18395
18433
  this.reset();
18396
18434
  this.clearUserMediaTimeout();
18435
+ this.clearConnectionTimeout();
18436
+ this.connecting = false;
18397
18437
  if (this.userMedia) this.userMedia.unloadRemainingEventListeners();
18398
18438
  if (this.submitting) ;
18399
18439
  else if (this.stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "15.3.2",
3
+ "version": "15.4.0",
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",
@@ -76,50 +76,50 @@
76
76
  "websocket-stream": "5.5.2"
77
77
  },
78
78
  "devDependencies": {
79
- "@chromatic-com/storybook": "5.3.0",
79
+ "@chromatic-com/storybook": "5.3.1",
80
80
  "@eslint/config-inspector": "3.4.0",
81
81
  "@eslint/js": "10.0.1",
82
82
  "@rsbuild/plugin-node-polyfill": "1.4.6",
83
83
  "@rsbuild/plugin-stylus": "2.0.1",
84
84
  "@rsdoctor/rspack-plugin": "1.6.3",
85
- "@rslib/core": "0.23.2",
86
- "@storybook/addon-a11y": "10.5.10",
87
- "@storybook/addon-docs": "10.5.10",
88
- "@storybook/addon-links": "10.5.10",
89
- "@storybook/html": "10.5.10",
85
+ "@rslib/core": "1.0.0",
86
+ "@storybook/addon-a11y": "10.6.0",
87
+ "@storybook/addon-docs": "10.6.0",
88
+ "@storybook/addon-links": "10.6.0",
89
+ "@storybook/html": "10.6.0",
90
90
  "@tsconfig/node26": "26.0.1",
91
91
  "@tsconfig/strictest": "2.0.8",
92
92
  "@types/defined": "1.0.2",
93
- "@types/node": "26.4.1",
93
+ "@types/node": "26.5.0",
94
94
  "@types/superagent": "8.1.11",
95
95
  "@types/ua-parser-js": "0.7.39",
96
96
  "@vitest/eslint-plugin": "1.6.27",
97
97
  "audit-ci": "7.1.0",
98
98
  "chromatic": "18.7.2",
99
99
  "cross-env": "10.1.0",
100
- "eslint": "10.9.1",
100
+ "eslint": "10.10.0",
101
101
  "eslint-import-resolver-typescript": "4.4.5",
102
102
  "eslint-plugin-de-morgan": "2.1.3",
103
103
  "eslint-plugin-depend": "1.5.0",
104
104
  "eslint-plugin-import-x": "4.17.1",
105
105
  "eslint-plugin-package-json": "1.8.0",
106
- "eslint-plugin-regexp": "3.2.0",
106
+ "eslint-plugin-regexp": "3.3.0",
107
107
  "eslint-plugin-simple-import-sort": "14.0.0",
108
108
  "globals": "17.12.0",
109
109
  "jsdom": "30.0.1",
110
110
  "msw": "2.15.0",
111
- "msw-storybook-addon": "2.0.7",
111
+ "msw-storybook-addon": "3.0.0",
112
112
  "prettier": "3.9.6",
113
113
  "prettier-plugin-curly": "0.4.1",
114
114
  "prettier-plugin-jsdoc": "1.8.1",
115
115
  "prettier-plugin-packagejson": "3.0.2",
116
116
  "prettier-plugin-sh": "0.19.0",
117
117
  "release-it": "21.0.2",
118
- "storybook": "10.5.10",
118
+ "storybook": "10.6.0",
119
119
  "storybook-html-rsbuild": "3.4.2",
120
120
  "type-fest": "5.9.0",
121
121
  "typescript": "6.0.3",
122
- "typescript-eslint": "8.69.0",
122
+ "typescript-eslint": "8.70.0",
123
123
  "vitest": "4.1.11"
124
124
  },
125
125
  "engines": {
File without changes