videomail-client 5.2.2 → 5.4.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/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,13 @@
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/optionsWrapper.js | 27 | fix this, it's not really an option
11
11
  | src/js/wrappers/visuals/recorder.js | 582 | in https://github.com/binarykitchen/videomail-client/issues/142
12
12
  | src/js/wrappers/visuals/recorder.js | 619 | retry with navigator.getUserMedia_() maybe?
13
13
  | 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.4.1",
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": [
@@ -58,14 +58,14 @@
58
58
  ]
59
59
  },
60
60
  "dependencies": {
61
- "@babel/runtime": "7.20.1",
61
+ "@babel/runtime": "7.20.6",
62
62
  "add-eventlistener-with-options": "1.25.5",
63
63
  "animitter": "3.0.0",
64
64
  "audio-sample": "2.0.0",
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",
@@ -85,12 +85,12 @@
85
85
  "readystate": "0.4.1",
86
86
  "request-frame": "1.5.3",
87
87
  "safe-json-stringify": "1.2.0",
88
- "superagent": "8.0.3",
88
+ "superagent": "8.0.5",
89
89
  "ua-parser-js": "0.7.32",
90
90
  "websocket-stream": "5.5.2"
91
91
  },
92
92
  "devDependencies": {
93
- "@babel/core": "7.20.2",
93
+ "@babel/core": "7.20.5",
94
94
  "@babel/eslint-parser": "7.19.1",
95
95
  "@babel/plugin-transform-runtime": "7.19.6",
96
96
  "@babel/preset-env": "7.20.2",
@@ -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.29.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",
@@ -128,7 +128,7 @@
128
128
  "minimist": "1.2.7",
129
129
  "nib": "1.2.0",
130
130
  "postcss": "8.4.19",
131
- "prettier": "2.7.1",
131
+ "prettier": "2.8.0",
132
132
  "router": "1.3.7",
133
133
  "tape": "5.6.1",
134
134
  "tape-catch": "1.0.6",
@@ -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');
@@ -22758,7 +22758,7 @@ RequestBase.prototype.field = function (name, value, options) {
22758
22758
  value = String(value);
22759
22759
  }
22760
22760
 
22761
- // fix https://github.com/visionmedia/superagent/issues/1680
22761
+ // fix https://github.com/ladjs/superagent/issues/1680
22762
22762
  if (options) this._getFormData().append(name, value, options);else this._getFormData().append(name, value);
22763
22763
  return this;
22764
22764
  };
