videomail-client 9.2.13 → 9.2.15

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.13",
3
+ "version": "9.2.15",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -29,6 +29,8 @@
29
29
  <form action="/contact" method="post" id="someForm">
30
30
  <input name="from" type="email" placeholder="Enter your email address" required />
31
31
  <input name="subject" type="text" placeholder="Enter a subject" required />
32
+ <!-- Just for testing the isRegisteredFormField function, not relevant -->
33
+ <input name="phone" type="text" placeholder="Enter a phone number" />
32
34
  <fieldset>
33
35
  <legend>How do you want to contact us?</legend>
34
36
  <p>
@@ -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.13",
17270
+ "version": "9.2.15",
17271
17271
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
17272
17272
  "keywords": [
17273
17273
  "webcam",
@@ -18257,7 +18257,6 @@ var Browser = function Browser(options) {
18257
18257
  var osVersion = parseFloat(uaParser.os.version);
18258
18258
  var isWindows = uaParser.os.name === "Windows";
18259
18259
  var isEdge = uaParser.browser.name === "Edge" || isWindows && osVersion >= 10;
18260
- var isIE = /IE/.test(uaParser.browser.name);
18261
18260
  var isSafari = /Safari/.test(uaParser.browser.name);
18262
18261
  var isOpera = /Opera/.test(uaParser.browser.name);
18263
18262
  var isAndroid = /Android/.test(uaParser.os.name);
@@ -18289,8 +18288,6 @@ var Browser = function Browser(options) {
18289
18288
  }
18290
18289
  } else if (isChromium) {
18291
18290
  warning = "Probably you need to <a href=\"".concat(chromiumDownload, "\" target=\"_blank\">") + "upgrade Chromium</a> to fix this.";
18292
- } else if (isIE) {
18293
- warning = "Instead of Internet Explorer you need to upgrade to" + " <a href=\"".concat(edgeDownload, "\" target=\"_blank\">Edge</a>.");
18294
18291
  } else if (isOkSafari) {
18295
18292
  warning = "Probably you need to shut down Safari and restart it, this for correct webcam access.";
18296
18293
  } else if (isSafari) {
@@ -19875,6 +19872,8 @@ var Container = function Container(options) {
19875
19872
  if (options.enableAutoUnload) {
19876
19873
  window.addEventListener("beforeunload", function (e) {
19877
19874
  self.unload(e);
19875
+ }, {
19876
+ once: true
19878
19877
  });
19879
19878
  }
19880
19879
  if (!playerOnly) {
@@ -20617,6 +20616,17 @@ var Form = function Form(container, formElement, options) {
20617
20616
  _eventEmitter.default.call(this, options, "Form");
20618
20617
  var debug = options.debug;
20619
20618
  var self = this;
20619
+ var FORM_FIELDS = {
20620
+ subject: options.selectors.subjectInputName,
20621
+ from: options.selectors.fromInputName,
20622
+ to: options.selectors.toInputName,
20623
+ cc: options.selectors.ccInputName,
20624
+ bcc: options.selectors.bccInputName,
20625
+ body: options.selectors.bodyInputName,
20626
+ key: options.selectors.keyInputName,
20627
+ parentKey: options.selectors.parentKeyInputName,
20628
+ sendCopy: options.selectors.sendCopyInputName
20629
+ };
20620
20630
  var keyInput;
20621
20631
  function getData() {
20622
20632
  return (0, _getFormData.default)(formElement, {
@@ -20624,17 +20634,6 @@ var Form = function Form(container, formElement, options) {
20624
20634
  });
20625
20635
  }
20626
20636
  this.transformFormData = function (formData) {
20627
- var FORM_FIELDS = {
20628
- subject: options.selectors.subjectInputName,
20629
- from: options.selectors.fromInputName,
20630
- to: options.selectors.toInputName,
20631
- cc: options.selectors.ccInputName,
20632
- bcc: options.selectors.bccInputName,
20633
- body: options.selectors.bodyInputName,
20634
- key: options.selectors.keyInputName,
20635
- parentKey: options.selectors.parentKeyInputName,
20636
- sendCopy: options.selectors.sendCopyInputName
20637
- };
20638
20637
  var transformedFormData = {};
20639
20638
  Object.keys(FORM_FIELDS).forEach(function (key) {
20640
20639
  var formFieldValue = FORM_FIELDS[key];
@@ -20710,11 +20709,22 @@ var Form = function Form(container, formElement, options) {
20710
20709
  }
20711
20710
  (0, _hidden.default)(formElement, true);
20712
20711
  }
20713
- function getInputElements() {
20714
- return formElement.querySelectorAll("input, textarea");
20715
- }
20716
- function getSelectElements() {
20717
- return formElement.querySelectorAll("select");
20712
+ function isRegisteredFormField(formElement) {
20713
+ var formElementName = formElement.name;
20714
+ var registeredFormFieldNames = Object.values(FORM_FIELDS);
20715
+ var isRegistered = registeredFormFieldNames.includes(formElementName);
20716
+ return isRegistered;
20717
+ }
20718
+ function getRegisteredFormElements() {
20719
+ var elements = formElement.querySelectorAll("input, textarea, select");
20720
+ var registeredElements = [];
20721
+ for (var i = 0; i < elements.length; i++) {
20722
+ var element = elements[i];
20723
+ if (isRegisteredFormField(element)) {
20724
+ registeredElements.push(element);
20725
+ }
20726
+ }
20727
+ return registeredElements;
20718
20728
  }
20719
20729
  this.disable = function (buttonsToo) {
20720
20730
  setDisabled(true, buttonsToo);
@@ -20722,45 +20732,27 @@ var Form = function Form(container, formElement, options) {
20722
20732
  this.enable = function (buttonsToo) {
20723
20733
  setDisabled(false, buttonsToo);
20724
20734
  };
20725
- function removeAllInputListeners() {
20726
- var inputElements = getInputElements();
20727
- for (var i = 0, len = inputElements.length; i < len; i++) {
20728
- var inputElement = inputElements[i];
20729
- if (inputElement.type === "radio") {
20730
- inputElement.removeEventListener("change", container.validate);
20731
- } else {
20732
- inputElement.removeEventListener("input", container.validate);
20733
- }
20734
- }
20735
- var selectElements = getSelectElements();
20736
- for (var j = 0, len2 = selectElements.length; j < len2; j++) {
20737
- selectElements[j].removeEventListener("change", container.validate);
20738
- }
20739
- }
20740
20735
  this.build = function () {
20741
20736
  debug("Form: build()");
20737
+ keyInput = formElement.querySelector("input[name=\"".concat(options.selectors.keyInputName, "\"]"));
20738
+ if (!keyInput) {
20739
+ keyInput = (0, _hyperscript.default)("input", {
20740
+ name: options.selectors.keyInputName,
20741
+ type: "hidden"
20742
+ });
20743
+ formElement.appendChild(keyInput);
20744
+ }
20742
20745
  if (options.enableAutoValidation) {
20743
- var inputElements = getInputElements();
20746
+ var inputElements = getRegisteredFormElements();
20744
20747
  for (var i = 0, len = inputElements.length; i < len; i++) {
20745
20748
  var inputElement = inputElements[i];
20746
- if (inputElement.type === "radio") {
20749
+ var type = inputElement.type;
20750
+ if (type === "radio" || type === "select") {
20747
20751
  inputElement.addEventListener("change", container.validate);
20748
20752
  } else {
20749
20753
  inputElement.addEventListener("input", container.validate);
20750
20754
  }
20751
20755
  }
20752
- var selectElements = getSelectElements();
20753
- for (var j = 0, len2 = selectElements.length; j < len2; j++) {
20754
- selectElements[j].addEventListener("change", container.validate);
20755
- }
20756
- }
20757
- keyInput = formElement.querySelector("input[name=\"".concat(options.selectors.keyInputName, "\"]"));
20758
- if (!keyInput) {
20759
- keyInput = (0, _hyperscript.default)("input", {
20760
- name: options.selectors.keyInputName,
20761
- type: "hidden"
20762
- });
20763
- formElement.appendChild(keyInput);
20764
20756
  }
20765
20757
  this.on(_events.default.PREVIEW, function (videomailKey) {
20766
20758
  /*
@@ -20813,6 +20805,18 @@ var Form = function Form(container, formElement, options) {
20813
20805
  startListeningToSubmitEvents();
20814
20806
  });
20815
20807
  };
20808
+ function removeAllInputListeners() {
20809
+ var inputElements = getRegisteredFormElements();
20810
+ for (var i = 0, len = inputElements.length; i < len; i++) {
20811
+ var inputElement = inputElements[i];
20812
+ var type = inputElement.type;
20813
+ if (type === "radio" || type === "select") {
20814
+ inputElement.removeEventListener("change", container.validate);
20815
+ } else {
20816
+ inputElement.removeEventListener("input", container.validate);
20817
+ }
20818
+ }
20819
+ }
20816
20820
  function hideSubmitButton() {
20817
20821
  var submitButton = self.findSubmitButton();
20818
20822
  (0, _hidden.default)(submitButton, true);
@@ -20849,20 +20853,13 @@ var Form = function Form(container, formElement, options) {
20849
20853
  return false; // important to stop submission
20850
20854
  };
20851
20855
  this.getInvalidElement = function () {
20852
- var inputElements = getInputElements();
20856
+ var inputElements = getRegisteredFormElements();
20853
20857
  var i = 0;
20854
20858
  for (var len = inputElements.length; i < len; i++) {
20855
20859
  if (!inputElements[i].validity.valid) {
20856
20860
  return inputElements[i];
20857
20861
  }
20858
20862
  }
20859
- var selectElements = getSelectElements();
20860
- var j = 0;
20861
- for (var len2 = selectElements.length; j < len2; j++) {
20862
- if (!selectElements[j].validity.valid) {
20863
- return selectElements[j];
20864
- }
20865
- }
20866
20863
  return null;
20867
20864
  };
20868
20865
  this.validate = function () {
@@ -23261,12 +23258,16 @@ var Replay = function Replay(parentElement, options) {
23261
23258
  // this forces to actually fetch the videos from the server
23262
23259
  replayElement.load();
23263
23260
  if (!videomail) {
23264
- replayElement.addEventListener("canplaythrough", function (event) {
23265
- self.emit(_events.default.PREVIEW_SHOWN, event);
23261
+ replayElement.addEventListener("canplaythrough", function () {
23262
+ self.emit(_events.default.PREVIEW_SHOWN);
23263
+ }, {
23264
+ once: true
23266
23265
  });
23267
23266
  } else {
23268
- replayElement.addEventListener("canplaythrough", function (event) {
23269
- self.emit(_events.default.REPLAY_SHOWN, event);
23267
+ replayElement.addEventListener("canplaythrough", function () {
23268
+ self.emit(_events.default.REPLAY_SHOWN);
23269
+ }, {
23270
+ once: true
23270
23271
  });
23271
23272
  }
23272
23273
  };