@danidoble/webserial 4.3.3 → 4.3.5
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/boardroid.cjs +1 -1
- package/dist/boardroid.js +506 -478
- package/dist/hopper.cjs +2 -2
- package/dist/hopper.js +132 -121
- package/dist/jofemar.cjs +1 -1
- package/dist/jofemar.js +732 -705
- package/dist/kernel-D8A562gb.cjs +1 -0
- package/dist/kernel-DAtdBEi3.js +815 -0
- package/dist/kernel.cjs +2 -2
- package/dist/kernel.js +3 -3
- package/dist/locker.cjs +1 -1
- package/dist/locker.js +81 -83
- package/dist/pinpad.cjs +21 -21
- package/dist/pinpad.js +3386 -3278
- package/dist/pinpax.cjs +4 -4
- package/dist/pinpax.js +112 -116
- package/dist/relay.cjs +1 -1
- package/dist/relay.js +2 -2
- package/dist/{webserial-core-ByrJ7tlu.js → webserial-core-BjytHor1.js} +179 -182
- package/dist/webserial-core-N14HUamr.cjs +4 -0
- package/dist/webserial.cjs +2 -2
- package/dist/webserial.js +4 -4
- package/package.json +3 -3
- package/dist/kernel-BblykfpT.js +0 -875
- package/dist/kernel-CzkmE_OW.cjs +0 -1
- package/dist/webserial-core-5B5nYtyR.cjs +0 -4
package/dist/pinpax.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
`,
|
|
3
|
-
`);await this.appendToQueue(this.stringArrayToUint8Array(
|
|
4
|
-
`);await this.appendToQueue(e,"login")}}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./kernel-D8A562gb.cjs"),a=require("./relay-DGFymXOw.cjs"),c=require("./webserial-core-N14HUamr.cjs");class u extends h.Kernel{__pinpax__={server:"DEV",bussinessId:null,encriptionKey: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.h.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.h.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 bussinessId(s){this.__pinpax__.bussinessId=s}get bussinessId(){return this.__pinpax__.bussinessId}set encriptionKey(s){this.__pinpax__.encriptionKey=s}get encriptionKey(){return this.__pinpax__.encriptionKey}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)}catch(t){console.error("Error parsing response",t,s),this.dispatch("serial:message",s);return}switch(e.response){case"INITAPP":this.dispatch("init-app",{status:"started"}),this.#n().then(()=>{});break;case"CONNECT":this.dispatch("connectMessage",{status:"connected"}),this.#r().then(()=>{});break;case"LOGIN":this.dispatch("login",e);break;case"LASTVOUCHER":this.dispatch("voucher",e),this.__pinpax__.waiting.voucher&&(this.__pinpax__.asyncResponses.voucher=e,this.__pinpax__.waiting.voucher=!1);break;case"DEVICEINFO":this.dispatch("info",e);break;case"KEEPALIVE":this.dispatch("keep-alive",{status:"alive"});break;case"RESETAPP":this.dispatch("reset-app",{status:"accepted"});break;case"GETCONFIG":this.dispatch("get-config",e);break;case"HIDEBUTTONS":this.dispatch("buttons-status",{hidden:!0});break;case"SHOWBUTTONS":this.dispatch("buttons-status",{hidden:!1});break;case"PAYMENT_PROCESS":this.dispatch("payment",{status:"starting",amount:e.amount,reference:e.referecence});break;case"INSERT_CARD":this.dispatch("payment",{status:"insert card"});break;case"CARD_DATA":this.dispatch("payment",{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":this.dispatch("payment",{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":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":this.__pinpax__.waiting.sale&&(this.__pinpax__.asyncResponses.sale={status:"error",approved:!1,response:e}),this.dispatch("error",{status:"error",response:e}),this.dispatch("payment",{status:"error",response:e});break;case"REFUND":this.dispatch("refund",{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.bussinessId||!this.encriptionKey||!this.server)throw new Error("Invalid data to login check apiKey, bussinessId, encriptionKey, server");const s=JSON.stringify({action:"LOGIN_MIT",server:this.__pinpax__.server,bussiness_id:this.__pinpax__.bussinessId,encription_key:this.__pinpax__.encriptionKey,api_key:this.__pinpax__.apiKey}),e=this.parseStringToBytes(s,`\r
|
|
4
|
+
`);await this.appendToQueue(e,"login")}}exports.PinPax=u;
|
package/dist/pinpax.js
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { K as h } from "./kernel-DAtdBEi3.js";
|
|
2
|
+
import { s as a } from "./relay-CsdB0FSa.js";
|
|
3
|
+
import { h as c } from "./webserial-core-BjytHor1.js";
|
|
4
|
+
class y extends h {
|
|
5
|
+
__pinpax__ = {
|
|
6
|
+
server: "DEV",
|
|
7
|
+
bussinessId: null,
|
|
8
|
+
encriptionKey: null,
|
|
9
|
+
apiKey: null,
|
|
10
|
+
asyncResponses: {
|
|
11
|
+
voucher: null,
|
|
12
|
+
sale: null
|
|
13
|
+
},
|
|
14
|
+
waiting: {
|
|
15
|
+
voucher: !1,
|
|
16
|
+
sale: !1
|
|
17
|
+
}
|
|
18
|
+
};
|
|
14
19
|
constructor({
|
|
15
20
|
filters: s = null,
|
|
16
21
|
config_port: e = {
|
|
@@ -21,8 +26,8 @@ class S extends C {
|
|
|
21
26
|
bufferSize: 32768,
|
|
22
27
|
flowControl: "none"
|
|
23
28
|
},
|
|
24
|
-
no_device:
|
|
25
|
-
device_listen_on_channel:
|
|
29
|
+
no_device: t = 1,
|
|
30
|
+
device_listen_on_channel: i = 1
|
|
26
31
|
} = {
|
|
27
32
|
filters: null,
|
|
28
33
|
config_port: {
|
|
@@ -36,26 +41,28 @@ class S extends C {
|
|
|
36
41
|
no_device: 1,
|
|
37
42
|
device_listen_on_channel: 1
|
|
38
43
|
}) {
|
|
39
|
-
super({ filters: s, config_port: e, no_device:
|
|
40
|
-
|
|
41
|
-
y(this, "__pinpax__", {
|
|
42
|
-
server: "DEV",
|
|
43
|
-
bussinessId: null,
|
|
44
|
-
encriptionKey: null,
|
|
45
|
-
apiKey: null,
|
|
46
|
-
asyncResponses: {
|
|
47
|
-
voucher: null,
|
|
48
|
-
sale: null
|
|
49
|
-
},
|
|
50
|
-
waiting: {
|
|
51
|
-
voucher: !1,
|
|
52
|
-
sale: !1
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
if (this.__internal__.device.type = "pinpax", m.getCustom(this.typeDevice, a))
|
|
56
|
-
throw new Error(`Device ${this.typeDevice} ${a} already exists`);
|
|
44
|
+
if (super({ filters: s, config_port: e, no_device: t, device_listen_on_channel: i }), this.__internal__.device.type = "pinpax", c.getCustom(this.typeDevice, t))
|
|
45
|
+
throw new Error(`Device ${this.typeDevice} ${t} already exists`);
|
|
57
46
|
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
|
|
58
|
-
`,
|
|
47
|
+
`, this.#t(), c.add(this), this.getResponseAsString();
|
|
48
|
+
}
|
|
49
|
+
#t() {
|
|
50
|
+
const s = [
|
|
51
|
+
"buttons-status",
|
|
52
|
+
"init-app",
|
|
53
|
+
"connectMessage",
|
|
54
|
+
"voucher",
|
|
55
|
+
"info",
|
|
56
|
+
"keep-alive",
|
|
57
|
+
"reset-app",
|
|
58
|
+
"get-config",
|
|
59
|
+
"payment",
|
|
60
|
+
"error",
|
|
61
|
+
"refund",
|
|
62
|
+
"login"
|
|
63
|
+
];
|
|
64
|
+
for (const e of s)
|
|
65
|
+
this.serialRegisterAvailableListener(e);
|
|
59
66
|
}
|
|
60
67
|
set bussinessId(s) {
|
|
61
68
|
this.__pinpax__.bussinessId = s;
|
|
@@ -85,17 +92,17 @@ class S extends C {
|
|
|
85
92
|
let e = null;
|
|
86
93
|
try {
|
|
87
94
|
e = JSON.parse(s);
|
|
88
|
-
} catch (
|
|
89
|
-
console.error("Error parsing response",
|
|
95
|
+
} catch (t) {
|
|
96
|
+
console.error("Error parsing response", t, s), this.dispatch("serial:message", s);
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
92
99
|
switch (e.response) {
|
|
93
100
|
case "INITAPP":
|
|
94
|
-
this.dispatch("init-app", { status: "started" }),
|
|
101
|
+
this.dispatch("init-app", { status: "started" }), this.#n().then(() => {
|
|
95
102
|
});
|
|
96
103
|
break;
|
|
97
104
|
case "CONNECT":
|
|
98
|
-
this.dispatch("connectMessage", { status: "connected" }),
|
|
105
|
+
this.dispatch("connectMessage", { status: "connected" }), this.#r().then(() => {
|
|
99
106
|
});
|
|
100
107
|
break;
|
|
101
108
|
case "LOGIN":
|
|
@@ -160,7 +167,7 @@ class S extends C {
|
|
|
160
167
|
});
|
|
161
168
|
break;
|
|
162
169
|
case "TRANSACTION_RESULT":
|
|
163
|
-
o(
|
|
170
|
+
this.#o({
|
|
164
171
|
status: "result",
|
|
165
172
|
approved: e.approved,
|
|
166
173
|
acquirer: e.acquirer,
|
|
@@ -215,7 +222,7 @@ class S extends C {
|
|
|
215
222
|
this.dispatch("serial:message", e);
|
|
216
223
|
}
|
|
217
224
|
serialSetConnectionConstant(s = 1) {
|
|
218
|
-
return
|
|
225
|
+
return a.connection(s);
|
|
219
226
|
}
|
|
220
227
|
softReload() {
|
|
221
228
|
super.softReload(), this.__pinpax__.waiting.sale = !1, this.__pinpax__.waiting.voucher = !1, this.__pinpax__.asyncResponses.sale = null, this.__pinpax__.asyncResponses.voucher = null;
|
|
@@ -225,24 +232,53 @@ class S extends C {
|
|
|
225
232
|
if (s.constructor !== Object) throw new Error("Invalid object");
|
|
226
233
|
if (Object.keys(s).length === 0) throw new Error("Empty object");
|
|
227
234
|
if (s.action === void 0 || s.action === null) throw new Error("Invalid object add action");
|
|
228
|
-
const e = JSON.stringify(s),
|
|
235
|
+
const e = JSON.stringify(s), t = this.parseStringToBytes(e, `\r
|
|
229
236
|
`);
|
|
230
|
-
await this.appendToQueue(this.stringArrayToUint8Array(
|
|
237
|
+
await this.appendToQueue(this.stringArrayToUint8Array(t), "custom");
|
|
231
238
|
}
|
|
232
239
|
async connectMessage() {
|
|
233
|
-
await this.appendToQueue(
|
|
240
|
+
await this.appendToQueue(a.connect(), "connect:message");
|
|
241
|
+
}
|
|
242
|
+
async #e() {
|
|
243
|
+
if (this.isDisconnected) throw new Error("Device is disconnected");
|
|
244
|
+
if (this.queue.length === 0) return !0;
|
|
245
|
+
const s = this;
|
|
246
|
+
return new Promise((e) => {
|
|
247
|
+
let t = setInterval(() => {
|
|
248
|
+
s.queue.length === 0 && (clearInterval(t), e(!0));
|
|
249
|
+
}, 500);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
async #s({ type: s = "production" } = {}) {
|
|
253
|
+
const e = a.readQR({ type: s });
|
|
254
|
+
return await this.appendToQueue(e, "read-qr");
|
|
255
|
+
}
|
|
256
|
+
async #a() {
|
|
257
|
+
await this.appendToQueue(a.forceHide(), "force-hide");
|
|
258
|
+
}
|
|
259
|
+
async #i() {
|
|
260
|
+
await this.appendToQueue(a.forceShow(), "force-show");
|
|
261
|
+
}
|
|
262
|
+
async #n() {
|
|
263
|
+
await this.connectMessage();
|
|
264
|
+
}
|
|
265
|
+
async #r() {
|
|
266
|
+
await this.hideButtons();
|
|
267
|
+
}
|
|
268
|
+
#o(s) {
|
|
269
|
+
this.dispatch("payment", s), this.__pinpax__.waiting.sale && (this.__pinpax__.asyncResponses.sale = s);
|
|
234
270
|
}
|
|
235
271
|
async makeSale({ amount: s = 0, reference: e = null } = {}) {
|
|
236
272
|
if (this.isDisconnected) throw new Error("Device is disconnected");
|
|
237
273
|
if (this.__pinpax__.waiting.sale) throw new Error("Already waiting for sale response");
|
|
238
|
-
const
|
|
239
|
-
this.__pinpax__.waiting.sale = !0, this.__pinpax__.asyncResponses.sale = null, this.queue.length > 0 && await
|
|
240
|
-
const
|
|
241
|
-
return await this.appendToQueue(
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
const
|
|
245
|
-
|
|
274
|
+
const t = a.makeSale({ amount: s, reference: e });
|
|
275
|
+
this.__pinpax__.waiting.sale = !0, this.__pinpax__.asyncResponses.sale = null, this.queue.length > 0 && await this.#e();
|
|
276
|
+
const i = this;
|
|
277
|
+
return await this.appendToQueue(t, "make-sale"), new Promise((n) => {
|
|
278
|
+
const r = setInterval(() => {
|
|
279
|
+
if (i.__pinpax__.asyncResponses.sale) {
|
|
280
|
+
const o = i.__pinpax__.asyncResponses.sale;
|
|
281
|
+
i.__pinpax__.asyncResponses.sale = null, i.__pinpax__.waiting.sale = !1, clearInterval(r), n(o.approved);
|
|
246
282
|
}
|
|
247
283
|
}, 100);
|
|
248
284
|
});
|
|
@@ -252,62 +288,62 @@ class S extends C {
|
|
|
252
288
|
if (this.__pinpax__.waiting.voucher) throw new Error("Already waiting for voucher");
|
|
253
289
|
if (!s) throw new Error("Folio is required");
|
|
254
290
|
this.__pinpax__.waiting.voucher = !0, this.__pinpax__.asyncResponses.voucher = null;
|
|
255
|
-
const e =
|
|
256
|
-
this.queue.length > 0 && await
|
|
257
|
-
const
|
|
258
|
-
return new Promise((
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
}, 1e4),
|
|
262
|
-
if (
|
|
263
|
-
const
|
|
264
|
-
|
|
291
|
+
const e = a.getVoucher({ folio: s });
|
|
292
|
+
this.queue.length > 0 && await this.#e(), await this.appendToQueue(e, "get-voucher");
|
|
293
|
+
const t = this;
|
|
294
|
+
return new Promise((i, n) => {
|
|
295
|
+
const r = setTimeout(() => {
|
|
296
|
+
t.__pinpax__.waiting.voucher = !1, n("Timeout");
|
|
297
|
+
}, 1e4), o = setInterval(() => {
|
|
298
|
+
if (t.__pinpax__.asyncResponses.voucher) {
|
|
299
|
+
const p = t.__pinpax__.asyncResponses.voucher;
|
|
300
|
+
t.__pinpax__.asyncResponses.voucher = null, t.__pinpax__.waiting.voucher = !1, clearInterval(o), clearTimeout(r), i(p.voucher);
|
|
265
301
|
}
|
|
266
302
|
}, 100);
|
|
267
303
|
});
|
|
268
304
|
}
|
|
269
305
|
async info() {
|
|
270
|
-
await this.appendToQueue(
|
|
306
|
+
await this.appendToQueue(a.info(), "info");
|
|
271
307
|
}
|
|
272
308
|
async keepAlive() {
|
|
273
|
-
await this.appendToQueue(
|
|
309
|
+
await this.appendToQueue(a.keepAlive(), "keep-alive");
|
|
274
310
|
}
|
|
275
311
|
async restartApp() {
|
|
276
|
-
await this.appendToQueue(
|
|
312
|
+
await this.appendToQueue(a.restartApp(), "reset-app");
|
|
277
313
|
}
|
|
278
314
|
async getConfig() {
|
|
279
|
-
return await this.appendToQueue(
|
|
315
|
+
return await this.appendToQueue(a.getConfig(), "get-config");
|
|
280
316
|
}
|
|
281
317
|
async hideButtons() {
|
|
282
|
-
return await this.appendToQueue(
|
|
318
|
+
return await this.appendToQueue(a.hideButtons(), "hide-buttons"), await this.#a();
|
|
283
319
|
}
|
|
284
320
|
async showButtons() {
|
|
285
|
-
return await this.appendToQueue(
|
|
321
|
+
return await this.appendToQueue(a.showButtons(), "show-buttons"), await this.#i();
|
|
286
322
|
}
|
|
287
323
|
async demo() {
|
|
288
|
-
return console.warn("RUNNING DEMO APP, BE CAREFUL"), await this.appendToQueue(
|
|
324
|
+
return console.warn("RUNNING DEMO APP, BE CAREFUL"), await this.appendToQueue(a.demo(), "demo");
|
|
289
325
|
}
|
|
290
|
-
async refund({ amount: s = 0, folio: e = null, auth:
|
|
326
|
+
async refund({ amount: s = 0, folio: e = null, auth: t = null } = {}) {
|
|
291
327
|
return await this.appendToQueue(
|
|
292
|
-
|
|
328
|
+
a.refund({
|
|
293
329
|
amount: s,
|
|
294
330
|
folio: e,
|
|
295
|
-
auth:
|
|
331
|
+
auth: t
|
|
296
332
|
}),
|
|
297
333
|
"refund"
|
|
298
334
|
);
|
|
299
335
|
}
|
|
300
336
|
async readProductionQR() {
|
|
301
|
-
return await
|
|
337
|
+
return await this.#s({ type: "production" });
|
|
302
338
|
}
|
|
303
339
|
async readQualityAssuranceQR() {
|
|
304
|
-
return
|
|
340
|
+
return this.#s({ type: "QA" });
|
|
305
341
|
}
|
|
306
342
|
async exit() {
|
|
307
|
-
return await this.appendToQueue(
|
|
343
|
+
return await this.appendToQueue(a.exit(), "exit-app");
|
|
308
344
|
}
|
|
309
345
|
async init() {
|
|
310
|
-
await this.appendToQueue(
|
|
346
|
+
await this.appendToQueue(a.init(), "init-app");
|
|
311
347
|
}
|
|
312
348
|
async login() {
|
|
313
349
|
if (!this.apiKey || !this.bussinessId || !this.encriptionKey || !this.server)
|
|
@@ -323,46 +359,6 @@ class S extends C {
|
|
|
323
359
|
await this.appendToQueue(e, "login");
|
|
324
360
|
}
|
|
325
361
|
}
|
|
326
|
-
t = new WeakSet(), w = function() {
|
|
327
|
-
const s = [
|
|
328
|
-
"buttons-status",
|
|
329
|
-
"init-app",
|
|
330
|
-
"connectMessage",
|
|
331
|
-
"voucher",
|
|
332
|
-
"info",
|
|
333
|
-
"keep-alive",
|
|
334
|
-
"reset-app",
|
|
335
|
-
"get-config",
|
|
336
|
-
"payment",
|
|
337
|
-
"error",
|
|
338
|
-
"refund",
|
|
339
|
-
"login"
|
|
340
|
-
];
|
|
341
|
-
for (const e of s)
|
|
342
|
-
this.serialRegisterAvailableListener(e);
|
|
343
|
-
}, _ = async function() {
|
|
344
|
-
if (this.isDisconnected) throw new Error("Device is disconnected");
|
|
345
|
-
if (this.queue.length === 0) return !0;
|
|
346
|
-
const s = this;
|
|
347
|
-
return new Promise((e) => {
|
|
348
|
-
let a = setInterval(() => {
|
|
349
|
-
s.queue.length === 0 && (clearInterval(a), e(!0));
|
|
350
|
-
}, 500);
|
|
351
|
-
});
|
|
352
|
-
}, l = async function({ type: s = "production" } = {}) {
|
|
353
|
-
const e = n.readQR({ type: s });
|
|
354
|
-
return await this.appendToQueue(e, "read-qr");
|
|
355
|
-
}, g = async function() {
|
|
356
|
-
await this.appendToQueue(n.forceHide(), "force-hide");
|
|
357
|
-
}, v = async function() {
|
|
358
|
-
await this.appendToQueue(n.forceShow(), "force-show");
|
|
359
|
-
}, b = async function() {
|
|
360
|
-
await this.connectMessage();
|
|
361
|
-
}, x = async function() {
|
|
362
|
-
await this.hideButtons();
|
|
363
|
-
}, T = function(s) {
|
|
364
|
-
this.dispatch("payment", s), this.__pinpax__.waiting.sale && (this.__pinpax__.asyncResponses.sale = s);
|
|
365
|
-
};
|
|
366
362
|
export {
|
|
367
|
-
|
|
363
|
+
y as PinPax
|
|
368
364
|
};
|
package/dist/relay.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./kernel-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./kernel-D8A562gb.cjs"),i=require("./relay-DGFymXOw.cjs"),r=require("./webserial-core-N14HUamr.cjs");class o extends a.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=!0,r.h.getCustom(this.typeDevice,n))throw new Error(`Device ${this.typeDevice} ${n} already exists`);r.h.add(this)}serialMessage(t){const e={code:t,name:null,description:null,request:null,no_code:0};switch(t[1].toString()){case"dd":e.name="Connection with the serial device completed.",e.description="Your connection with the serial device was successfully completed.",e.request="connect",e.no_code=100;break;case"de":break;default: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;break}this.dispatch("serial:message",e)}serialRelaySumHex(t){let e=0;return t.forEach((n,s)=>{s!==3&&(e+=n)}),e}serialSetConnectionConstant(t=1){return i.e.connection(t)}async turnOn(){const t=i.e.activate();await this.appendToQueue(t,"relay:turn-on")}async turnOff(){const t=i.e.deactivate();await this.appendToQueue(t,"relay:turn-off")}async toggle({inverse:t=!1,ms:e=300}={}){if(!t){await this.turnOn(),await a.wait(e),await this.turnOff();return}await this.turnOff(),await a.wait(e),await this.turnOn()}}exports.Relay=o;
|
package/dist/relay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { K as o, w as i } from "./kernel-
|
|
1
|
+
import { K as o, w as i } from "./kernel-DAtdBEi3.js";
|
|
2
2
|
import { e as a } from "./relay-CsdB0FSa.js";
|
|
3
|
-
import { h as s } from "./webserial-core-
|
|
3
|
+
import { h as s } from "./webserial-core-BjytHor1.js";
|
|
4
4
|
class p extends o {
|
|
5
5
|
constructor({ filters: t = null, config_port: e = null, no_device: n = 1 } = {}) {
|
|
6
6
|
if (super({ filters: t, config_port: e, no_device: n }), this.__internal__.device.type = "relay", this.__internal__.auto_response = !0, s.getCustom(this.typeDevice, n))
|