videomail-client 15.0.3 → 15.2.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.
@@ -4,6 +4,7 @@ export type { BrowserStats } from "./types/BrowserStats";
4
4
  export type { VideomailCommand } from "./types/command";
5
5
  export type { VideomailCommandArgs } from "./types/command";
6
6
  export type { DeliveryRecord } from "./types/Delivery";
7
+ export type { CapacitorDeviceMetadata } from "./types/device";
7
8
  export type { EmailAddress, EmailAddresses } from "./types/EmailAddress";
8
9
  export type { FullVideomailErrorData, VideomailErrorData } from "./types/error";
9
10
  export type { VideomailEvents } from "./types/events";
@@ -16,4 +17,5 @@ export type { RecordingStats } from "./types/RecordingStats";
16
17
  export type { VideomailThread } from "./types/thread";
17
18
  export type { PartialVideomail, Videomail } from "./types/Videomail";
18
19
  export type { VideoTypeType } from "./types/VideoType";
20
+ export { default as getCapacitorDeviceMetadata } from "./util/getCapacitorDeviceMetadata";
19
21
  export { VideoType };
package/dist/esm/index.js CHANGED
@@ -2,6 +2,7 @@ import { deserializeError, serializeError } from "serialize-error";
2
2
  import superagent from "superagent";
3
3
  import defined from "defined";
4
4
  import { UAParser } from "ua-parser-js";
5
+ import { Device } from "@capacitor/device";
5
6
  import get_form_data from "get-form-data";
6
7
  import { createNanoEvents } from "nanoevents";
7
8
  import deepmerge from "deepmerge";
@@ -3620,7 +3621,7 @@ const constants = {
3620
3621
  }
3621
3622
  };
3622
3623
  var package_namespaceObject = {
3623
- rE: "15.0.3"
3624
+ rE: "15.2.0"
3624
3625
  };
