videomail-client 5.2.2 → 5.3.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.
package/README.md CHANGED
@@ -39,7 +39,7 @@ To run the prototype full of examples in your browser with Gulp, just do:
39
39
  2. `npm run watch` to ignite a static server and
40
40
  3. open `https://localhost:8443` in your browser
41
41
 
42
- Best is to study `/prototype/contact_form_json.html` which demonstrates how easy it is to integrate the videomail client into your own contact form.
42
+ Best is to study `/prototype/contact_form.html` which demonstrates how easy it is to integrate the videomail client into your own contact form.
43
43
 
44
44
  Beware that all _must run over HTTPs_. Google Chrome and soon other browsers won't allow the use of `getUserMedia()` on insecure origins.
45
45
 
package/TODO.md CHANGED
@@ -1,13 +1,14 @@
1
1
  ### TODOs
2
2
  | Filename | line # | TODO
3
3
  |:------|:------:|:------
4
- | src/js/wrappers/container.js | 334 | figure out how to fire dom's onload event again
5
- | src/js/wrappers/container.js | 335 | or how to run all the scripts over again
6
- | src/js/wrappers/optionsWrapper.js | 27 | fix this, it's not really an option
7
4
  | src/js/util/audioRecorder.js | 11 | code needs rewrite
8
5
  | src/js/util/eventEmitter.js | 6 | MAKE EVENT EMITTING IN DESPOT NOT GLOBAL BUT BY CONTAINER ID INSTEAD
9
6
  | src/js/util/eventEmitter.js | 43 | have this emitted through a configuration because it is pretty noisy
10
7
  | src/js/util/humanize.js | 4 | get rid of this class and use those imports directly
8
+ | src/js/wrappers/container.js | 293 | figure out how to fire dom's onload event again
9
+ | src/js/wrappers/container.js | 294 | or how to run all the scripts over again
10
+ | src/js/wrappers/container.js | 576 | CONTINUE FROM HERE, MAKE VALIDATION CLEVER WHEN AUTOMATIC SO THAT IT REQUIRES AT
11
+ | src/js/wrappers/optionsWrapper.js | 27 | fix this, it's not really an option
11
12
  | src/js/wrappers/visuals/recorder.js | 582 | in https://github.com/binarykitchen/videomail-client/issues/142
12
13
  | src/js/wrappers/visuals/recorder.js | 619 | retry with navigator.getUserMedia_() maybe?
