videomail-client 9.1.18 → 9.2.1

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.1.18",
3
+ "version": "9.2.1",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -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.1.18",
17270
+ "version": "9.2.1",
17271
17271
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
17272
17272
  "keywords": [
17273
17273
  "webcam",
@@ -17519,8 +17519,22 @@ var VideomailClient = function VideomailClient(options) {
17519
17519
  this.hide = function () {
17520
17520
  container.hide();
17521
17521
  };
17522
- this.get = function (alias, cb) {
17523
- new _resource.default(localOptions).get(alias, function (err, videomail) {
17522
+ this.getByAlias = function (alias, cb) {
17523
+ var resource = new _resource.default(localOptions);
17524
+ resource.getByAlias(alias, function (err, videomail) {
17525
+ if (err) {
17526
+ cb(err);
17527
+ } else {
17528
+ cb(null, container.addPlayerDimensions(videomail));
17529
+ }
17530
+ });
17531
+ };
17532
+
17533
+ // Shim, backward compat
17534
+ this.get = this.getByAlias;
17535
+ this.getByKey = function (key, cb) {
17536
+ var resource = new _resource.default(localOptions);
17537
+ resource.getByKey(key, function (err, videomail) {
17524
17538
  if (err) {
17525
17539
  cb(err);
17526
17540
  } else {
@@ -17697,8 +17711,6 @@ var _default = exports.default = {
17697
17711
  // leave as it, permanent websocket url to send frames
17698
17712
  siteName: "videomail-client-demo",
17699
17713
  // Required for API, use https://videomail.io/whitelist
17700
- cache: true,
17701
- // reduces GET queries when loading videos
17702
17714
  insertCss: true,
17703
17715
  // inserts predefined CSS, see examples
17704
17716
  enablePause: true,
@@ -17764,7 +17776,6 @@ var _default = exports.default = {
17764
17776
 
17765
17777
  keyInputName: "videomail_key",
17766
17778
  parentKeyInputName: "videomail_parent_key",
17767
- aliasInputName: "videomail_alias",
17768
17779
  formId: null,
17769
17780
  // automatically detects form if any
17770
17781
  submitButtonId: null,
@@ -17892,10 +17903,8 @@ Object.defineProperty(exports, "__esModule", {
17892
17903
  exports.default = _default;
17893
17904
  var _superagent = _interopRequireDefault(_dereq_("superagent"));
17894
17905
  var _constants = _interopRequireDefault(_dereq_("./constants"));
17895
- var CACHE_KEY = "alias";
17896
17906
  var timezoneId = Intl.DateTimeFormat().resolvedOptions().timeZone;
17897
17907
  function _default(options) {
17898
- var cache = {};
17899
17908
  function applyDefaultValue(videomail, name) {
17900
17909
  if (options.defaults[name] && !videomail[name]) {
17901
17910
  videomail[name] = options.defaults[name];
@@ -17923,8 +17932,8 @@ function _default(options) {
17923
17932
  }
17924
17933
  return err;
17925
17934
  }
17926
- function fetch(alias, cb) {
17927
- var url = "".concat(options.baseUrl, "/videomail/").concat(alias, "/snapshot");
17935
+ function fetch(identifierName, identifierValue, cb) {
17936
+ var url = "".concat(options.baseUrl, "/videomail/").concat(identifierName, "/").concat(identifierValue, "/snapshot");
17928
17937
  var request = (0, _superagent.default)("get", url);
17929
17938
  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) {
17930
17939
  err = packError(err, res);
@@ -17932,9 +17941,6 @@ function _default(options) {
17932
17941
  cb(err);
17933
17942
  } else {
17934
17943
  var videomail = res.body ? res.body : null;
17935
- if (options.cache) {
17936
- cache[CACHE_KEY] = videomail;
17937
- }
17938
17944
  cb(null, videomail);
17939
17945
  }
17940
17946
  });
@@ -17957,22 +17963,15 @@ function _default(options) {
17957
17963
  cb(err);
17958
17964
  } else {
17959
17965
  var returnedVideomail = res.body && res.body.videomail ? res.body.videomail : null;
17960
- if (options.cache && videomail[CACHE_KEY]) {
17961
- cache[videomail[CACHE_KEY]] = returnedVideomail;
17962
- }
17963
17966
  cb(null, returnedVideomail, res.body);
17964
17967
  }
17965
17968
  });
17966
17969
  }
17967
- this.get = function (alias, cb) {
17968
- if (options.cache && cache[alias]) {
17969
- // keep all callbacks async
17970
- setTimeout(function () {
17971
- cb(null, cache[alias]);
17972
- }, 0);
17973
- } else {
17974
- fetch(alias, cb);
17975
- }
17970
+ this.getByAlias = function (alias, cb) {
17971
+ fetch("alias", alias, cb);
17972
+ };
17973
+ this.getByKey = function (key, cb) {
17974
+ fetch("key", key, cb);
17976
17975
  };
17977
17976
  this.reportError = function (err, cb) {
17978
17977
  var queryParams = {};
@@ -19953,8 +19952,6 @@ var Container = function Container(options) {
19953
19952
 
19954
19953
  // can be missing when no videomail was recorded and is not required
19955
19954
  if (videomailResponse) {
19956
- formData[options.selectors.aliasInputName] = videomailResponse.videomail.alias;
19957
-
19958
19955
  /*
19959
19956
  * this in case if user wants all videomail metadata to be posted
19960
19957
  * altogether with the remaining form
@@ -20204,7 +20201,7 @@ var Container = function Container(options) {
20204
20201
  if (valid) {
20205
20202
  if (!areVisualsHidden() && !visualsValid) {
20206
20203
  // TODO Improve this check to have this based on `key`
20207
- if (submitted || buttonsAreReady() || self.isRecording() || self.isPaused() || self.isCountingDown()) {
20204
+ if (buttonsAreReady() || self.isRecording() || self.isPaused() || self.isCountingDown()) {
20208
20205
  valid = false;
20209
20206
  }
20210
20207
  if (!valid) {
@@ -20301,7 +20298,7 @@ var Container = function Container(options) {
20301
20298
  return method && method.toUpperCase() === "PUT";
20302
20299
  }
20303
20300
  this.submitAll = function (formData, method, url) {
20304
- debug("Container: submitAll(".concat(method, " ").concat(url, ")"));
20301
+ debug("Container: submitAll(".concat(method, ": ").concat(url, ")"));
20305
20302
  var post = isPost(method);
20306
20303
  var hasVideomailKey = Boolean(formData[options.selectors.keyInputName]);
20307
20304
  function startSubmission() {