3625
3626
  function isAudioEnabled(options) {
3626
3627
  return Boolean(options.audio.enabled);
@@ -3982,6 +3983,41 @@ function findOriginalExc(exc) {
3982
3983
  return exc;
3983
3984
  }
3984
3985
  const error_findOriginalExc = findOriginalExc;
3986
+ async function getCapacitorDeviceMetadata() {
3987
+ const errors = [];
3988
+ let battery;
3989
+ let info;
3990
+ let languageCode;
3991
+ let languageTag;
3992
+ try {
3993
+ info = await Device.getInfo();
3994
+ } catch (exc) {
3995
+ errors.push(serializeError(exc));
3996
+ }
3997
+ try {
3998
+ battery = await Device.getBatteryInfo();
3999
+ } catch (exc) {
4000
+ errors.push(serializeError(exc));
4001
+ }
4002
+ try {
4003
+ languageCode = await Device.getLanguageCode();
4004
+ } catch (exc) {
4005
+ errors.push(serializeError(exc));
4006
+ }
4007
+ try {
4008
+ languageTag = await Device.getLanguageTag();
4009
+ } catch (exc) {
4010
+ errors.push(serializeError(exc));
4011
+ }
4012
+ const metadata = {};
4013
+ if (battery) metadata.battery = battery;
4014
+ if (errors.length > 0) metadata.errors = errors;
4015
+ if (info) metadata.info = info;
4016
+ if (languageCode) metadata.languageCode = languageCode;
4017
+ if (languageTag) metadata.languageTag = languageTag;
4018
+ return metadata;
4019
+ }
4020
+ const util_getCapacitorDeviceMetadata = getCapacitorDeviceMetadata;
3985
4021
  function Despot_define_property(obj, key, value) {
3986
4022
  if (key in obj) Object.defineProperty(obj, key, {
3987
4023
  value: value,
@@ -4406,35 +4442,33 @@ class Resource {
4406
4442
  [constants.WHITELIST_KEY_LABEL]: this.options.whitelistKey
4407
4443
  };
4408
4444
  const url = `${this.options.apiUrl}/client-error/`;
4409
- try {
4410
- const fullVideomailErrorData = {
4411
- browser: err.browser,
4412
- code: err.code,
4413
- cookie: err.cookie,
4414
- cpu: err.cpu,
4415
- device: err.device,
4416
- engine: err.engine,
4417
- err: err.err ? serializeError(err.err) : void 0,
4418
- explanation: err.explanation,
4419
- location: err.location,
4420
- logLines: err.logLines,
4421
- orientation: err.orientation,
4422
- os: err.os,
4423
- screen: err.screen,
4424
- whitelistKey: err.whitelistKey,
4425
- status: err.status,
4426
- title: err.title,
4427
- message: err.message,
4428
- stack: err.stack,
4429
- versions: {
4430
- videomailClient: package_namespaceObject.rE,
4431
- videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
4432
- }
4433
- };
4434
- await superagent(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
4435
- } catch (exc) {
4436
- console.error(exc);
4437
- }
4445
+ const capacitorDevice = await util_getCapacitorDeviceMetadata();
4446
+ const fullVideomailErrorData = {
4447
+ capacitorDevice,
4448
+ browser: err.browser,
4449
+ code: err.code,
4450
+ cookie: err.cookie,
4451
+ cpu: err.cpu,
4452
+ device: err.device,
4453
+ engine: err.engine,
4454
+ err: err.err ? serializeError(err.err) : void 0,
4455
+ explanation: err.explanation,
4456
+ location: err.location,
4457
+ logLines: err.logLines,
4458
+ orientation: err.orientation,
4459
+ os: err.os,
4460
+ screen: err.screen,
4461
+ whitelistKey: err.whitelistKey,
4462
+ status: err.status,
4463
+ title: err.title,
4464
+ message: err.message,
4465
+ stack: err.stack,
4466
+ versions: {
4467
+ videomailClient: package_namespaceObject.rE,
4468
+ videomailNinjaFormPlugin: this.options.versions?.videomailNinjaFormPlugin
4469
+ }
4470
+ };
4471
+ await superagent(FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId).withCredentials().send(fullVideomailErrorData).timeout(this.options.timeouts.connection);
4438
4472
  }
4439
4473
  async post(videomail) {
4440
4474
  const newVideomail = this.applyDefaultValues(videomail);
@@ -7014,12 +7048,12 @@ class Recorder extends util_Despot {
7014
7048
  }
7015
7049
  getAvgInterval() {
7016
7050
  const intervalSum = this.getIntervalSum();
7017
- if (!intervalSum) return;
7051
+ if (void 0 === intervalSum || intervalSum <= 0) return;
7018
7052
  return intervalSum / this.framesCount;
7019
7053
  }
7020
7054
  getAvgFps() {
7021
7055
  const intervalSum = this.getIntervalSum();
7022
- if (!intervalSum) return;
7056
+ if (void 0 === intervalSum || intervalSum <= 0) return;
7023
7057
  return this.framesCount / intervalSum * 1000;
7024
7058
  }
7025
7059
  getRecordingStats() {
@@ -8674,4 +8708,4 @@ const Reactions = {
8674
8708
  label: "Sad"
8675
8709
  }
8676
8710
  };
8677
- export { Reactions, VideoType, VideomailClient };
8711
+ export { Reactions, VideoType, VideomailClient, util_getCapacitorDeviceMetadata as getCapacitorDeviceMetadata };
@@ -0,0 +1,10 @@
1
+ import type { BatteryInfo, DeviceInfo, GetLanguageCodeResult, LanguageTag } from "@capacitor/device";
2
+ import type { ErrorObject } from "serialize-error";
3
+ interface CapacitorDeviceMetadata {
4
+ battery?: BatteryInfo;
5
+ errors?: ErrorObject[];
6
+ info?: DeviceInfo;
7
+ languageCode?: GetLanguageCodeResult;
8
+ languageTag?: LanguageTag;
9
+ }
10
+ export type { CapacitorDeviceMetadata };
@@ -1,5 +1,6 @@
1
1
  import { ErrorObject } from "serialize-error";
2
2
  import type { IBrowser, ICPU, IDevice, IEngine, IOS } from "ua-parser-js";
3
+ import { CapacitorDeviceMetadata } from "./device";
3
4
  export interface VideomailErrorData {
4
5
  cause?: any;
5
6
  promise?: any;
@@ -40,5 +41,6 @@ export interface FullVideomailErrorData extends VideomailErrorData {
40
41
  clientIp?: string | null | undefined;
41
42
  userAgent?: string | null | undefined;
42
43
  isBot?: boolean | undefined;
44
+ capacitorDevice: CapacitorDeviceMetadata;
43
45
  }
44
46
  export {};
@@ -0,0 +1,3 @@
1
+ import { CapacitorDeviceMetadata } from "../types/device";
2
+ declare function getCapacitorDeviceMetadata(): Promise<CapacitorDeviceMetadata>;
3
+ export default getCapacitorDeviceMetadata;