13
14
  | src/js/wrappers/visuals/recorder.js | 759 | commented out because for some reasons server does
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "5.2.2",
3
+ "version": "5.3.0",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "author": "Michael Heuberger <michael.heuberger@binarykitchen.com>",
6
6
  "contributors": [
@@ -65,7 +65,7 @@
65
65
  "canvas-to-buffer": "2.0.0",
66
66
  "classlist.js": "1.1.20150312",
67
67
  "contains": "0.1.1",
68
- "core-js": "3.26.0",
68
+ "core-js": "3.26.1",
69
69
  "create-error": "0.3.1",
70
70
  "deepmerge": "4.2.2",
71
71
  "defined": "1.0.1",
@@ -102,7 +102,7 @@
102
102
  "connect-send-json": "1.0.0",
103
103
  "cssnano": "5.1.14",
104
104
  "del": "6.1.1",
105
- "eslint": "8.27.0",
105
+ "eslint": "8.28.0",
106
106
  "eslint-config-prettier": "8.5.0",
107
107
  "eslint-plugin-import": "2.26.0",
108
108
  "eslint-plugin-node": "11.1.0",
@@ -454,9 +454,9 @@
454
454
  >
455
455
  </li>
456
456
  <li>
457
- <a href="/with_time_control.html" class="" title="with_time_control.html"
458
- ><span class="name">with_time_control.html</span><span class="size">904</span
459
- ><span class="date">2022-9-22 11:11:53</span></a
457
+ <a href="/with_cc_and_bcc.html" class="" title="with_cc_and_bcc.html"
458
+ ><span class="name">with_cc_and_bcc.html</span><span class="size">1104</span
459
+ ><span class="date">2022-11-15 11:11:53</span></a
460
460
  >
461
461
  </li>
462
462
  <li>
@@ -4344,16 +4344,16 @@ module.exports = function (exec, SKIP_CLOSING) {
4344
4344
  };
4345
4345
 
4346
4346
  },{"../internals/well-known-symbol":197}],47:[function(_dereq_,module,exports){
4347
- var uncurryThisRaw = _dereq_('../internals/function-uncurry-this-raw');
4347
+ var uncurryThis = _dereq_('../internals/function-uncurry-this');
4348
4348
 
4349
- var toString = uncurryThisRaw({}.toString);
4350
- var stringSlice = uncurryThisRaw(''.slice);
4349
+ var toString = uncurryThis({}.toString);
4350
+ var stringSlice = uncurryThis(''.slice);
4351
4351
 
4352
4352
  module.exports = function (it) {
4353
4353
  return stringSlice(toString(it), 8, -1);
4354
4354
  };
4355
4355
 
4356
- },{"../internals/function-uncurry-this-raw":86}],48:[function(_dereq_,module,exports){
4356
+ },{"../internals/function-uncurry-this":87}],48:[function(_dereq_,module,exports){
4357
4357
  var TO_STRING_TAG_SUPPORT = _dereq_('../internals/to-string-tag-support');
4358
4358
  var isCallable = _dereq_('../internals/is-callable');
4359
4359
  var classofRaw = _dereq_('../internals/classof-raw');
@@ -4779,7 +4779,7 @@ module.exports = function (exec) {
4779
4779
  'use strict';
4780
4780
  // TODO: Remove from `core-js@4` since it's moved to entry points
4781
4781
  _dereq_('../modules/es.regexp.exec');
4782
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
4782
+ var uncurryThis = _dereq_('../internals/function-uncurry-this-clause');
4783
4783
  var defineBuiltIn = _dereq_('../internals/define-built-in');
4784
4784
  var regexpExec = _dereq_('../internals/regexp-exec');
4785
4785
  var fails = _dereq_('../internals/fails');
@@ -4851,7 +4851,7 @@ module.exports = function (KEY, exec, FORCED, SHAM) {
4851
4851
  if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
4852
4852
  };
4853
4853
 
4854
- },{"../internals/create-non-enumerable-property":52,"../internals/define-built-in":56,"../internals/fails":79,"../internals/function-uncurry-this":87,"../internals/regexp-exec":152,"../internals/well-known-symbol":197,"../modules/es.regexp.exec":221}],81:[function(_dereq_,module,exports){
4854
+ },{"../internals/create-non-enumerable-property":52,"../internals/define-built-in":56,"../internals/fails":79,"../internals/function-uncurry-this-clause":86,"../internals/regexp-exec":152,"../internals/well-known-symbol":197,"../modules/es.regexp.exec":221}],81:[function(_dereq_,module,exports){
4855
4855
  var NATIVE_BIND = _dereq_('../internals/function-bind-native');
4856
4856
 
4857
4857
  var FunctionPrototype = Function.prototype;
@@ -4864,7 +4864,7 @@ module.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? c
4864
4864
  });
4865
4865
 
4866
4866
  },{"../internals/function-bind-native":83}],82:[function(_dereq_,module,exports){
4867
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
4867
+ var uncurryThis = _dereq_('../internals/function-uncurry-this-clause');
4868
4868
  var aCallable = _dereq_('../internals/a-callable');
4869
4869
  var NATIVE_BIND = _dereq_('../internals/function-bind-native');
4870
4870
 
@@ -4878,7 +4878,7 @@ module.exports = function (fn, that) {
4878
4878
  };
4879
4879
  };
4880
4880
 
4881
- },{"../internals/a-callable":19,"../internals/function-bind-native":83,"../internals/function-uncurry-this":87}],83:[function(_dereq_,module,exports){
4881
+ },{"../internals/a-callable":19,"../internals/function-bind-native":83,"../internals/function-uncurry-this-clause":86}],83:[function(_dereq_,module,exports){
4882
4882
  var fails = _dereq_('../internals/fails');
4883
4883
 
4884
4884
  module.exports = !fails(function () {
@@ -4917,6 +4917,17 @@ module.exports = {
4917
4917
  };
4918
4918
 
4919
4919
  },{"../internals/descriptors":60,"../internals/has-own-property":94}],86:[function(_dereq_,module,exports){
4920
+ var classofRaw = _dereq_('../internals/classof-raw');
4921
+ var uncurryThis = _dereq_('../internals/function-uncurry-this');
4922
+
4923
+ module.exports = function (fn) {
4924
+ // Nashorn bug:
4925
+ // https://github.com/zloirock/core-js/issues/1128
4926
+ // https://github.com/zloirock/core-js/issues/1130
4927
+ if (classofRaw(fn) === 'Function') return uncurryThis(fn);
4928
+ };
4929
+
4930
+ },{"../internals/classof-raw":47,"../internals/function-uncurry-this":87}],87:[function(_dereq_,module,exports){
4920
4931
  var NATIVE_BIND = _dereq_('../internals/function-bind-native');
4921
4932
 
4922
4933
  var FunctionPrototype = Function.prototype;
@@ -4929,18 +4940,7 @@ module.exports = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
4929
4940
  };
4930
4941
  };
4931
4942
 
4932
- },{"../internals/function-bind-native":83}],87:[function(_dereq_,module,exports){
4933
- var classofRaw = _dereq_('../internals/classof-raw');
4934
- var uncurryThisRaw = _dereq_('../internals/function-uncurry-this-raw');
4935
-
4936
- module.exports = function (fn) {
4937
- // Nashorn bug:
4938
- // https://github.com/zloirock/core-js/issues/1128
4939
- // https://github.com/zloirock/core-js/issues/1130
4940
- if (classofRaw(fn) === 'Function') return uncurryThisRaw(fn);
4941
- };
4942
-
4943
- },{"../internals/classof-raw":47,"../internals/function-uncurry-this-raw":86}],88:[function(_dereq_,module,exports){
4943
+ },{"../internals/function-bind-native":83}],88:[function(_dereq_,module,exports){
4944
4944
  var global = _dereq_('../internals/global');
4945
4945
  var isCallable = _dereq_('../internals/is-callable');
4946
4946
 
@@ -6842,10 +6842,10 @@ var store = _dereq_('../internals/shared-store');
6842
6842
  (module.exports = function (key, value) {
6843
6843
  return store[key] || (store[key] = value !== undefined ? value : {});
6844
6844
  })('versions', []).push({
6845
- version: '3.26.0',
6845
+ version: '3.26.1',
6846
6846
  mode: IS_PURE ? 'pure' : 'global',
6847
6847
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
6848
- license: 'https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE',
6848
+ license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
6849
6849
  source: 'https://github.com/zloirock/core-js'
6850
6850
  });
6851
6851
 
@@ -7925,7 +7925,7 @@ setSpecies(ARRAY_BUFFER);
7925
7925
  },{"../internals/array-buffer":28,"../internals/export":78,"../internals/global":93,"../internals/set-species":159}],200:[function(_dereq_,module,exports){
7926
7926
  'use strict';
7927
7927
  var $ = _dereq_('../internals/export');
7928
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
7928
+ var uncurryThis = _dereq_('../internals/function-uncurry-this-clause');
7929
7929
  var fails = _dereq_('../internals/fails');
7930
7930
  var ArrayBufferModule = _dereq_('../internals/array-buffer');
7931
7931
  var anObject = _dereq_('../internals/an-object');
@@ -7964,7 +7964,7 @@ $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE },
7964
7964
  }