@@ -22784,7 +22784,7 @@ RequestBase.prototype.abort = function () {
22784
22784
  //
22785
22785
  // References:
22786
22786
  // <https://github.com/nodejs/node/issues/31630>
22787
- // <https://github.com/visionmedia/superagent/pull/1084/commits/dc18679a7c5ccfc6046d882015e5126888973bc8>
22787
+ // <https://github.com/ladjs/superagent/pull/1084/commits/dc18679a7c5ccfc6046d882015e5126888973bc8>
22788
22788
  //
22789
22789
  // Thanks to @shadowgate15 and @niftylettuce
22790
22790
  if (semver.gte(process.version, 'v13.0.0') && semver.lt(process.version, 'v14.0.0')) {
@@ -22829,7 +22829,8 @@ RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
22829
22829
  * using "Access-Control-Allow-Origin" with a wildcard,
22830
22830
  * and also must set "Access-Control-Allow-Credentials"
22831
22831
  * to "true".
22832
- *
22832
+ * @param {Boolean} [on=true] - Set 'withCredentials' state
22833
+ * @return {Request} for chaining
22833
22834
  * @api public
22834
22835
  */
22835
22836
 
@@ -26004,7 +26005,7 @@ function wrappy (fn, cb) {
26004
26005
  },{}],345:[function(_dereq_,module,exports){
26005
26006
  module.exports={
26006
26007
  "name": "videomail-client",
26007
- "version": "5.2.2",
26008
+ "version": "5.4.1",
26008
26009
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
26009
26010
  "author": "Michael Heuberger <michael.heuberger@binarykitchen.com>",
26010
26011
  "contributors": [
@@ -26062,14 +26063,14 @@ module.exports={
26062
26063
  ]
26063
26064
  },
26064
26065
  "dependencies": {
26065
- "@babel/runtime": "7.20.1",
26066
+ "@babel/runtime": "7.20.6",
26066
26067
  "add-eventlistener-with-options": "1.25.5",
26067
26068
  "animitter": "3.0.0",
26068
26069
  "audio-sample": "2.0.0",
26069
26070
  "canvas-to-buffer": "2.0.0",
26070
26071
  "classlist.js": "1.1.20150312",
26071
26072
  "contains": "0.1.1",
26072
- "core-js": "3.26.0",
26073
+ "core-js": "3.26.1",
26073
26074
  "create-error": "0.3.1",
26074
26075
  "deepmerge": "4.2.2",
26075
26076
  "defined": "1.0.1",
@@ -26089,12 +26090,12 @@ module.exports={
26089
26090
  "readystate": "0.4.1",
26090
26091
  "request-frame": "1.5.3",
26091
26092
  "safe-json-stringify": "1.2.0",
26092
- "superagent": "8.0.3",
26093
+ "superagent": "8.0.5",
26093
26094
  "ua-parser-js": "0.7.32",
26094
26095
  "websocket-stream": "5.5.2"
26095
26096
  },
26096
26097
  "devDependencies": {
26097
- "@babel/core": "7.20.2",
26098
+ "@babel/core": "7.20.5",
26098
26099
  "@babel/eslint-parser": "7.19.1",
26099
26100
  "@babel/plugin-transform-runtime": "7.19.6",
26100
26101
  "@babel/preset-env": "7.20.2",
@@ -26106,7 +26107,7 @@ module.exports={
26106
26107
  "connect-send-json": "1.0.0",
26107
26108
  "cssnano": "5.1.14",
26108
26109
  "del": "6.1.1",
26109
- "eslint": "8.27.0",
26110
+ "eslint": "8.29.0",
26110
26111
  "eslint-config-prettier": "8.5.0",
26111
26112
  "eslint-plugin-import": "2.26.0",
26112
26113
  "eslint-plugin-node": "11.1.0",
@@ -26132,7 +26133,7 @@ module.exports={
26132
26133
  "minimist": "1.2.7",
26133
26134
  "nib": "1.2.0",
26134
26135
  "postcss": "8.4.19",
26135
- "prettier": "2.7.1",
26136
+ "prettier": "2.8.0",
26136
26137
  "router": "1.3.7",
26137
26138
  "tape": "5.6.1",
26138
26139
  "tape-catch": "1.0.6",
@@ -26616,6 +26617,10 @@ var _default = {
26616
26617
  // define default FROM email address
26617
26618
  to: null,
26618
26619
  // define default TO email address
26620
+ cc: null,
26621
+ // define default CC email address
26622
+ bcc: null,
26623
+ // define default BCC email address
26619
26624
  subject: null,
26620
26625
  // define default subject line
26621
26626
  body: null // define default body content
@@ -28452,8 +28457,6 @@ Object.defineProperty(exports, "__esModule", {
28452
28457
  value: true
28453
28458
  });
28454
28459
  exports.default = void 0;
28455
- _dereq_("core-js/modules/es.regexp.exec.js");
28456
- _dereq_("core-js/modules/es.string.replace.js");
28457
28460
  _dereq_("core-js/modules/es.array.for-each.js");
28458
28461
  _dereq_("core-js/modules/es.object.to-string.js");
28459
28462
  _dereq_("core-js/modules/web.dom-collections.for-each.js");
@@ -28637,42 +28640,8 @@ var Container = function Container(options) {
28637
28640
  function hideMySelf() {
28638
28641
  (0, _hidden.default)(containerElement, true);
28639
28642
  }
28640
-
28641
- // fixes https://github.com/binarykitchen/videomail-client/issues/71
28642
- function trimEmail(email) {
28643
- return email.replace(/(^[,\s]+)|([,\s]+$)/g, '');
28644
- }
28645
28643
  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
- }
28644
+ var videomailFormData = form.transformFormData(formData);
28676
28645
 
28677
28646
  // when method is undefined, treat it as a post
28678
28647
  if (isPost(method) || !method) {
@@ -28946,7 +28915,49 @@ var Container = function Container(options) {
28946
28915
  if (invalidInput) {
28947
28916
  whyInvalid = 'Form input named ' + invalidInput.name + ' is invalid. It has the value: "' + invalidInput.value + '"';
28948
28917
  } else {
28949
- whyInvalid = 'Form input(s() are invalid';
28918
+ whyInvalid = 'Form input(s) are invalid';
28919
+ }
28920
+ }
28921
+ if (valid) {
28922
+ var _recipients$to, _recipients$cc, _recipients$bcc;
28923
+ // If CC and/or BCC exist, validate one more time to ensure at least
28924
+ // one recipient is given
28925
+ var recipients = form.getRecipients();
28926
+ var toIsConfigured = ('to' in recipients);
28927
+ var ccIsConfigured = ('cc' in recipients);
28928
+ var bccIsConfigured = ('bcc' in recipients);
28929
+ var hasTo = ((_recipients$to = recipients.to) === null || _recipients$to === void 0 ? void 0 : _recipients$to.length) > 0;
28930
+ var hasCc = ((_recipients$cc = recipients.cc) === null || _recipients$cc === void 0 ? void 0 : _recipients$cc.length) > 0;
28931
+ var hasBcc = ((_recipients$bcc = recipients.bcc) === null || _recipients$bcc === void 0 ? void 0 : _recipients$bcc.length) > 0;
28932
+ if (toIsConfigured) {
28933
+ if (!hasTo) {
28934
+ if (ccIsConfigured && bccIsConfigured) {
28935
+ if (!hasCc && !hasBcc) {
28936
+ valid = false;
28937
+ }
28938
+ } else if (ccIsConfigured) {
28939
+ if (!hasCc) {
28940
+ valid = false;
28941
+ }
28942
+ } else if (bccIsConfigured) {
28943
+ if (!hasBcc) {
28944
+ valid = false;
28945
+ }
28946
+ } else {
28947
+ whyInvalid = 'Please configure the form to have at least one recipient.';
28948
+ }
28949
+ }
28950
+ } else if (ccIsConfigured) {
28951
+ if (!hasCc) {
28952
+ if (bccIsConfigured) {
28953
+ if (!hasBcc) {
28954
+ valid = false;
28955
+ }
28956
+ }
28957
+ }
28958
+ }
28959
+ if (!valid) {
28960
+ whyInvalid = 'Please enter at least one recipient.';
28950
28961
  }
28951
28962
  }
28952
28963
  } else {
@@ -29076,7 +29087,7 @@ _util.default.inherits(Container, _eventEmitter.default);
29076
29087
  var _default = Container;
29077
29088
  exports.default = _default;
29078
29089
 
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){
29090
+ },{"../../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
29091
  "use strict";
29081
29092
 
29082
29093
  _dereq_("core-js/modules/es.object.define-property.js");
@@ -29200,6 +29211,12 @@ Object.defineProperty(exports, "__esModule", {
29200
29211
  value: true
29201
29212
  });
29202
29213
  exports.default = void 0;
29214
+ _dereq_("core-js/modules/es.regexp.exec.js");
29215
+ _dereq_("core-js/modules/es.string.replace.js");
29216
+ _dereq_("core-js/modules/es.array.for-each.js");
29217
+ _dereq_("core-js/modules/es.object.to-string.js");
29218
+ _dereq_("core-js/modules/web.dom-collections.for-each.js");
29219
+ _dereq_("core-js/modules/es.object.keys.js");
29203
29220
  var _getFormData = _interopRequireDefault(_dereq_("get-form-data"));
29204
29221
  var _hidden = _interopRequireDefault(_dereq_("hidden"));
29205
29222
  var _hyperscript = _interopRequireDefault(_dereq_("hyperscript"));
@@ -29207,6 +29224,10 @@ var _util = _interopRequireDefault(_dereq_("util"));
29207
29224
  var _events = _interopRequireDefault(_dereq_("../events"));
29208
29225
  var _eventEmitter = _interopRequireDefault(_dereq_("../util/eventEmitter"));
29209
29226
  var _videomailError = _interopRequireDefault(_dereq_("../util/videomailError"));
29227
+ // fixes https://github.com/binarykitchen/videomail-client/issues/71
29228
+ function trimEmail(email) {
29229
+ return email.replace(/(^[,\s]+)|([,\s]+$)/g, '');
29230
+ }
29210
29231
  var Form = function Form(container, formElement, options) {
29211
29232
  _eventEmitter.default.call(this, options, 'Form');
29212
29233
  var self = this;
@@ -29216,6 +29237,53 @@ var Form = function Form(container, formElement, options) {
29216
29237
  includeDisabled: true
29217
29238
  });
29218
29239
  }
29240
+ this.transformFormData = function (formData) {
29241
+ var FORM_FIELDS = {
29242
+ subject: options.selectors.subjectInputName,
29243
+ from: options.selectors.fromInputName,
29244
+ to: options.selectors.toInputName,
29245
+ cc: options.selectors.ccInputName,
29246
+ bcc: options.selectors.bccInputName,
29247
+ body: options.selectors.bodyInputName,
29248
+ key: options.selectors.keyInputName,
29249
+ parentKey: options.selectors.parentKeyInputName,
29250
+ sendCopy: options.selectors.sendCopyInputName
29251
+ };
29252
+ var transformedFormData = {};
29253
+ Object.keys(FORM_FIELDS).forEach(function (key) {
29254
+ var formFieldValue = FORM_FIELDS[key];
29255
+ if (formFieldValue in formData) {
29256
+ transformedFormData[key] = formData[formFieldValue];
29257
+ }
29258
+ });
29259
+ if (transformedFormData.from) {
29260
+ transformedFormData.from = trimEmail(transformedFormData.from);
29261
+ }
29262
+ if (transformedFormData.to) {
29263
+ transformedFormData.to = trimEmail(transformedFormData.to);
29264
+ }
29265
+ if (transformedFormData.cc) {
29266
+ transformedFormData.cc = trimEmail(transformedFormData.cc);
29267
+ }
29268
+ if (transformedFormData.bcc) {
29269
+ transformedFormData.bcc = trimEmail(transformedFormData.bcc);
29270
+ }
29271
+ return transformedFormData;
29272
+ };
29273
+ this.getRecipients = function () {
29274
+ var videomailFormData = this.transformFormData(getData());
29275
+ var recipients = {};
29276
+ if ('to' in videomailFormData) {
29277
+ recipients.to = videomailFormData.to;
29278
+ }
29279
+ if ('cc' in videomailFormData) {
29280
+ recipients.cc = videomailFormData.cc;
29281
+ }
29282
+ if ('bcc' in videomailFormData) {
29283
+ recipients.bcc = videomailFormData.bcc;
29284
+ }
29285
+ return recipients;
29286
+ };
29219
29287
  this.loadVideomail = function (videomail) {
29220
29288
  var limit = formElement.elements.length;
29221
29289
  var input;
@@ -29385,7 +29453,7 @@ _util.default.inherits(Form, _eventEmitter.default);
29385
29453
  var _default = Form;
29386
29454
  exports.default = _default;
29387
29455
 
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){
29456
+ },{"../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
29457
  "use strict";
29390
29458
 
29391
29459
  _dereq_("core-js/modules/es.object.define-property.js");