@danidoble/webserial 4.3.12 → 4.3.13

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/pinpad.js CHANGED
@@ -1,4 +1,4 @@
1
- import { K as si, a as ai, i as W, b as ee, w as ie } from "./kernel-D2dlpMca.js";
1
+ import { K as si, a as ai, i as W, b as ee, w as ie } from "./kernel-CxSXwsm6.js";
2
2
  import { s as ne } from "./webserial-core-l5v2UEyv.js";
3
3
  var oi = "0123456789abcdefghijklmnopqrstuvwxyz";
4
4
  function X(n) {
@@ -120,7 +120,7 @@ var tt, li = {
120
120
  }
121
121
  }, et = 1e13, ct = (
122
122
  /** @class */
123
- function() {
123
+ (function() {
124
124
  function n(t) {
125
125
  this.buf = [+t || 0];
126
126
  }
@@ -149,14 +149,14 @@ var tt, li = {
149
149
  var t = this.buf;
150
150
  return t.length == 1 ? t[0] : this;
151
151
  }, n;
152
- }()
152
+ })()
153
153
  ), xe = "…", fi = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, pi = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
154
154
  function nt(n, t) {
155
155
  return n.length > t && (n = n.substring(0, t) + xe), n;
156
156
  }
157
157
  var Lt = (
158
158
  /** @class */
159
- function() {
159
+ (function() {
160
160
  function n(t, e) {
161
161
  this.hexDigits = "0123456789ABCDEF", t instanceof n ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e);
162
162
  }
@@ -258,10 +258,10 @@ var Lt = (
258
258
  }
259
259
  return a > 0 && (r += ".incomplete"), r;
260
260
  }, n;
261
- }()
261
+ })()
262
262
  ), di = (
263
263
  /** @class */
264
- function() {
264
+ (function() {
265
265
  function n(t, e, i, r, s) {
266
266
  if (!(r instanceof oe))
267
267
  throw new Error("Invalid tag value.");
@@ -469,10 +469,10 @@ var Lt = (
469
469
  }
470
470
  return new n(i, o, s, r, c);
471
471
  }, n;
472
- }()
472
+ })()
473
473
  ), oe = (
474
474
  /** @class */
475
- function() {
475
+ (function() {
476
476
  function n(t) {
477
477
  var e = t.get();
478
478
  if (this.tagClass = e >> 6, this.tagConstructed = (e & 32) !== 0, this.tagNumber = e & 31, this.tagNumber == 31) {
@@ -488,10 +488,10 @@ var Lt = (
488
488
  }, n.prototype.isEOC = function() {
489
489
  return this.tagClass === 0 && this.tagNumber === 0;
490
490
  }, n;
491
- }()
491
+ })()
492
492
  ), $, _i = 244837814094590, ce = (_i & 16777215) == 15715070, I = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], gi = (1 << 26) / I[I.length - 1], P = (
493
493
  /** @class */
494
- function() {
494
+ (function() {
495
495
  function n(t, e, i) {
496
496
  t != null && (typeof t == "number" ? this.fromNumber(t, e, i) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e));
497
497
  }
@@ -1008,10 +1008,10 @@ var Lt = (
1008
1008
  o.length = (t >> 3) + 1, e.nextBytes(o), c > 0 ? o[0] &= (1 << c) - 1 : o[0] = 0, this.fromString(o, 256);
1009
1009
  }
1010
1010
  }, n;
1011
- }()
1011
+ })()
1012
1012
  ), mi = (
1013
1013
  /** @class */
1014
- function() {
1014
+ (function() {
1015
1015
  function n() {
1016
1016
  }
1017
1017
  return n.prototype.convert = function(t) {
@@ -1023,10 +1023,10 @@ var Lt = (
1023
1023
  }, n.prototype.sqrTo = function(t, e) {
1024
1024
  t.squareTo(e);
1025
1025
  }, n;
1026
- }()
1026
+ })()
1027
1027
  ), ue = (
1028
1028
  /** @class */
1029
- function() {
1029
+ (function() {
1030
1030
  function n(t) {
1031
1031
  this.m = t;
1032
1032
  }
@@ -1041,10 +1041,10 @@ var Lt = (
1041
1041
  }, n.prototype.sqrTo = function(t, e) {
1042
1042
  t.squareTo(e), this.reduce(e);
1043
1043
  }, n;
1044
- }()
1044
+ })()
1045
1045
  ), he = (
1046
1046
  /** @class */
1047
- function() {
1047
+ (function() {
1048
1048
  function n(t) {
1049
1049
  this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t;
1050
1050
  }
@@ -1068,10 +1068,10 @@ var Lt = (
1068
1068
  }, n.prototype.sqrTo = function(t, e) {
1069
1069
  t.squareTo(e), this.reduce(e);
1070
1070
  }, n;
1071
- }()
1071
+ })()
1072
1072
  ), yi = (
1073
1073
  /** @class */
1074
- function() {
1074
+ (function() {
1075
1075
  function n(t) {
1076
1076
  this.m = t, this.r2 = E(), this.q3 = E(), P.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t);
1077
1077
  }
@@ -1094,7 +1094,7 @@ var Lt = (
1094
1094
  }, n.prototype.sqrTo = function(t, e) {
1095
1095
  t.squareTo(e), this.reduce(e);
1096
1096
  }, n;
1097
- }()
1097
+ })()
1098
1098
  );