7965
7965
  });
7966
7966
 
7967
- },{"../internals/an-object":25,"../internals/array-buffer":28,"../internals/export":78,"../internals/fails":79,"../internals/function-uncurry-this":87,"../internals/species-constructor":164,"../internals/to-absolute-index":172,"../internals/to-length":177}],201:[function(_dereq_,module,exports){
7967
+ },{"../internals/an-object":25,"../internals/array-buffer":28,"../internals/export":78,"../internals/fails":79,"../internals/function-uncurry-this-clause":86,"../internals/species-constructor":164,"../internals/to-absolute-index":172,"../internals/to-length":177}],201:[function(_dereq_,module,exports){
7968
7968
  'use strict';
7969
7969
  var $ = _dereq_('../internals/export');
7970
7970
  var fails = _dereq_('../internals/fails');
@@ -8042,7 +8042,7 @@ $({ target: 'Array', proto: true, forced: [].forEach != forEach }, {
8042
8042
  'use strict';
8043
8043
  /* eslint-disable es/no-array-prototype-indexof -- required for testing */
8044
8044
  var $ = _dereq_('../internals/export');
8045
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
8045
+ var uncurryThis = _dereq_('../internals/function-uncurry-this-clause');
8046
8046
  var $indexOf = _dereq_('../internals/array-includes').indexOf;
8047
8047
  var arrayMethodIsStrict = _dereq_('../internals/array-method-is-strict');
8048
8048
 
@@ -8063,7 +8063,7 @@ $({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {
8063
8063
  }
8064
8064
  });
8065
8065
 
8066
- },{"../internals/array-includes":34,"../internals/array-method-is-strict":38,"../internals/export":78,"../internals/function-uncurry-this":87}],204:[function(_dereq_,module,exports){
8066
+ },{"../internals/array-includes":34,"../internals/array-method-is-strict":38,"../internals/export":78,"../internals/function-uncurry-this-clause":86}],204:[function(_dereq_,module,exports){
8067
8067
  'use strict';
8068
8068
  var toIndexedObject = _dereq_('../internals/to-indexed-object');
8069
8069
  var addToUnscopables = _dereq_('../internals/add-to-unscopables');
@@ -9435,7 +9435,7 @@ exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
9435
9435
  },{"../internals/array-buffer-view-core":27,"../internals/array-iteration":35}],244:[function(_dereq_,module,exports){
9436
9436
  'use strict';
9437
9437
  var global = _dereq_('../internals/global');
9438
- var uncurryThis = _dereq_('../internals/function-uncurry-this');
9438
+ var uncurryThis = _dereq_('../internals/function-uncurry-this-clause');
9439
9439
  var fails = _dereq_('../internals/fails');
9440
9440
  var aCallable = _dereq_('../internals/a-callable');
9441
9441
  var internalSort = _dereq_('../internals/array-sort');
@@ -9504,7 +9504,7 @@ exportTypedArrayMethod('sort', function sort(comparefn) {
9504
9504
  return internalSort(aTypedArray(this), getSortCompare(comparefn));
9505
9505
  }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
9506
9506
 
9507
- },{"../internals/a-callable":19,"../internals/array-buffer-view-core":27,"../internals/array-sort":42,"../internals/engine-ff-version":66,"../internals/engine-is-ie-or-edge":69,"../internals/engine-v8-version":75,"../internals/engine-webkit-version":76,"../internals/fails":79,"../internals/function-uncurry-this":87,"../internals/global":93}],245:[function(_dereq_,module,exports){
9507
+ },{"../internals/a-callable":19,"../internals/array-buffer-view-core":27,"../internals/array-sort":42,"../internals/engine-ff-version":66,"../internals/engine-is-ie-or-edge":69,"../internals/engine-v8-version":75,"../internals/engine-webkit-version":76,"../internals/fails":79,"../internals/function-uncurry-this-clause":86,"../internals/global":93}],245:[function(_dereq_,module,exports){
9508
9508
  'use strict';
9509
9509
  var ArrayBufferViewCore = _dereq_('../internals/array-buffer-view-core');
9510
9510
  var toLength = _dereq_('../internals/to-length');
@@ -26004,7 +26004,7 @@ function wrappy (fn, cb) {
26004
26004
  },{}],345:[function(_dereq_,module,exports){
26005
26005
  module.exports={
26006
26006
  "name": "videomail-client",
26007
- "version": "5.2.2",
26007
+ "version": "5.3.0",
26008
26008
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
26009
26009
  "author": "Michael Heuberger <michael.heuberger@binarykitchen.com>",
26010
26010
  "contributors": [
@@ -26069,7 +26069,7 @@ module.exports={
26069
26069
  "canvas-to-buffer": "2.0.0",
26070
26070
  "classlist.js": "1.1.20150312",
26071
26071
  "contains": "0.1.1",
26072
- "core-js": "3.26.0",
26072
+ "core-js": "3.26.1",
26073
26073
  "create-error": "0.3.1",
26074
26074
  "deepmerge": "4.2.2",
26075
26075
  "defined": "1.0.1",
@@ -26106,7 +26106,7 @@ module.exports={
26106
26106
  "connect-send-json": "1.0.0",
26107
26107
  "cssnano": "5.1.14",
26108
26108
  "del": "6.1.1",
26109
- "eslint": "8.27.0",
26109
+ "eslint": "8.28.0",
26110
26110
  "eslint-config-prettier": "8.5.0",
26111
26111
  "eslint-plugin-import": "2.26.0",
26112
26112
  "eslint-plugin-node": "11.1.0",
@@ -26616,6 +26616,10 @@ var _default = {
26616
26616
  // define default FROM email address
26617
26617
  to: null,
26618
26618
  // define default TO email address
26619
+ cc: null,
26620
+ // define default CC email address
26621
+ bcc: null,
26622
+ // define default BCC email address
26619
26623
  subject: null,
26620
26624
  // define default subject line
26621
26625
  body: null // define default body content
@@ -28452,8 +28456,6 @@ Object.defineProperty(exports, "__esModule", {
28452
28456
  value: true
28453
28457
  });
28454
28458
  exports.default = void 0;
28455
- _dereq_("core-js/modules/es.regexp.exec.js");
28456
- _dereq_("core-js/modules/es.string.replace.js");
28457
28459
  _dereq_("core-js/modules/es.array.for-each.js");
28458
28460
  _dereq_("core-js/modules/es.object.to-string.js");
28459
28461
  _dereq_("core-js/modules/web.dom-collections.for-each.js");
@@ -28637,42 +28639,8 @@ var Container = function Container(options) {
28637
28639
  function hideMySelf() {
28638
28640
  (0, _hidden.default)(containerElement, true);
28639
28641
  }
28640
-
28641
- // fixes https://github.com/binarykitchen/videomail-client/issues/71
28642
- function trimEmail(email) {
28643
- return email.replace(/(^[,\s]+)|([,\s]+$)/g, '');
28644
- }
28645
28642
  function submitVideomail(formData, method, cb) {
28646
- var FORM_FIELDS = {
28647
- subject: options.selectors.subjectInputName,
28648
- from: options.selectors.fromInputName,
28649
- to: options.selectors.toInputName,
28650
- cc: options.selectors.ccInputName,
28651
- bcc: options.selectors.bccInputName,
28652
- body: options.selectors.bodyInputName,
28653
- key: options.selectors.keyInputName,
28654
- parentKey: options.selectors.parentKeyInputName,
28655
- sendCopy: options.selectors.sendCopyInputName
28656
- };
28657
- var videomailFormData = {};
28658
- Object.keys(FORM_FIELDS).forEach(function (key) {
28659
- var formFieldValue = FORM_FIELDS[key];
28660
- if (formFieldValue in formData) {
28661
- videomailFormData[key] = formData[formFieldValue];
28662
- }
28663
- });
28664
- if (videomailFormData.from) {
28665
- videomailFormData.from = trimEmail(videomailFormData.from);
28666
- }
28667
- if (videomailFormData.to) {
28668
- videomailFormData.to = trimEmail(videomailFormData.to);
28669
- }
28670
- if (videomailFormData.cc) {
28671
- videomailFormData.cc = trimEmail(videomailFormData.cc);
28672
- }
28673
- if (videomailFormData.bcc) {
28674
- videomailFormData.bcc = trimEmail(videomailFormData.bcc);
28675
- }
28643
+ var videomailFormData = form.transformFormData(formData);
28676
28644
 
28677
28645
  // when method is undefined, treat it as a post
28678
28646
  if (isPost(method) || !method) {
@@ -28949,6 +28917,54 @@ var Container = function Container(options) {
28949
28917
  whyInvalid = 'Form input(s() are invalid';
28950
28918
  }
28951
28919
  }
28920
+
28921
+ // TODO CONTINUE FROM HERE, MAKE VALIDATION CLEVER WHEN AUTOMATIC SO THAT IT REQUIRES AT
28922
+ // LEAST ONE RECIPIENT AMONG TO/CC/BCC
28923
+ if (valid) {
28924
+ var _recipients$to, _recipients$cc, _recipients$bcc;
28925
+ // If CC and/or BCC exist, validate one more time to ensure at least
28926
+ // one recipient is given
28927
+ var recipients = form.getRecipients();
28928
+ var toIsConfigured = ('to' in recipients);
28929
+ var ccIsConfigured = ('cc' in recipients);
28930
+ var bccIsConfigured = ('bcc' in recipients);
28931
+ var hasTo = ((_recipients$to = recipients.to) === null || _recipients$to === void 0 ? void 0 : _recipients$to.length) > 0;
28932
+ var hasCc = ((_recipients$cc = recipients.cc) === null || _recipients$cc === void 0 ? void 0 : _recipients$cc.length) > 0;
28933
+ var hasBcc = ((_recipients$bcc = recipients.bcc) === null || _recipients$bcc === void 0 ? void 0 : _recipients$bcc.length) > 0;
28934
+ if (toIsConfigured) {
28935
+ if (!hasTo) {
28936
+ if (ccIsConfigured && bccIsConfigured) {
28937
+ if (!hasCc && !hasBcc) {
28938
+ valid = false;
28939
+ }
28940
+ } else if (ccIsConfigured) {
28941
+ if (!hasCc) {
28942
+ valid = false;
28943
+ }
28944
+ } else if (bccIsConfigured) {
28945
+ if (!hasBcc) {
28946
+ valid = false;
28947
+ }
28948
+ } else {
28949
+ whyInvalid = 'Please configure the form to have at least one recipient.';
28950
+ }
28951
+ }
28952
+ } else if (ccIsConfigured) {
28953
+ if (!hasCc) {
28954
+ if (bccIsConfigured) {
28955
+ if (!hasBcc) {
28956
+ valid = false;
28957
+ }
28958
+ }
28959
+ }
28960
+ }
28961
+ if (!valid) {
28962
+ whyInvalid = 'Please enter at least one recipient.';
28963
+ }
28964
+ console.log({
28965
+ recipients: recipients
28966
+ });
28967
+ }
28952
28968
  } else {
28953
28969
  valid = visualsValid;
28954
28970
  }
@@ -29076,7 +29092,7 @@ _util.default.inherits(Container, _eventEmitter.default);
29076
29092
  var _default = Container;
29077
29093
  exports.default = _default;
29078
29094
 
29079
- },{"../../styles/css/main.min.css.js":376,"../events":348,"../resource":350,"../util/eventEmitter":354,"../util/videomailError":359,"./buttons":360,"./dimension":362,"./form":363,"./optionsWrapper":364,"./visuals":365,"@babel/runtime/helpers/interopRequireDefault":1,"core-js/modules/es.array.for-each.js":202,"core-js/modules/es.object.define-property.js":208,"core-js/modules/es.object.keys.js":210,"core-js/modules/es.object.to-string.js":211,"core-js/modules/es.regexp.exec.js":221,"core-js/modules/es.string.replace.js":224,"core-js/modules/web.dom-collections.for-each.js":249,"document-visibility":260,"element-closest":262,"hidden":281,"insert-css":287,"util":338}],362:[function(_dereq_,module,exports){
29095
+ },{"../../styles/css/main.min.css.js":376,"../events":348,"../resource":350,"../util/eventEmitter":354,"../util/videomailError":359,"./buttons":360,"./dimension":362,"./form":363,"./optionsWrapper":364,"./visuals":365,"@babel/runtime/helpers/interopRequireDefault":1,"core-js/modules/es.array.for-each.js":202,"core-js/modules/es.object.define-property.js":208,"core-js/modules/es.object.keys.js":210,"core-js/modules/es.object.to-string.js":211,"core-js/modules/web.dom-collections.for-each.js":249,"document-visibility":260,"element-closest":262,"hidden":281,"insert-css":287,"util":338}],362:[function(_dereq_,module,exports){
29080
29096
  "use strict";
29081
29097
 
29082
29098
  _dereq_("core-js/modules/es.object.define-property.js");
@@ -29200,6 +29216,12 @@ Object.defineProperty(exports, "__esModule", {
29200
29216
  value: true
29201
29217
  });
29202
29218
  exports.default = void 0;
29219
+ _dereq_("core-js/modules/es.regexp.exec.js");
29220
+ _dereq_("core-js/modules/es.string.replace.js");
29221
+ _dereq_("core-js/modules/es.array.for-each.js");
29222
+ _dereq_("core-js/modules/es.object.to-string.js");
29223
+ _dereq_("core-js/modules/web.dom-collections.for-each.js");
29224
+ _dereq_("core-js/modules/es.object.keys.js");
29203
29225
  var _getFormData = _interopRequireDefault(_dereq_("get-form-data"));
29204
29226
  var _hidden = _interopRequireDefault(_dereq_("hidden"));
29205
29227
  var _hyperscript = _interopRequireDefault(_dereq_("hyperscript"));
@@ -29207,6 +29229,10 @@ var _util = _interopRequireDefault(_dereq_("util"));
29207
29229
  var _events = _interopRequireDefault(_dereq_("../events"));
29208
29230
  var _eventEmitter = _interopRequireDefault(_dereq_("../util/eventEmitter"));
29209
29231
  var _videomailError = _interopRequireDefault(_dereq_("../util/videomailError"));
29232
+ // fixes https://github.com/binarykitchen/videomail-client/issues/71
29233
+ function trimEmail(email) {
29234
+ return email.replace(/(^[,\s]+)|([,\s]+$)/g, '');
29235
+ }
29210
29236
  var Form = function Form(container, formElement, options) {
29211
29237
  _eventEmitter.default.call(this, options, 'Form');
29212
29238
  var self = this;
@@ -29216,6 +29242,53 @@ var Form = function Form(container, formElement, options) {
29216
29242
  includeDisabled: true
29217
29243
  });
29218
29244
  }
29245
+ this.transformFormData = function (formData) {
29246
+ var FORM_FIELDS = {
29247
+ subject: options.selectors.subjectInputName,
29248
+ from: options.selectors.fromInputName,
29249
+ to: options.selectors.toInputName,
29250
+ cc: options.selectors.ccInputName,
29251
+ bcc: options.selectors.bccInputName,
29252
+ body: options.selectors.bodyInputName,
29253
+ key: options.selectors.keyInputName,
29254
+ parentKey: options.selectors.parentKeyInputName,
29255
+ sendCopy: options.selectors.sendCopyInputName
29256
+ };
29257
+ var transformedFormData = {};
29258
+ Object.keys(FORM_FIELDS).forEach(function (key) {
29259
+ var formFieldValue = FORM_FIELDS[key];
29260
+ if (formFieldValue in formData) {
29261
+ transformedFormData[key] = formData[formFieldValue];
29262
+ }
29263
+ });
29264
+ if (transformedFormData.from) {
29265
+ transformedFormData.from = trimEmail(transformedFormData.from);
29266
+ }
29267
+ if (transformedFormData.to) {
29268
+ transformedFormData.to = trimEmail(transformedFormData.to);
29269
+ }
29270
+ if (transformedFormData.cc) {
29271
+ transformedFormData.cc = trimEmail(transformedFormData.cc);
29272
+ }
29273
+ if (transformedFormData.bcc) {
29274
+ transformedFormData.bcc = trimEmail(transformedFormData.bcc);
29275
+ }
29276
+ return transformedFormData;
29277
+ };
29278
+ this.getRecipients = function () {
29279
+ var videomailFormData = this.transformFormData(getData());
29280
+ var recipients = {};
29281
+ if ('to' in videomailFormData) {
29282
+ recipients.to = videomailFormData.to;
29283
+ }
29284
+ if ('cc' in videomailFormData) {
29285
+ recipients.cc = videomailFormData.cc;
29286
+ }
29287
+ if ('bcc' in videomailFormData) {
29288
+ recipients.bcc = videomailFormData.bcc;
29289
+ }
29290
+ return recipients;
29291
+ };
29219
29292
  this.loadVideomail = function (videomail) {
29220
29293
  var limit = formElement.elements.length;
29221
29294
  var input;
@@ -29385,7 +29458,7 @@ _util.default.inherits(Form, _eventEmitter.default);
29385
29458
  var _default = Form;
29386
29459
  exports.default = _default;
29387
29460
 
29388
- },{"../events":348,"../util/eventEmitter":354,"../util/videomailError":359,"@babel/runtime/helpers/interopRequireDefault":1,"core-js/modules/es.object.define-property.js":208,"get-form-data":271,"hidden":281,"hyperscript":283,"util":338}],364:[function(_dereq_,module,exports){
29461
+ },{"../events":348,"../util/eventEmitter":354,"../util/videomailError":359,"@babel/runtime/helpers/interopRequireDefault":1,"core-js/modules/es.array.for-each.js":202,"core-js/modules/es.object.define-property.js":208,"core-js/modules/es.object.keys.js":210,"core-js/modules/es.object.to-string.js":211,"core-js/modules/es.regexp.exec.js":221,"core-js/modules/es.string.replace.js":224,"core-js/modules/web.dom-collections.for-each.js":249,"get-form-data":271,"hidden":281,"hyperscript":283,"util":338}],364:[function(_dereq_,module,exports){
29389
29462
  "use strict";
29390
29463
 
29391
29464
  _dereq_("core-js/modules/es.object.define-property.js");