feat: captura y respaldo de login clasico, screenshots para tiendas y servicios sinpe
@@ -8,3 +8,5 @@ node_modules/
|
|||||||
*.db-wal
|
*.db-wal
|
||||||
*.db
|
*.db
|
||||||
cloudflared.exe
|
cloudflared.exe
|
||||||
|
scratch/
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"jsqr": "^1.4.0",
|
"jsqr": "^1.4.0",
|
||||||
"mailparser": "^3.9.36",
|
"mailparser": "^3.9.36",
|
||||||
"pg": "^8.23.1",
|
"pg": "^8.23.1",
|
||||||
|
"puppeteer-core": "^25.12.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"synckit": "^0.11.13",
|
"synckit": "^0.11.13",
|
||||||
"web-push": "^3.6.7"
|
"web-push": "^3.6.7"
|
||||||
@@ -33,6 +34,195 @@
|
|||||||
"url": "https://opencollective.com/pkgr"
|
"url": "https://opencollective.com/pkgr"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@puppeteer/browsers": {
|
||||||
|
"version": "3.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.3.tgz",
|
||||||
|
"integrity": "sha512-2Bt3m6dDAJqmZehn0wiXSYyQmuhyiHHZ7FjvrVaS1W2RoFGV6eCK71UvKYkNJjkwC1Q9nobjhvTMhLQztFVINA==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"modern-tar": "^0.8.4",
|
||||||
|
"yargs": "^18.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"browsers": "lib/main-cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"proxy-agent": ">=8.0.1",
|
||||||
|
"yauzl": "^2.10.0 || ^3.4.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"proxy-agent": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"yauzl": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/ansi-regex": {
|
||||||
|
"version": "6.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.4.0.tgz",
|
||||||
|
"integrity": "sha512-KzTVk2tCWAHtYrvvvaP8bJKJq2pVinhLcGEQdtLIYPbmNGNyYe8QwNaTUYQp2J7/vIsUKt5QCqAfUkYyG9DkOw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/ansi-styles": {
|
||||||
|
"version": "6.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
|
||||||
|
"integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/cliui": {
|
||||||
|
"version": "9.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz",
|
||||||
|
"integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"string-width": "^7.2.0",
|
||||||
|
"strip-ansi": "^7.1.0",
|
||||||
|
"wrap-ansi": "^9.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/cliui/node_modules/string-width": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^10.3.0",
|
||||||
|
"get-east-asian-width": "^1.0.0",
|
||||||
|
"strip-ansi": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/emoji-regex": {
|
||||||
|
"version": "10.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
|
||||||
|
"integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/string-width": {
|
||||||
|
"version": "8.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-8.3.0.tgz",
|
||||||
|
"integrity": "sha512-ZbmZM0JCihQN91dWnxoipT2KOEyHqEyfRXUyjuRhW8b/xnqPDoq4gWEVApTVa9db2wN8mmoikgFBbjh71+cGeQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"get-east-asian-width": "^1.5.0",
|
||||||
|
"strip-ansi": "^7.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/strip-ansi": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^6.2.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/wrap-ansi": {
|
||||||
|
"version": "9.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
|
||||||
|
"integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^6.2.1",
|
||||||
|
"string-width": "^7.0.0",
|
||||||
|
"strip-ansi": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/wrap-ansi/node_modules/string-width": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^10.3.0",
|
||||||
|
"get-east-asian-width": "^1.0.0",
|
||||||
|
"strip-ansi": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/y18n": {
|
||||||
|
"version": "5.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||||
|
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/yargs": {
|
||||||
|
"version": "18.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs/-/yargs-18.2.0.tgz",
|
||||||
|
"integrity": "sha512-9OpKOLeaoNFecEp7P6iYbzze/5CqWoH7N3SMs/6y1XF4nMvFMspEGZzJ6uFi9MmQwXhyzqYoSEKO3tvA3Z/o2w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"cliui": "^9.0.1",
|
||||||
|
"escalade": "^3.1.1",
|
||||||
|
"get-caller-file": "^2.0.5",
|
||||||
|
"string-width": "^8.2.1",
|
||||||
|
"y18n": "^5.0.5",
|
||||||
|
"yargs-parser": "^22.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@puppeteer/browsers/node_modules/yargs-parser": {
|
||||||
|
"version": "22.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
|
||||||
|
"integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@selderee/plugin-htmlparser2": {
|
"node_modules/@selderee/plugin-htmlparser2": {
|
||||||
"version": "0.12.0",
|
"version": "0.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@selderee/plugin-htmlparser2/-/plugin-htmlparser2-0.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/@selderee/plugin-htmlparser2/-/plugin-htmlparser2-0.12.0.tgz",
|
||||||
@@ -226,6 +416,22 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chromium-bidi": {
|
||||||
|
"version": "17.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-17.0.2.tgz",
|
||||||
|
"integrity": "sha512-5v9GQFhTktFvotn/OFNJBmKLKRAb6n9r0bVCwf7sHgWc3/JryK0bj1nn93L3pHFrfgcsu6Be6EWsDi+1XHTGDg==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"mitt": "^3.0.1",
|
||||||
|
"zod": "^3.24.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.19.0 <22.0.0 || >=22.12.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"devtools-protocol": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cliui": {
|
"node_modules/cliui": {
|
||||||
"version": "6.0.0",
|
"version": "6.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||||
@@ -372,6 +578,12 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/devtools-protocol": {
|
||||||
|
"version": "0.0.1687809",
|
||||||
|
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1687809.tgz",
|
||||||
|
"integrity": "sha512-t7kSb+UKYdyxcmqy98U2P86ne6rCve3DIJ4+lp54i/hhClgFuG35JrLj23rO14Jw3sWDsp7i+22QhNU0+/qk8g==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/dijkstrajs": {
|
"node_modules/dijkstrajs": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
||||||
@@ -528,6 +740,15 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/escalade": {
|
||||||
|
"version": "3.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
||||||
|
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/escape-html": {
|
"node_modules/escape-html": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
@@ -656,6 +877,18 @@
|
|||||||
"node": "6.* || 8.* || >= 10.*"
|
"node": "6.* || 8.* || >= 10.*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/get-east-asian-width": {
|
||||||
|
"version": "1.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.7.0.tgz",
|
||||||
|
"integrity": "sha512-XjH1AECxf0giL2V1aU8vKyRR2ppRUb5c0EvT7zuJTokQ74bNo52zOtghqdWIqrhUD79fo3x0WfKZdOqxF6LG1Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/get-intrinsic": {
|
"node_modules/get-intrinsic": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||||
@@ -1109,6 +1342,21 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mitt": {
|
||||||
|
"version": "3.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
|
||||||
|
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/modern-tar": {
|
||||||
|
"version": "0.8.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/modern-tar/-/modern-tar-0.8.5.tgz",
|
||||||
|
"integrity": "sha512-snEhs+6G5Tjd4I7tLCDOaoln2RgE0bD19RzEKgvgK2hZ5VKy3MpLhLTZ2fWpXSTg4K2cyPwp+VHATFJhxfnOeA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.3",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
@@ -1484,6 +1732,23 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/puppeteer-core": {
|
||||||
|
"version": "25.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-25.12.0.tgz",
|
||||||
|
"integrity": "sha512-z6LQUt5SH7jwGtGA+nMtJuEjZIsqPiwQ+EFHCYuVDQrJpvifNmmGuyDvTzAKPyFzihxgHc5f3aMzu2kn8Ps37A==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@puppeteer/browsers": "3.2.3",
|
||||||
|
"chromium-bidi": "17.0.2",
|
||||||
|
"devtools-protocol": "0.0.1687809",
|
||||||
|
"typed-query-selector": "^2.12.2",
|
||||||
|
"webdriver-bidi-protocol": "0.4.3",
|
||||||
|
"ws": "^8.21.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22.12.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/qrcode": {
|
"node_modules/qrcode": {
|
||||||
"version": "1.5.4",
|
"version": "1.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||||
@@ -1890,6 +2155,12 @@
|
|||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/typed-query-selector": {
|
||||||
|
"version": "2.12.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.3.tgz",
|
||||||
|
"integrity": "sha512-/dtuMZyutHLlrxWhhC1uib00ELUr2dZ8C9B8YzZYsJmeE3V56OxRblrSM2UaF142pcMtak7ehZ6+poWGeehNIg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/uc.micro": {
|
"node_modules/uc.micro": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz",
|
||||||
@@ -1952,6 +2223,12 @@
|
|||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/webdriver-bidi-protocol": {
|
||||||
|
"version": "0.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.3.tgz",
|
||||||
|
"integrity": "sha512-uuN0goWfxP22B7J/uAgBpOYNPttC+XVseYE+rSY5+rQ+YBeVz/VORw8WbmLVcqW78zNg5A4qnjNXYUWR3il2ig==",
|
||||||
|
"license": "Apache-2.0"
|
||||||
|
},
|
||||||
"node_modules/which-module": {
|
"node_modules/which-module": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
||||||
@@ -1978,6 +2255,27 @@
|
|||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/ws": {
|
||||||
|
"version": "8.22.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",
|
||||||
|
"integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"bufferutil": "^4.0.1",
|
||||||
|
"utf-8-validate": ">=5.0.2"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"bufferutil": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"utf-8-validate": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
@@ -2027,6 +2325,15 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"node_modules/zod": {
|
||||||
|
"version": "3.25.76",
|
||||||
|
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||||
|
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/colinhacks"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
"jsqr": "^1.4.0",
|
"jsqr": "^1.4.0",
|
||||||
"mailparser": "^3.9.36",
|
"mailparser": "^3.9.36",
|
||||||
"pg": "^8.23.1",
|
"pg": "^8.23.1",
|
||||||
|
"puppeteer-core": "^25.12.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"synckit": "^0.11.13",
|
"synckit": "^0.11.13",
|
||||||
"web-push": "^3.6.7"
|
"web-push": "^3.6.7"
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>SiboPay - Inicio de Sesión Clásico con Roles</title>
|
||||||
|
<link rel="icon" type="image/png" href="/img/sibopay-emblem.png">
|
||||||
|
<link rel="stylesheet" href="/css/styles.css">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
|
||||||
|
background: radial-gradient(circle at 50% 10%, #0284c7 0%, #0f172a 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.login-overlay {
|
||||||
|
position: relative !important;
|
||||||
|
background: none !important;
|
||||||
|
padding: 20px !important;
|
||||||
|
display: flex !important;
|
||||||
|
align-items: center !important;
|
||||||
|
justify-content: center !important;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="login-overlay">
|
||||||
|
<div id="viewLoginClassicCard" class="login-card">
|
||||||
|
<div class="login-brand">
|
||||||
|
<div class="login-logo" style="margin-bottom: 6px;">
|
||||||
|
<img src="/img/sibopay-emblem.png" alt="SiboPay Logo" style="width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(2, 132, 199, 0.3)); display: inline-block;">
|
||||||
|
</div>
|
||||||
|
<h1 class="login-title" style="margin: 0; font-size: 1.85rem; font-weight: 900; letter-spacing: -0.5px;">Sibo<strong style="color: #0284c7;">Pay</strong></h1>
|
||||||
|
<p class="login-subtitle">Sistema Digital de Pagos y Monedero Estudiantil</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SELECTOR ENTRE INICIO DE SESIÓN Y REGISTRO -->
|
||||||
|
<div class="login-tabs">
|
||||||
|
<button type="button" class="login-tab-btn active" id="tabBtnLogin" onclick="switchLoginTab('login')" style="display: inline-flex; align-items: center; justify-content: center; gap: 8px;">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" x2="3" y1="12" y2="12"/></svg>
|
||||||
|
<span>Iniciar Sesión</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="login-tab-btn" id="tabBtnRegister" onclick="switchLoginTab('register')" style="display: inline-flex; align-items: center; justify-content: center; gap: 8px;">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="9" cy="7" r="3.5"/><path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/><circle cx="17.5" cy="7.5" r="2.5"/><path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/></svg>
|
||||||
|
<span>Registro de Padres</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FORMULARIO 1: INICIAR SESIÓN CON SELECTOR DE ROL -->
|
||||||
|
<form id="formLogin" onsubmit="event.preventDefault()">
|
||||||
|
<div class="login-role-selector-wrap">
|
||||||
|
<label style="font-size: 0.74rem; font-weight: 900; color: #475569; text-transform: uppercase; letter-spacing: 0.6px; display: block; margin-bottom: 8px;">¿Quién eres?</label>
|
||||||
|
<div class="login-role-grid">
|
||||||
|
<div onclick="selectLoginRole('padre')" id="loginRoleCardPadre" class="login-role-card selected">
|
||||||
|
<div class="login-role-icon">
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<circle cx="9" cy="7" r="3.5"/>
|
||||||
|
<path d="M3 20v-1.5A4.5 4.5 0 0 1 7.5 14h3A4.5 4.5 0 0 1 15 18.5V20"/>
|
||||||
|
<circle cx="17.5" cy="7.5" r="2.5"/>
|
||||||
|
<path d="M15 14a3.5 3.5 0 0 1 5.5 3v3"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<span class="login-role-name">Padre</span>
|
||||||
|
<span class="login-role-desc">o Encargado</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div onclick="selectLoginRole('estudiante')" id="loginRoleCardEstudiante" class="login-role-card">
|
||||||
|
<div class="login-role-icon">
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1-2.5-2.5Z"/>
|
||||||
|
<path d="M6 6h10"/>
|
||||||
|
<path d="M6 10h10"/>
|
||||||
|
<circle cx="12" cy="15" r="2"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<span class="login-role-name">Estudiante</span>
|
||||||
|
<span class="login-role-desc">Carné QR</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div onclick="selectLoginRole('personal')" id="loginRoleCardPersonal" class="login-role-card">
|
||||||
|
<div class="login-role-icon">
|
||||||
|
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M6 13.8V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v9.8"/>
|
||||||
|
<path d="M4 13.8h16a1 1 0 0 1 1 1V20a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5.2a1 1 0 0 1 1-1Z"/>
|
||||||
|
<line x1="10" y1="18" x2="14" y2="18"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<span class="login-role-name">Personal</span>
|
||||||
|
<span class="login-role-desc">Soda / Cocina</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login-form-group">
|
||||||
|
<label id="lblLoginUser" for="loginUsername">Usuario o Teléfono del Padre:</label>
|
||||||
|
<input type="text" id="loginUsername" class="login-input" placeholder="Ej: padre, carlos_papa o 8888-1122" value="padre">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login-form-group">
|
||||||
|
<label id="lblLoginPass" for="loginPassword">Contraseña:</label>
|
||||||
|
<input type="password" id="loginPassword" class="login-input" placeholder="••••••••" value="••••••••">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" id="btnLoginSubmit" class="login-submit-btn" style="display: flex; align-items: center; justify-content: center; gap: 8px;">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/><polyline points="10 17 15 12 10 7"/><line x1="15" x2="3" y1="12" y2="12"/></svg>
|
||||||
|
<span id="lblBtnLoginText">Ingresar como Padre / Encargado</span>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- ACCESOS RÁPIDOS DE PRUEBA (1-CLICK DEMO) -->
|
||||||
|
<div class="login-demo-box">
|
||||||
|
<div class="login-demo-title">Accesos Rápidos de Prueba:</div>
|
||||||
|
<div class="login-demo-btns">
|
||||||
|
<button type="button" class="login-demo-btn" style="border: 1.5px solid #0284c7; background: #f0f9ff;">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="#0284c7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>
|
||||||
|
<span style="color: #0284c7; font-weight: 800;">Developer</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="login-demo-btn">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/></svg>
|
||||||
|
<span>Admin Soda</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="login-demo-btn">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="14" x="2" y="5" rx="2"/><line x1="2" x2="22" y1="10" y2="10"/></svg>
|
||||||
|
<span>Cajero</span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="login-demo-btn">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/></svg>
|
||||||
|
<span>Padre</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function selectLoginRole(role) {
|
||||||
|
document.getElementById('loginRoleCardPadre').classList.toggle('selected', role === 'padre');
|
||||||
|
document.getElementById('loginRoleCardEstudiante').classList.toggle('selected', role === 'estudiante');
|
||||||
|
document.getElementById('loginRoleCardPersonal').classList.toggle('selected', role === 'personal');
|
||||||
|
|
||||||
|
const lblUser = document.getElementById('lblLoginUser');
|
||||||
|
const inputUser = document.getElementById('loginUsername');
|
||||||
|
const btnText = document.getElementById('lblBtnLoginText');
|
||||||
|
|
||||||
|
if (role === 'estudiante') {
|
||||||
|
lblUser.textContent = 'Carné o Código de Estudiante:';
|
||||||
|
inputUser.placeholder = 'Ej: EST-2026-00001';
|
||||||
|
btnText.textContent = 'Ingresar como Estudiante';
|
||||||
|
} else if (role === 'personal') {
|
||||||
|
lblUser.textContent = 'Usuario de Personal / Cocina:';
|
||||||
|
inputUser.placeholder = 'Ej: cocina, cajero, soda';
|
||||||
|
btnText.textContent = 'Ingresar al Personal de Soda / Cocina';
|
||||||
|
} else {
|
||||||
|
lblUser.textContent = 'Usuario o Teléfono del Padre:';
|
||||||
|
inputUser.placeholder = 'Ej: padre, 8888-1122';
|
||||||
|
btnText.textContent = 'Ingresar como Padre / Encargado';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 472 KiB |
|
After Width: | Height: | Size: 178 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 328 KiB |
|
After Width: | Height: | Size: 333 KiB |
|
After Width: | Height: | Size: 574 KiB |
|
After Width: | Height: | Size: 565 KiB |
|
After Width: | Height: | Size: 369 KiB |
|
After Width: | Height: | Size: 724 KiB |
|
After Width: | Height: | Size: 364 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 947 KiB |
|
After Width: | Height: | Size: 402 KiB |
|
After Width: | Height: | Size: 404 KiB |
|
After Width: | Height: | Size: 273 KiB |
|
After Width: | Height: | Size: 383 KiB |
|
After Width: | Height: | Size: 262 KiB |
|
After Width: | Height: | Size: 741 KiB |
|
After Width: | Height: | Size: 377 KiB |
|
After Width: | Height: | Size: 234 KiB |
|
After Width: | Height: | Size: 974 KiB |
|
After Width: | Height: | Size: 417 KiB |
|
After Width: | Height: | Size: 419 KiB |
|
After Width: | Height: | Size: 290 KiB |
|
After Width: | Height: | Size: 410 KiB |
|
After Width: | Height: | Size: 279 KiB |
|
After Width: | Height: | Size: 648 KiB |
|
After Width: | Height: | Size: 620 KiB |
|
After Width: | Height: | Size: 290 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 924 KiB |
|
After Width: | Height: | Size: 355 KiB |
|
After Width: | Height: | Size: 357 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 281 KiB |
|
After Width: | Height: | Size: 224 KiB |
|
After Width: | Height: | Size: 415 KiB |
|
After Width: | Height: | Size: 428 KiB |
|
After Width: | Height: | Size: 425 KiB |
@@ -0,0 +1,45 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const puppeteer = require('puppeteer-core');
|
||||||
|
|
||||||
|
const CHROME_PATH = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
|
||||||
|
const PREVIEW_URL = 'http://localhost:3030/templates/preview-login-clasico.html';
|
||||||
|
const OUT_DIR = path.join(__dirname, '../screenshots/login_clasico_roles');
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
if (!fs.existsSync(OUT_DIR)) fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||||
|
|
||||||
|
const browser = await puppeteer.launch({
|
||||||
|
executablePath: CHROME_PATH,
|
||||||
|
headless: 'new',
|
||||||
|
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||||
|
});
|
||||||
|
|
||||||
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
// 1. Captura en resolución móvil moderna (1080 x 2400 px)
|
||||||
|
await page.setViewport({ width: 360, height: 800, deviceScaleFactor: 3 });
|
||||||
|
await page.goto(PREVIEW_URL, { waitUntil: 'networkidle2' });
|
||||||
|
const outMobile = path.join(OUT_DIR, 'Login_Clasico_Roles_Padre_Estudiante_Personal.png');
|
||||||
|
await page.screenshot({ path: outMobile, type: 'png' });
|
||||||
|
console.log('✓ Guardado screenshot móvil:', outMobile);
|
||||||
|
|
||||||
|
// 2. Captura con rol Estudiante seleccionado
|
||||||
|
await page.evaluate(() => selectLoginRole('estudiante'));
|
||||||
|
await new Promise(r => setTimeout(r, 400));
|
||||||
|
const outEstudiante = path.join(OUT_DIR, 'Login_Clasico_Rol_Estudiante.png');
|
||||||
|
await page.screenshot({ path: outEstudiante, type: 'png' });
|
||||||
|
console.log('✓ Guardado screenshot estudiante:', outEstudiante);
|
||||||
|
|
||||||
|
// 3. Captura con rol Personal de cocina seleccionado
|
||||||
|
await page.evaluate(() => selectLoginRole('personal'));
|
||||||
|
await new Promise(r => setTimeout(r, 400));
|
||||||
|
const outPersonal = path.join(OUT_DIR, 'Login_Clasico_Rol_Personal_Cocina.png');
|
||||||
|
await page.screenshot({ path: outPersonal, type: 'png' });
|
||||||
|
console.log('✓ Guardado screenshot personal cocina:', outPersonal);
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
console.log('¡Capturas del inicio de sesión clásico generadas con éxito!');
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch(console.error);
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const puppeteer = require('puppeteer-core');
|
||||||
|
|
||||||
|
const CHROME_PATH = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
|
||||||
|
const APP_URL = 'http://localhost:3030/app';
|
||||||
|
const POS_URL = 'http://localhost:3030/pos.html';
|
||||||
|
|
||||||
|
const BASE_OUT_DIR = path.join(__dirname, '../screenshots');
|
||||||
|
|
||||||
|
// Especificaciones oficiales exigidas por Apple App Store Connect y Google Play Console
|
||||||
|
const PRESETS = [
|
||||||
|
{
|
||||||
|
name: 'apple_app_store/iphone_6_7_inch',
|
||||||
|
description: 'iPhone 6.7" (iPhone 16 / 15 / 14 Pro Max) - 1290 x 2796 px',
|
||||||
|
width: 430,
|
||||||
|
height: 932,
|
||||||
|
scale: 3,
|
||||||
|
expectedRes: '1290 x 2796'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'apple_app_store/iphone_6_5_inch',
|
||||||
|
description: 'iPhone 6.5" (iPhone 11 Pro Max / XS Max / XR) - 1242 x 2688 px',
|
||||||
|
width: 414,
|
||||||
|
height: 896,
|
||||||
|
scale: 3,
|
||||||
|
expectedRes: '1242 x 2688'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'google_play_store/phone_1080x2400',
|
||||||
|
description: 'Android Phone Google Play (FHD+ 20:9) - 1080 x 2400 px',
|
||||||
|
width: 360,
|
||||||
|
height: 800,
|
||||||
|
scale: 3,
|
||||||
|
expectedRes: '1080 x 2400'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'apple_app_store/ipad_pro_12_9_inch',
|
||||||
|
description: 'iPad Pro 12.9" (App Store Tablet) - 2048 x 2732 px',
|
||||||
|
width: 1024,
|
||||||
|
height: 1366,
|
||||||
|
scale: 2,
|
||||||
|
expectedRes: '2048 x 2732'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
|
||||||
|
|
||||||
|
// Sanitización y anonimización de nombres reales para screenshots oficiales de tiendas
|
||||||
|
async function anonymizeNamesInPage(page) {
|
||||||
|
await page.evaluate(() => {
|
||||||
|
const walkTextNodes = (root) => {
|
||||||
|
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
|
||||||
|
let node;
|
||||||
|
while ((node = walker.nextNode())) {
|
||||||
|
if (!node.nodeValue) continue;
|
||||||
|
let txt = node.nodeValue;
|
||||||
|
txt = txt.replace(/Mateo Alvarado Castro/gi, 'Nombre del Estudiante');
|
||||||
|
txt = txt.replace(/Mateo Castro Alvarado/gi, 'Nombre del Estudiante');
|
||||||
|
txt = txt.replace(/Carlos Alvarado \(Papá\)/gi, 'Nombre de los Padres');
|
||||||
|
txt = txt.replace(/Carlos Alvarado/gi, 'Nombre del Padre');
|
||||||
|
txt = txt.replace(/QR-MATEO-/gi, 'QR-ESTUDIANTE-');
|
||||||
|
if (txt !== node.nodeValue) {
|
||||||
|
node.nodeValue = txt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 1. Reemplazos globales en todos los nodos de texto
|
||||||
|
walkTextNodes(document.body);
|
||||||
|
|
||||||
|
// 2. Tarjeta del Estudiante en Menú Principal
|
||||||
|
const walletName = document.getElementById('walletName');
|
||||||
|
if (walletName) walletName.textContent = 'Nombre del Estudiante';
|
||||||
|
|
||||||
|
const walletAvatar = document.getElementById('walletAvatar');
|
||||||
|
if (walletAvatar) walletAvatar.textContent = 'NE';
|
||||||
|
|
||||||
|
// 3. Modal de Carné QR
|
||||||
|
const qrCardTitle = document.querySelector('.qr-card-header-title');
|
||||||
|
if (qrCardTitle) {
|
||||||
|
let sub = document.getElementById('qrStudentNameHeader');
|
||||||
|
if (!sub) {
|
||||||
|
sub = document.createElement('div');
|
||||||
|
sub.id = 'qrStudentNameHeader';
|
||||||
|
sub.style.cssText = 'font-size: 0.95rem; font-weight: 800; color: #0284c7; margin-top: 4px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px;';
|
||||||
|
qrCardTitle.parentNode.insertBefore(sub, qrCardTitle.nextSibling);
|
||||||
|
}
|
||||||
|
sub.textContent = 'Nombre del Estudiante';
|
||||||
|
}
|
||||||
|
|
||||||
|
const qrToken = document.getElementById('qrTokenDisplay');
|
||||||
|
if (qrToken) {
|
||||||
|
qrToken.textContent = qrToken.textContent.replace(/MATEO/g, 'ESTUDIANTE');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Portal de Padres: Cabecera
|
||||||
|
const parentLoggedName = document.getElementById('parentLoggedName');
|
||||||
|
if (parentLoggedName) {
|
||||||
|
parentLoggedName.textContent = 'Nombre de los Padres (Padre/Madre)';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Portal de Padres: Estudiante seleccionado
|
||||||
|
const parentActiveChildName = document.getElementById('parentActiveChildName');
|
||||||
|
if (parentActiveChildName) {
|
||||||
|
parentActiveChildName.textContent = 'Nombre del Estudiante';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Portal de Padres: Fichas de Hijos e iniciales
|
||||||
|
document.querySelectorAll('#viewPadres div, #viewPadres span, #viewPadres strong, #viewPadres h4').forEach(el => {
|
||||||
|
if (el.children.length === 0 && el.textContent.trim() === 'MA') {
|
||||||
|
el.textContent = 'NE';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('#parentHijosList > div, .parent-child-card').forEach(card => {
|
||||||
|
const strong = card.querySelector('strong');
|
||||||
|
if (strong && (strong.textContent.includes('Mateo') || strong.textContent.includes('Alvarado'))) {
|
||||||
|
strong.textContent = 'Nombre del Estudiante';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 7. Subvista SINPE Móvil
|
||||||
|
const sinpeBanner = document.querySelector('#parentSubViewSinpe');
|
||||||
|
if (sinpeBanner) {
|
||||||
|
walkTextNodes(sinpeBanner);
|
||||||
|
sinpeBanner.querySelectorAll('div, span, button').forEach(el => {
|
||||||
|
if (el.textContent.trim() === 'MA') el.textContent = 'NE';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pasada final de seguridad
|
||||||
|
walkTextNodes(document.body);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function captureScreen(page, outPath) {
|
||||||
|
const dir = path.dirname(outPath);
|
||||||
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
||||||
|
await page.screenshot({ path: outPath, type: 'png' });
|
||||||
|
const buf = fs.readFileSync(outPath);
|
||||||
|
const w = buf.readUInt32BE(16);
|
||||||
|
const h = buf.readUInt32BE(20);
|
||||||
|
const kb = Math.round(buf.length / 1024);
|
||||||
|
console.log(` ✓ Guardado: ${path.basename(outPath)} (${w}x${h} px, ${kb} KB)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
console.log('========================================================================');
|
||||||
|
console.log('📸 GENERADOR DE SCREENSHOTS OFICIALES ANONIMIZADOS (APPLE & GOOGLE STORE)');
|
||||||
|
console.log('========================================================================\n');
|
||||||
|
|
||||||
|
const browser = await puppeteer.launch({
|
||||||
|
executablePath: CHROME_PATH,
|
||||||
|
headless: 'new',
|
||||||
|
args: ['--no-sandbox', '--disable-setuid-sandbox', '--hide-scrollbars']
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const preset of PRESETS) {
|
||||||
|
console.log(`\n📱 Procesando preset: ${preset.description}`);
|
||||||
|
const outDir = path.join(BASE_OUT_DIR, preset.name);
|
||||||
|
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
||||||
|
|
||||||
|
const page = await browser.newPage();
|
||||||
|
await page.setViewport({
|
||||||
|
width: preset.width,
|
||||||
|
height: preset.height,
|
||||||
|
deviceScaleFactor: preset.scale
|
||||||
|
});
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 1. PANTALLA DE BIENVENIDA / SPLASH LOGIN
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.goto(APP_URL, { waitUntil: 'networkidle2' });
|
||||||
|
await page.evaluate(() => localStorage.clear());
|
||||||
|
await page.reload({ waitUntil: 'networkidle2' });
|
||||||
|
await sleep(700);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '01_Bienvenida_Login_SiboPay.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 2. MODAL INFERIOR (BOTTOM SHEET) INICIO DE SESIÓN
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.evaluate(() => {
|
||||||
|
if (typeof openLoginSheet === 'function') openLoginSheet('login');
|
||||||
|
});
|
||||||
|
await sleep(600);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '02_Acceso_Seguro_BottomSheet.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 3. MONEDERO ESTUDIANTIL & CARNÉ QR (ANONIMIZADO)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.evaluate(async () => {
|
||||||
|
document.getElementById('loginUsername').value = 'mateo';
|
||||||
|
document.getElementById('loginPassword').value = '1234';
|
||||||
|
await handleLoginSubmit();
|
||||||
|
});
|
||||||
|
await sleep(1500);
|
||||||
|
|
||||||
|
// Abrir Modal de Carné QR
|
||||||
|
await page.evaluate(() => {
|
||||||
|
if (typeof openQrModal === 'function') openQrModal();
|
||||||
|
});
|
||||||
|
await sleep(800);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '03_Carne_Digital_QR_Estudiante.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 4. CATÁLOGO DE LA SODA ESCOLAR & PRODUCTOS (ANONIMIZADO)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.evaluate(() => {
|
||||||
|
if (typeof closeQrModal === 'function') closeQrModal();
|
||||||
|
});
|
||||||
|
await sleep(600);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '04_Catalogo_Soda_Escolar.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 5. PORTAL PARENTAL (MONITOREO DE HIJOS Y SALDOS ANONIMIZADOS)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.evaluate(() => localStorage.clear());
|
||||||
|
await page.reload({ waitUntil: 'networkidle2' });
|
||||||
|
await page.evaluate(async () => {
|
||||||
|
document.getElementById('loginUsername').value = 'padre';
|
||||||
|
document.getElementById('loginPassword').value = 'padre123';
|
||||||
|
await handleLoginSubmit();
|
||||||
|
});
|
||||||
|
await sleep(1800);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '05_Portal_Padres_Monitoreo.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 6. RECARGA OFICIAL POR SINPE MÓVIL (ANONIMIZADO)
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.evaluate(() => {
|
||||||
|
if (typeof openParentSubView === 'function') openParentSubView('sinpe');
|
||||||
|
});
|
||||||
|
await sleep(800);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '06_Recarga_SINPE_Movil.png'));
|
||||||
|
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
// 7. TERMINAL POS Y CAJA RÁPIDA DE LA SODA ESCOLAR
|
||||||
|
// -------------------------------------------------------------
|
||||||
|
await page.goto(POS_URL, { waitUntil: 'networkidle2' });
|
||||||
|
await sleep(1200);
|
||||||
|
await anonymizeNamesInPage(page);
|
||||||
|
await captureScreen(page, path.join(outDir, '07_Terminal_POS_Caja_Soda.png'));
|
||||||
|
|
||||||
|
await page.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
console.log('\n========================================================================');
|
||||||
|
console.log('🎉 ¡TODOS LOS SCREENSHOTS ANONIMIZADOS FUERON GENERADOS CON ÉXITO!');
|
||||||
|
console.log(`📁 Carpeta principal: ${BASE_OUT_DIR}`);
|
||||||
|
console.log('========================================================================\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch(err => {
|
||||||
|
console.error('Error fatal durante la generación de screenshots:', err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
const db = require('../server/db');
|
||||||
|
|
||||||
|
try {
|
||||||
|
db.db.exec(`
|
||||||
|
CREATE TABLE IF NOT EXISTS escuelas (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
codigo TEXT UNIQUE NOT NULL,
|
||||||
|
nombre TEXT NOT NULL,
|
||||||
|
telefono_sinpe TEXT DEFAULT '8888-8888',
|
||||||
|
nombre_sinpe TEXT DEFAULT 'Soda Central',
|
||||||
|
concesionario TEXT,
|
||||||
|
activo INTEGER DEFAULT 1,
|
||||||
|
creado_en DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||||
|
);
|
||||||
|
INSERT OR IGNORE INTO escuelas (id, codigo, nombre, telefono_sinpe, nombre_sinpe, concesionario, activo)
|
||||||
|
VALUES (1, 'ESC01', 'Soda Escolar Central', '8888-8888', 'Soda Central', 'Concesionario Central', 1);
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Column additions if missing
|
||||||
|
const cols = [
|
||||||
|
{ table: 'estudiantes', col: 'escuela_id', type: 'INTEGER DEFAULT 1' },
|
||||||
|
{ table: 'productos', col: 'escuela_id', type: 'INTEGER DEFAULT 1' },
|
||||||
|
{ table: 'ordenes', col: 'escuela_id', type: 'INTEGER DEFAULT 1' },
|
||||||
|
{ table: 'usuarios', col: 'escuela_id', type: 'INTEGER DEFAULT 1' },
|
||||||
|
{ table: 'solicitudes_recarga_sinpe', col: 'escuela_id', type: 'INTEGER DEFAULT 1' }
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const c of cols) {
|
||||||
|
try {
|
||||||
|
db.db.exec(`ALTER TABLE ${c.table} ADD COLUMN ${c.col} ${c.type};`);
|
||||||
|
} catch (e) {
|
||||||
|
// Column might already exist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('SQLite local database migration completed successfully!');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Migration error:', err);
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const puppeteer = require('puppeteer-core');
|
||||||
|
const express = require('express');
|
||||||
|
|
||||||
|
const CHROME_PATH = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
|
||||||
|
const PORT = 3033;
|
||||||
|
const OUT_DIR = path.join(__dirname, '../screenshots/desktop_preview');
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const fs = require('fs');
|
||||||
|
if (!fs.existsSync(OUT_DIR)) fs.mkdirSync(OUT_DIR, { recursive: true });
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
app.use(express.static(path.join(__dirname, '../public')));
|
||||||
|
|
||||||
|
const server = app.listen(PORT, async () => {
|
||||||
|
console.log(`Server listening on port ${PORT}`);
|
||||||
|
try {
|
||||||
|
const browser = await puppeteer.launch({
|
||||||
|
executablePath: CHROME_PATH,
|
||||||
|
headless: 'new',
|
||||||
|
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||||
|
});
|
||||||
|
|
||||||
|
const page = await browser.newPage();
|
||||||
|
await page.setViewport({ width: 1920, height: 1080, deviceScaleFactor: 1 });
|
||||||
|
await page.goto(`http://localhost:${PORT}/index.html`, { waitUntil: 'networkidle2' });
|
||||||
|
|
||||||
|
// Verify computed style of .splash-doodle-bg
|
||||||
|
const animInfo = await page.evaluate(() => {
|
||||||
|
const el = document.querySelector('.splash-doodle-bg');
|
||||||
|
if (!el) return null;
|
||||||
|
const style = window.getComputedStyle(el);
|
||||||
|
return {
|
||||||
|
animation: style.animation,
|
||||||
|
animationName: style.animationName,
|
||||||
|
animationDuration: style.animationDuration,
|
||||||
|
backgroundSize: style.backgroundSize
|
||||||
|
};
|
||||||
|
});
|
||||||
|
console.log('Animation Info:', animInfo);
|
||||||
|
|
||||||
|
const outPath = path.join(OUT_DIR, 'Login_Desktop_Fondo_Animado.png');
|
||||||
|
await page.screenshot({ path: outPath, type: 'png' });
|
||||||
|
console.log('✓ Guardado screenshot desktop:', outPath);
|
||||||
|
|
||||||
|
await browser.close();
|
||||||
|
server.close();
|
||||||
|
process.exit(0);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
server.close();
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
@@ -0,0 +1,189 @@
|
|||||||
|
/**
|
||||||
|
* Servicio de Lectura y Conciliación IMAP de Notificaciones SINPE Móvil para SiboPay
|
||||||
|
*/
|
||||||
|
|
||||||
|
const imapSimple = require('imap-simple');
|
||||||
|
const { simpleParser } = require('mailparser');
|
||||||
|
const { parseSinpeEmail, normalizarCodigoDetalle } = require('./sinpeParser');
|
||||||
|
|
||||||
|
let isChecking = false;
|
||||||
|
|
||||||
|
const getImapConfig = () => {
|
||||||
|
const cleanPassword = (process.env.SINPE_EMAIL_PASSWORD || '').replace(/\s+/g, '');
|
||||||
|
return {
|
||||||
|
imap: {
|
||||||
|
user: process.env.SINPE_EMAIL_USER || '',
|
||||||
|
password: cleanPassword,
|
||||||
|
host: process.env.SINPE_IMAP_HOST || 'imap.gmail.com',
|
||||||
|
port: parseInt(process.env.SINPE_IMAP_PORT || '993', 10),
|
||||||
|
tls: true,
|
||||||
|
authTimeout: 10000,
|
||||||
|
tlsOptions: { rejectUnauthorized: false }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escanea la bandeja de entrada buscando los correos más recientes de notificación SINPE
|
||||||
|
* y los guarda en la base de datos de transacciones.
|
||||||
|
*/
|
||||||
|
async function checkSinpeEmailsOnce(db) {
|
||||||
|
if (isChecking) return { scanned: 0, status: 'already_running' };
|
||||||
|
|
||||||
|
const user = process.env.SINPE_EMAIL_USER;
|
||||||
|
const pass = process.env.SINPE_EMAIL_PASSWORD;
|
||||||
|
const isEnabled = process.env.SINPE_IMAP_ENABLED === 'true' || process.env.SINPE_IMAP_ENABLED === '1';
|
||||||
|
|
||||||
|
if (!isEnabled || !user || !pass) {
|
||||||
|
return { scanned: 0, status: 'disabled_or_unconfigured' };
|
||||||
|
}
|
||||||
|
|
||||||
|
isChecking = true;
|
||||||
|
let connection = null;
|
||||||
|
let savedCount = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const config = getImapConfig();
|
||||||
|
connection = await imapSimple.connect(config);
|
||||||
|
const box = await connection.openBox('INBOX');
|
||||||
|
|
||||||
|
const totalMessages = (box && box.messages && box.messages.total) || 0;
|
||||||
|
if (totalMessages === 0) {
|
||||||
|
return { scanned: 0, status: 'empty_inbox' };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Consultar los últimos 25 correos
|
||||||
|
const startSeq = Math.max(1, totalMessages - 24);
|
||||||
|
const searchCriteria = [`${startSeq}:${totalMessages}`];
|
||||||
|
const fetchOptions = {
|
||||||
|
bodies: ['HEADER', 'TEXT', ''],
|
||||||
|
markSeen: false,
|
||||||
|
struct: true
|
||||||
|
};
|
||||||
|
|
||||||
|
const messages = await connection.search(searchCriteria, fetchOptions);
|
||||||
|
|
||||||
|
if (messages && messages.length > 0) {
|
||||||
|
for (const msg of messages) {
|
||||||
|
try {
|
||||||
|
const headerPart = msg.parts.find(p => p.which === 'HEADER');
|
||||||
|
const rawHeader = headerPart ? headerPart.body : {};
|
||||||
|
let subject = Array.isArray(rawHeader.subject) ? rawHeader.subject[0] : (rawHeader.subject || '');
|
||||||
|
let from = Array.isArray(rawHeader.from) ? rawHeader.from[0] : (rawHeader.from || '');
|
||||||
|
|
||||||
|
const allPart = msg.parts.find(p => p.which === '' || p.which === 'TEXT');
|
||||||
|
let bodyText = '';
|
||||||
|
let bodyHtml = '';
|
||||||
|
|
||||||
|
if (allPart && allPart.body) {
|
||||||
|
const parsed = await simpleParser(allPart.body);
|
||||||
|
bodyText = parsed.text || '';
|
||||||
|
bodyHtml = parsed.html || '';
|
||||||
|
if (parsed.subject) subject = parsed.subject;
|
||||||
|
if (parsed.from && parsed.from.text) from = parsed.from.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parsedSinpe = parseSinpeEmail(subject, bodyText, bodyHtml, from);
|
||||||
|
|
||||||
|
if (parsedSinpe.isSinpe && parsedSinpe.amountCrc > 0) {
|
||||||
|
const txId = `sinpe_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
|
||||||
|
const normCod = parsedSinpe.codigoDetalleNormalizado || '';
|
||||||
|
const refNum = parsedSinpe.referenceNumber || (normCod ? `REF-${normCod}` : `TX-${Date.now()}`);
|
||||||
|
|
||||||
|
// Insertar o ignorar si ya existe
|
||||||
|
try {
|
||||||
|
if (db) {
|
||||||
|
const existing = db.prepare(`
|
||||||
|
SELECT id FROM sinpe_transacciones_banco
|
||||||
|
WHERE (codigo_detalle_norm = ? AND codigo_detalle_norm IS NOT NULL AND codigo_detalle_norm != '')
|
||||||
|
OR (reference_number = ? AND reference_number IS NOT NULL AND reference_number != '')
|
||||||
|
LIMIT 1
|
||||||
|
`).get(normCod || '__none__', refNum);
|
||||||
|
|
||||||
|
if (!existing) {
|
||||||
|
db.prepare(`
|
||||||
|
INSERT INTO sinpe_transacciones_banco
|
||||||
|
(id, reference_number, codigo_detalle, codigo_detalle_norm, amount_crc, sender_phone, sender_name, origin_bank, status, raw_data)
|
||||||
|
VALUES
|
||||||
|
(?, ?, ?, ?, ?, ?, ?, ?, 'unclaimed', ?)
|
||||||
|
`).run(
|
||||||
|
txId,
|
||||||
|
refNum,
|
||||||
|
parsedSinpe.codigoDetalle || null,
|
||||||
|
normCod || null,
|
||||||
|
parsedSinpe.amountCrc,
|
||||||
|
parsedSinpe.senderPhone || null,
|
||||||
|
parsedSinpe.senderName || 'Cliente SINPE',
|
||||||
|
parsedSinpe.originBank || 'SINPE Móvil',
|
||||||
|
JSON.stringify({ from, subject, summary: parsedSinpe.rawSummary })
|
||||||
|
);
|
||||||
|
savedCount++;
|
||||||
|
console.log(`💵 [SINPE IMAP] Notificación registrada: ₡${parsedSinpe.amountCrc} | Código: ${parsedSinpe.codigoDetalle || 'N/A'} | Ref: #${refNum} | Banco: ${parsedSinpe.originBank}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (dbErr) {
|
||||||
|
console.warn('⚠️ [SINPE IMAP] Error al persistir en BD:', dbErr.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (msgErr) {
|
||||||
|
console.warn('⚠️ [SINPE IMAP] Error procesando correo:', msgErr.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { scanned: messages ? messages.length : 0, saved: savedCount, status: 'ok' };
|
||||||
|
} catch (err) {
|
||||||
|
console.error('❌ [SINPE IMAP] Error de conexión:', err.message);
|
||||||
|
return { scanned: 0, status: 'error', error: err.message };
|
||||||
|
} finally {
|
||||||
|
if (connection) {
|
||||||
|
try { connection.end(); } catch (_) {}
|
||||||
|
}
|
||||||
|
isChecking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserta manualmente una transacción simulada (útil para pruebas inmediatas en QA o sin transferir dinero real)
|
||||||
|
*/
|
||||||
|
function simularSinpeEmail(db, { codigo, codigoDetalle, monto, banco, remitente, telefono, comprobante }) {
|
||||||
|
if (!db) throw new Error('DB no inicializada');
|
||||||
|
const txId = `sim_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
|
||||||
|
const rawCod = codigo || codigoDetalle || null;
|
||||||
|
const cleanCod = rawCod ? String(rawCod).trim() : null;
|
||||||
|
const normCod = cleanCod ? normalizarCodigoDetalle(cleanCod) : null;
|
||||||
|
const refNum = comprobante ? String(comprobante).trim() : (normCod ? `REF-${normCod}` : `SIM-${Date.now()}`);
|
||||||
|
const montoNum = parseInt(monto, 10) || 1000;
|
||||||
|
|
||||||
|
db.prepare(`
|
||||||
|
INSERT INTO sinpe_transacciones_banco
|
||||||
|
(id, reference_number, codigo_detalle, codigo_detalle_norm, amount_crc, sender_phone, sender_name, origin_bank, status, raw_data)
|
||||||
|
VALUES
|
||||||
|
(?, ?, ?, ?, ?, ?, ?, ?, 'unclaimed', ?)
|
||||||
|
`).run(
|
||||||
|
txId,
|
||||||
|
refNum,
|
||||||
|
cleanCod,
|
||||||
|
normCod,
|
||||||
|
montoNum,
|
||||||
|
telefono || '8888-1122',
|
||||||
|
remitente || 'Padre de Familia',
|
||||||
|
banco || 'BAC Credomatic',
|
||||||
|
JSON.stringify({ simulado: true, fecha: new Date().toISOString() })
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: txId,
|
||||||
|
codigo_detalle: cleanCod,
|
||||||
|
codigo_detalle_norm: normCod,
|
||||||
|
reference_number: refNum,
|
||||||
|
amount_crc: montoNum,
|
||||||
|
origin_bank: banco || 'BAC Credomatic',
|
||||||
|
sender_name: remitente || 'Padre de Familia'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
checkSinpeEmailsOnce,
|
||||||
|
simularSinpeEmail
|
||||||
|
};
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
/**
|
||||||
|
* Parser de Notificaciones Bancarias de SINPE Móvil (Costa Rica) para SiboPay
|
||||||
|
* Extrae:
|
||||||
|
* - Códigos de detalle SiboPay (SIBO-XXXX o SIBOXXXX) con tolerancia total a guiones/espacios/mayúsculas
|
||||||
|
* - Montos en colones (₡ / CRC)
|
||||||
|
* - Números de comprobante / referencia bancaria
|
||||||
|
* - Banco de origen (BAC, BCR, BNCR, Promerica, Davivienda, Scotiabank, etc.)
|
||||||
|
* - Teléfono y nombre del remitente
|
||||||
|
*/
|
||||||
|
|
||||||
|
function stripHtml(html = '') {
|
||||||
|
return String(html)
|
||||||
|
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
|
||||||
|
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
|
||||||
|
.replace(/<[^>]+>/g, ' ')
|
||||||
|
.replace(/ /gi, ' ')
|
||||||
|
.replace(/&/gi, '&')
|
||||||
|
.replace(/</gi, '<')
|
||||||
|
.replace(/>/gi, '>')
|
||||||
|
.replace(/\s+/g, ' ')
|
||||||
|
.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normaliza un código de SINPE para comparación tolerante
|
||||||
|
* Ejemplos: "SIBO-7K9M", "sibo7k9m", "SIBO 7k9m", "sibo-7k9m" -> "SIBO7K9M"
|
||||||
|
*/
|
||||||
|
function normalizarCodigoDetalle(codigo = '') {
|
||||||
|
if (!codigo) return '';
|
||||||
|
const str = String(codigo).trim();
|
||||||
|
const match = str.match(/\bSIBO[\s\-_]?([A-Za-z0-9]{3,8})\b/i) || str.match(/SIBO[\s\-_]?([A-Za-z0-9]{3,8})/i);
|
||||||
|
if (match) {
|
||||||
|
return `SIBO${match[1].toUpperCase()}`;
|
||||||
|
}
|
||||||
|
return str.replace(/[\s\-_]/g, '').toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseSinpeEmail(arg1 = '', bodyText = '', bodyHtml = '', from = '') {
|
||||||
|
let subject = '';
|
||||||
|
let text = '';
|
||||||
|
let html = '';
|
||||||
|
let cleanFrom = '';
|
||||||
|
|
||||||
|
if (typeof arg1 === 'object' && arg1 !== null) {
|
||||||
|
subject = arg1.subject || '';
|
||||||
|
text = arg1.text || arg1.bodyText || '';
|
||||||
|
html = arg1.html || arg1.bodyHtml || '';
|
||||||
|
cleanFrom = String(arg1.from || '').toLowerCase();
|
||||||
|
} else {
|
||||||
|
subject = String(arg1 || '');
|
||||||
|
text = String(bodyText || '');
|
||||||
|
html = String(bodyHtml || '');
|
||||||
|
cleanFrom = String(from || '').toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
const fullText = `${subject}\n${text}\n${stripHtml(html)}`.trim();
|
||||||
|
const lowerText = fullText.toLowerCase();
|
||||||
|
|
||||||
|
// 1. Detección de Banco de Costa Rica
|
||||||
|
let originBank = 'SINPE Móvil CR';
|
||||||
|
if (cleanFrom.includes('bac') || lowerText.includes('bac credomatic') || lowerText.includes('bac san jose')) {
|
||||||
|
originBank = 'BAC Credomatic';
|
||||||
|
} else if (cleanFrom.includes('bncr') || lowerText.includes('banco nacional') || lowerText.includes('bn móvil') || lowerText.includes('bn movil')) {
|
||||||
|
originBank = 'Banco Nacional (BNCR)';
|
||||||
|
} else if (cleanFrom.includes('bancobcr') || cleanFrom.includes('bcr') || lowerText.includes('banco de costa rica')) {
|
||||||
|
originBank = 'Banco de Costa Rica (BCR)';
|
||||||
|
} else if (cleanFrom.includes('promerica') || lowerText.includes('promerica')) {
|
||||||
|
originBank = 'Banco Promerica';
|
||||||
|
} else if (cleanFrom.includes('scotiabank') || lowerText.includes('scotiabank')) {
|
||||||
|
originBank = 'Scotiabank';
|
||||||
|
} else if (cleanFrom.includes('davivienda') || lowerText.includes('davivienda')) {
|
||||||
|
originBank = 'Davivienda';
|
||||||
|
} else if (cleanFrom.includes('wink') || cleanFrom.includes('coopenae') || lowerText.includes('wink')) {
|
||||||
|
originBank = 'Wink (Coopenae)';
|
||||||
|
} else if (cleanFrom.includes('sibopay') || cleanFrom.includes('simulad')) {
|
||||||
|
originBank = 'SiboPay Direct';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Extraer Código de Detalle SiboPay (Tolerancia total a guión, espacios o todo pegado)
|
||||||
|
let codigoDetalle = null;
|
||||||
|
const codigoRegex = /\bSIBO[\s\-_]?([A-Za-z0-9]{3,8})\b/i;
|
||||||
|
const matchCodigo = fullText.match(codigoRegex) || fullText.match(/SIBO[\s\-_]?([A-Za-z0-9]{3,8})/i);
|
||||||
|
if (matchCodigo) {
|
||||||
|
codigoDetalle = `SIBO-${matchCodigo[1].toUpperCase()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Extraer Monto en Colones (₡ / CRC / ¢)
|
||||||
|
let amountCrc = 0;
|
||||||
|
const amountPatterns = [
|
||||||
|
/(?:monto|importe|valor|suma|por concepto de|total|cr[eé]dito|acreditad[oa]|recibid[oa]|transferid[oa])\s*(?:de|por)?\s*[:#=\-]?\s*(?:₡|¢|CRC)?\s*([0-9]+(?:[,.\s][0-9]+)*)\s*(?:colones|crc|¢|₡)?/i,
|
||||||
|
/(?:₡|¢|CRC)\s*[:#=\-]?\s*([0-9]+(?:[,.\s][0-9]+)*)/i,
|
||||||
|
/([0-9]+(?:[,.\s][0-9]+)*)\s*(?:colones|crc|¢|₡)/i,
|
||||||
|
/(?:crc|colones)\s*[:#=\-]?\s*([0-9]+(?:[,.\s][0-9]+)*)/i
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const regex of amountPatterns) {
|
||||||
|
const match = fullText.match(regex);
|
||||||
|
if (match && match[1]) {
|
||||||
|
let numStr = match[1].trim().replace(/\s+/g, '');
|
||||||
|
if (numStr.includes('.') && numStr.includes(',')) {
|
||||||
|
if (numStr.indexOf('.') < numStr.indexOf(',')) {
|
||||||
|
numStr = numStr.replace(/\./g, '').replace(',', '.');
|
||||||
|
} else {
|
||||||
|
numStr = numStr.replace(/,/g, '');
|
||||||
|
}
|
||||||
|
} else if (numStr.includes(',')) {
|
||||||
|
const parts = numStr.split(',');
|
||||||
|
if (parts[1] && parts[1].length === 2) {
|
||||||
|
numStr = parts[0] + '.' + parts[1];
|
||||||
|
} else {
|
||||||
|
numStr = numStr.replace(/,/g, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const parsedNum = parseFloat(numStr);
|
||||||
|
if (!isNaN(parsedNum) && parsedNum > 0) {
|
||||||
|
amountCrc = Math.round(parsedNum);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. Extraer Teléfono Emisor (8 dígitos)
|
||||||
|
let senderPhone = null;
|
||||||
|
const phonePatterns = [
|
||||||
|
/(?:tel[eé]fono|origen|celular|m[oó]vil|remitente|emisor)\s*[:#=\-]?\s*(?:\+?506\s*[-.]?)?([245678]\d{3}[-\s.]?\d{4})/i,
|
||||||
|
/(?:\+?506\s*[-.]?)?([245678]\d{3}[-\s.]?\d{4})/i
|
||||||
|
];
|
||||||
|
for (const regex of phonePatterns) {
|
||||||
|
const match = fullText.match(regex);
|
||||||
|
if (match && match[1]) {
|
||||||
|
const digits = match[1].replace(/\D/g, '');
|
||||||
|
if (digits.length === 8) {
|
||||||
|
senderPhone = `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. Extraer Número de Comprobante / Referencia Bancaria
|
||||||
|
let referenceNumber = null;
|
||||||
|
const refPatterns = [
|
||||||
|
/(?:n[uú]mero\s*(?:de\s*)?|n[o°º]\.?\s*(?:de\s*)?|c[oó]digo\s*(?:de\s*)?)?(?:comprobante|referencia|transacci[oó]n|autorizaci[oó]n|operaci[oó]n|documento|folio|confirmaci[oó]n|trf|ref|doc|aut)(?:\s+de\s+(?:transferencia|pago|operaci[oó]n|dep[oó]sito|transacci[oó]n))?\s*[:#=\.\-]?\s*([A-Za-z0-9\-_]{4,35})/i,
|
||||||
|
/#\s*([A-Za-z0-9\-_]{4,24})/,
|
||||||
|
/(?:SINPE|TRF|DOC|REF|AUT)[-_]?([0-9]{4,20})/i
|
||||||
|
];
|
||||||
|
for (const regex of refPatterns) {
|
||||||
|
const match = fullText.match(regex);
|
||||||
|
if (match && match[1]) {
|
||||||
|
const clean = match[1].trim();
|
||||||
|
if (!clean.toUpperCase().startsWith('SIBO') && clean.length >= 4) {
|
||||||
|
referenceNumber = clean;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 6. Nombre del remitente si está disponible
|
||||||
|
let senderName = null;
|
||||||
|
const nameMatch = fullText.match(/(?:de|de parte de|remitente|ordenante|cliente|titular)\s*[:#=\-]?\s*([A-Za-zÀ-ÿ\s]{4,40})(?:\n|\r|\.|,|-)/i);
|
||||||
|
if (nameMatch && nameMatch[1]) {
|
||||||
|
const cand = nameMatch[1].trim();
|
||||||
|
if (!cand.toLowerCase().includes('banco') && !cand.toLowerCase().includes('sinpe')) {
|
||||||
|
senderName = cand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
isSinpe: Boolean(amountCrc > 0 && (codigoDetalle || referenceNumber || originBank !== 'SINPE Móvil CR')),
|
||||||
|
codigoDetalle,
|
||||||
|
codigoDetalleNormalizado: codigoDetalle ? normalizarCodigoDetalle(codigoDetalle) : null,
|
||||||
|
amount: amountCrc,
|
||||||
|
amountCrc,
|
||||||
|
referenceNumber: referenceNumber || (codigoDetalle ? `REF-${codigoDetalle.replace(/[^A-Za-z0-9]/g, '')}` : null),
|
||||||
|
senderPhone: senderPhone || '',
|
||||||
|
senderName: senderName || 'Cliente SINPE',
|
||||||
|
originBank,
|
||||||
|
rawSummary: subject || ''
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
parseSinpeEmail,
|
||||||
|
normalizarCodigoDetalle
|
||||||
|
};
|
||||||