@danidoble/webserial 4.1.8 → 4.1.9

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/dist/webserial.js CHANGED
@@ -1392,8 +1392,8 @@ const I = class I extends Tt {
1392
1392
  static add(n) {
1393
1393
  const t = n.typeDevice, e = n.uuid;
1394
1394
  if (typeof I.devices[t] > "u") return I.typeError(t);
1395
- if (I.$dispatchChange(n), !I.devices[t][e])
1396
- return I.devices[t][e] = n, I.$dispatchChange(n), I.devices[t].indexOf(n);
1395
+ if (this.instance.dispatch("change", I.devices), !I.devices[t][e])
1396
+ return I.devices[t][e] = n, this.instance.dispatch("change", I.devices), I.devices[t].indexOf(n);
1397
1397
  }
1398
1398
  static get(n, t) {
1399
1399
  return typeof I.devices[n] > "u" ? I.typeError(n) : I.devices[n][t];
@@ -1456,7 +1456,7 @@ let X = I;
1456
1456
  X.instance || (X.instance = new X());
1457
1457
  class Vt extends Da {
1458
1458
  constructor(n) {
1459
- super(n), this.getResponseAsArrayHex(), this.__internal__.device.door_open = !1, this.__internal__.time.response_engines = 2e3, this.__internal__.time.sense = 100, this.__internal__.interval.waiting_sense = 0, this.__internal__.dispense = {
1459
+ super(n), this.__internal__ = structuredClone(this.__internal__), this.getResponseAsArrayHex(), this.__internal__.device.door_open = !1, this.__internal__.time.response_engines = 2e3, this.__internal__.time.sense = 100, this.__internal__.interval.waiting_sense = 0, this.__internal__.dispense = {
1460
1460
  must_response: !1,
1461
1461
  dispensing: !1,
1462
1462
  status: null,
@@ -1541,7 +1541,7 @@ class Vt extends Da {
1541
1541
  console.error("Invalid data to make an emulation");
1542
1542
  return;
1543
1543
  }
1544
- this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"), X.$dispatchChange(this), this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0)), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
1544
+ this.__internal__.serial.connected || (this.__internal__.serial.connected = !0, this.dispatch("serial:connected"), X.instance.dispatch("change"), this.__internal__.interval.reconnection && (clearInterval(this.__internal__.interval.reconnection), this.__internal__.interval.reconnection = 0)), this.__internal__.timeout.until_response && (clearTimeout(this.__internal__.timeout.until_response), this.__internal__.timeout.until_response = 0);
1545
1545
  const t = [];
1546
1546
  for (const e in n.code)
1547
1547
  t.push(n.code[e].toString().padStart(2, "0").toLowerCase());
@@ -4745,7 +4745,7 @@ function Lt(r, n) {
4745
4745
  const cr = (r) => {
4746
4746
  const n = Lt({}, r);
4747
4747
  let { data: t, withXSRFToken: e, xsrfHeaderName: i, xsrfCookieName: s, headers: a, auth: c } = n;
4748
- n.headers = a = ct.from(a), n.url = nr(or(n.baseURL, n.url), r.params, r.paramsSerializer), c && a.set(
4748
+ n.headers = a = ct.from(a), n.url = nr(or(n.baseURL, n.url, n.allowAbsoluteUrls), r.params, r.paramsSerializer), c && a.set(
4749
4749
  "Authorization",
4750
4750
  "Basic " + btoa((c.username || "") + ":" + (c.password ? unescape(encodeURIComponent(c.password)) : ""))
4751
4751
  );
@@ -5095,7 +5095,7 @@ function Pi(r) {
5095
5095
  ), e.response.headers = ct.from(e.response.headers))), Promise.reject(e);
5096
5096
  });
5097
5097
  }
5098
- const dr = "1.8.2", Xe = {};
5098
+ const dr = "1.8.3", Xe = {};
5099
5099
  ["object", "boolean", "number", "function", "string", "symbol"].forEach((r, n) => {
5100
5100
  Xe[r] = function(e) {
5101
5101
  return typeof e === r || "a" + (n < 1 ? "n " : " ") + r;
@@ -5465,13 +5465,36 @@ var _, fr, gr, br, vn, yr, mr, wr, vr, Er, Pr, Cr, Tr, Sr, kr, ne, ie, xr, re, A
5465
5465
  class Zc extends Vt {
5466
5466
  constructor({
5467
5467
  filters: t = null,
5468
- config_port: e = null,
5468
+ config_port: e = {
5469
+ baudRate: 19200,
5470
+ dataBits: 8,
5471
+ stopBits: 1,
5472
+ parity: "none",
5473
+ bufferSize: 32768,
5474
+ flowControl: "none"
5475
+ },
5469
5476
  no_device: i = 1,
5470
- username: s = null,
5471
- password: a = null,
5472
- environment: c = "production"
5473
- } = {}) {
5474
- super({ filters: t, config_port: e, no_device: i });
5477
+ device_listen_on_channel: s = 1,
5478
+ username: a = null,
5479
+ password: c = null,
5480
+ environment: l = "production"
5481
+ } = {
5482
+ filters: null,
5483
+ config_port: {
5484
+ baudRate: 19200,
5485
+ dataBits: 8,
5486
+ stopBits: 1,
5487
+ parity: "none",
5488
+ bufferSize: 32768,
5489
+ flowControl: "none"
5490
+ },
5491
+ no_device: 1,
5492
+ device_listen_on_channel: 1,
5493
+ username: null,
5494
+ password: null,
5495
+ environment: "production"
5496
+ }) {
5497
+ super({ filters: t, config_port: e, no_device: i, device_listen_on_channel: s });
5475
5498
  J(this, _);
5476
5499
  rt(this, "__pinPad__", {
5477
5500
  buffer: null,
@@ -5622,7 +5645,7 @@ class Zc extends Vt {
5622
5645
  throw new Error("Crypto not supported in this browser");
5623
5646
  if (X.getCustom(this.typeDevice, i))
5624
5647
  throw new Error(`Device ${this.typeDevice} ${i} already exists`);
5625
- this.__internal__.time.response_connection = 3e3, this.__internal__.time.response_general = 5e3, this.__internal__.serial.delay_first_connection = 1e3, this.__internal__.serial.config_port.baudRate = 19200, this.environment = c, s && (this.username = s), a && (this.password = a), o(this, _, gr).call(this), o(this, _, fr).call(this);
5648
+ this.__internal__.time.response_connection = 3e3, this.__internal__.time.response_general = 5e3, this.__internal__.serial.delay_first_connection = 1e3, this.environment = l, a && (this.username = a), c && (this.password = c), o(this, _, gr).call(this), o(this, _, fr).call(this);
5626
5649
  }
5627
5650
  async timeout(t, e) {
5628
5651
  await super.timeout(t, e), this.__pinPad__.waiting.statusAboutWaiting && e === "about" ? this.__pinPad__.waiting.statusAboutWaiting = "rejected" : this.__pinPad__.waiting.statusInjectWaiting && e === "inject" ? this.__pinPad__.waiting.statusInjectWaiting = "rejected" : this.__pinPad__.waiting.statusinitDUKPTWaiting && e === "init-dukpt" ? this.__pinPad__.waiting.statusinitDUKPTWaiting = "rejected" : this.__pinPad__.waiting.statuswritingDUKPTWaiting && e === "dukpt" ? this.__pinPad__.waiting.statuswritingDUKPTWaiting = "rejected" : this.__pinPad__.waiting.statusReadCardWaiting && e === "read-card" ? this.__pinPad__.waiting.statusReadCardWaiting = "rejected" : this.__pinPad__.waiting.statusSecondGenerateWaiting && e === "second-generate" && (this.__pinPad__.waiting.statusSecondGenerateWaiting = "rejected");
@@ -5943,9 +5966,7 @@ _ = new WeakSet(), fr = function() {
5943
5966
  "pp:merchant-moto",
5944
5967
  "pp:dukpt",
5945
5968
  "pp:finish-emv",
5946
- "pp:response",
5947
- "pp:error",
5948
- "pp:finish-emv"
5969
+ "pp:response"
5949
5970
  ];
5950
5971
  for (const e of t)
5951
5972
  this.serialRegisterAvailableListener(e);
@@ -8717,7 +8738,7 @@ const nl = {
8717
8738
  wait: Ct,
8718
8739
  getSeconds: an,
8719
8740
  supportWebSerial: ya
8720
- }, il = "4.1.8";
8741
+ }, il = "4.1.9";
8721
8742
  export {
8722
8743
  el as Arduino,
8723
8744
  tl as Boardroid,