videomail-client 12.0.2 → 13.1.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.
@@ -10664,7 +10664,7 @@ var __webpack_exports__ = {};
10664
10664
  var client = __webpack_require__("./node_modules/superagent/lib/client.js");
10665
10665
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10666
10666
  var package_namespaceObject = {
10667
- rE: "12.0.2"
10667
+ rE: "13.1.0"
10668
10668
  };
10669
10669
  var defined = __webpack_require__("./node_modules/defined/index.js");
10670
10670
  var defined_default = /*#__PURE__*/ __webpack_require__.n(defined);
@@ -14419,8 +14419,9 @@ var __webpack_exports__ = {};
14419
14419
  for (const formControl of this.formElement.elements){
14420
14420
  const name = formControl.getAttribute("name");
14421
14421
  if (name) {
14422
- const value = videomail[name];
14422
+ let value = videomail[name];
14423
14423
  const tagName = formControl.tagName;
14424
+ if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, videomail);
14424
14425
  switch(tagName){
14425
14426
  case "INPUT":
14426
14427
  {
@@ -14570,7 +14571,7 @@ var __webpack_exports__ = {};
14570
14571
  e.preventDefault();
14571
14572
  } else this.options.logger.debug("Form: doTheSubmit()");
14572
14573
  var _this_formElement_getAttribute;
14573
- const url = null != (_this_formElement_getAttribute = this.formElement.getAttribute("action")) ? _this_formElement_getAttribute : this.options.baseUrl;
14574
+ const url = null != (_this_formElement_getAttribute = this.formElement.getAttribute("action")) ? _this_formElement_getAttribute : this.options.apiUrl;
14574
14575
  const method = this.formElement.getAttribute("method");
14575
14576
  let chosenMethod;
14576
14577
  switch(method){
@@ -14669,7 +14670,7 @@ var __webpack_exports__ = {};
14669
14670
  return newVideomail;
14670
14671
  }
14671
14672
  async get(identifierName, identifierValue) {
14672
- const url = `${this.options.baseUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
14673
+ const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
14673
14674
  try {
14674
14675
  const request = await client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.SITE_NAME_LABEL, this.options.siteName).timeout(this.options.timeouts.connection);
14675
14676
  const videomail = request.body;
@@ -14685,7 +14686,7 @@ var __webpack_exports__ = {};
14685
14686
  const queryParams = {
14686
14687
  [constants.SITE_NAME_LABEL]: this.options.siteName
14687
14688
  };
14688
- let url = `${this.options.baseUrl}/videomail/`;
14689
+ let url = `${this.options.apiUrl}/videomail/`;
14689
14690
  if (method === FormMethod.PUT && videomail.key) url += videomail.key;
14690
14691
  try {
14691
14692
  const request = await client_default()(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
@@ -14707,7 +14708,7 @@ var __webpack_exports__ = {};
14707
14708
  const queryParams = {
14708
14709
  [constants.SITE_NAME_LABEL]: this.options.siteName
14709
14710
  };
14710
- const url = `${this.options.baseUrl}/client-error/`;
14711
+ const url = `${this.options.apiUrl}/client-error/`;
14711
14712
  try {
14712
14713
  var _this_options_versions;
14713
14714
  const fullVideomailErrorData = {
@@ -14813,7 +14814,7 @@ var __webpack_exports__ = {};
14813
14814
  logger: console,
14814
14815
  logStackSize: 30,
14815
14816
  verbose: !PRODUCTION,
14816
- baseUrl: "https://videomail.io",
14817
+ apiUrl: "https://videomail.io/api",
14817
14818
  socketUrl: "wss://videomail.io",
14818
14819
  siteName: "videomail-client-demo",
14819
14820
  enablePause: true,
@@ -14904,7 +14905,8 @@ var __webpack_exports__ = {};
14904
14905
  },
14905
14906
  loadUserMediaOnRecord: false,
14906
14907
  callbacks: {
14907
- adjustFormDataBeforePosting: void 0
14908
+ adjustFormDataBeforePosting: void 0,
14909
+ adjustFormValueBeforePopulating: void 0
14908
14910
  },
14909
14911
  defaults: {
14910
14912
  from: void 0,
package/dist/esm/index.js CHANGED
@@ -3606,7 +3606,7 @@ const constants = {
3606
3606
  }
3607
3607
  };
3608
3608
  var package_namespaceObject = {
3609
- rE: "12.0.2"
3609
+ rE: "13.1.0"
3610
3610
  };
3611
3611
  function canPlayType_canPlayType(video, type) {
3612
3612
  const canPlayType = video.canPlayType(`video/${type}`);
@@ -4070,8 +4070,9 @@ class Form extends util_Despot {
4070
4070
  for (const formControl of this.formElement.elements){
4071
4071
  const name = formControl.getAttribute("name");
4072
4072
  if (name) {
4073
- const value = videomail[name];
4073
+ let value = videomail[name];
4074
4074
  const tagName = formControl.tagName;
4075
+ if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, videomail);
4075
4076
  switch(tagName){
4076
4077
  case "INPUT":
4077
4078
  {
@@ -4218,7 +4219,7 @@ class Form extends util_Despot {
4218
4219
  this.options.logger.debug(`Form: doTheSubmit(${util_pretty(e)})`);
4219
4220
  e.preventDefault();
4220
4221
  } else this.options.logger.debug("Form: doTheSubmit()");
4221
- const url = this.formElement.getAttribute("action") ?? this.options.baseUrl;
4222
+ const url = this.formElement.getAttribute("action") ?? this.options.apiUrl;
4222
4223
  const method = this.formElement.getAttribute("method");
4223
4224
  let chosenMethod;
4224
4225
  switch(method){
@@ -4297,7 +4298,7 @@ class Resource {
4297
4298
  return newVideomail;
4298
4299
  }
4299
4300
  async get(identifierName, identifierValue) {
4300
- const url = `${this.options.baseUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
4301
+ const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
4301
4302
  try {
4302
4303
  const request = await superagent("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.SITE_NAME_LABEL, this.options.siteName).timeout(this.options.timeouts.connection);
4303
4304
  const videomail = request.body;
@@ -4313,7 +4314,7 @@ class Resource {
4313
4314
  const queryParams = {
4314
4315
  [constants.SITE_NAME_LABEL]: this.options.siteName
4315
4316
  };
4316
- let url = `${this.options.baseUrl}/videomail/`;
4317
+ let url = `${this.options.apiUrl}/videomail/`;
4317
4318
  if (method === FormMethod.PUT && videomail.key) url += videomail.key;
4318
4319
  try {
4319
4320
  const request = await superagent(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
@@ -4335,7 +4336,7 @@ class Resource {
4335
4336
  const queryParams = {
4336
4337
  [constants.SITE_NAME_LABEL]: this.options.siteName
4337
4338
  };
4338
- const url = `${this.options.baseUrl}/client-error/`;
4339
+ const url = `${this.options.apiUrl}/client-error/`;
4339
4340
  try {
4340
4341
  const fullVideomailErrorData = {
4341
4342
  browser: err.browser,
@@ -4432,7 +4433,7 @@ const options_options = {
4432
4433
  logger: console,
4433
4434
  logStackSize: 30,
4434
4435
  verbose: !PRODUCTION,
4435
- baseUrl: "https://videomail.io",
4436
+ apiUrl: "https://videomail.io/api",
4436
4437
  socketUrl: "wss://videomail.io",
4437
4438
  siteName: "videomail-client-demo",
4438
4439
  enablePause: true,
@@ -4523,7 +4524,8 @@ const options_options = {
4523
4524
  },
4524
4525
  loadUserMediaOnRecord: false,
4525
4526
  callbacks: {
4526
- adjustFormDataBeforePosting: void 0
4527
+ adjustFormDataBeforePosting: void 0,
4528
+ adjustFormValueBeforePopulating: void 0
4527
4529
  },
4528
4530
  defaults: {
4529
4531
  from: void 0,
@@ -1,5 +1,5 @@
1
1
  import { PartialDeep } from "type-fest";
2
- import { PartialVideomail } from "./Videomail";
2
+ import { PartialVideomail, Videomail } from "./Videomail";
3
3
  export interface VideomailClientOptions {
4
4
  logger: {
5
5
  debug: (message: unknown) => void;
@@ -10,7 +10,7 @@ export interface VideomailClientOptions {
10
10
  };
11
11
  logStackSize: number;
12
12
  verbose: boolean;
13
- baseUrl: string;
13
+ apiUrl: string;
14
14
  socketUrl: string;
15
15
  siteName: string;
16
16
  enablePause: boolean;
@@ -99,6 +99,7 @@ export interface VideomailClientOptions {
99
99
  loadUserMediaOnRecord: boolean;
100
100
  callbacks: {
101
101
  adjustFormDataBeforePosting?: undefined | ((videomail: PartialVideomail) => PartialVideomail);
102
+ adjustFormValueBeforePopulating?: undefined | ((name: string, videomail: Videomail) => string);
102
103
  };
103
104
  defaults: {
104
105
  from?: string | undefined;
package/dist/umd/index.js CHANGED
@@ -10670,7 +10670,7 @@
10670
10670
  var client = __webpack_require__("./node_modules/superagent/lib/client.js");
10671
10671
  var client_default = /*#__PURE__*/ __webpack_require__.n(client);
10672
10672
  var package_namespaceObject = {
10673
- rE: "12.0.2"
10673
+ rE: "13.1.0"
10674
10674
  };
10675
10675
  var defined = __webpack_require__("./node_modules/defined/index.js");
10676
10676
  var defined_default = /*#__PURE__*/ __webpack_require__.n(defined);
@@ -14405,8 +14405,9 @@
14405
14405
  for (const formControl of this.formElement.elements){
14406
14406
  const name = formControl.getAttribute("name");
14407
14407
  if (name) {
14408
- const value = videomail[name];
14408
+ let value = videomail[name];
14409
14409
  const tagName = formControl.tagName;
14410
+ if (this.options.callbacks.adjustFormValueBeforePopulating) value = this.options.callbacks.adjustFormValueBeforePopulating(name, videomail);
14410
14411
  switch(tagName){
14411
14412
  case "INPUT":
14412
14413
  {
@@ -14553,7 +14554,7 @@
14553
14554
  this.options.logger.debug(`Form: doTheSubmit(${util_pretty(e)})`);
14554
14555
  e.preventDefault();
14555
14556
  } else this.options.logger.debug("Form: doTheSubmit()");
14556
- const url = this.formElement.getAttribute("action") ?? this.options.baseUrl;
14557
+ const url = this.formElement.getAttribute("action") ?? this.options.apiUrl;
14557
14558
  const method = this.formElement.getAttribute("method");
14558
14559
  let chosenMethod;
14559
14560
  switch(method){
@@ -14632,7 +14633,7 @@
14632
14633
  return newVideomail;
14633
14634
  }
14634
14635
  async get(identifierName, identifierValue) {
14635
- const url = `${this.options.baseUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
14636
+ const url = `${this.options.apiUrl}/videomail/${identifierName}/${identifierValue}/snapshot`;
14636
14637
  try {
14637
14638
  const request = await client_default()("get", url).type("json").set("Accept", "application/json").withCredentials().set("Timezone-Id", this.timezoneId).set(constants.SITE_NAME_LABEL, this.options.siteName).timeout(this.options.timeouts.connection);
14638
14639
  const videomail = request.body;
@@ -14648,7 +14649,7 @@
14648
14649
  const queryParams = {
14649
14650
  [constants.SITE_NAME_LABEL]: this.options.siteName
14650
14651
  };
14651
- let url = `${this.options.baseUrl}/videomail/`;
14652
+ let url = `${this.options.apiUrl}/videomail/`;
14652
14653
  if (method === FormMethod.PUT && videomail.key) url += videomail.key;
14653
14654
  try {
14654
14655
  const request = await client_default()(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(videomail).timeout(this.options.timeouts.connection);
@@ -14670,7 +14671,7 @@
14670
14671
  const queryParams = {
14671
14672
  [constants.SITE_NAME_LABEL]: this.options.siteName
14672
14673
  };
14673
- const url = `${this.options.baseUrl}/client-error/`;
14674
+ const url = `${this.options.apiUrl}/client-error/`;
14674
14675
  try {
14675
14676
  const fullVideomailErrorData = {
14676
14677
  browser: err.browser,
@@ -14767,7 +14768,7 @@
14767
14768
  logger: console,
14768
14769
  logStackSize: 30,
14769
14770
  verbose: !PRODUCTION,
14770
- baseUrl: "https://videomail.io",
14771
+ apiUrl: "https://videomail.io/api",
14771
14772
  socketUrl: "wss://videomail.io",
14772
14773
  siteName: "videomail-client-demo",
14773
14774
  enablePause: true,
@@ -14858,7 +14859,8 @@
14858
14859
  },
14859
14860
  loadUserMediaOnRecord: false,
14860
14861
  callbacks: {
14861
- adjustFormDataBeforePosting: void 0
14862
+ adjustFormDataBeforePosting: void 0,
14863
+ adjustFormValueBeforePopulating: void 0
14862
14864
  },
14863
14865
  defaults: {
14864
14866
  from: void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "12.0.2",
3
+ "version": "13.1.0",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",