videomail-client 10.0.4 → 10.0.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.
package/dist/index.cjs CHANGED
@@ -3907,7 +3907,6 @@ function __webpack_require__(moduleId) {
3907
3907
  VideomailError_define_property(VideomailError, "BROWSER_PROBLEM", "browser-problem");
3908
3908
  VideomailError_define_property(VideomailError, "WEBCAM_PROBLEM", "webcam-problem");
3909
3909
  VideomailError_define_property(VideomailError, "OVERCONSTRAINED", "OverconstrainedError");
3910
- VideomailError_define_property(VideomailError, "NOT_FOUND_ERROR", "NotFoundError");
3911
3910
  VideomailError_define_property(VideomailError, "NOT_READABLE_ERROR", "NotReadableError");
3912
3911
  VideomailError_define_property(VideomailError, "SECURITY_ERROR", "SecurityError");
3913
3912
  VideomailError_define_property(VideomailError, "TRACK_START_ERROR", "TrackStartError");
@@ -3915,30 +3914,18 @@ function __webpack_require__(moduleId) {
3915
3914
  /* ESM default export */ const error_VideomailError = VideomailError;
3916
3915
  function createError(errorParams) {
3917
3916
  const { exc, options } = errorParams;
3917
+ let err = errorParams.err;
3918
+ if (!err && exc instanceof Error) err = exc;
3919
+ if (err instanceof error_VideomailError) return err;
3918
3920
  let message = errorParams.message;
3919
3921
  let explanation = errorParams.explanation;
3920
- let err = errorParams.err;
3921
3922
  var _errorParams_classList;
3922
3923
  const classList = null !== (_errorParams_classList = errorParams.classList) && void 0 !== _errorParams_classList ? _errorParams_classList : [];
3923
- if (!err && exc instanceof Error) err = exc;
3924
- if (err instanceof error_VideomailError) return err;
3925
3924
  const audioEnabled = isAudioEnabled(options);
3926
3925
  const browser = getBrowser(options);
3927
- let errorCode;
3928
- let errType;
3929
- // whole code is ugly because all browsers behave so differently :(
3930
- if ("object" == typeof err) {
3931
- if ("code" in err) errorCode = err.code;
3932
- if (err.name === error_VideomailError.TRACK_START_ERROR) errType = error_VideomailError.TRACK_START_ERROR;
3933
- else if (err.name === error_VideomailError.SECURITY_ERROR) errType = error_VideomailError.SECURITY_ERROR;
3934
- else if (8 === errorCode && err.name === error_VideomailError.NOT_FOUND_ERROR) errType = error_VideomailError.NOT_FOUND_ERROR;
3935
- else if (35 === errorCode || err.name === error_VideomailError.NOT_ALLOWED_ERROR) // https://github.com/binarykitchen/videomail.io/issues/411
3936
- errType = error_VideomailError.NOT_ALLOWED_ERROR;
3937
- else if (err.constructor.name === error_VideomailError.DOM_EXCEPTION) errType = err.name === error_VideomailError.NOT_READABLE_ERROR ? error_VideomailError.NOT_READABLE_ERROR : error_VideomailError.DOM_EXCEPTION;
3938
- else if (err.constructor.name === error_VideomailError.OVERCONSTRAINED) errType = error_VideomailError.OVERCONSTRAINED;
3939
- else if (err.name) errType = err.name;
3940
- } else errType = err;
3941
- switch(errType){
3926
+ var _err_name;
3927
+ const errName = null !== (_err_name = null == err ? void 0 : err.name) && void 0 !== _err_name ? _err_name : null == err ? void 0 : err.constructor.name;
3928
+ switch(errName){
3942
3929
  case error_VideomailError.SECURITY_ERROR:
3943
3930
  message = "The operation was insecure";
3944
3931
  explanation = "Probably you have disallowed Cookies for this page?";
@@ -3956,7 +3943,6 @@ function __webpack_require__(moduleId) {
3956
3943
  message = "Source of your webcam cannot be accessed";
3957
3944
  explanation = "Probably it is locked from another process or has a hardware error.";
3958
3945
  break;
3959
- case error_VideomailError.NOT_FOUND_ERROR:
3960
3946
  case "NO_DEVICES_FOUND":
3961
3947
  if (audioEnabled) {
3962
3948
  message = "No webcam nor microphone found";
@@ -4012,31 +3998,8 @@ function __webpack_require__(moduleId) {
4012
3998
  classList.push(error_VideomailError.WEBCAM_PROBLEM);
4013
3999
  break;
4014
4000
  case error_VideomailError.DOM_EXCEPTION:
4015
- switch(errorCode){
4016
- case 8:
4017
- message = "Requested webcam not found";
4018
- explanation = "A webcam is needed but could not be found";
4019
- classList.push(error_VideomailError.WEBCAM_PROBLEM);
4020
- break;
4021
- case 9:
4022
- {
4023
- const newUrl = `https:${window.location.href.substring(window.location.protocol.length)}`;
4024
- message = "Security upgrade needed";
4025
- explanation = `Click <a href="${newUrl}">here</a> to switch to HTTPs which is more safe and enables encrypted videomail transfers.`;
4026
- classList.push(error_VideomailError.BROWSER_PROBLEM);
4027
- break;
4028
- }
4029
- case 11:
4030
- message = "Invalid State";
4031
- explanation = "The object is in an invalid, unusable state";
4032
- classList.push(error_VideomailError.BROWSER_PROBLEM);
4033
- break;
4034
- default:
4035
- message = "DOM Exception";
4036
- explanation = pretty(err);
4037
- classList.push(error_VideomailError.BROWSER_PROBLEM);
4038
- break;
4039
- }
4001
+ message = "DOM Exception";
4002
+ explanation = pretty(err);
4040
4003
  break;
4041
4004
  /*
4042
4005
  * Chrome has a weird problem where if you try to do a getUserMedia request too early, it
@@ -4056,12 +4019,11 @@ function __webpack_require__(moduleId) {
4056
4019
  /*
4057
4020
  * it can be that explanation itself is an error object
4058
4021
  * error objects can be prettified to undefined sometimes
4059
- */ if (!explanation && originalExplanation) // tried toString before but nah
4060
- explanation = `Inspected: ${originalExplanation}`;
4022
+ */ if (!explanation && originalExplanation) explanation = `Inspected: ${originalExplanation}`;
4061
4023
  if (!message && (null == err ? void 0 : err.message)) message = err.message;
4062
4024
  // for weird, undefined cases
4063
4025
  if (!message) {
4064
- if (errType) message = `${errType} (weird)`;
4026
+ if (errName) message = `${errName} (weird)`;
4065
4027
  if (!explanation) explanation = pretty(err);
4066
4028
  // avoid dupes
4067
4029
  if (pretty(message) === explanation) explanation = void 0;
@@ -4466,14 +4428,12 @@ function __webpack_require__(moduleId) {
4466
4428
  const body = response.body;
4467
4429
  if ("error" in body) {
4468
4430
  const message = body.error.message;
4469
- const name = body.error.name;
4470
- const stack = body.error.stack;
4471
4431
  const cause = body.error.cause;
4472
4432
  const error = new Error(message, {
4473
4433
  cause
4474
4434
  });
4475
- error.name = name;
4476
- error.stack = stack;
4435
+ if (body.error.name) error.name = body.error.name;
4436
+ if (body.error.stack) error.stack = body.error.stack;
4477
4437
  return error;
4478
4438
  }
4479
4439
  }
@@ -5811,7 +5771,7 @@ function __webpack_require__(moduleId) {
5811
5771
  const external_is_power_of_two_namespaceObject = require("is-power-of-two");
5812
5772
  var external_is_power_of_two_default = /*#__PURE__*/ __webpack_require__.n(external_is_power_of_two_namespaceObject);
5813
5773
  var package_namespaceObject = {
5814
- i8: "10.0.2"
5774
+ i8: "10.0.4"
5815
5775
  }; // CONCATENATED MODULE: ./src/types/env.ts
5816
5776
  // ... and these actually define the runtime mode of Node.js and are
5817
5777
  // set either in package.json, via Jest or in the Dockerfile
package/dist/index.js CHANGED
@@ -3807,7 +3807,6 @@ class VideomailError extends Error {
3807
3807
  static BROWSER_PROBLEM = "browser-problem";
3808
3808
  static WEBCAM_PROBLEM = "webcam-problem";
3809
3809
  static OVERCONSTRAINED = "OverconstrainedError";
3810
- static NOT_FOUND_ERROR = "NotFoundError";
3811
3810
  static NOT_READABLE_ERROR = "NotReadableError";
3812
3811
  static SECURITY_ERROR = "SecurityError";
3813
3812
  static TRACK_START_ERROR = "TrackStartError";
@@ -3854,29 +3853,16 @@ class VideomailError extends Error {
3854
3853
  /* ESM default export */ const error_VideomailError = VideomailError;
3855
3854
  function createError(errorParams) {
3856
3855
  const { exc, options } = errorParams;
3857
- let message = errorParams.message;
3858
- let explanation = errorParams.explanation;
3859
3856
  let err = errorParams.err;
3860
- const classList = errorParams.classList ?? [];
3861
3857
  if (!err && exc instanceof Error) err = exc;
3862
3858
  if (err instanceof error_VideomailError) return err;
3859
+ let message = errorParams.message;
3860
+ let explanation = errorParams.explanation;
3861
+ const classList = errorParams.classList ?? [];
3863
3862
  const audioEnabled = isAudioEnabled(options);
3864
3863
  const browser = getBrowser(options);
3865
- let errorCode;
3866
- let errType;
3867
- // whole code is ugly because all browsers behave so differently :(
3868
- if ("object" == typeof err) {
3869
- if ("code" in err) errorCode = err.code;
3870
- if (err.name === error_VideomailError.TRACK_START_ERROR) errType = error_VideomailError.TRACK_START_ERROR;
3871
- else if (err.name === error_VideomailError.SECURITY_ERROR) errType = error_VideomailError.SECURITY_ERROR;
3872
- else if (8 === errorCode && err.name === error_VideomailError.NOT_FOUND_ERROR) errType = error_VideomailError.NOT_FOUND_ERROR;
3873
- else if (35 === errorCode || err.name === error_VideomailError.NOT_ALLOWED_ERROR) // https://github.com/binarykitchen/videomail.io/issues/411
3874
- errType = error_VideomailError.NOT_ALLOWED_ERROR;
3875
- else if (err.constructor.name === error_VideomailError.DOM_EXCEPTION) errType = err.name === error_VideomailError.NOT_READABLE_ERROR ? error_VideomailError.NOT_READABLE_ERROR : error_VideomailError.DOM_EXCEPTION;
3876
- else if (err.constructor.name === error_VideomailError.OVERCONSTRAINED) errType = error_VideomailError.OVERCONSTRAINED;
3877
- else if (err.name) errType = err.name;
3878
- } else errType = err;
3879
- switch(errType){
3864
+ const errName = err?.name ?? err?.constructor.name;
3865
+ switch(errName){
3880
3866
  case error_VideomailError.SECURITY_ERROR:
3881
3867
  message = "The operation was insecure";
3882
3868
  explanation = "Probably you have disallowed Cookies for this page?";
@@ -3894,7 +3880,6 @@ function createError(errorParams) {
3894
3880
  message = "Source of your webcam cannot be accessed";
3895
3881
  explanation = "Probably it is locked from another process or has a hardware error.";
3896
3882
  break;
3897
- case error_VideomailError.NOT_FOUND_ERROR:
3898
3883
  case "NO_DEVICES_FOUND":
3899
3884
  if (audioEnabled) {
3900
3885
  message = "No webcam nor microphone found";
@@ -3950,31 +3935,8 @@ function createError(errorParams) {
3950
3935
  classList.push(error_VideomailError.WEBCAM_PROBLEM);
3951
3936
  break;
3952
3937
  case error_VideomailError.DOM_EXCEPTION:
3953
- switch(errorCode){
3954
- case 8:
3955
- message = "Requested webcam not found";
3956
- explanation = "A webcam is needed but could not be found";
3957
- classList.push(error_VideomailError.WEBCAM_PROBLEM);
3958
- break;
3959
- case 9:
3960
- {
3961
- const newUrl = `https:${window.location.href.substring(window.location.protocol.length)}`;
3962
- message = "Security upgrade needed";
3963
- explanation = `Click <a href="${newUrl}">here</a> to switch to HTTPs which is more safe and enables encrypted videomail transfers.`;
3964
- classList.push(error_VideomailError.BROWSER_PROBLEM);
3965
- break;
3966
- }
3967
- case 11:
3968
- message = "Invalid State";
3969
- explanation = "The object is in an invalid, unusable state";
3970
- classList.push(error_VideomailError.BROWSER_PROBLEM);
3971
- break;
3972
- default:
3973
- message = "DOM Exception";
3974
- explanation = pretty(err);
3975
- classList.push(error_VideomailError.BROWSER_PROBLEM);
3976
- break;
3977
- }
3938
+ message = "DOM Exception";
3939
+ explanation = pretty(err);
3978
3940
  break;
3979
3941
  /*
3980
3942
  * Chrome has a weird problem where if you try to do a getUserMedia request too early, it
@@ -3994,12 +3956,11 @@ function createError(errorParams) {
3994
3956
  /*
3995
3957
  * it can be that explanation itself is an error object
3996
3958
  * error objects can be prettified to undefined sometimes
3997
- */ if (!explanation && originalExplanation) // tried toString before but nah
3998
- explanation = `Inspected: ${originalExplanation}`;
3959
+ */ if (!explanation && originalExplanation) explanation = `Inspected: ${originalExplanation}`;
3999
3960
  if (!message && err?.message) message = err.message;
4000
3961
  // for weird, undefined cases
4001
3962
  if (!message) {
4002
- if (errType) message = `${errType} (weird)`;
3963
+ if (errName) message = `${errName} (weird)`;
4003
3964
  if (!explanation) explanation = pretty(err);
4004
3965
  // avoid dupes
4005
3966
  if (pretty(message) === explanation) explanation = void 0;
@@ -4368,14 +4329,12 @@ function findOriginalExc(exc) {
4368
4329
  const body = response.body;
4369
4330
  if ("error" in body) {
4370
4331
  const message = body.error.message;
4371
- const name = body.error.name;
4372
- const stack = body.error.stack;
4373
4332
  const cause = body.error.cause;
4374
4333
  const error = new Error(message, {
4375
4334
  cause
4376
4335
  });
4377
- error.name = name;
4378
- error.stack = stack;
4336
+ if (body.error.name) error.name = body.error.name;
4337
+ if (body.error.stack) error.stack = body.error.stack;
4379
4338
  return error;
4380
4339
  }
4381
4340
  }
@@ -5596,7 +5555,7 @@ function isPromise_isPromise(anything) {
5596
5555
  }
5597
5556
  /* ESM default export */ const isPromise = isPromise_isPromise;
5598
5557
  var package_namespaceObject = {
5599
- i8: "10.0.2"
5558
+ i8: "10.0.4"
5600
5559
  }; // CONCATENATED MODULE: ./src/types/env.ts
5601
5560
  // ... and these actually define the runtime mode of Node.js and are
5602
5561
  // set either in package.json, via Jest or in the Dockerfile
@@ -31,7 +31,6 @@ declare class VideomailError extends Error {
31
31
  static readonly BROWSER_PROBLEM = "browser-problem";
32
32
  static readonly WEBCAM_PROBLEM = "webcam-problem";
33
33
  static readonly OVERCONSTRAINED = "OverconstrainedError";
34
- static readonly NOT_FOUND_ERROR = "NotFoundError";
35
34
  static readonly NOT_READABLE_ERROR = "NotReadableError";
36
35
  static readonly SECURITY_ERROR = "SecurityError";
37
36
  static readonly TRACK_START_ERROR = "TrackStartError";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "10.0.4",
3
+ "version": "10.0.5",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -105,7 +105,7 @@
105
105
  "eslint-plugin-storybook": "0.11.0",
106
106
  "globals": "15.12.0",
107
107
  "jsdom": "25.0.1",
108
- "msw": "2.6.4",
108
+ "msw": "2.6.5",
109
109
  "msw-storybook-addon": "2.0.4",
110
110
  "prettier": "3.3.3",
111
111
  "prettier-plugin-curly": "0.3.1",