@danidoble/webserial 4.4.0-beta.2 → 4.4.0-beta.3

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.
Files changed (58) hide show
  1. package/dist/boardroid.cjs +1 -1
  2. package/dist/boardroid.js +99 -95
  3. package/dist/hopper.cjs +2 -2
  4. package/dist/hopper.js +66 -51
  5. package/dist/jofemar.cjs +1 -1
  6. package/dist/jofemar.js +57 -141
  7. package/dist/kernel-C1HLYiV1.cjs +1 -0
  8. package/dist/kernel-C8ISUhzV.cjs +1 -0
  9. package/dist/kernel-CQcZ_OiG.js +831 -0
  10. package/dist/{kernel-CXM5xoJD.js → kernel-DkC7Kj3m.js} +147 -124
  11. package/dist/kernel-DtXV8d8B.js +831 -0
  12. package/dist/kernel-DyNuXvtW.cjs +1 -0
  13. package/dist/kernel-aqBCxtkj.js +831 -0
  14. package/dist/kernel-pO_elWba.cjs +1 -0
  15. package/dist/kernel.cjs +2 -2
  16. package/dist/kernel.d.ts +14 -0
  17. package/dist/kernel.d.ts.map +1 -0
  18. package/dist/kernel.js +3 -4
  19. package/dist/locker.cjs +1 -1
  20. package/dist/locker.js +32 -26
  21. package/dist/main.d.ts +28 -0
  22. package/dist/main.d.ts.map +1 -0
  23. package/dist/pinpad.cjs +14 -14
  24. package/dist/pinpad.js +816 -791
  25. package/dist/pinpax.cjs +4 -4
  26. package/dist/pinpax.js +54 -54
  27. package/dist/relay.cjs +1 -1
  28. package/dist/relay.js +11 -18
  29. package/dist/serial/boardroid.d.ts +206 -0
  30. package/dist/serial/boardroid.d.ts.map +1 -0
  31. package/dist/serial/hopper.d.ts +85 -0
  32. package/dist/serial/hopper.d.ts.map +1 -0
  33. package/dist/serial/jofemar.d.ts +218 -0
  34. package/dist/serial/jofemar.d.ts.map +1 -0
  35. package/dist/serial/kernel.d.ts +137 -0
  36. package/dist/serial/kernel.d.ts.map +1 -0
  37. package/dist/serial/locker.d.ts +33 -0
  38. package/dist/serial/locker.d.ts.map +1 -0
  39. package/dist/serial/pinpad.d.ts +263 -0
  40. package/dist/serial/pinpad.d.ts.map +1 -0
  41. package/dist/serial/pinpax.d.ts +60 -0
  42. package/dist/serial/pinpax.d.ts.map +1 -0
  43. package/dist/serial/relay.d.ts +13 -0
  44. package/dist/serial/relay.d.ts.map +1 -0
  45. package/dist/utils/devices.d.ts +26 -0
  46. package/dist/utils/devices.d.ts.map +1 -0
  47. package/dist/utils/dispatcher.d.ts +17 -0
  48. package/dist/utils/dispatcher.d.ts.map +1 -0
  49. package/dist/utils/emulator.d.ts +80 -0
  50. package/dist/utils/emulator.d.ts.map +1 -0
  51. package/dist/utils/utils.d.ts +7 -0
  52. package/dist/utils/utils.d.ts.map +1 -0
  53. package/dist/webserial-core-CH2Xov2y.js +3325 -0
  54. package/dist/webserial-core-Cj_EZjAU.cjs +4 -0
  55. package/dist/webserial.cjs +2 -2
  56. package/dist/webserial.js +16 -16
  57. package/package.json +10 -7
  58. package/dist/kernel-Dizfdw3M.cjs +0 -1
