videomail-client 9.2.0 → 9.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "9.2.0",
3
+ "version": "9.2.2",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -112,7 +112,7 @@
112
112
  "prettier": "3.3.3",
113
113
  "prettier-plugin-curly": "0.2.2",
114
114
  "prettier-plugin-organize-imports": "4.0.0",
115
- "prettier-plugin-packagejson": "2.5.1",
115
+ "prettier-plugin-packagejson": "2.5.2",
116
116
  "prettier-plugin-sh": "0.14.0",
117
117
  "router": "1.3.8",
118
118
  "tape": "5.8.1",
@@ -0,0 +1,23 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>videomail-client examples</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
6
+ </head>
7
+ <body>
8
+ <h1>Attempt to get a snapshot of a non-existing videomail</h1>
9
+ <p>This is how error responses are processed:</p>
10
+ <div id="videomail"></div>
11
+ <pre><code id="error"></code></pre>
12
+ <script src="/js/videomail-client.js"></script>
13
+ <script>
14
+ var videomailClient = new VideomailClient.default();
15
+
16
+ // This showcases how the packError fn works
17
+ videomailClient.get("i do not exist", function (err, videomail) {
18
+ var errorEl = document.getElementById("error");
19
+ errorEl.innerHTML = JSON.stringify(err, null, 4);
20
+ });
21
+ </script>
22
+ </body>
23
+ </html>
@@ -499,6 +499,12 @@
499
499
  ><span class="size">2710</span><span class="date">2019-9-13 11:11:53</span></a
500
500
  >
501
501
  </li>
502
+ <li>
503
+ <a href="/error_handling.html" class="" title="error_handling.html"
504
+ ><span class="name">error_handling.html</span><span class="size">???</span
505
+ ><span class="date">???</span></a
506
+ >
507
+ </li>
502
508
  </ul>
503
509
  </div>
504
510
  </body>