1099
1099
  function E() {
1100
1100
  return new P(null);
@@ -1155,7 +1155,7 @@ P.ZERO = z(0);
1155
1155
  P.ONE = z(1);
1156
1156
  var bi = (
1157
1157
  /** @class */
1158
- function() {
1158
+ (function() {
1159
1159
  function n() {
1160
1160
  this.i = 0, this.j = 0, this.S = [];
1161
1161
  }
@@ -1170,7 +1170,7 @@ var bi = (
1170
1170
  var t;
1171
1171
  return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255];
1172
1172
  }, n;
1173
- }()
1173
+ })()
1174
1174
  );
1175
1175
  function Pi() {
1176
1176
  return new bi();
@@ -1211,14 +1211,14 @@ function vi() {
1211
1211
  }
1212
1212
  var Ct = (
1213
1213
  /** @class */
1214
- function() {
1214
+ (function() {
1215
1215
  function n() {
1216
1216
  }
1217
1217
  return n.prototype.nextBytes = function(t) {
1218
1218
  for (var e = 0; e < t.length; ++e)
1219
1219
  t[e] = vi();
1220
1220
  }, n;
1221
- }()
1221
+ })()
1222
1222
  );
1223
1223
  function Ht(n) {
1224
1224
  return wi(Di(Ei(n), n.length * 8));
@@ -1333,7 +1333,7 @@ function Vi(n, t) {
1333
1333
  }
1334
1334
  var Ui = (
1335
1335
  /** @class */
1336
- function() {
1336
+ (function() {
1337
1337
  function n() {
1338
1338
  this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
1339
1339
  }
@@ -1429,7 +1429,7 @@ var Ui = (
1429
1429
  var a = s.toString(16).replace(/^1f+00/, ""), o = ki(a);
1430
1430
  return o == i(t).toString();
1431
1431
  }, n;
1432
- }()
1432
+ })()
1433
1433
  );
1434
1434
  function Li(n, t) {
1435
1435
  for (var e = n.toByteArray(), i = 0; i < e.length && e[i] == 0; )
@@ -1860,7 +1860,7 @@ p.asn1.DERTaggedObject = function(n) {
1860
1860
  }, typeof n < "u" && (typeof n.tag < "u" && (this.hT = n.tag), typeof n.explicit < "u" && (this.isExplicit = n.explicit), typeof n.obj < "u" && (this.asn1Object = n.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
1861
1861
  };
1862
1862
  R(p.asn1.DERTaggedObject, p.asn1.ASN1Object);
1863
- var Fi = /* @__PURE__ */ function() {
1863
+ var Fi = /* @__PURE__ */ (function() {
1864
1864
  var n = function(t, e) {
1865
1865
  return n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(i, r) {
1866
1866
  i.__proto__ = r;
@@ -1877,9 +1877,9 @@ var Fi = /* @__PURE__ */ function() {
1877
1877
  }
1878
1878
  t.prototype = e === null ? Object.create(e) : (i.prototype = e.prototype, new i());
1879
1879
  };
1880
- }(), _e = (
1880
+ })(), _e = (
1881
1881
  /** @class */
1882
- function(n) {
1882
+ (function(n) {
1883
1883
  Fi(t, n);
1884
1884
  function t(e) {
1885
1885
  var i = n.call(this) || this;
@@ -1975,10 +1975,10 @@ var Fi = /* @__PURE__ */ function() {
1975
1975
  }, t.prototype.parsePropertiesFrom = function(e) {
1976
1976
  this.n = e.n, this.e = e.e, e.hasOwnProperty("d") && (this.d = e.d, this.p = e.p, this.q = e.q, this.dmp1 = e.dmp1, this.dmq1 = e.dmq1, this.coeff = e.coeff);
1977
1977
  }, t;
1978
- }(Ui)
1978
+ })(Ui)
1979
1979
  ), kt, ji = typeof process < "u" ? (kt = process.env) === null || kt === void 0 ? void 0 : kt.npm_package_version : void 0, qi = (
1980
1980
  /** @class */
1981
- function() {
1981
+ (function() {
1982
1982
  function n(t) {
1983
1983
  t === void 0 && (t = {}), this.default_key_size = t.default_key_size ? parseInt(t.default_key_size, 10) : 1024, this.default_public_exponent = t.default_public_exponent || "010001", this.log = t.log || !1, this.key = t.key || null;
1984
1984
  }
@@ -2050,7 +2050,7 @@ var Fi = /* @__PURE__ */ function() {
2050
2050
  }, n.prototype.getPublicKeyB64 = function() {
2051
2051
  return this.getKey().getPublicBaseKeyB64();
2052
2052
  }, n.version = ji, n;
2053
- }()
2053
+ })()
2054
2054
  );
2055
2055
  function Be(n, t) {
2056
2056
  return function() {
@@ -4187,9 +4187,8 @@ class Fr extends si {
4187
4187
  }
4188
4188
  // eslint-disable-next-line no-unused-vars
4189
4189
  serialSetConnectionConstant(t = 1) {
4190
- const e = "", i = "";
4191
4190
  let r = "C56AABOUT";
4192
- r = e + r.length.toString().padStart(3, "0") + r + i;
4191
+ r = "" + r.length.toString().padStart(3, "0") + r + "";
4193
4192
  let s = 0;
4194
4193
  for (let o = 0; o < r.length; o++)
4195
4194
  s ^= r.charCodeAt(o);
package/dist/pinpax.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./kernel-BaX0x8ws.cjs"),a=require("./relay-E3NCcSjS.cjs"),c=require("./webserial-core-BNx2y6fr.cjs");class h extends u.Kernel{__pinpax__={server:"DEV",businessId:null,encryptionKey:null,apiKey:null,asyncResponses:{voucher:null,sale:null},waiting:{voucher:!1,sale:!1}};constructor({filters:s=null,config_port:e={baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:t=1,device_listen_on_channel:i=1}={filters:null,config_port:{baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1}){if(super({filters:s,config_port:e,no_device:t,device_listen_on_channel:i}),this.__internal__.device.type="pinpax",c.s.getCustom(this.typeDevice,t))throw new Error(`Device ${this.typeDevice} ${t} already exists`);this.__internal__.time.response_connection=4e3,this.__internal__.time.response_general=3e3,this.__internal__.serial.delay_first_connection=1e3,this.__internal__.serial.response.replacer="",this.__internal__.serial.response.limiter=`\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./kernel-chJkQxDD.cjs"),a=require("./relay-E3NCcSjS.cjs"),c=require("./webserial-core-BNx2y6fr.cjs");class h extends u.Kernel{__pinpax__={server:"DEV",businessId:null,encryptionKey:null,apiKey:null,asyncResponses:{voucher:null,sale:null},waiting:{voucher:!1,sale:!1}};constructor({filters:s=null,config_port:e={baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:t=1,device_listen_on_channel:i=1}={filters:null,config_port:{baudRate:115200,dataBits:8,stopBits:1,parity:"none",bufferSize:32768,flowControl:"none"},no_device:1,device_listen_on_channel:1}){if(super({filters:s,config_port:e,no_device:t,device_listen_on_channel:i}),this.__internal__.device.type="pinpax",c.s.getCustom(this.typeDevice,t))throw new Error(`Device ${this.typeDevice} ${t} already exists`);this.__internal__.time.response_connection=4e3,this.__internal__.time.response_general=3e3,this.__internal__.serial.delay_first_connection=1e3,this.__internal__.serial.response.replacer="",this.__internal__.serial.response.limiter=`\r
2
2
  `,this.#t(),c.s.add(this),this.getResponseAsString()}#t(){const s=["buttons-status","init-app","connectMessage","voucher","info","keep-alive","reset-app","get-config","payment","error","refund","login"];for(const e of s)this.serialRegisterAvailableListener(e)}set businessId(s){this.__pinpax__.businessId=s}get businessId(){return this.__pinpax__.businessId}set encryptionKey(s){this.__pinpax__.encryptionKey=s}get encryptionKey(){return this.__pinpax__.encryptionKey}set apiKey(s){this.__pinpax__.apiKey=s}get apiKey(){return this.__pinpax__.apiKey}set server(s){this.__pinpax__.server=s}get server(){return this.__pinpax__.server}serialMessage(s){let e=null;try{e=JSON.parse(s),e.request||(e.request=this.lastAction),e.name||(e.name=this.lastAction)}catch(t){console.error("Error parsing response",t,s),this.dispatch("serial:message",s);return}switch(e.response){case"INITAPP":this.dispatch("init-app",{name:"INITAPP",request:this.lastAction,status:"started"}),this.#n().then(()=>{});break;case"CONNECT":this.dispatch("connectMessage",{name:"CONNECT",request:this.lastAction,status:"connected"}),this.#r().then(()=>{});break;case"LOGIN":e.name||(e.name="LOGIN"),this.dispatch("login",e);break;case"LASTVOUCHER":e.name||(e.name="LASTVOUCHER"),this.dispatch("voucher",e),this.__pinpax__.waiting.voucher&&(this.__pinpax__.asyncResponses.voucher=e,this.__pinpax__.waiting.voucher=!1);break;case"DEVICEINFO":e.name||(e.name="DEVICEINFO"),this.dispatch("info",e);break;case"KEEPALIVE":this.dispatch("keep-alive",{name:"KEEPALIVE",request:this.lastAction,status:"alive"});break;case"RESETAPP":this.dispatch("reset-app",{name:"RESETAPP",request:this.lastAction,status:"accepted"});break;case"GETCONFIG":e.name||(e.name="GETCONFIG"),this.dispatch("get-config",e);break;case"HIDEBUTTONS":this.dispatch("buttons-status",{name:"HIDEBUTTONS",request:this.lastAction,hidden:!0});break;case"SHOWBUTTONS":this.dispatch("buttons-status",{name:"SHOWBUTTONS",request:this.lastAction,hidden:!1});break;case"PAYMENT_PROCESS":e.name||(e.name="PAYMENT_PROCESS"),this.dispatch("payment",{name:"PAYMENT_PROCESS",request:this.lastAction,status:"starting",amount:e.amount,reference:e.referecence});break;case"INSERT_CARD":this.dispatch("payment",{name:"INSERT_CARD",request:this.lastAction,status:"insert card"});break;case"CARD_DATA":e.name||(e.name="CARD_DATA"),this.dispatch("payment",{name:"CARD_DATA",request:this.lastAction,status:"card data",amount:e.amount,cardHolderName:e.cardHolderName,ccMark:e.ccMark,ccType:e.ccType,currency:e.currency,maskedPan:e.maskedPan,readingType:e.readingType});break;case"MERCHANT":e.name||(e.name="MERCHANT"),this.dispatch("payment",{request:this.lastAction,status:"merchant",afiliation:e.afiliation,alias:e.alias,amountCashBackCommission:e.amountCashBackCommission,currency:e.currency,description:e.description,hasCashBack:e.hasCashBack,limitCashBackAmount:e.limitCashBackAmount,merchant:e.merchant,months:e.months,name:e.name});break;case"TRANSACTION_RESULT":e.name||(e.name="TRANSACTION_RESULT"),this.#o({status:"result",approved:e.approved,acquirer:e.acquirer,address:e.address,amount:e.amount,amountCashback:e.amountCashback,appIDLabel:e.appIDLabel,appId:e.appId,arqc:e.arqc,auth:e.auth,ccBin:e.ccBin,ccExpirationDate:e.ccExpirationDate,ccName:e.ccName,ccNumber:e.ccNumber,ccType:e.ccType,comissionCashback:e.comissionCashback,currency:e.currency,date:e.date,errorCode:e.errorCode,errorDescription:e.errorDescription,folio:e.folio,id:e.id,merchantName:e.merchantName,msiLabel:e.msiLabel,operation:e.operation,pin:e.pin,qps:e.qps,reference:e.reference,response:e.response,source:e.source,sourceLabel:e.sourceLabel,time:e.time});break;case"ERROR":e.name||(e.name="ERROR"),this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale={status:"error",approved:!1,response:e}),this.dispatch("error",{name:"ERROR",request:this.lastAction,status:"error",response:e}),this.dispatch("payment",{name:"ERROR",request:this.lastAction,status:"error",response:e});break;case"REFUND":this.dispatch("refund",{name:"ERROR",request:this.lastAction,status:"refund",response:e});break}this.dispatch("serial:message",e)}serialSetConnectionConstant(s=1){return a.s.connection(s)}softReload(){super.softReload(),this.__pinpax__.waiting.sale=!1,this.__pinpax__.waiting.voucher=!1,this.__pinpax__.asyncResponses.sale=null,this.__pinpax__.asyncResponses.voucher=null}async sendCustomCode(s={}){if(typeof s!="object")throw new Error("Invalid object");if(s.constructor!==Object)throw new Error("Invalid object");if(Object.keys(s).length===0)throw new Error("Empty object");if(s.action===void 0||s.action===null)throw new Error("Invalid object add action");const e=JSON.stringify(s),t=this.parseStringToBytes(e,`\r
3
3
  `);await this.appendToQueue(this.stringArrayToUint8Array(t),"custom")}async connectMessage(){await this.appendToQueue(a.s.connect(),"connect:message")}async#e(){if(this.isDisconnected)throw new Error("Device is disconnected");if(this.queue.length===0)return!0;const s=this;return new Promise(e=>{let t=setInterval(()=>{s.queue.length===0&&(clearInterval(t),e(!0))},500)})}async#s({type:s="production"}={}){const e=a.s.readQR({type:s});return await this.appendToQueue(e,"read-qr")}async#a(){await this.appendToQueue(a.s.forceHide(),"force-hide")}async#i(){await this.appendToQueue(a.s.forceShow(),"force-show")}async#n(){await this.connectMessage()}async#r(){await this.hideButtons()}#o(s){this.dispatch("payment",s),this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale=s)}async makeSale({amount:s=0,reference:e=null}={}){if(this.isDisconnected)throw new Error("Device is disconnected");if(this.__pinpax__.waiting.sale)throw new Error("Already waiting for sale response");const t=a.s.makeSale({amount:s,reference:e});this.__pinpax__.waiting.sale=!0,this.__pinpax__.asyncResponses.sale=null,this.queue.length>0&&await this.#e();const i=this;return await this.appendToQueue(t,"make-sale"),new Promise(n=>{const r=setInterval(()=>{if(i.__pinpax__.asyncResponses.sale){const o=i.__pinpax__.asyncResponses.sale;i.__pinpax__.asyncResponses.sale=null,i.__pinpax__.waiting.sale=!1,clearInterval(r),n(o.approved)}},100)})}async getVoucher({folio:s=null}={}){if(this.isDisconnected)throw new Error("Device is disconnected");if(this.__pinpax__.waiting.voucher)throw new Error("Already waiting for voucher");if(!s)throw new Error("Folio is required");this.__pinpax__.waiting.voucher=!0,this.__pinpax__.asyncResponses.voucher=null;const e=a.s.getVoucher({folio:s});this.queue.length>0&&await this.#e(),await this.appendToQueue(e,"get-voucher");const t=this;return new Promise((i,n)=>{const r=setTimeout(()=>{t.__pinpax__.waiting.voucher=!1,n("Timeout")},1e4),o=setInterval(()=>{if(t.__pinpax__.asyncResponses.voucher){const p=t.__pinpax__.asyncResponses.voucher;t.__pinpax__.asyncResponses.voucher=null,t.__pinpax__.waiting.voucher=!1,clearInterval(o),clearTimeout(r),i(p.voucher)}},100)})}async info(){await this.appendToQueue(a.s.info(),"info")}async keepAlive(){await this.appendToQueue(a.s.keepAlive(),"keep-alive")}async restartApp(){await this.appendToQueue(a.s.restartApp(),"reset-app")}async getConfig(){return await this.appendToQueue(a.s.getConfig(),"get-config")}async hideButtons(){return await this.appendToQueue(a.s.hideButtons(),"hide-buttons"),await this.#a()}async showButtons(){return await this.appendToQueue(a.s.showButtons(),"show-buttons"),await this.#i()}async demo(){return console.warn("RUNNING DEMO APP, BE CAREFUL"),await this.appendToQueue(a.s.demo(),"demo")}async refund({amount:s=0,folio:e=null,auth:t=null}={}){return await this.appendToQueue(a.s.refund({amount:s,folio:e,auth:t}),"refund")}async readProductionQR(){return await this.#s({type:"production"})}async readQualityAssuranceQR(){return this.#s({type:"QA"})}async exit(){return await this.appendToQueue(a.s.exit(),"exit-app")}async init(){await this.appendToQueue(a.s.init(),"init-app")}async login(){if(!this.apiKey||!this.businessId||!this.encryptionKey||!this.server)throw new Error("Invalid data to login check apiKey, businessId, encryptionKey, server");const s=JSON.stringify({action:"LOGIN_MIT",server:this.__pinpax__.server,business_id:this.__pinpax__.businessId,encryption_key:this.__pinpax__.encryptionKey,api_key:this.__pinpax__.apiKey}),e=this.parseStringToBytes(s,`\r
4
4
  `);await this.appendToQueue(e,"login")}}exports.PinPax=h;
package/dist/pinpax.js CHANGED
@@ -1,4 +1,4 @@
1
- import { K as h } from "./kernel-D2dlpMca.js";
1
+ import { K as h } from "./kernel-CxSXwsm6.js";
2
2
  import { s as a } from "./relay-DP8PLsDP.js";
3
3
  import { s as c } from "./webserial-core-l5v2UEyv.js";
4
4
  class m extends h {
package/dist/relay.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./kernel-BaX0x8ws.cjs"),a=require("./relay-E3NCcSjS.cjs"),r=require("./webserial-core-BNx2y6fr.cjs");class l extends s.Kernel{constructor({filters:t=null,config_port:e=null,no_device:n=1}={}){if(super({filters:t,config_port:e,no_device:n}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,r.s.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);r.s.add(this)}serialMessage(t){t=this.fixHexArray(t);const e={code:t,name:null,description:null,request:null,no_code:0};t[0]==="a0"&&t[2]=="00"?(e.name="Relay turned off",e.description="The relay has been turned off successfully.",e.request=this.lastAction,e.no_code=101):t[0]==="a0"&&t[2]=="01"?(e.name="Relay turned on",e.description="The relay has been turned on successfully.",e.request=this.lastAction,e.no_code=102):(e.name="Unrecognized response",e.description="The response of application was received, but dont identify with any of current parameters",e.request="undefined",e.no_code=400),this.dispatch("serial:message",e)}serialRelaySumHex(t){let e=0;return t.forEach((n,i)=>{i!==3&&(e+=n)}),e}serialSetConnectionConstant(t=1){return a.e.connection(t)}async turnOn(){const t=a.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=a.e.deactivate();await this.appendToQueue(t,"relay:turn-off")}async toggle({inverse:t=!1,ms:e=300}={}){if(!t){await this.turnOn(),await s.wait(e),await this.turnOff();return}await this.turnOff(),await s.wait(e),await this.turnOn()}}exports.Relay=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./kernel-chJkQxDD.cjs"),a=require("./relay-E3NCcSjS.cjs"),r=require("./webserial-core-BNx2y6fr.cjs");class l extends s.Kernel{constructor({filters:t=null,config_port:e=null,no_device:n=1}={}){if(super({filters:t,config_port:e,no_device:n}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,r.s.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);r.s.add(this)}serialMessage(t){t=this.fixHexArray(t);const e={code:t,name:null,description:null,request:null,no_code:0};t[0]==="a0"&&t[2]=="00"?(e.name="Relay turned off",e.description="The relay has been turned off successfully.",e.request=this.lastAction,e.no_code=101):t[0]==="a0"&&t[2]=="01"?(e.name="Relay turned on",e.description="The relay has been turned on successfully.",e.request=this.lastAction,e.no_code=102):(e.name="Unrecognized response",e.description="The response of application was received, but dont identify with any of current parameters",e.request="undefined",e.no_code=400),this.dispatch("serial:message",e)}serialRelaySumHex(t){let e=0;return t.forEach((n,i)=>{i!==3&&(e+=n)}),e}serialSetConnectionConstant(t=1){return a.e.connection(t)}async turnOn(){const t=a.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=a.e.deactivate();await this.appendToQueue(t,"relay:turn-off")}async toggle({inverse:t=!1,ms:e=300}={}){if(!t){await this.turnOn(),await s.wait(e),await this.turnOff();return}await this.turnOff(),await s.wait(e),await this.turnOn()}}exports.Relay=l;
package/dist/relay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { K as o, w as a } from "./kernel-D2dlpMca.js";
1
+ import { K as o, w as a } from "./kernel-CxSXwsm6.js";
2
2
  import { e as s } from "./relay-DP8PLsDP.js";
3
3
  import { s as i } from "./webserial-core-l5v2UEyv.js";
4
4
  class h extends o {
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-BaX0x8ws.cjs"),r=require("./relay.cjs"),o=require("./locker.cjs"),i=require("./pinpad.cjs"),t=require("./pinpax.cjs"),n=require("./jofemar.cjs"),a=require("./boardroid.cjs"),s=require("./hopper.cjs"),c=require("./webserial-core-BNx2y6fr.cjs");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./kernel-chJkQxDD.cjs"),r=require("./relay.cjs"),o=require("./locker.cjs"),i=require("./pinpad.cjs"),t=require("./pinpax.cjs"),n=require("./jofemar.cjs"),a=require("./boardroid.cjs"),s=require("./hopper.cjs"),c=require("./webserial-core-BNx2y6fr.cjs");/**
2
2
  * @license Webserial
3
3
  * webserial
4
4
  *
package/dist/webserial.js CHANGED
@@ -1,5 +1,5 @@
1
- import { s as o, g as r, w as e } from "./kernel-D2dlpMca.js";
2
- import { E as f, K as x } from "./kernel-D2dlpMca.js";
1
+ import { s as o, g as r, w as e } from "./kernel-CxSXwsm6.js";
2
+ import { E as f, K as x } from "./kernel-CxSXwsm6.js";
3
3
  import { Relay as n } from "./relay.js";
4
4
  import { Locker as l } from "./locker.js";
5
5
  import { PinPad as P } from "./pinpad.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danidoble/webserial",
3
- "version": "4.3.12",
3
+ "version": "4.3.13",
4
4
  "author": "danidoble",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "postcss": "^8.5.6",
21
21
  "prettier": "^3.6.2",
22
22
  "uuid": "^11.1.0",
23
- "vite": "^7.1.3",
23
+ "vite": "^7.1.4",
24
24
  "webserial-core": "^1.0.12"
25
25
  },
26
26
  "exports": {