package/dist/pinpax.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./kernel-Dizfdw3M.cjs"),a=require("./relay-E3NCcSjS.cjs"),c=require("./webserial-core-YjdXyVOx.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,socket:n=!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,socket:!1}){if(super({filters:s,config_port:e,no_device:t,device_listen_on_channel:i,socket:n}),this.__internal__.device.type="pinpax",c.a.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
- `,this.#t(),c.a.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
- `);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
- `);await this.appendToQueue(e,"login")}}exports.PinPax=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./kernel-C1HLYiV1.cjs"),t=require("./relay-E3NCcSjS.cjs");class p extends o.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:a=1,device_listen_on_channel:i=1,socket:n=!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,socket:!1}){if(super({filters:s,config_port:e,no_device:a,device_listen_on_channel:i,socket:n}),this.__internal__.device.type="pinpax",o.Devices.getCustom(this.typeDevice,a))throw new Error(`Device ${this.typeDevice} ${a} 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
+ `,this.#t(),o.Devices.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(a){console.error("Error parsing response",a,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(){return t.s.connection()}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),a=this.parseStringToBytes(e,`\r
3
+ `);await this.appendToQueue(this.stringArrayToUint8Array(a),"custom")}async connectMessage(){await this.appendToQueue(t.s.connect(),"connect:message")}async#e(){if(this.isDisconnected)throw new Error("Device is disconnected");return this.queue.length===0?!0:new Promise(s=>{const e=setInterval(()=>{this.queue.length===0&&(clearInterval(e),s(!0))},500)})}async#s({type:s="production"}={}){const e=t.s.readQR({type:s});return await this.appendToQueue(e,"read-qr")}async#a(){await this.appendToQueue(t.s.forceHide(),"force-hide")}async#i(){await this.appendToQueue(t.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)}cancelSaleRequestInProcess(){this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale={status:"error",approved:!1,response:{}})}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 a=t.s.makeSale({amount:s,reference:e});return this.__pinpax__.waiting.sale=!0,this.__pinpax__.asyncResponses.sale=null,this.queue.length>0&&await this.#e(),await this.appendToQueue(a,"make-sale"),new Promise(i=>{const n=setInterval(()=>{if(this.__pinpax__.asyncResponses.sale){const r=this.__pinpax__.asyncResponses.sale;this.__pinpax__.asyncResponses.sale=null,this.__pinpax__.waiting.sale=!1,clearInterval(n),i(r.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=t.s.getVoucher({folio:s});return this.queue.length>0&&await this.#e(),await this.appendToQueue(e,"get-voucher"),new Promise((a,i)=>{const n=setTimeout(()=>{this.__pinpax__.waiting.voucher=!1,i("Timeout")},1e4),r=setInterval(()=>{if(this.__pinpax__.asyncResponses.voucher){const c=this.__pinpax__.asyncResponses.voucher;this.__pinpax__.asyncResponses.voucher=null,this.__pinpax__.waiting.voucher=!1,clearInterval(r),clearTimeout(n),a(c.voucher)}},100)})}async info(){await this.appendToQueue(t.s.info(),"info")}async keepAlive(){await this.appendToQueue(t.s.keepAlive(),"keep-alive")}async restartApp(){await this.appendToQueue(t.s.restartApp(),"reset-app")}async getConfig(){return await this.appendToQueue(t.s.getConfig(),"get-config")}async hideButtons(){return await this.appendToQueue(t.s.hideButtons(),"hide-buttons"),await this.#a()}async showButtons(){return await this.appendToQueue(t.s.showButtons(),"show-buttons"),await this.#i()}async demo(){return console.warn("RUNNING DEMO APP, BE CAREFUL"),await this.appendToQueue(t.s.demo(),"demo")}async refund({amount:s=0,folio:e=null,auth:a=null}={}){return await this.appendToQueue(t.s.refund({amount:s,folio:e,auth:a}),"refund")}async readProductionQR(){return await this.#s({type:"production"})}async readQualityAssuranceQR(){return this.#s({type:"QA"})}async exit(){return await this.appendToQueue(t.s.exit(),"exit-app")}async init(){await this.appendToQueue(t.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
+ `);await this.appendToQueue(e,"login")}}exports.PinPax=p;
package/dist/pinpax.js CHANGED
@@ -1,7 +1,6 @@
1
- import { K as h } from "./kernel-CXM5xoJD.js";
2
- import { s as a } from "./relay-DP8PLsDP.js";
3
- import { a as c } from "./webserial-core-D3luFguv.js";
4
- class m extends h {
1
+ import { K as p, D as o } from "./kernel-DtXV8d8B.js";
2
+ import { s as t } from "./relay-DP8PLsDP.js";
3
+ class l extends p {
5
4
  __pinpax__ = {
6
5
  server: "DEV",
7
6
  businessId: null,
@@ -26,7 +25,7 @@ class m extends h {
26
25
  bufferSize: 32768,
27
26
  flowControl: "none"
28
27
  },
29
- no_device: t = 1,
28
+ no_device: a = 1,
30
29
  device_listen_on_channel: i = 1,
31
30
  socket: n = !1
32
31
  } = {
@@ -43,10 +42,10 @@ class m extends h {
43
42
  device_listen_on_channel: 1,
44
43
  socket: !1
45
44
  }) {
46
- if (super({ filters: s, config_port: e, no_device: t, device_listen_on_channel: i, socket: n }), this.__internal__.device.type = "pinpax", c.getCustom(this.typeDevice, t))
47
- throw new Error(`Device ${this.typeDevice} ${t} already exists`);
45
+ if (super({ filters: s, config_port: e, no_device: a, device_listen_on_channel: i, socket: n }), this.__internal__.device.type = "pinpax", o.getCustom(this.typeDevice, a))
46
+ throw new Error(`Device ${this.typeDevice} ${a} already exists`);
48
47
  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
49
- `, this.#t(), c.add(this), this.getResponseAsString();
48
+ `, this.#t(), o.add(this), this.getResponseAsString();
50
49
  }
51
50
  #t() {
52
51
  const s = [
@@ -94,8 +93,8 @@ class m extends h {
94
93
  let e = null;
95
94
  try {
96
95
  e = JSON.parse(s), e.request || (e.request = this.lastAction), e.name || (e.name = this.lastAction);
97
- } catch (t) {
98
- console.error("Error parsing response", t, s), this.dispatch("serial:message", s);
96
+ } catch (a) {
97
+ console.error("Error parsing response", a, s), this.dispatch("serial:message", s);
99
98
  return;
100
99
  }
101
100
  switch (e.response) {
@@ -222,8 +221,8 @@ class m extends h {
222
221
  }
223
222
  this.dispatch("serial:message", e);
224
223
  }
225
- serialSetConnectionConstant(s = 1) {
226
- return a.connection(s);
224
+ serialSetConnectionConstant() {
225
+ return t.connection();
227
226
  }
228
227
  softReload() {
229
228
  super.softReload(), this.__pinpax__.waiting.sale = !1, this.__pinpax__.waiting.voucher = !1, this.__pinpax__.asyncResponses.sale = null, this.__pinpax__.asyncResponses.voucher = null;
@@ -233,32 +232,30 @@ class m extends h {
233
232
  if (s.constructor !== Object) throw new Error("Invalid object");
234
233
  if (Object.keys(s).length === 0) throw new Error("Empty object");
235
234
  if (s.action === void 0 || s.action === null) throw new Error("Invalid object add action");
236
- const e = JSON.stringify(s), t = this.parseStringToBytes(e, `\r
235
+ const e = JSON.stringify(s), a = this.parseStringToBytes(e, `\r
237
236
  `);
238
- await this.appendToQueue(this.stringArrayToUint8Array(t), "custom");
237
+ await this.appendToQueue(this.stringArrayToUint8Array(a), "custom");
239
238
  }
240
239
  async connectMessage() {
241
- await this.appendToQueue(a.connect(), "connect:message");
240
+ await this.appendToQueue(t.connect(), "connect:message");
242
241
  }
243
242
  async #e() {
244
243
  if (this.isDisconnected) throw new Error("Device is disconnected");
245
- if (this.queue.length === 0) return !0;
246
- const s = this;
247
- return new Promise((e) => {
248
- let t = setInterval(() => {
249
- s.queue.length === 0 && (clearInterval(t), e(!0));
244
+ return this.queue.length === 0 ? !0 : new Promise((s) => {
245
+ const e = setInterval(() => {
246
+ this.queue.length === 0 && (clearInterval(e), s(!0));
250
247
  }, 500);
251
248
  });
252
249
  }
253
250
  async #s({ type: s = "production" } = {}) {
254
- const e = a.readQR({ type: s });
251
+ const e = t.readQR({ type: s });
255
252
  return await this.appendToQueue(e, "read-qr");
256
253
  }
257
254
  async #a() {
258
- await this.appendToQueue(a.forceHide(), "force-hide");
255
+ await this.appendToQueue(t.forceHide(), "force-hide");
259
256
  }
260
257
  async #i() {
261
- await this.appendToQueue(a.forceShow(), "force-show");
258
+ await this.appendToQueue(t.forceShow(), "force-show");
262
259
  }
263
260
  async #n() {
264
261
  await this.connectMessage();
@@ -269,17 +266,22 @@ class m extends h {
269
266
  #o(s) {
270
267
  this.dispatch("payment", s), this.__pinpax__.waiting.sale && (this.__pinpax__.asyncResponses.sale = s);
271
268
  }
269
+ cancelSaleRequestInProcess() {
270
+ this.__pinpax__.waiting.sale && (this.__pinpax__.asyncResponses.sale = {
271
+ status: "error",
272
+ approved: !1,
273
+ response: {}
274
+ });
275
+ }
272
276
  async makeSale({ amount: s = 0, reference: e = null } = {}) {
273
277
  if (this.isDisconnected) throw new Error("Device is disconnected");
274
278
  if (this.__pinpax__.waiting.sale) throw new Error("Already waiting for sale response");
275
- const t = a.makeSale({ amount: s, reference: e });
276
- this.__pinpax__.waiting.sale = !0, this.__pinpax__.asyncResponses.sale = null, this.queue.length > 0 && await this.#e();
277
- const i = this;
278
- return await this.appendToQueue(t, "make-sale"), new Promise((n) => {
279
- const r = setInterval(() => {
280
- if (i.__pinpax__.asyncResponses.sale) {
281
- const o = i.__pinpax__.asyncResponses.sale;
282
- i.__pinpax__.asyncResponses.sale = null, i.__pinpax__.waiting.sale = !1, clearInterval(r), n(o.approved);
279
+ const a = t.makeSale({ amount: s, reference: e });
280
+ return this.__pinpax__.waiting.sale = !0, this.__pinpax__.asyncResponses.sale = null, this.queue.length > 0 && await this.#e(), await this.appendToQueue(a, "make-sale"), new Promise((i) => {
281
+ const n = setInterval(() => {
282
+ if (this.__pinpax__.asyncResponses.sale) {
283
+ const r = this.__pinpax__.asyncResponses.sale;
284
+ this.__pinpax__.asyncResponses.sale = null, this.__pinpax__.waiting.sale = !1, clearInterval(n), i(r.approved);
283
285
  }
284
286
  }, 100);
285
287
  });
@@ -289,47 +291,45 @@ class m extends h {
289
291
  if (this.__pinpax__.waiting.voucher) throw new Error("Already waiting for voucher");
290
292
  if (!s) throw new Error("Folio is required");
291
293
  this.__pinpax__.waiting.voucher = !0, this.__pinpax__.asyncResponses.voucher = null;
292
- const e = a.getVoucher({ folio: s });
293
- this.queue.length > 0 && await this.#e(), await this.appendToQueue(e, "get-voucher");
294
- const t = this;
295
- return new Promise((i, n) => {
296
- const r = setTimeout(() => {
297
- t.__pinpax__.waiting.voucher = !1, n("Timeout");
298
- }, 1e4), o = setInterval(() => {
299
- if (t.__pinpax__.asyncResponses.voucher) {
300
- const p = t.__pinpax__.asyncResponses.voucher;
301
- t.__pinpax__.asyncResponses.voucher = null, t.__pinpax__.waiting.voucher = !1, clearInterval(o), clearTimeout(r), i(p.voucher);
294
+ const e = t.getVoucher({ folio: s });
295
+ return this.queue.length > 0 && await this.#e(), await this.appendToQueue(e, "get-voucher"), new Promise((a, i) => {
296
+ const n = setTimeout(() => {
297
+ this.__pinpax__.waiting.voucher = !1, i("Timeout");
298
+ }, 1e4), r = setInterval(() => {
299
+ if (this.__pinpax__.asyncResponses.voucher) {
300
+ const c = this.__pinpax__.asyncResponses.voucher;
301
+ this.__pinpax__.asyncResponses.voucher = null, this.__pinpax__.waiting.voucher = !1, clearInterval(r), clearTimeout(n), a(c.voucher);
302
302
  }
303
303
  }, 100);
304
304
  });
305
305
  }
306
306
  async info() {
307
- await this.appendToQueue(a.info(), "info");
307
+ await this.appendToQueue(t.info(), "info");
308
308
  }
309
309
  async keepAlive() {
310
- await this.appendToQueue(a.keepAlive(), "keep-alive");
310
+ await this.appendToQueue(t.keepAlive(), "keep-alive");
311
311
  }
312
312
  async restartApp() {
313
- await this.appendToQueue(a.restartApp(), "reset-app");
313
+ await this.appendToQueue(t.restartApp(), "reset-app");
314
314
  }
315
315
  async getConfig() {
316
- return await this.appendToQueue(a.getConfig(), "get-config");
316
+ return await this.appendToQueue(t.getConfig(), "get-config");
317
317
  }
318
318
  async hideButtons() {
319
- return await this.appendToQueue(a.hideButtons(), "hide-buttons"), await this.#a();
319
+ return await this.appendToQueue(t.hideButtons(), "hide-buttons"), await this.#a();
320
320
  }
321
321
  async showButtons() {
322
- return await this.appendToQueue(a.showButtons(), "show-buttons"), await this.#i();
322
+ return await this.appendToQueue(t.showButtons(), "show-buttons"), await this.#i();
323
323
  }
324
324
  async demo() {
325
- return console.warn("RUNNING DEMO APP, BE CAREFUL"), await this.appendToQueue(a.demo(), "demo");
325
+ return console.warn("RUNNING DEMO APP, BE CAREFUL"), await this.appendToQueue(t.demo(), "demo");
326
326
  }
327
- async refund({ amount: s = 0, folio: e = null, auth: t = null } = {}) {
327
+ async refund({ amount: s = 0, folio: e = null, auth: a = null } = {}) {
328
328
  return await this.appendToQueue(
329
- a.refund({
329
+ t.refund({
330
330
  amount: s,
331
331
  folio: e,
332
- auth: t
332
+ auth: a
333
333
  }),
334
334
  "refund"
335
335
  );
@@ -341,10 +341,10 @@ class m extends h {
341
341
  return this.#s({ type: "QA" });
342
342
  }
343
343
  async exit() {
344
- return await this.appendToQueue(a.exit(), "exit-app");
344
+ return await this.appendToQueue(t.exit(), "exit-app");
345
345
  }
346
346
  async init() {
347
- await this.appendToQueue(a.init(), "init-app");
347
+ await this.appendToQueue(t.init(), "init-app");
348
348
  }
349
349
  async login() {
350
350
  if (!this.apiKey || !this.businessId || !this.encryptionKey || !this.server)
@@ -361,5 +361,5 @@ class m extends h {
361
361
  }
362
362
  }
363
363
  export {
364
- m as PinPax
364
+ l as PinPax
365
365
  };
package/dist/relay.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./kernel-Dizfdw3M.cjs"),r=require("./relay-E3NCcSjS.cjs"),i=require("./webserial-core-YjdXyVOx.cjs");class l extends s.Kernel{constructor({filters:t=null,config_port:e=null,no_device:n=1,socket:a=!1}={}){if(super({filters:t,config_port:e,no_device:n,socket:a}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,this.__internal__.serial.auto_response=[2,6,221,221,240,207,3],i.a.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);i.a.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,a)=>{a!==3&&(e+=n)}),e}serialSetConnectionConstant(t=1){return r.e.connection(t)}async turnOn(){const t=r.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=r.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 n=require("./kernel-C1HLYiV1.cjs"),a=require("./relay-E3NCcSjS.cjs");class r extends n.Kernel{constructor({filters:t=null,config_port:e,no_device:s=1,socket:i=!1}={}){if(super({filters:t,config_port:e,no_device:s,socket:i}),this.__internal__.device.type="relay",this.__internal__.auto_response=!1,this.__internal__.serial.auto_response=[2,6,221,221,240,207,3],n.Devices.getCustom(this.typeDevice,s))throw new Error(`Device ${this.typeDevice} ${s} already exists`);n.Devices.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)}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 n.wait(e),await this.turnOff();return}await this.turnOff(),await n.wait(e),await this.turnOn()}}exports.Relay=r;
package/dist/relay.js CHANGED
@@ -1,11 +1,10 @@
1
- import { K as o, w as i } from "./kernel-CXM5xoJD.js";
2
- import { e as s } from "./relay-DP8PLsDP.js";
3
- import { a as r } from "./webserial-core-D3luFguv.js";
4
- class d extends o {
5
- constructor({ filters: t = null, config_port: e = null, no_device: n = 1, socket: a = !1 } = {}) {
6
- if (super({ filters: t, config_port: e, no_device: n, socket: a }), this.__internal__.device.type = "relay", this.__internal__.auto_response = !1, this.__internal__.serial.auto_response = [2, 6, 221, 221, 240, 207, 3], r.getCustom(this.typeDevice, n))
7
- throw new Error(`Device ${this.typeDevice} ${n} already exists`);
8
- r.add(this);
1
+ import { K as o, D as a, w as i } from "./kernel-DtXV8d8B.js";
2
+ import { e as n } from "./relay-DP8PLsDP.js";
3
+ class f extends o {
4
+ constructor({ filters: t = null, config_port: e, no_device: s = 1, socket: r = !1 } = {}) {
5
+ if (super({ filters: t, config_port: e, no_device: s, socket: r }), this.__internal__.device.type = "relay", this.__internal__.auto_response = !1, this.__internal__.serial.auto_response = [2, 6, 221, 221, 240, 207, 3], a.getCustom(this.typeDevice, s))
6
+ throw new Error(`Device ${this.typeDevice} ${s} already exists`);
7
+ a.add(this);
9
8
  }
10
9
  serialMessage(t) {
11
10
  t = this.fixHexArray(t);
@@ -18,21 +17,15 @@ class d extends o {
18
17
  };
19
18
  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);
20
19
  }
21
- serialRelaySumHex(t) {
22
- let e = 0;
23
- return t.forEach((n, a) => {
24
- a !== 3 && (e += n);
25
- }), e;
26
- }
27
20
  serialSetConnectionConstant(t = 1) {
28
- return s.connection(t);
21
+ return n.connection(t);
29
22
  }
30
23
  async turnOn() {
31
- const t = s.activate();
24
+ const t = n.activate();
32
25
  await this.appendToQueue(t, "relay:turn-on");
33
26
  }
34
27
  async turnOff() {
35
- const t = s.deactivate();
28
+ const t = n.deactivate();
36
29
  await this.appendToQueue(t, "relay:turn-off");
37
30
  }
38
31
  async toggle({ inverse: t = !1, ms: e = 300 } = {}) {
@@ -44,5 +37,5 @@ class d extends o {
44
37
  }
45
38
  }
46
39
  export {
47
- d as Relay
40
+ f as Relay
48
41
  };
@@ -0,0 +1,206 @@
1
+ import { Kernel, ConstructorParams, DispenseResponse } from './kernel';
2
+ interface MessageSerial {
3
+ code: string[] | Uint8Array<ArrayBufferLike> | string | ArrayBuffer;
4
+ name: string | null;
5
+ description: string | null;
6
+ request: string | null;
7
+ no_code: number;
8
+ additional?: any;
9
+ finished_test?: boolean;
10
+ }
11
+ export declare class Boardroid extends Kernel {
12
+ #private;
13
+ __coin_purse: {
14
+ available: boolean;
15
+ };
16
+ __banknote_purse: {
17
+ available: boolean;
18
+ isRecycler: boolean;
19
+ recycler: {
20
+ ict: boolean;
21
+ banknote: number;
22
+ };
23
+ };
24
+ __sale: {
25
+ price: number;
26
+ change: number;
27
+ change_verified: number;
28
+ dispense_all: boolean;
29
+ last_change: number;
30
+ clear(): void;
31
+ };
32
+ __money_session: {
33
+ inserted: number;
34
+ retired: number;
35
+ clear(): void;
36
+ };
37
+ coins: {
38
+ tubes: {
39
+ g50: number;
40
+ c50: number;
41
+ p1: number;
42
+ p2: number;
43
+ p5: number;
44
+ p10: number;
45
+ };
46
+ box: {
47
+ g50: number;
48
+ c50: number;
49
+ p1: number;
50
+ p2: number;
51
+ p5: number;
52
+ p10: number;
53
+ };
54
+ totals: {
55
+ g50: number;
56
+ c50: number;
57
+ p1: number;
58
+ p2: number;
59
+ p5: number;
60
+ p10: number;
61
+ };
62
+ total: number;
63
+ };
64
+ banknotes: {
65
+ stacker: {
66
+ p20: number;
67
+ p50: number;
68
+ p100: number;
69
+ p200: number;
70
+ p500: number;
71
+ p1000: number;
72
+ };
73
+ recycler: {
74
+ p20: number;
75
+ p50: number;
76
+ p100: number;
77
+ p200: number;
78
+ p500: number;
79
+ p1000: number;
80
+ };
81
+ out: {
82
+ p20: number;
83
+ p50: number;
84
+ p100: number;
85
+ p200: number;
86
+ p500: number;
87
+ p1000: number;
88
+ };
89
+ totals: {
90
+ p20: number;
91
+ p50: number;
92
+ p100: number;
93
+ p200: number;
94
+ p500: number;
95
+ p1000: number;
96
+ };
97
+ total: number;
98
+ };
99
+ card_reader: {
100
+ available: boolean;
101
+ max_pre_credit: number;
102
+ };
103
+ constructor({ filters, config_port, no_device, socket }?: ConstructorParams);
104
+ get totalInTubes(): number;
105
+ get totalInRecycler(): number;
106
+ get hasRecycler(): boolean;
107
+ set hasRecycler(value: boolean);
108
+ get hasICT(): boolean;
109
+ set hasICT(value: boolean);
110
+ set banknoteICT(value: number);
111
+ get banknoteICT(): number;
112
+ get hasCoinPurse(): boolean;
113
+ set hasCoinPurse(value: boolean);
114
+ set price(value: number);
115
+ get price(): number;
116
+ get change(): number;
117
+ softReload(): void;
118
+ serialMessage(code: string[] | Uint8Array<ArrayBufferLike> | string | ArrayBuffer): void;
119
+ serialSetConnectionConstant(listen_on_port?: number): string | Uint8Array<ArrayBufferLike> | string[];
120
+ coinPurseConfigure({ enable, high, low }?: {
121
+ enable?: boolean | undefined;
122
+ high?: number | undefined;
123
+ low?: number | undefined;
124
+ }): Promise<void>;
125
+ coinPurseEnable(): Promise<void>;
126
+ coinPurseDisable(): Promise<void>;
127
+ coinPurseDispense({ $_50c, $_1, $_2, $_5, $_10 }?: {
128
+ $_50c?: number | undefined;
129
+ $_1?: number | undefined;
130
+ $_2?: number | undefined;
131
+ $_5?: number | undefined;
132
+ $_10?: number | undefined;
133
+ }): Promise<void>;
134
+ coinPurseReadTubes(): Promise<void>;
135
+ banknotePurseConfigure({ enable, scrow }?: {
136
+ enable?: boolean | undefined;
137
+ scrow?: boolean | undefined;
138
+ }): Promise<void>;
139
+ banknotePurseDispense({ $_20, $_50, $_100, $_200, $_500, $_1000 }?: {
140
+ $_20?: number | undefined;
141
+ $_50?: number | undefined;
142
+ $_100?: number | undefined;
143
+ $_200?: number | undefined;
144
+ $_500?: number | undefined;
145
+ $_1000?: number | undefined;
146
+ }): Promise<void>;
147
+ banknotePurseEnable({ scrow }: {
148
+ scrow?: boolean | undefined;
149
+ }): Promise<void>;
150
+ banknotePurseDisable(): Promise<void>;
151
+ banknotePurseAcceptInScrow(): Promise<void>;
152
+ banknotePurseRejectInScrow(): Promise<void>;
153
+ banknotePurseSaveMemory({ channel, $_20, $_50, $_100, $_200, $_500, $_1000, }?: {
154
+ channel?: null | undefined;
155
+ $_20?: null | undefined;
156
+ $_50?: null | undefined;
157
+ $_100?: null | undefined;
158
+ $_200?: null | undefined;
159
+ $_500?: null | undefined;
160
+ $_1000?: null | undefined;
161
+ }): Promise<void>;
162
+ banknotePurseReadRecycler(): Promise<void>;
163
+ cardReaderDisable(): Promise<void>;
164
+ cardReaderDispense({ channel, second_channel, sensor, seconds, price }?: {
165
+ channel?: number | undefined;
166
+ second_channel?: null | undefined;
167
+ sensor?: boolean | undefined;
168
+ seconds?: null | undefined;
169
+ price?: number | undefined;
170
+ }): Promise<void>;
171
+ paymentPursesDisable({ coin, banknote, cardReader }?: {
172
+ coin?: boolean | undefined;
173
+ banknote?: boolean | undefined;
174
+ cardReader?: boolean | undefined;
175
+ }): Promise<void>;
176
+ paymentPursesEnable({ coin, banknote, scrowBanknote }?: {
177
+ coin?: boolean | undefined;
178
+ banknote?: boolean | undefined;
179
+ scrowBanknote?: boolean | undefined;
180
+ }): Promise<void>;
181
+ coolingRelayConfigure({ enable }?: {
182
+ enable?: boolean | undefined;
183
+ }): Promise<void>;
184
+ coolingRelayEnable(): Promise<void>;
185
+ coolingRelayDisable(): Promise<void>;
186
+ readTemperature(): Promise<void>;
187
+ dispense({ selection, second_selection, sensor, seconds, retry, }?: {
188
+ selection: number;
189
+ second_selection?: number | null;
190
+ sensor?: boolean;
191
+ seconds?: number | null;
192
+ retry?: boolean;
193
+ }): Promise<DispenseResponse>;
194
+ testEngines({ singleEngine }?: {
195
+ singleEngine?: boolean | undefined;
196
+ }): Promise<void>;
197
+ sendCustomCode({ code, }?: {
198
+ code: string[];
199
+ }): Promise<void>;
200
+ hasToReturnChange(money?: number): boolean;
201
+ returnChange(): Promise<boolean>;
202
+ returnInsertedMoney(): Promise<boolean>;
203
+ serialCorruptMessage(data: Uint8Array | number[] | string[] | never | null | string | ArrayBuffer, message: MessageSerial): Promise<void>;
204
+ }
205
+ export {};
206
+ //# sourceMappingURL=boardroid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boardroid.d.ts","sourceRoot":"","sources":["../../lib/serial/boardroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIvE,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,WAAW,CAAC;IACpE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBAAa,SAAU,SAAQ,MAAM;;IACnC,YAAY;;MAEV;IAEK,gBAAgB;;;;;;;MAOrB;IAEF,MAAM;;;;;;;MAaJ;IAEF,eAAe;;;;MAOb;IAEF,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;MAKH;IAEF,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAMP;IAEF,WAAW;;;MAGT;gBAMU,EAAE,OAAc,EAAE,WAAW,EAAE,SAAa,EAAE,MAAc,EAAE,GAAE,iBAAsB;IAqDlG,IAAI,YAAY,WASf;IAED,IAAI,eAAe,WASlB;IAED,IAAI,WAAW,YAEd;IAED,IAAI,WAAW,CAAC,KAAK,SAAA,EAEpB;IAED,IAAI,MAAM,YAET;IAED,IAAI,MAAM,CAAC,KAAK,SAAA,EAEf;IAED,IAAI,WAAW,CAAC,KAAK,QAAA,EAIpB;IAED,IAAI,WAAW,WAEd;IAED,IAAI,YAAY,YAEf;IAED,IAAI,YAAY,CAAC,KAAK,SAAA,EAKrB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAMtB;IAED,IAAI,KAAK,IARQ,MAAM,CAUtB;IAED,IAAI,MAAM,WAIT;IAUD,UAAU;IAwpBV,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,WAAW;IAoGjF,2BAA2B,CAAC,cAAc,SAAI;IAIxC,kBAAkB,CAAC,EAAE,MAAc,EAAE,IAAW,EAAE,GAAU,EAAE;;;;KAAK;IAQnE,eAAe;IAIf,gBAAgB;IAIhB,iBAAiB,CAAC,EAAE,KAAS,EAAE,GAAO,EAAE,GAAO,EAAE,GAAO,EAAE,IAAQ,EAAE;;;;;;KAAK;IAezE,kBAAkB;IAYlB,sBAAsB,CAAC,EAAE,MAAc,EAAE,KAAa,EAAE;;;KAAK;IA+B7D,qBAAqB,CAAC,EAAE,IAAQ,EAAE,IAAQ,EAAE,KAAS,EAAE,KAAS,EAAE,KAAS,EAAE,MAAU,EAAE;;;;;;;KAAK;IAe9F,mBAAmB,CAAC,EAAE,KAAa,EAAE;;KAAA;IAIrC,oBAAoB;IAIpB,0BAA0B;IAQ1B,0BAA0B;IAQ1B,uBAAuB,CAAC,EAC5B,OAAc,EACd,IAAW,EACX,IAAW,EACX,KAAY,EACZ,KAAY,EACZ,KAAY,EACZ,MAAa,GACd;;;;;;;;KAAK;IAiBA,yBAAyB;IAMzB,iBAAiB;IAKjB,kBAAkB,CAAC,EAAE,OAAW,EAAE,cAAqB,EAAE,MAAa,EAAE,OAAc,EAAE,KAAS,EAAE;;;;;;KAAK;IAwBxG,oBAAoB,CAAC,EAAE,IAAW,EAAE,QAAe,EAAE,UAAkB,EAAE;;;;KAAK;IAM9E,mBAAmB,CAAC,EAAE,IAAW,EAAE,QAAe,EAAE,aAAqB,EAAE;;;;KAAK;IAKhF,qBAAqB,CAAC,EAAE,MAAc,EAAE;;KAAK;IAI7C,kBAAkB;IAIlB,mBAAmB;IAInB,eAAe;IAIf,QAAQ,CACZ,EACE,SAAa,EACb,gBAAuB,EACvB,MAAa,EACb,OAAc,EACd,KAAY,GACb,GAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,CAAC,EAAE,OAAO,CAAC;KAOjB;IAuDG,WAAW,CAAC,EAAE,YAAoB,EAAE;;KAAK;IA6BzC,cAAc,CAClB,EACE,IAAS,GACV,GAAE;QACD,IAAI,EAAE,MAAM,EAAE,CAAC;KAGhB;IA6GH,iBAAiB,CAAC,KAAK,SAAI;IAkDrB,YAAY;IAIZ,mBAAmB;IAMV,oBAAoB,CACjC,IAAI,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,WAAW,EAC5E,OAAO,EAAE,aAAa;CAIzB"}
@@ -0,0 +1,85 @@
1
+ import { Core } from 'webserial-core';
2
+ interface Hoppers {
3
+ levels: {
4
+ id: number;
5
+ currency: number;
6
+ key: string;
7
+ name: string;
8
+ amount: number;
9
+ capacity: number;
10
+ }[];
11
+ balance: number;
12
+ current: number | null;
13
+ }
14
+ interface ConstructorParams {
15
+ filters?: SerialPortFilter[] | null;
16
+ config_port?: SerialOptions;
17
+ no_device?: number;
18
+ device_listen_on_channel?: number | string;
19
+ bypassSerialBytesConnection?: boolean;
20
+ socket?: boolean;
21
+ }
22
+ export declare class Hopper extends Core {
23
+ #private;
24
+ __hoppers__: Hoppers;
25
+ constructor({ filters, config_port, no_device, socket, }?: ConstructorParams);
26
+ get balance(): number;
27
+ get currentHopper(): number | null;
28
+ get levels(): {
29
+ id: number;
30
+ currency: number;
31
+ key: string;
32
+ name: string;
33
+ amount: number;
34
+ capacity: number;
35
+ }[];
36
+ setMaxCapacity({ hopper, capacity }?: {
37
+ hopper?: number;
38
+ capacity?: number;
39
+ }): this;
40
+ setHopperName({ hopper, name }?: {
41
+ hopper?: number;
42
+ name?: string;
43
+ }): this;
44
+ setHopperKey({ hopper, key }?: {
45
+ hopper?: number;
46
+ key?: string;
47
+ }): this;
48
+ setHopperCurrency({ hopper, currency }?: {
49
+ hopper?: number;
50
+ currency?: number;
51
+ }): this;
52
+ serialMessage(codex1: string[] | Uint8Array<ArrayBufferLike> | string | ArrayBuffer): void;
53
+ serialSetConnectionConstant(): number[];
54
+ sendConnect(): Promise<void>;
55
+ requestStatus(): Promise<void>;
56
+ readBalance(): Promise<void>;
57
+ clearBalance(): Promise<void>;
58
+ forceInvalid(): Promise<void>;
59
+ readHopper({ hopper }?: {
60
+ hopper?: number;
61
+ }): Promise<void>;
62
+ writeHopper({ hopper, quantity }?: {
63
+ hopper?: number;
64
+ quantity?: number;
65
+ }): Promise<void>;
66
+ dispenseHopper({ hopper }?: {
67
+ hopper?: number;
68
+ }): Promise<void>;
69
+ dispenseChange({ change }?: {
70
+ change?: number;
71
+ }): Promise<void>;
72
+ configValidator({ enable, }?: {
73
+ enable: boolean;
74
+ }): Promise<void>;
75
+ disableValidator(): Promise<void>;
76
+ enableValidator(): Promise<void>;
77
+ change1x1({ hopper }?: {
78
+ hopper?: number;
79
+ }): Promise<void>;
80
+ sendCustomCode({ code, }?: {
81
+ code: any;
82
+ }): Promise<void>;
83
+ }
84
+ export {};
85
+ //# sourceMappingURL=hopper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hopper.d.ts","sourceRoot":"","sources":["../../lib/serial/hopper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAW,MAAM,gBAAgB,CAAC;AAE/C,UAAU,OAAO;IACf,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxG,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,UAAU,iBAAiB;IACzB,OAAO,CAAC,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAeD,qBAAa,MAAO,SAAQ,IAAI;;IAC9B,WAAW,EAAE,OAAO,CASlB;gBAGA,EACE,OAAc,EACd,WAOC,EACD,SAAa,EACb,MAAc,GACf,GAAE,iBAYF;IAyBH,IAAI,OAAO,WAEV;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,MAAM;YAjGI,MAAM;kBAAY,MAAM;aAAO,MAAM;cAAQ,MAAM;gBAAU,MAAM;kBAAY,MAAM;QAmGlG;IAED,cAAc,CAAC,EAAE,MAAU,EAAE,QAAe,EAAE;;;KAAgC;IAM9E,aAAa,CAAC,EAAE,MAAU,EAAE,IAAS,EAAE;;;KAA0B;IASjE,YAAY,CAAC,EAAE,MAAU,EAAE,GAAQ,EAAE;;;KAAyB;IAS9D,iBAAiB,CAAC,EAAE,MAAU,EAAE,QAAY,EAAE;;;KAA6B;IAiK3E,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,WAAW;IA0HnF,2BAA2B;IAIrB,WAAW;IAKX,aAAa;IAKb,WAAW;IAKX,YAAY;IAKZ,YAAY;IAMZ,UAAU,CAAC,EAAE,MAAU,EAAE;;KAAgB;IAQzC,WAAW,CAAC,EAAE,MAAU,EAAE,QAAY,EAAE;;;KAA6B;IAUrE,cAAc,CAAC,EAAE,MAAU,EAAE;;KAAgB;IAO7C,cAAc,CAAC,EAAE,MAAU,EAAE;;KAAgB;IAc7C,eAAe,CACnB,EACE,MAAc,GACf,GAAE;QACD,MAAM,EAAE,OAAO,CAAC;KACG;IAUjB,gBAAgB;IAIhB,eAAe;IAIf,SAAS,CAAC,EAAE,MAAU,EAAE;;KAAgB;IAOxC,cAAc,CAClB,EACE,IAAS,GACV,GAAE;QACD,IAAI,EAAE,GAAG,CAAC;KACI;CASnB"}