@@ -17267,7 +17267,7 @@ function wrappy (fn, cb) {
17267
17267
  },{}],116:[function(_dereq_,module,exports){
17268
17268
  module.exports={
17269
17269
  "name": "videomail-client",
17270
- "version": "9.2.0",
17270
+ "version": "9.2.2",
17271
17271
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
17272
17272
  "keywords": [
17273
17273
  "webcam",
@@ -17379,7 +17379,7 @@ module.exports={
17379
17379
  "prettier": "3.3.3",
17380
17380
  "prettier-plugin-curly": "0.2.2",
17381
17381
  "prettier-plugin-organize-imports": "4.0.0",
17382
- "prettier-plugin-packagejson": "2.5.1",
17382
+ "prettier-plugin-packagejson": "2.5.2",
17383
17383
  "prettier-plugin-sh": "0.14.0",
17384
17384
  "router": "1.3.8",
17385
17385
  "tape": "5.8.1",
@@ -17775,6 +17775,7 @@ var _default = exports.default = {
17775
17775
  // the form checkbox name for sending myself a copy
17776
17776
 
17777
17777
  keyInputName: "videomail_key",
17778
+ parentKeyInputName: "videomail_parent_key",
17778
17779
  formId: null,
17779
17780
  // automatically detects form if any
17780
17781
  submitButtonId: null,
@@ -17921,23 +17922,37 @@ function _default(options) {
17921
17922
  }
17922
17923
  return videomail;
17923
17924
  }
17925
+ function setProperty(packedError, property, value) {
17926
+ Object.defineProperty(packedError, property, {
17927
+ value: value,
17928
+ enumerable: true,
17929
+ configurable: true,
17930
+ writable: true
17931
+ });
17932
+ }
17924
17933
  function packError(err, res) {
17925
17934
  if (res && res.body && res.body.error) {
17926
- // use the server generated text instead of the superagent's default text
17927
- err = res.body.error;
17928
- if (!err.message && res.text) {
17929
- err.message = res.text;
17930
- }
17935
+ var originalError = res.body.error;
17936
+ var packedError = new Error();
17937
+ setProperty(packedError, "name", originalError.name);
17938
+ setProperty(packedError, "message", originalError.message || res.statusText);
17939
+ setProperty(packedError, "cause", originalError.cause);
17940
+ setProperty(packedError, "status", originalError.status);
17941
+ setProperty(packedError, "code", originalError.code);
17942
+ setProperty(packedError, "errno", originalError.errno);
17943
+ setProperty(packedError, "details", originalError.details);
17944
+ setProperty(packedError, "stack", originalError.stack);
17945
+ return packedError;
17931
17946
  }
17932
17947
  return err;
17933
17948
  }
17934
17949
  function fetch(identifierName, identifierValue, cb) {
17935
17950
  var url = "".concat(options.baseUrl, "/videomail/").concat(identifierName, "/").concat(identifierValue, "/snapshot");
17936
17951
  var request = (0, _superagent.default)("get", url);
17937
- request.set("Accept", "application/json").set("Timezone-Id", timezoneId).set(_constants.default.SITE_NAME_LABEL, options.siteName).timeout(options.timeouts.connection).end(function (err, res) {
17938
- err = packError(err, res);
17952
+ request.type("json").set("Accept", "application/json").set("Timezone-Id", timezoneId).set(_constants.default.SITE_NAME_LABEL, options.siteName).timeout(options.timeouts.connection).end(function (err, res) {
17939
17953
  if (err) {
17940
- cb(err);
17954
+ var prettyError = packError(err, res);
17955
+ cb(prettyError);
17941
17956
  } else {
17942
17957
  var videomail = res.body ? res.body : null;
17943
17958
  cb(null, videomail);
@@ -17957,9 +17972,9 @@ function _default(options) {
17957
17972
  var request = (0, _superagent.default)(method, url);
17958
17973
  queryParams[_constants.default.SITE_NAME_LABEL] = options.siteName;
17959
17974
  request.query(queryParams).set("Timezone-Id", timezoneId).send(videomail).timeout(options.timeout).end(function (err, res) {
17960
- err = packError(err, res);
17961
17975
  if (err) {
17962
- cb(err);
17976
+ var prettyError = packError(err, res);
17977
+ cb(prettyError);
17963
17978
  } else {
17964
17979
  var returnedVideomail = res.body && res.body.videomail ? res.body.videomail : null;
17965
17980
  cb(null, returnedVideomail, res.body);
@@ -17978,9 +17993,9 @@ function _default(options) {
17978
17993
  var request = (0, _superagent.default)("post", url);
17979
17994
  queryParams[_constants.default.SITE_NAME_LABEL] = options.siteName;
17980
17995
  request.query(queryParams).send(err).timeout(options.timeout).end(function (err, res) {
17981
- err = packError(err, res);
17982
17996
  if (err) {
17983
- cb && cb(err);
17997
+ var prettyError = packError(err, res);
17998
+ cb && cb(prettyError);
17984
17999
  } else {
17985
18000
  cb && cb();
17986
18001
  }
@@ -18026,9 +18041,9 @@ function _default(options) {
18026
18041
  }
18027
18042
  if (formType) {
18028
18043
  _superagent.default.post(url).type(formType).set("Timezone-Id", timezoneId).send(formData).timeout(options.timeout).end(function (err, res) {
18029
- err = packError(err, res);
18030
18044
  if (err) {
18031
- cb(err);
18045
+ var prettyError = packError(err, res);
18046
+ cb(prettyError);
18032
18047
  } else {
18033
18048
  cb(null, res);
18034
18049
  }
@@ -19988,6 +20003,9 @@ var Container = function Container(options) {
19988
20003
  }
19989
20004
  this.addPlayerDimensions = function (videomail, element) {
19990
20005
  try {
20006
+ if (!videomail) {
20007
+ throw new Error("Videomail data is missing for attaching player dimensions");
20008
+ }
19991
20009
  videomail.playerHeight = self.calculateHeight({
19992
20010
  responsive: true,
19993
20011
  videoWidth: videomail.width,
@@ -20553,6 +20571,7 @@ var Form = function Form(container, formElement, options) {
20553
20571
  bcc: options.selectors.bccInputName,
20554
20572
  body: options.selectors.bodyInputName,
20555
20573
  key: options.selectors.keyInputName,
20574
+ parentKey: options.selectors.parentKeyInputName,
20556
20575
  sendCopy: options.selectors.sendCopyInputName
20557
20576
  };
20558
20577
  var transformedFormData = {};