mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49:15 +00:00
Compare commits
65 Commits
feature/tw
...
fix/versio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a86da2851 | ||
|
|
248d04b666 | ||
|
|
7790391b50 | ||
|
|
4142ca4fd5 | ||
|
|
2ce342a0cb | ||
|
|
dfced8c594 | ||
|
|
9ddf144244 | ||
|
|
b465de55a0 | ||
|
|
739c63d025 | ||
|
|
8d897f824e | ||
|
|
e48b29ed29 | ||
|
|
255ba86506 | ||
|
|
c7ff6b4794 | ||
|
|
0059a1e7fb | ||
|
|
73ea7c0063 | ||
|
|
decccb672a | ||
|
|
51466bf1c7 | ||
|
|
d3b8310180 | ||
|
|
7797c2b461 | ||
|
|
ec46cfdd65 | ||
|
|
15f6972257 | ||
|
|
9cb98b5e73 | ||
|
|
af716b7537 | ||
|
|
d4b49a9bd7 | ||
|
|
eebc3c9806 | ||
|
|
257f1cc12d | ||
|
|
1036273a28 | ||
|
|
1b8ed93367 | ||
|
|
8c1820c879 | ||
|
|
e5a9db7e12 | ||
|
|
9d5aa7db5d | ||
|
|
40b0d9691e | ||
|
|
2e906bce79 | ||
|
|
f05ff4cf88 | ||
|
|
5735b49e25 | ||
|
|
1988948c30 | ||
|
|
cb33c0df68 | ||
|
|
f4ad7040ab | ||
|
|
b115dc3654 | ||
|
|
8c6023e93b | ||
|
|
5d7c297f2f | ||
|
|
04f99d5ed2 | ||
|
|
bb3f21b056 | ||
|
|
cf6188d860 | ||
|
|
294bfbb35f | ||
|
|
230538bcea | ||
|
|
5e7aa72494 | ||
|
|
3159ea5665 | ||
|
|
4b307efe79 | ||
|
|
0105dab2c4 | ||
|
|
6e8e16c9a4 | ||
|
|
8d73c86946 | ||
|
|
a7b19d9bff | ||
|
|
4b7de0f690 | ||
|
|
520145bf7d | ||
|
|
2253d57fed | ||
|
|
0fb93f66a3 | ||
|
|
501887300d | ||
|
|
14b6247106 | ||
|
|
eda8a67718 | ||
|
|
73caf090ba | ||
|
|
afa6771903 | ||
|
|
88af2469cb | ||
|
|
999d6742b4 | ||
|
|
5e1a373730 |
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@@ -0,0 +1 @@
|
|||||||
|
packages/docs/*
|
||||||
@@ -10,5 +10,9 @@ module.exports = {
|
|||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaVersion: 'latest',
|
ecmaVersion: 'latest',
|
||||||
},
|
},
|
||||||
rules: {},
|
rules: {
|
||||||
|
'no-unsafe-negation': 'off',
|
||||||
|
'no-prototype-builtins': 'off',
|
||||||
|
'no-useless-escape': 'off',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
66
.github/workflows/ci.yml
vendored
66
.github/workflows/ci.yml
vendored
@@ -1,26 +1,58 @@
|
|||||||
name: Test / Coverage
|
name: BotWhatsapp Build-Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
branches: [dev]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
############ BUILD PACKAGE ############
|
||||||
|
build-package:
|
||||||
|
name: Build Package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs:
|
||||||
strategy:
|
- test-unit
|
||||||
matrix:
|
|
||||||
node-version: [16.x]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: 16.x
|
||||||
- run: npm install
|
cache: 'yarn'
|
||||||
- run: npm run build --if-present
|
registry-url: https://registry.npmjs.org/
|
||||||
- run: npm run test.unit
|
|
||||||
- run: npm run test.coverage
|
- run: corepack enable
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
run: yarn install --immutable --network-timeout 300000
|
||||||
|
|
||||||
|
- name: Build Package
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Build Eslint rules
|
||||||
|
run: yarn lint:fix
|
||||||
|
|
||||||
|
############ UNIT TEST ############
|
||||||
|
test-unit:
|
||||||
|
name: Unit Tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
cache: 'yarn'
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
|
- run: corepack enable
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
run: yarn install --immutable --network-timeout 300000
|
||||||
|
|
||||||
|
- name: Unit Tests
|
||||||
|
run: yarn test
|
||||||
|
|||||||
9
.github/workflows/contributors.yml
vendored
9
.github/workflows/contributors.yml
vendored
@@ -1,11 +1,10 @@
|
|||||||
name: Add contributors
|
name: Add contributors
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: '20 20 * * *'
|
|
||||||
push:
|
|
||||||
branches: [dev]
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, dev]
|
branches:
|
||||||
|
- dev
|
||||||
|
- main
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
contrib-readme-job:
|
contrib-readme-job:
|
||||||
|
|||||||
56
.github/workflows/releases.yml
vendored
Normal file
56
.github/workflows/releases.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
name: BotWhatsapp Releases
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- next-release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
############ RELEASE ############
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
persist-credentials: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16.x
|
||||||
|
cache: 'yarn'
|
||||||
|
registry-url: https://registry.npmjs.org/
|
||||||
|
|
||||||
|
- run: corepack enable
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
run: yarn install --immutable --network-timeout 300000
|
||||||
|
|
||||||
|
- name: Build Package
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/bot
|
||||||
|
run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/cli
|
||||||
|
run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/create-bot-whatsapp
|
||||||
|
run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/database
|
||||||
|
run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Release @bot-whatsapp/provider
|
||||||
|
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Commit Versioning & Push changes
|
||||||
|
uses: actions-js/push@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
message: 'ci(version): :zap: automatic - ${date} updated versions every packages'
|
||||||
|
branch: 'dev'
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/node_modules
|
/node_modules
|
||||||
|
/packages/*/starters
|
||||||
/packages/*/node_modules
|
/packages/*/node_modules
|
||||||
/packages/*/dist
|
/packages/*/dist
|
||||||
/packages/*/docs/dist
|
/packages/*/docs/dist
|
||||||
@@ -20,6 +21,7 @@ coverage/
|
|||||||
log
|
log
|
||||||
log/*
|
log/*
|
||||||
*.log
|
*.log
|
||||||
|
*.tgz
|
||||||
lib
|
lib
|
||||||
tmp/
|
tmp/
|
||||||
.yarn/*
|
.yarn/*
|
||||||
@@ -27,6 +29,9 @@ tmp/
|
|||||||
!.yarn/plugins/@yarnpkg/plugin-postinstall.cjs
|
!.yarn/plugins/@yarnpkg/plugin-postinstall.cjs
|
||||||
.fleet/
|
.fleet/
|
||||||
example-app*/
|
example-app*/
|
||||||
|
base-*/
|
||||||
|
!starters/apps/base-*/
|
||||||
qr.svg
|
qr.svg
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
|
.npmrc
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
packages/**/lib
|
packages/**/lib
|
||||||
packages/docs
|
packages/docs/*.json
|
||||||
**/.git
|
**/.git
|
||||||
**/.svn
|
**/.svn
|
||||||
**/.hg
|
**/.hg
|
||||||
|
|||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -4,6 +4,8 @@
|
|||||||
"contributing",
|
"contributing",
|
||||||
"cli",
|
"cli",
|
||||||
"bot",
|
"bot",
|
||||||
"provider"
|
"provider",
|
||||||
|
"adapter",
|
||||||
|
"ci"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
__Requerimientos:__
|
__Requerimientos:__
|
||||||
- Node v16 o superior __[descargar node](https://nodejs.org/es/download/)__
|
- Node v16 o superior __[descargar node](https://nodejs.org/es/download/)__
|
||||||
- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguiras las intrucciones para instalar yarn.
|
- __[Yarn](https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable)__ como gestor de paquetes. En el link conseguirás las intrucciones para instalar yarn.
|
||||||
- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de codigo con plugins
|
- __[VSCode](https://code.visualstudio.com/download)__ (recomendado): Editor de código con plugins.
|
||||||
- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudara a crear commit semantico.
|
- __[Conventional Commits](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits&ssr=false#overview)__ (plugin-vscode) este plugin te ayudará a crear commit semántico.
|
||||||
- Se usara la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2
|
- Se usará la rama __dev__ *(https://github.com/leifermendez/bot-whatsapp/tree/dev)* como rama principal hasta que se haga oficialmente el lanzamiento de la V2.
|
||||||
|
|
||||||
### 🚀 Iniciando
|
### 🚀 Iniciando
|
||||||
|
|
||||||
@@ -22,14 +22,14 @@ yarn install
|
|||||||
```
|
```
|
||||||
|
|
||||||
__Compilar (build)__
|
__Compilar (build)__
|
||||||
Para compilar la aplicación es necesario ejecutar, eso te genera dentro de packages del monorepo un directorio `lib`
|
Para compilar la aplicación es necesario ejecutar este comando, el cual genera un directorio `lib` dentro de los paquetes del monorepo.
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn build
|
yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
__Example-app__
|
__Example-app__
|
||||||
Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo
|
Se ejecuta el CLI (Command Line Interface) para ayudarte a crear un app-bot de ejemplo.
|
||||||
```
|
```
|
||||||
yarn run cli
|
yarn run cli
|
||||||
```
|
```
|
||||||
@@ -42,15 +42,16 @@ npm run pre-copy
|
|||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
__Commit y Push__
|
### __Commit y Push__
|
||||||
El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__ es una herramienta que dispara unas acciones al momento de hacer commit y hacer push
|
|
||||||
|
|
||||||
__commit:__ Los commit son semanticos esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__
|
El proyecto tiene implementado __[husky](https://typicode.github.io/husky/#/)__, es una herramienta que dispara unas acciones al momento de hacer commit y hacer push.
|
||||||
|
|
||||||
__push:__ Cada push ejecutar `yarn run test` el cual ejecuta los test internos que tienen que cumplir con __95% de cobertura__.
|
__commit:__ Los commit son semánticos, esto quiere decir que deben cumplir un standar al momento de escribirlos ejemplo: ` feat(adapter): new adapter myqsl ` puede ver más info sobre esto __[aquí](https://github.com/conventional-changelog/commitlint/#what-is-commitlint)__
|
||||||
|
|
||||||
|
__push:__ Cada push ejecutar `yarn run test` el cual realiza los test internos que tienen que cumplir con __95% de cobertura__.
|
||||||
|
|
||||||
|
|
||||||
> Documento en constaten actualización....
|
> Documento en constante actualización....
|
||||||
|
|
||||||
------
|
------
|
||||||
- [Discord](https://link.codigoencasa.com/DISCORD)
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -3,8 +3,8 @@
|
|||||||
--------
|
--------
|
||||||
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
||||||
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||||
|
|
||||||
- [ ] Evitar dependencias
|
🚀 __Roadmap:__ [https://github.com/users/leifermendez/projects/4/views/1](https://github.com/users/leifermendez/projects/4/views/1)
|
||||||
|
|
||||||
|
|
||||||
**Comunidad**
|
**Comunidad**
|
||||||
@@ -46,14 +46,21 @@ Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
|||||||
<sub><b>Null</b></sub>
|
<sub><b>Null</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<a href="https://github.com/jzvi12">
|
||||||
|
<img src="https://avatars.githubusercontent.com/u/10729787?v=4" width="50;" alt="jzvi12"/>
|
||||||
|
<br />
|
||||||
|
<sub><b>Null</b></sub>
|
||||||
|
</a>
|
||||||
|
</td></tr>
|
||||||
|
<tr>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/tonyvazgar">
|
<a href="https://github.com/tonyvazgar">
|
||||||
<img src="https://avatars.githubusercontent.com/u/21047090?v=4" width="50;" alt="tonyvazgar"/>
|
<img src="https://avatars.githubusercontent.com/u/21047090?v=4" width="50;" alt="tonyvazgar"/>
|
||||||
<br />
|
<br />
|
||||||
<sub><b>Luis Antonio Vázquez García</b></sub>
|
<sub><b>Luis Antonio Vázquez García</b></sub>
|
||||||
</a>
|
</a>
|
||||||
</td></tr>
|
</td>
|
||||||
<tr>
|
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://github.com/ulisesvina">
|
<a href="https://github.com/ulisesvina">
|
||||||
<img src="https://avatars.githubusercontent.com/u/20508563?v=4" width="50;" alt="ulisesvina"/>
|
<img src="https://avatars.githubusercontent.com/u/20508563?v=4" width="50;" alt="ulisesvina"/>
|
||||||
|
|||||||
3
TODO.md
3
TODO.md
@@ -11,9 +11,10 @@
|
|||||||
- [X] sensitivy viene activado por defecto
|
- [X] sensitivy viene activado por defecto
|
||||||
- [X] fallback respuesta en hijo: Se puede colocar en option el ref de la answer fallback
|
- [X] fallback respuesta en hijo: Se puede colocar en option el ref de la answer fallback
|
||||||
- [X] Cuando Envian Sticket devuelve mensaje raro
|
- [X] Cuando Envian Sticket devuelve mensaje raro
|
||||||
|
- [x] addAnswer agregar delay
|
||||||
- [ ] colocar mensaje esperando conectando whatsapp (provider)
|
- [ ] colocar mensaje esperando conectando whatsapp (provider)
|
||||||
- [ ] createDatabase validar implementacion de funciones
|
- [ ] createDatabase validar implementacion de funciones
|
||||||
- [ ] limitar caracteres de mensajes
|
- [ ] limitar caracteres de mensajes 4000
|
||||||
- [X] cuando envias numeros (5 o 1) se dispara el flujo
|
- [X] cuando envias numeros (5 o 1) se dispara el flujo
|
||||||
|
|
||||||
### @bot-whatsapp/database
|
### @bot-whatsapp/database
|
||||||
|
|||||||
3
core.class.log
Normal file
3
core.class.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||||
|
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||||
|
[handleMsg]: { from: 'XXXXXX', body: 'hola', hasMedia: false }
|
||||||
@@ -11,12 +11,13 @@
|
|||||||
"bot:rollup": "rollup --config ./packages/bot/rollup-bot.config.js",
|
"bot:rollup": "rollup --config ./packages/bot/rollup-bot.config.js",
|
||||||
"provider:rollup": "rollup --config ./packages/provider/rollup-provider.config.js ",
|
"provider:rollup": "rollup --config ./packages/provider/rollup-provider.config.js ",
|
||||||
"database:rollup": "rollup --config ./packages/database/rollup-database.config.js",
|
"database:rollup": "rollup --config ./packages/database/rollup-database.config.js",
|
||||||
|
"create-bot-whatsapp:rollup": "rollup --config ./packages/create-bot-whatsapp/rollup-create.config.js",
|
||||||
"format:check": "prettier --check ./packages",
|
"format:check": "prettier --check ./packages",
|
||||||
"format:write": "prettier --write ./packages",
|
"format:write": "prettier --write ./packages",
|
||||||
"fmt.staged": "pretty-quick --staged",
|
"fmt.staged": "pretty-quick --staged",
|
||||||
"lint:check": "eslint ./packages",
|
"lint:check": "eslint ./packages",
|
||||||
"lint:fix": "eslint --fix ./packages",
|
"lint:fix": "eslint --fix ./packages",
|
||||||
"build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup",
|
"build": "yarn run cli:rollup && yarn run bot:rollup && yarn run provider:rollup && yarn run database:rollup && yarn run create-bot-whatsapp:rollup",
|
||||||
"copy.lib": "node ./scripts/move.js",
|
"copy.lib": "node ./scripts/move.js",
|
||||||
"test.unit": "node ./node_modules/uvu/bin.js packages test",
|
"test.unit": "node ./node_modules/uvu/bin.js packages test",
|
||||||
"test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit",
|
"test.coverage": "node ./node_modules/c8/bin/c8.js npm run test.unit",
|
||||||
@@ -80,6 +81,7 @@
|
|||||||
"rollup": "^3.2.3",
|
"rollup": "^3.2.3",
|
||||||
"rollup-plugin-cleanup": "^3.2.1",
|
"rollup-plugin-cleanup": "^3.2.1",
|
||||||
"rollup-plugin-copy": "^3.4.0",
|
"rollup-plugin-copy": "^3.4.0",
|
||||||
|
"semver": "^7.3.8",
|
||||||
"standard-version": "^9.5.0",
|
"standard-version": "^9.5.0",
|
||||||
"uvu": "^0.5.6"
|
"uvu": "^0.5.6"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
const { toCtx } = require('../io/methods')
|
const { toCtx } = require('../io/methods')
|
||||||
const { printer } = require('../utils/interactive')
|
const { printer } = require('../utils/interactive')
|
||||||
|
const { delay } = require('../utils/delay')
|
||||||
|
const Queue = require('../utils/queue')
|
||||||
const { Console } = require('console')
|
const { Console } = require('console')
|
||||||
const { createWriteStream } = require('fs')
|
const { createWriteStream } = require('fs')
|
||||||
|
|
||||||
@@ -32,16 +34,16 @@ class CoreClass {
|
|||||||
listenerBusEvents = () => [
|
listenerBusEvents = () => [
|
||||||
{
|
{
|
||||||
event: 'preinit',
|
event: 'preinit',
|
||||||
func: () => printer('Iniciando provider espere...'),
|
func: () => printer('Iniciando proveedor, espere...'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event: 'require_action',
|
event: 'require_action',
|
||||||
func: ({ instructions, title = '⚡⚡ ACCION REQUERIDA ⚡⚡' }) =>
|
func: ({ instructions, title = '⚡⚡ ACCIÓN REQUERIDA ⚡⚡' }) =>
|
||||||
printer(instructions, title),
|
printer(instructions, title),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event: 'ready',
|
event: 'ready',
|
||||||
func: () => printer('Provider conectado y listo'),
|
func: () => printer('Proveedor conectado y listo'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
event: 'auth_failure',
|
event: 'auth_failure',
|
||||||
@@ -140,10 +142,14 @@ class CoreClass {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFlow = (messageToSend, numberOrId) => {
|
sendFlow = async (messageToSend, numberOrId) => {
|
||||||
const queue = []
|
const queue = []
|
||||||
for (const ctxMessage of messageToSend) {
|
for (const ctxMessage of messageToSend) {
|
||||||
queue.push(this.sendProviderAndSave(numberOrId, ctxMessage))
|
const delayMs = ctxMessage?.options?.delay || 0
|
||||||
|
if (delayMs) await delay(delayMs)
|
||||||
|
Queue.enqueue(() =>
|
||||||
|
this.sendProviderAndSave(numberOrId, ctxMessage)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return Promise.all(queue)
|
return Promise.all(queue)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ const createFlow = (args) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Crear instancia de clase Provider
|
* Crear instancia de clase Provider
|
||||||
|
* Depdendiendo del Provider puedes pasar argumentos
|
||||||
|
* Ver Documentacion
|
||||||
* @param {*} args
|
* @param {*} args
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const { toJson } = require('./toJson')
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param answer string
|
* @param answer string
|
||||||
* @param options {media:string, buttons:[{"body":"😎 Cursos"}], capture:true default false}
|
* @param options {media:string, buttons:[{"body":"😎 Cursos"}], delay:ms, capture:true default false}
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const addAnswer =
|
const addAnswer =
|
||||||
@@ -24,6 +24,7 @@ const addAnswer =
|
|||||||
: false,
|
: false,
|
||||||
child:
|
child:
|
||||||
typeof options?.child === 'string' ? `${options?.child}` : null,
|
typeof options?.child === 'string' ? `${options?.child}` : null,
|
||||||
|
delay: typeof options?.delay === 'number' ? options?.delay : 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const getNested = () => ({
|
const getNested = () => ({
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/bot",
|
"name": "@bot-whatsapp/bot",
|
||||||
"version": "0.0.1",
|
"version": "0.0.15-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bundle.bot.cjs",
|
"main": "./lib/bundle.bot.cjs",
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bot:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js",
|
"bot:rollup": "node ../../node_modules/.bin/rollup index.js --config ./rollup-cli.config.js",
|
||||||
"format:check": "prettier --check .",
|
"format:check": "prettier --check .",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ProviderClass extends EventEmitter {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sendMessage = async (userId, message, sendMessage) => {
|
sendMessage = async (userId, message) => {
|
||||||
if (NODE_ENV !== 'production')
|
if (NODE_ENV !== 'production')
|
||||||
console.log('[sendMessage]', { userId, message })
|
console.log('[sendMessage]', { userId, message })
|
||||||
return message
|
return message
|
||||||
|
|||||||
4
packages/bot/utils/delay.js
Normal file
4
packages/bot/utils/delay.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
const delay = (miliseconds) =>
|
||||||
|
new Promise((res) => setTimeout(res, miliseconds))
|
||||||
|
|
||||||
|
module.exports = { delay }
|
||||||
46
packages/bot/utils/queue.js
Normal file
46
packages/bot/utils/queue.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
class Queue {
|
||||||
|
static queue = []
|
||||||
|
static pendingPromise = false
|
||||||
|
|
||||||
|
static enqueue(promise) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.queue.push({
|
||||||
|
promise,
|
||||||
|
resolve,
|
||||||
|
reject,
|
||||||
|
})
|
||||||
|
this.dequeue()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static dequeue() {
|
||||||
|
if (this.workingOnPromise) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const item = this.queue.shift()
|
||||||
|
if (!item) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.workingOnPromise = true
|
||||||
|
item.promise()
|
||||||
|
.then((value) => {
|
||||||
|
this.workingOnPromise = false
|
||||||
|
item.resolve(value)
|
||||||
|
this.dequeue()
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.workingOnPromise = false
|
||||||
|
item.reject(err)
|
||||||
|
this.dequeue()
|
||||||
|
})
|
||||||
|
} catch (err) {
|
||||||
|
this.workingOnPromise = false
|
||||||
|
item.reject(err)
|
||||||
|
this.dequeue()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Queue
|
||||||
@@ -12,20 +12,20 @@ const checkNodeVersion = () => {
|
|||||||
)
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
console.log(green(`Node.js combatible ${version}`))
|
console.log(green(`Node.js compatible ${version}`))
|
||||||
console.log(``)
|
console.log(``)
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkOs = () => {
|
const checkOs = () => {
|
||||||
console.log(bgCyan('🙂 Revisando tu Sistema Operativo'))
|
console.log(bgCyan('🙂 Revisando tu sistema operativo'))
|
||||||
const os = process.platform
|
const os = process.platform
|
||||||
if (!os.includes('win32')) {
|
if (!os.includes('win32')) {
|
||||||
const messages = [
|
const messages = [
|
||||||
`El sistema operativo actual (${os}) posiblemente requiera`,
|
`El sistema operativo actual (${os}) posiblemente requiera`,
|
||||||
`una confiuración adicional referente al puppeter`,
|
`una configuración adicional referente al puppeteer`,
|
||||||
``,
|
``,
|
||||||
`Recuerda pasar por el WIKI`,
|
`Recuerda pasar por el WIKI`,
|
||||||
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalaci%C3%B3n`,
|
`🔗 https://github.com/leifermendez/bot-whatsapp/wiki/Instalación`,
|
||||||
``,
|
``,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ const copyFiles = async (from, to) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const copyBaseApp = async () => {
|
/**
|
||||||
const BASEP_APP_PATH_FROM = `${process.cwd()}/starters/apps/base`
|
* Copiar directorio con archivos
|
||||||
const BASEP_APP_PATH_TO = `${process.cwd()}/example-app-base`
|
* @param {*} templateName
|
||||||
|
*/
|
||||||
|
const copyBaseApp = async (fromDir = process.cwd(), toDir = process.cwd()) => {
|
||||||
|
const BASEP_APP_PATH_FROM = `${fromDir}`
|
||||||
|
const BASEP_APP_PATH_TO = `${toDir}`
|
||||||
await copyFiles(BASEP_APP_PATH_FROM, BASEP_APP_PATH_TO)
|
await copyFiles(BASEP_APP_PATH_FROM, BASEP_APP_PATH_TO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const getPkgManage = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const installDeps = (pkgManager, packageList) => {
|
const installDeps = (pkgManager, packageList) => {
|
||||||
const errorMessage = `Ocurrio un error instalando ${packageList}`
|
const errorMessage = `Ocurrió un error instalando ${packageList}`
|
||||||
let childProcess = []
|
let childProcess = []
|
||||||
|
|
||||||
const installSingle = (pkgInstall) => () => {
|
const installSingle = (pkgInstall) => () => {
|
||||||
|
|||||||
@@ -1,54 +1,58 @@
|
|||||||
const prompts = require('prompts')
|
const prompts = require('prompts')
|
||||||
const { yellow, red } = require('kleur')
|
const { yellow, red, cyan } = require('kleur')
|
||||||
const { installAll } = require('../install')
|
|
||||||
const { cleanSession } = require('../clean')
|
|
||||||
const { copyBaseApp } = require('../create-app')
|
const { copyBaseApp } = require('../create-app')
|
||||||
|
const { join } = require('path')
|
||||||
|
const { existsSync } = require('fs')
|
||||||
const { checkNodeVersion, checkOs } = require('../check')
|
const { checkNodeVersion, checkOs } = require('../check')
|
||||||
const { jsonConfig } = require('../configuration')
|
|
||||||
|
const bannerDone = () => {
|
||||||
|
console.log(``)
|
||||||
|
console.log(
|
||||||
|
cyan(
|
||||||
|
[
|
||||||
|
`[Agradecimientos]: Este es un proyecto OpenSource, si tienes intenciones de colaborar puedes hacerlo:`,
|
||||||
|
`[😉] Comprando un cafe https://www.buymeacoffee.com/leifermendez`,
|
||||||
|
`[⭐] Dar estrella https://github.com/leifermendez/bot-whatsapp`,
|
||||||
|
`[🚀] Realizando mejoras en el codigo`,
|
||||||
|
].join('\n')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
console.log(``)
|
||||||
|
}
|
||||||
|
|
||||||
const startInteractive = async () => {
|
const startInteractive = async () => {
|
||||||
const questions = [
|
const questions = [
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'exampeOpt',
|
name: 'outDir',
|
||||||
message:
|
message: 'Quieres crear un bot? (Y/n)',
|
||||||
'Quieres crear una app de ejemplo "example-app-example"? (Y/n)',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// type: 'text',
|
|
||||||
// name: 'dependencies',
|
|
||||||
// message:
|
|
||||||
// 'Quieres actualizar las librerias "whatsapp-web.js"? (Y/n)',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
type: 'text',
|
|
||||||
name: 'cleanTmp',
|
|
||||||
message: 'Quieres limpiar la session del bot? (Y/n)',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'multiselect',
|
type: 'multiselect',
|
||||||
name: 'providerWs',
|
name: 'providerWs',
|
||||||
message: 'Proveedor de Whatsapp',
|
message: '¿Cuál proveedor de whatsapp quieres utilizar?',
|
||||||
choices: [
|
choices: [
|
||||||
{ title: 'whatsapp-web.js', value: 'whatsapp-web.js' },
|
{ title: 'whatsapp-web.js (gratis)', value: 'wweb' },
|
||||||
|
{ title: 'Twilio', value: 'twilio' },
|
||||||
|
{ title: 'Baileys (gratis)', value: 'bailey', disabled: true },
|
||||||
{ title: 'API Oficial (Meta)', value: 'meta', disabled: true },
|
{ title: 'API Oficial (Meta)', value: 'meta', disabled: true },
|
||||||
{ title: 'Twilio', value: 'twilio', disabled: true },
|
|
||||||
],
|
],
|
||||||
max: 1,
|
max: 1,
|
||||||
hint: 'Espacio para selecionar',
|
hint: 'Espacio para seleccionar',
|
||||||
instructions: '↑/↓',
|
instructions: '↑/↓',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: 'multiselect',
|
type: 'multiselect',
|
||||||
name: 'providerDb',
|
name: 'providerDb',
|
||||||
message: 'Cual base de datos quieres usar',
|
message: '¿Cuál base de datos quieres utilizar?',
|
||||||
choices: [
|
choices: [
|
||||||
{ title: 'JSONFile', value: 'json' },
|
{ title: 'Memory', value: 'memory' },
|
||||||
{ title: 'MySQL', value: 'mysql', disabled: true },
|
{ title: 'Mongo', value: 'mongo' },
|
||||||
{ title: 'Mongo', value: 'mongo', disabled: true },
|
{ title: 'MySQL', value: 'mysql' },
|
||||||
|
{ title: 'Json', value: 'json', disabled: true },
|
||||||
],
|
],
|
||||||
max: 1,
|
max: 1,
|
||||||
hint: 'Espacio para selecionar',
|
hint: 'Espacio para seleccionar',
|
||||||
instructions: '↑/↓',
|
instructions: '↑/↓',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@@ -57,90 +61,77 @@ const startInteractive = async () => {
|
|||||||
checkNodeVersion()
|
checkNodeVersion()
|
||||||
checkOs()
|
checkOs()
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
console.log('Proceso cancelado!')
|
console.log('¡Proceso cancelado!')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const response = await prompts(questions, { onCancel })
|
const response = await prompts(questions, { onCancel })
|
||||||
const {
|
const { outDir = '', providerDb = [], providerWs = [] } = response
|
||||||
dependencies = '',
|
|
||||||
cleanTmp = '',
|
const createApp = async (templateName = null) => {
|
||||||
exampeOpt = '',
|
if (!templateName)
|
||||||
providerDb = [],
|
throw new Error('TEMPLATE_NAME_INVALID: ', templateName)
|
||||||
providerWs = [],
|
|
||||||
} = response
|
const possiblesPath = [
|
||||||
/**
|
join(__dirname, 'starters', 'apps', templateName),
|
||||||
* Question
|
join(__dirname, '..', 'starters', 'apps', templateName),
|
||||||
* @returns
|
join(__dirname, '..', '..', 'starters', 'apps', templateName),
|
||||||
*/
|
]
|
||||||
const installOrUdpateDep = async () => {
|
|
||||||
const answer = dependencies.toLowerCase() || 'n'
|
const answer = outDir.toLowerCase() || 'n'
|
||||||
if (answer.includes('n')) return true
|
if (answer.includes('n')) return true
|
||||||
|
|
||||||
if (answer.includes('y')) {
|
if (answer.includes('y')) {
|
||||||
await installAll()
|
const indexOfPath = possiblesPath.find((a) => existsSync(a))
|
||||||
return true
|
await copyBaseApp(indexOfPath, join(process.cwd(), templateName))
|
||||||
|
console.log(``)
|
||||||
|
console.log(yellow(`cd ${templateName}`))
|
||||||
|
console.log(yellow(`npm install`))
|
||||||
|
console.log(yellow(`npm start`))
|
||||||
|
console.log(``)
|
||||||
|
|
||||||
|
return outDir
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Question
|
* Selccionar Provider (meta, twilio, etc...)
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const cleanAllSession = async () => {
|
|
||||||
const answer = cleanTmp.toLowerCase() || 'n'
|
|
||||||
if (answer.includes('n')) return true
|
|
||||||
|
|
||||||
if (answer.includes('y')) {
|
|
||||||
await cleanSession()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const createApp = async () => {
|
|
||||||
const answer = exampeOpt.toLowerCase() || 'n'
|
|
||||||
if (answer.includes('n')) return true
|
|
||||||
|
|
||||||
if (answer.includes('y')) {
|
|
||||||
await copyBaseApp()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const vendorProvider = async () => {
|
const vendorProvider = async () => {
|
||||||
|
const [answer] = providerWs
|
||||||
if (!providerWs.length) {
|
if (!providerWs.length) {
|
||||||
console.log(
|
console.log(
|
||||||
red(
|
red(
|
||||||
`Debes de seleccionar una WS Provider. Tecla [Space] para seleccionar`
|
`Debes seleccionar un proveedor de whatsapp. Tecla [Space] para seleccionar`
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
console.log(yellow(`'Deberia crer una carpeta en root/provider'`))
|
return answer
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selecionar adaptador de base de datos
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
const dbProvider = async () => {
|
const dbProvider = async () => {
|
||||||
const answer = providerDb
|
const [answer] = providerDb
|
||||||
if (!providerDb.length) {
|
if (!providerDb.length) {
|
||||||
console.log(
|
console.log(
|
||||||
red(
|
red(
|
||||||
`Debes de seleccionar una DB Provider. Tecla [Space] para seleccionar`
|
`Debes seleccionar un proveedor de base de datos. Tecla [Space] para seleccionar`
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
if (answer === 'json') {
|
return answer
|
||||||
console.log('Deberia crer una carpeta en root/data')
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await createApp()
|
const providerAdapter = await vendorProvider()
|
||||||
await installOrUdpateDep()
|
const dbAdapter = await dbProvider()
|
||||||
await cleanAllSession()
|
const NAME_DIR = ['base', providerAdapter, dbAdapter].join('-')
|
||||||
await vendorProvider()
|
await createApp(NAME_DIR)
|
||||||
await dbProvider()
|
bannerDone()
|
||||||
await jsonConfig()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { startInteractive }
|
module.exports = { startInteractive }
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/cli",
|
"name": "@bot-whatsapp/cli",
|
||||||
"version": "0.0.1",
|
"version": "0.0.22-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"cross-spawn": "^7.0.3",
|
"cross-spawn": "^7.0.3",
|
||||||
@@ -11,6 +10,7 @@
|
|||||||
"kleur": "^4.1.5"
|
"kleur": "^4.1.5"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"./starters/",
|
||||||
"./lib/cli/bundle.cli.cjs"
|
"./lib/cli/bundle.cli.cjs"
|
||||||
],
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const banner = require('../../config/banner.rollup.json')
|
const banner = require('../../config/banner.rollup.json')
|
||||||
const commonjs = require('@rollup/plugin-commonjs')
|
const commonjs = require('@rollup/plugin-commonjs')
|
||||||
|
const copy = require('rollup-plugin-copy')
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
|
|
||||||
@@ -12,5 +13,11 @@ module.exports = {
|
|||||||
file: PATH,
|
file: PATH,
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
},
|
},
|
||||||
plugins: [commonjs(), nodeResolve()],
|
plugins: [
|
||||||
|
copy({
|
||||||
|
targets: [{ src: 'starters/*', dest: join(__dirname, 'starters') }],
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
nodeResolve(),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
2
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
2
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
@@ -1,3 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
const main = require('../lib/bin/bundle.create.cjs')
|
const main = require('../lib/bundle.create-bot-whatsapp.cjs')
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
|
const { startInteractive } = require('../cli')
|
||||||
/**
|
/**
|
||||||
* Main function
|
* Voy a llamar directo a CLI
|
||||||
|
* Temporalmente luego mejoro esta
|
||||||
|
* parte
|
||||||
|
* @returns
|
||||||
*/
|
*/
|
||||||
const main = () => {
|
const main = () => startInteractive()
|
||||||
console.clear()
|
|
||||||
console.log(``)
|
|
||||||
console.log(`[PostInstall]: Este es el main function.`)
|
|
||||||
console.log(`[PostInstall]: 👌 Aqui podrias instalar cosas`)
|
|
||||||
console.log(``)
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = main
|
module.exports = main
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "create-bot-whatsapp",
|
"name": "create-bot-whatsapp",
|
||||||
"version": "0.0.1",
|
"version": "0.0.28-alpha.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "./lib/bin/bundle.create.cjs",
|
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||||
"private": true,
|
"files": [
|
||||||
|
"./starters/",
|
||||||
|
"./bin/create.js",
|
||||||
|
"./lib/bundle.create-bot-whatsapp.cjs"
|
||||||
|
],
|
||||||
|
"bin": "./bin/create.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bot-whatsapp/cli": "*"
|
"@bot-whatsapp/cli": "*"
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"bot": "./lib/bin/bundle.create.cjs"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
const banner = require('../../config/banner.rollup.json')
|
const banner = require('../../config/banner.rollup.json')
|
||||||
const commonjs = require('@rollup/plugin-commonjs')
|
const commonjs = require('@rollup/plugin-commonjs')
|
||||||
|
|
||||||
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
const { nodeResolve } = require('@rollup/plugin-node-resolve')
|
||||||
const { join } = require('path')
|
const { join } = require('path')
|
||||||
|
|
||||||
const PATH = join(__dirname, 'lib', 'bin', 'bundle.create.cjs')
|
const PATH = join(__dirname, 'lib', 'bundle.create-bot-whatsapp.cjs')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
input: join(__dirname, 'index.js'),
|
input: join(__dirname, 'index.js'),
|
||||||
|
|||||||
@@ -1,20 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/database",
|
"name": "@bot-whatsapp/database",
|
||||||
"version": "0.0.1",
|
"version": "0.0.14-alpha.0",
|
||||||
"description": "Esto es el conector a mysql, pg, mongo",
|
"description": "Esto es el conector a mysql, pg, mongo",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"private": true,
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"files": [
|
||||||
|
"./lib/"
|
||||||
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"mongodb": "^4.11.0",
|
"mongodb": "^4.11.0",
|
||||||
"mysql2": "^2.3.3"
|
"mysql2": "^2.3.3",
|
||||||
|
"stormdb": "^0.6.0"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
"./mock": "./lib/mock/index.cjs",
|
"./mock": "./lib/mock/index.cjs",
|
||||||
"./mongo": "./lib/mongo/index.cjs",
|
"./mongo": "./lib/mongo/index.cjs",
|
||||||
|
"./json-file": "./lib/json-file/index.cjs",
|
||||||
"./mysql": "./lib/mysql/index.cjs"
|
"./mysql": "./lib/mysql/index.cjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,12 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
plugins: [commonjs()],
|
plugins: [commonjs()],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
input: join(__dirname, 'src', 'json-file', 'index.js'),
|
||||||
|
output: {
|
||||||
|
banner: banner['banner.output'].join(''),
|
||||||
|
file: join(__dirname, 'lib', 'json-file', 'index.cjs'),
|
||||||
|
},
|
||||||
|
plugins: [commonjs()],
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
48
packages/database/src/json-file/index.js
Normal file
48
packages/database/src/json-file/index.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const StormDB = require('stormdb')
|
||||||
|
const engine = new StormDB.localFileEngine(
|
||||||
|
path.join(process.cwd(), './db.stormdb')
|
||||||
|
)
|
||||||
|
|
||||||
|
class JsonFileAdapter {
|
||||||
|
db
|
||||||
|
listHistory = []
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.init().then()
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.db = new StormDB(engine)
|
||||||
|
this.db.default({ history: [] })
|
||||||
|
resolve(this.db)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
getPrevByNumber = async (from) => {
|
||||||
|
const response = await this.db.get('history')
|
||||||
|
const { history } = response.state
|
||||||
|
|
||||||
|
if (!history.length) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = history.filter((res) => res.from === from).pop()
|
||||||
|
|
||||||
|
return {
|
||||||
|
...result,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
save = async (ctx) => {
|
||||||
|
await this.db
|
||||||
|
.get('history')
|
||||||
|
.push({ ...ctx })
|
||||||
|
.save()
|
||||||
|
console.log('Guardado en DB...', ctx)
|
||||||
|
this.listHistory.push(ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = JsonFileAdapter
|
||||||
@@ -13,9 +13,10 @@ class MyslAdapter {
|
|||||||
async init() {
|
async init() {
|
||||||
this.db = mysql.createConnection(this.credentials)
|
this.db = mysql.createConnection(this.credentials)
|
||||||
|
|
||||||
await this.db.connect((error) => {
|
await this.db.connect(async (error) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
console.log(`Solicitud de conexión a base de datos exitosa`)
|
console.log(`Solicitud de conexión a base de datos exitosa`)
|
||||||
|
await this.checkTableExists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
@@ -64,6 +65,42 @@ class MyslAdapter {
|
|||||||
})
|
})
|
||||||
this.listHistory.push(ctx)
|
this.listHistory.push(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createTable = () =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
const tableName = 'history'
|
||||||
|
|
||||||
|
const sql = `CREATE TABLE ${tableName}
|
||||||
|
(id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
ref varchar(255) NOT NULL,
|
||||||
|
keyword varchar(255) NOT NULL,
|
||||||
|
answer longtext NOT NULL,
|
||||||
|
refSerialize varchar(255) NOT NULL,
|
||||||
|
phone varchar(255) NOT NULL,
|
||||||
|
options longtext NOT NULL
|
||||||
|
)`
|
||||||
|
|
||||||
|
this.db.query(sql, (err) => {
|
||||||
|
if (err) throw err
|
||||||
|
console.log(`Tabla ${tableName} creada correctamente `)
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
checkTableExists = () =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
const sql = "SHOW TABLES LIKE 'history'"
|
||||||
|
|
||||||
|
this.db.query(sql, (err, rows) => {
|
||||||
|
if (err) throw err
|
||||||
|
|
||||||
|
if (!rows.length) {
|
||||||
|
this.createTable()
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(!!rows.length)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = MyslAdapter
|
module.exports = MyslAdapter
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite';
|
import { cloudflarePagesAdaptor } from '@builder.io/qwik-city/adaptors/cloudflare-pages/vite'
|
||||||
import { extendConfig } from '@builder.io/qwik-city/vite';
|
import { extendConfig } from '@builder.io/qwik-city/vite'
|
||||||
import baseConfig from '../../vite.config';
|
import baseConfig from '../../vite.config'
|
||||||
|
|
||||||
export default extendConfig(baseConfig, () => {
|
export default extendConfig(baseConfig, () => {
|
||||||
return {
|
return {
|
||||||
build: {
|
build: {
|
||||||
ssr: true,
|
ssr: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
|
input: ['src/entry.cloudflare-pages.tsx', '@qwik-city-plan'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
cloudflarePagesAdaptor({
|
cloudflarePagesAdaptor({
|
||||||
staticGenerate: true,
|
staticGenerate: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
// Cloudflare Pages Functions
|
// Cloudflare Pages Functions
|
||||||
// https://developers.cloudflare.com/pages/platform/functions/
|
// https://developers.cloudflare.com/pages/platform/functions/
|
||||||
export { onRequest } from '../server/entry.cloudflare-pages';
|
export { onRequest } from '../server/entry.cloudflare-pages'
|
||||||
|
|||||||
@@ -1,44 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "bot-whatsapp-docs",
|
"name": "bot-whatsapp-docs",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "Basic start point to build a docs site with Qwik",
|
"description": "Basic start point to build a docs site with Qwik",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=15.0.0"
|
"node": ">=15.0.0"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "qwik build",
|
"build": "qwik build",
|
||||||
"build.client": "vite build",
|
"build.client": "vite build",
|
||||||
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
||||||
"build.server": "vite build -c adaptors/cloudflare-pages/vite.config.ts",
|
"build.server": "vite build -c adaptors/cloudflare-pages/vite.config.ts",
|
||||||
"build.types": "tsc --incremental --noEmit",
|
"build.types": "tsc --incremental --noEmit",
|
||||||
"deploy": "wrangler pages dev ./dist",
|
"deploy": "wrangler pages dev ./dist",
|
||||||
"dev": "vite --mode ssr",
|
"dev": "vite --mode ssr",
|
||||||
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
|
||||||
"fmt": "prettier --write .",
|
"fmt": "prettier --write .",
|
||||||
"fmt.check": "prettier --check .",
|
"fmt.check": "prettier --check .",
|
||||||
"lint": "eslint \"src/**/*.ts*\"",
|
"lint": "eslint \"src/**/*.ts*\"",
|
||||||
"preview": "qwik build preview && vite preview --open",
|
"preview": "qwik build preview && vite preview --open",
|
||||||
"start": "vite --open --mode ssr",
|
"start": "vite --open --mode ssr",
|
||||||
"qwik": "qwik"
|
"qwik": "qwik"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@builder.io/qwik": "0.14.1",
|
"@builder.io/qwik": "0.14.1",
|
||||||
"@builder.io/qwik-city": "0.0.127",
|
"@builder.io/qwik-city": "0.0.127",
|
||||||
"@types/eslint": "8.4.10",
|
"@types/eslint": "8.4.10",
|
||||||
"@types/node": "latest",
|
"@types/node": "latest",
|
||||||
"@typescript-eslint/eslint-plugin": "5.43.0",
|
"@typescript-eslint/eslint-plugin": "5.43.0",
|
||||||
"@typescript-eslint/parser": "5.43.0",
|
"@typescript-eslint/parser": "5.43.0",
|
||||||
"autoprefixer": "10.4.11",
|
"autoprefixer": "10.4.11",
|
||||||
"eslint": "8.28.0",
|
"eslint": "8.28.0",
|
||||||
"eslint-plugin-qwik": "0.14.1",
|
"eslint-plugin-qwik": "0.14.1",
|
||||||
"node-fetch": "3.3.0",
|
"node-fetch": "3.3.0",
|
||||||
"postcss": "^8.4.16",
|
"postcss": "^8.4.16",
|
||||||
"prettier": "2.7.1",
|
"prettier": "2.7.1",
|
||||||
"tailwindcss": "^3.1.8",
|
"tailwindcss": "^3.1.8",
|
||||||
"typescript": "4.9.3",
|
"typescript": "4.9.3",
|
||||||
"vite": "3.2.4",
|
"vite": "3.2.4",
|
||||||
"vite-tsconfig-paths": "3.5.0",
|
"vite-tsconfig-paths": "3.5.0",
|
||||||
"wrangler": "latest"
|
"wrangler": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
|
"$schema": "https://json.schemastore.org/web-manifest-combined.json",
|
||||||
"name": "qwik-project-name",
|
"name": "qwik-project-name",
|
||||||
"short_name": "Welcome to Qwik",
|
"short_name": "Welcome to Qwik",
|
||||||
"start_url": ".",
|
"start_url": ".",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#fff",
|
"background_color": "#fff",
|
||||||
"description": "A Qwik project app."
|
"description": "A Qwik project app."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
nav.breadcrumbs {
|
nav.breadcrumbs {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span {
|
nav.breadcrumbs > span {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px 0;
|
padding: 5px 0;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span a {
|
nav.breadcrumbs > span a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span::after {
|
nav.breadcrumbs > span::after {
|
||||||
content: '>';
|
content: '>';
|
||||||
padding: 0 5px;
|
padding: 0 5px;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav.breadcrumbs > span:last-child::after {
|
nav.breadcrumbs > span:last-child::after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +1,77 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city';
|
import { useContent, useLocation, ContentMenu } from '@builder.io/qwik-city'
|
||||||
import styles from './breadcrumbs.css?inline';
|
import styles from './breadcrumbs.css?inline'
|
||||||
|
|
||||||
export const Breadcrumbs = component$(() => {
|
export const Breadcrumbs = component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { menu } = useContent();
|
const { menu } = useContent()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
const breadcrumbs = createBreadcrumbs(menu, loc.pathname);
|
const breadcrumbs = createBreadcrumbs(menu, loc.pathname)
|
||||||
if (breadcrumbs.length === 0) {
|
if (breadcrumbs.length === 0) {
|
||||||
return null;
|
return null
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<nav class="breadcrumbs">
|
|
||||||
{breadcrumbs.map((b) => (
|
|
||||||
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
|
||||||
))}
|
|
||||||
</nav>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
export function createBreadcrumbs(menu: ContentMenu | undefined, pathname: string) {
|
|
||||||
if (menu?.items) {
|
|
||||||
for (const indexA of menu.items) {
|
|
||||||
const breadcrumbA: ContentBreadcrumb = {
|
|
||||||
text: indexA.text,
|
|
||||||
};
|
|
||||||
if (typeof indexA.href === 'string') {
|
|
||||||
breadcrumbA.href = indexA.href;
|
|
||||||
}
|
|
||||||
if (indexA.href === pathname) {
|
|
||||||
return [breadcrumbA];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indexA.items) {
|
|
||||||
for (const indexB of indexA.items) {
|
|
||||||
const breadcrumbB: ContentBreadcrumb = {
|
|
||||||
text: indexB.text,
|
|
||||||
};
|
|
||||||
if (typeof indexB.href === 'string') {
|
|
||||||
breadcrumbB.href = indexB.href;
|
|
||||||
}
|
|
||||||
if (indexB.href === pathname) {
|
|
||||||
return [breadcrumbA, breadcrumbB];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indexB.items) {
|
|
||||||
for (const indexC of indexB.items) {
|
|
||||||
const breadcrumbC: ContentBreadcrumb = {
|
|
||||||
text: indexC.text,
|
|
||||||
};
|
|
||||||
if (typeof indexC.href === 'string') {
|
|
||||||
breadcrumbC.href = indexC.href;
|
|
||||||
}
|
|
||||||
if (indexC.href === pathname) {
|
|
||||||
return [breadcrumbA, breadcrumbB, breadcrumbC];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
return (
|
||||||
|
<nav class="breadcrumbs">
|
||||||
|
{breadcrumbs.map((b) => (
|
||||||
|
<span>{b.href ? <a href={b.href}>{b.text}</a> : b.text}</span>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
export function createBreadcrumbs(
|
||||||
|
menu: ContentMenu | undefined,
|
||||||
|
pathname: string
|
||||||
|
) {
|
||||||
|
if (menu?.items) {
|
||||||
|
for (const indexA of menu.items) {
|
||||||
|
const breadcrumbA: ContentBreadcrumb = {
|
||||||
|
text: indexA.text,
|
||||||
|
}
|
||||||
|
if (typeof indexA.href === 'string') {
|
||||||
|
breadcrumbA.href = indexA.href
|
||||||
|
}
|
||||||
|
if (indexA.href === pathname) {
|
||||||
|
return [breadcrumbA]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indexA.items) {
|
||||||
|
for (const indexB of indexA.items) {
|
||||||
|
const breadcrumbB: ContentBreadcrumb = {
|
||||||
|
text: indexB.text,
|
||||||
|
}
|
||||||
|
if (typeof indexB.href === 'string') {
|
||||||
|
breadcrumbB.href = indexB.href
|
||||||
|
}
|
||||||
|
if (indexB.href === pathname) {
|
||||||
|
return [breadcrumbA, breadcrumbB]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indexB.items) {
|
||||||
|
for (const indexC of indexB.items) {
|
||||||
|
const breadcrumbC: ContentBreadcrumb = {
|
||||||
|
text: indexC.text,
|
||||||
|
}
|
||||||
|
if (typeof indexC.href === 'string') {
|
||||||
|
breadcrumbC.href = indexC.href
|
||||||
|
}
|
||||||
|
if (indexC.href === pathname) {
|
||||||
|
return [breadcrumbA, breadcrumbB, breadcrumbC]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ContentBreadcrumb {
|
interface ContentBreadcrumb {
|
||||||
text: string;
|
text: string
|
||||||
href?: string;
|
href?: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
footer {
|
footer {
|
||||||
border-top: 0.5px solid #ddd;
|
border-top: 0.5px solid #ddd;
|
||||||
margin-top: 40px;
|
margin-top: 40px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer a {
|
||||||
color: #9e9e9e;
|
color: #9e9e9e;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer ul {
|
footer ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
footer li {
|
footer li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 6px 12px;
|
padding: 6px 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,40 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import styles from './footer.css?inline';
|
import styles from './footer.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer>
|
<footer>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="/docs">Docs</a>
|
<a href="/docs">Docs</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/about-us">About Us</a>
|
<a href="/about-us">About Us</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/">Qwik</a>
|
<a href="https://qwik.builder.io/">Qwik</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://twitter.com/QwikDev">Twitter</a>
|
<a href="https://twitter.com/QwikDev">Twitter</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/BuilderIO/qwik">GitHub</a>
|
<a href="https://github.com/BuilderIO/qwik">GitHub</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/chat">Chat</a>
|
<a href="https://qwik.builder.io/chat">Chat</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div>
|
<div>
|
||||||
<a href="https://www.builder.io/" target="_blank" class="builder">
|
<a
|
||||||
Made with ♡ by Builder.io
|
href="https://www.builder.io/"
|
||||||
</a>
|
target="_blank"
|
||||||
</div>
|
class="builder"
|
||||||
</footer>
|
>
|
||||||
);
|
Made with ♡ by Builder.io
|
||||||
});
|
</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
header {
|
header {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 11;
|
z-index: 11;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: minmax(130px, auto) 1fr;
|
grid-template-columns: minmax(130px, auto) 1fr;
|
||||||
gap: 30px;
|
gap: 30px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
header a.logo {
|
header a.logo {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
header a {
|
header a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav {
|
header nav {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav a {
|
header nav a {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 5px 15px;
|
padding: 5px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
header nav a:hover {
|
header nav a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,32 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useLocation } from '@builder.io/qwik-city';
|
import { useLocation } from '@builder.io/qwik-city'
|
||||||
import { QwikLogo } from '../icons/qwik';
|
import { QwikLogo } from '../icons/qwik'
|
||||||
import styles from './header.css?inline';
|
import styles from './header.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header>
|
<header>
|
||||||
<a class="logo" href="/">
|
<a class="logo" href="/">
|
||||||
<QwikLogo />
|
<QwikLogo />
|
||||||
</a>
|
</a>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="/docs" class={{ active: pathname.startsWith('/docs') }}>
|
<a
|
||||||
Docs
|
href="/docs"
|
||||||
</a>
|
class={{ active: pathname.startsWith('/docs') }}
|
||||||
<a href="/about-us" class={{ active: pathname.startsWith('/about-us') }}>
|
>
|
||||||
About Us
|
Docs
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
<a
|
||||||
</header>
|
href="/about-us"
|
||||||
);
|
class={{ active: pathname.startsWith('/about-us') }}
|
||||||
});
|
>
|
||||||
|
About Us
|
||||||
|
</a>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
export const QwikLogo = () => (
|
export const QwikLogo = () => (
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 167 53">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 167 53">
|
||||||
<path
|
<path
|
||||||
fill="#000"
|
fill="#000"
|
||||||
d="M81.95 46.59h-6.4V35.4a12.25 12.25 0 0 1-7.06 2.17c-3.47 0-6.06-.94-7.67-2.92-1.6-1.96-2.42-5.45-2.42-10.43 0-5.1.95-8.62 2.87-10.67 1.96-2.08 5.1-3.09 9.43-3.09 4.1 0 7.82.57 11.25 1.67V46.6Zm-6.4-30.31a16.6 16.6 0 0 0-4.85-.66c-2.17 0-3.73.56-4.6 1.7-.85 1.17-1.32 3.38-1.32 6.65 0 3.08.41 5.14 1.26 6.26.86 1.1 2.33 1.67 4.5 1.67 2.84 0 5.01-1.17 5.01-2.62v-13Zm15.58-5.14c2.27 6.3 4.2 12.6 5.86 18.95 2.22-6.5 4.1-12.8 5.55-18.95h5.61a187.5 187.5 0 0 1 5.3 18.95c2.52-6.9 4.5-13.21 5.95-18.95h6.31a285.68 285.68 0 0 1-8.92 25.76h-7.53c-.86-4.6-2.22-10.14-4.04-16.75a151.51 151.51 0 0 1-4.89 16.75H92.8a287.88 287.88 0 0 0-8.17-25.76h6.5Zm41.7-3.58c-2.83 0-3.63-.7-3.63-3.59 0-2.57.82-3.18 3.63-3.18 2.83 0 3.63.6 3.63 3.18 0 2.89-.8 3.59-3.63 3.59Zm-3.18 3.58h6.4V36.9h-6.4V11.14Zm36.65 0c-4.54 6.46-7.72 10.39-9.49 11.8 1.46.95 5.36 5.95 10.2 13.98h-7.38c-6.02-9.13-8.89-13.07-10.3-13.67v13.67h-6.4V0h6.4v23.23c1.45-1.06 4.63-5.1 9.54-12.09h7.43Z"
|
d="M81.95 46.59h-6.4V35.4a12.25 12.25 0 0 1-7.06 2.17c-3.47 0-6.06-.94-7.67-2.92-1.6-1.96-2.42-5.45-2.42-10.43 0-5.1.95-8.62 2.87-10.67 1.96-2.08 5.1-3.09 9.43-3.09 4.1 0 7.82.57 11.25 1.67V46.6Zm-6.4-30.31a16.6 16.6 0 0 0-4.85-.66c-2.17 0-3.73.56-4.6 1.7-.85 1.17-1.32 3.38-1.32 6.65 0 3.08.41 5.14 1.26 6.26.86 1.1 2.33 1.67 4.5 1.67 2.84 0 5.01-1.17 5.01-2.62v-13Zm15.58-5.14c2.27 6.3 4.2 12.6 5.86 18.95 2.22-6.5 4.1-12.8 5.55-18.95h5.61a187.5 187.5 0 0 1 5.3 18.95c2.52-6.9 4.5-13.21 5.95-18.95h6.31a285.68 285.68 0 0 1-8.92 25.76h-7.53c-.86-4.6-2.22-10.14-4.04-16.75a151.51 151.51 0 0 1-4.89 16.75H92.8a287.88 287.88 0 0 0-8.17-25.76h6.5Zm41.7-3.58c-2.83 0-3.63-.7-3.63-3.59 0-2.57.82-3.18 3.63-3.18 2.83 0 3.63.6 3.63 3.18 0 2.89-.8 3.59-3.63 3.59Zm-3.18 3.58h6.4V36.9h-6.4V11.14Zm36.65 0c-4.54 6.46-7.72 10.39-9.49 11.8 1.46.95 5.36 5.95 10.2 13.98h-7.38c-6.02-9.13-8.89-13.07-10.3-13.67v13.67h-6.4V0h6.4v23.23c1.45-1.06 4.63-5.1 9.54-12.09h7.43Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#18B6F6"
|
fill="#18B6F6"
|
||||||
d="M40.97 52.54 32.1 43.7l-.14.02v-.1l-18.9-18.66 4.66-4.5-2.74-15.7L2 20.87a7.14 7.14 0 0 0-1.03 8.52l8.11 13.45a6.81 6.81 0 0 0 5.92 3.3l4.02-.05 21.96 6.46Z"
|
d="M40.97 52.54 32.1 43.7l-.14.02v-.1l-18.9-18.66 4.66-4.5-2.74-15.7L2 20.87a7.14 7.14 0 0 0-1.03 8.52l8.11 13.45a6.81 6.81 0 0 0 5.92 3.3l4.02-.05 21.96 6.46Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#AC7EF4"
|
fill="#AC7EF4"
|
||||||
d="m45.82 20.54-1.78-3.3-.93-1.68-.37-.66-.04.04-4.9-8.47a6.85 6.85 0 0 0-5.99-3.43l-4.28.12-12.8.04a6.85 6.85 0 0 0-5.85 3.37L1.1 21.99 15 4.73l18.24 20.04L30 28.04l1.94 15.68.02-.04v.04h-.04l.04.04 1.51 1.47 7.36 7.19c.3.29.81-.06.6-.43l-4.54-8.93 7.91-14.63.26-.3a6.73 6.73 0 0 0 .76-7.6Z"
|
d="m45.82 20.54-1.78-3.3-.93-1.68-.37-.66-.04.04-4.9-8.47a6.85 6.85 0 0 0-5.99-3.43l-4.28.12-12.8.04a6.85 6.85 0 0 0-5.85 3.37L1.1 21.99 15 4.73l18.24 20.04L30 28.04l1.94 15.68.02-.04v.04h-.04l.04.04 1.51 1.47 7.36 7.19c.3.29.81-.06.6-.43l-4.54-8.93 7.91-14.63.26-.3a6.73 6.73 0 0 0 .76-7.6Z"
|
||||||
/>
|
/>
|
||||||
<path
|
<path
|
||||||
fill="#fff"
|
fill="#fff"
|
||||||
d="M33.3 24.69 15.02 4.75l2.6 15.62-4.66 4.51L31.91 43.7l-1.7-15.62 3.1-3.4Z"
|
d="M33.3 24.69 15.02 4.75l2.6 15.62-4.66 4.51L31.91 43.7l-1.7-15.62 3.1-3.4Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
)
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
.menu {
|
.menu {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
padding: 20px 10px;
|
padding: 20px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu h5 {
|
.menu h5 {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu ul {
|
.menu ul {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
margin: 5px 0 25px 0;
|
margin: 5px 0 25px 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,37 @@
|
|||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import { useContent, Link, useLocation } from '@builder.io/qwik-city';
|
import { useContent, Link, useLocation } from '@builder.io/qwik-city'
|
||||||
import styles from './menu.css?inline';
|
import styles from './menu.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { menu } = useContent();
|
const { menu } = useContent()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside class="menu">
|
<aside class="menu">
|
||||||
{menu
|
{menu
|
||||||
? menu.items?.map((item) => (
|
? menu.items?.map((item) => (
|
||||||
<>
|
<>
|
||||||
<h5>{item.text}</h5>
|
<h5>{item.text}</h5>
|
||||||
<ul>
|
<ul>
|
||||||
{item.items?.map((item) => (
|
{item.items?.map((item) => (
|
||||||
<li>
|
<li>
|
||||||
<Link
|
<Link
|
||||||
href={item.href}
|
href={item.href}
|
||||||
class={{
|
class={{
|
||||||
'is-active': loc.pathname === item.href,
|
'is-active':
|
||||||
}}
|
loc.pathname === item.href,
|
||||||
>
|
}}
|
||||||
{item.text}
|
>
|
||||||
</Link>
|
{item.text}
|
||||||
</li>
|
</Link>
|
||||||
))}
|
</li>
|
||||||
</ul>
|
))}
|
||||||
</>
|
</ul>
|
||||||
))
|
</>
|
||||||
: null}
|
))
|
||||||
</aside>
|
: null}
|
||||||
);
|
</aside>
|
||||||
});
|
)
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
.on-this-page {
|
.on-this-page {
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page h6 {
|
.on-this-page h6 {
|
||||||
margin: 10px 0;
|
margin: 10px 0;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page ul {
|
.on-this-page ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 20px 0;
|
padding: 0 0 20px 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a {
|
.on-this-page a {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
border: 0 solid #ddd;
|
border: 0 solid #ddd;
|
||||||
border-left-width: 2px;
|
border-left-width: 2px;
|
||||||
padding: 4px 2px 4px 8px;
|
padding: 4px 2px 4px 8px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a.indent {
|
.on-this-page a.indent {
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.on-this-page a:hover {
|
.on-this-page a:hover {
|
||||||
border-color: var(--theme-accent);
|
border-color: var(--theme-accent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +1,63 @@
|
|||||||
import { useContent, useLocation } from '@builder.io/qwik-city';
|
import { useContent, useLocation } from '@builder.io/qwik-city'
|
||||||
import { component$, useStyles$ } from '@builder.io/qwik';
|
import { component$, useStyles$ } from '@builder.io/qwik'
|
||||||
import styles from './on-this-page.css?inline';
|
import styles from './on-this-page.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
const { headings } = useContent();
|
const { headings } = useContent()
|
||||||
const contentHeadings = headings?.filter((h) => h.level === 2 || h.level === 3) || [];
|
const contentHeadings =
|
||||||
|
headings?.filter((h) => h.level === 2 || h.level === 3) || []
|
||||||
|
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation()
|
||||||
const editUrl = `#update-your-edit-url-for-${pathname}`;
|
const editUrl = `#update-your-edit-url-for-${pathname}`
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside class="on-this-page">
|
<aside class="on-this-page">
|
||||||
{contentHeadings.length > 0 ? (
|
{contentHeadings.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<h6>On This Page</h6>
|
<h6>On This Page</h6>
|
||||||
<ul>
|
<ul>
|
||||||
{contentHeadings.map((h) => (
|
{contentHeadings.map((h) => (
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={`#${h.id}`}
|
href={`#${h.id}`}
|
||||||
class={{
|
class={{
|
||||||
block: true,
|
block: true,
|
||||||
indent: h.level > 2,
|
indent: h.level > 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{h.text}
|
{h.text}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<h6>More</h6>
|
<h6>More</h6>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href={editUrl} target="_blank">
|
<a href={editUrl} target="_blank">
|
||||||
Edit this page
|
Edit this page
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://qwik.builder.io/chat" target="_blank">
|
<a href="https://qwik.builder.io/chat" target="_blank">
|
||||||
Join our community
|
Join our community
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/BuilderIO/qwik" target="_blank">
|
<a href="https://github.com/BuilderIO/qwik" target="_blank">
|
||||||
GitHub
|
GitHub
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="https://twitter.com/QwikDev" target="_blank">
|
<a href="https://twitter.com/QwikDev" target="_blank">
|
||||||
@QwikDev
|
@QwikDev
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</aside>
|
</aside>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,32 +1,35 @@
|
|||||||
import { component$ } from '@builder.io/qwik';
|
import { component$ } from '@builder.io/qwik'
|
||||||
import { useDocumentHead, useLocation } from '@builder.io/qwik-city';
|
import { useDocumentHead, useLocation } from '@builder.io/qwik-city'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The RouterHead component is placed inside of the document `<head>` element.
|
* The RouterHead component is placed inside of the document `<head>` element.
|
||||||
*/
|
*/
|
||||||
export const RouterHead = component$(() => {
|
export const RouterHead = component$(() => {
|
||||||
const head = useDocumentHead();
|
const head = useDocumentHead()
|
||||||
const loc = useLocation();
|
const loc = useLocation()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<title>{head.title}</title>
|
<title>{head.title}</title>
|
||||||
|
|
||||||
<link rel="canonical" href={loc.href} />
|
<link rel="canonical" href={loc.href} />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0"
|
||||||
|
/>
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
|
|
||||||
{head.meta.map((m) => (
|
{head.meta.map((m) => (
|
||||||
<meta {...m} />
|
<meta {...m} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{head.links.map((l) => (
|
{head.links.map((l) => (
|
||||||
<link {...l} />
|
<link {...l} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{head.styles.map((s) => (
|
{head.styles.map((s) => (
|
||||||
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
* - https://qwik.builder.io/qwikcity/adaptors/cloudflare-pages/
|
* - https://qwik.builder.io/qwikcity/adaptors/cloudflare-pages/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { createQwikCity } from '@builder.io/qwik-city/middleware/cloudflare-pages';
|
import { createQwikCity } from '@builder.io/qwik-city/middleware/cloudflare-pages'
|
||||||
import qwikCityPlan from '@qwik-city-plan';
|
import qwikCityPlan from '@qwik-city-plan'
|
||||||
import render from './entry.ssr';
|
import render from './entry.ssr'
|
||||||
|
|
||||||
const onRequest = createQwikCity({ render, qwikCityPlan });
|
const onRequest = createQwikCity({ render, qwikCityPlan })
|
||||||
|
|
||||||
export { onRequest };
|
export { onRequest }
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
* - More code is transferred to the browser than in SSR mode.
|
* - More code is transferred to the browser than in SSR mode.
|
||||||
* - Optimizer/Serialization/Deserialization code is not exercised!
|
* - Optimizer/Serialization/Deserialization code is not exercised!
|
||||||
*/
|
*/
|
||||||
import { render, RenderOptions } from '@builder.io/qwik';
|
import { render, RenderOptions } from '@builder.io/qwik'
|
||||||
import Root from './root';
|
import Root from './root'
|
||||||
|
|
||||||
export default function (opts: RenderOptions) {
|
export default function (opts: RenderOptions) {
|
||||||
return render(document, <Root />, opts);
|
return render(document, <Root />, opts)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
* - https://vitejs.dev/config/preview-options.html#preview-options
|
* - https://vitejs.dev/config/preview-options.html#preview-options
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { createQwikCity } from '@builder.io/qwik-city/middleware/node';
|
import { createQwikCity } from '@builder.io/qwik-city/middleware/node'
|
||||||
import render from './entry.ssr';
|
import render from './entry.ssr'
|
||||||
import qwikCityPlan from '@qwik-city-plan';
|
import qwikCityPlan from '@qwik-city-plan'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default export is the QwikCity adaptor used by Vite preview.
|
* The default export is the QwikCity adaptor used by Vite preview.
|
||||||
*/
|
*/
|
||||||
export default createQwikCity({ render, qwikCityPlan });
|
export default createQwikCity({ render, qwikCityPlan })
|
||||||
|
|||||||
@@ -10,18 +10,18 @@
|
|||||||
* - npm run build
|
* - npm run build
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server'
|
||||||
import { manifest } from '@qwik-client-manifest';
|
import { manifest } from '@qwik-client-manifest'
|
||||||
import Root from './root';
|
import Root from './root'
|
||||||
|
|
||||||
export default function (opts: RenderToStreamOptions) {
|
export default function (opts: RenderToStreamOptions) {
|
||||||
return renderToStream(<Root />, {
|
return renderToStream(<Root />, {
|
||||||
manifest,
|
manifest,
|
||||||
...opts,
|
...opts,
|
||||||
// Use container attributes to set attributes on the html tag.
|
// Use container attributes to set attributes on the html tag.
|
||||||
containerAttributes: {
|
containerAttributes: {
|
||||||
lang: 'en-us',
|
lang: 'en-us',
|
||||||
...opts.containerAttributes,
|
...opts.containerAttributes,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,66 +1,67 @@
|
|||||||
* {
|
* {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--user-font-scale: 1rem - 16px;
|
--user-font-scale: 1rem - 16px;
|
||||||
--max-width: calc(100% - 1rem);
|
--max-width: calc(100% - 1rem);
|
||||||
|
|
||||||
--font-body: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,
|
--font-body: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI,
|
||||||
Apple Color Emoji, Segoe UI Emoji;
|
Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
|
||||||
--font-mono: 'IBM Plex Mono', Consolas, 'Andale Mono WT', 'Andale Mono', 'Lucida Console',
|
--font-mono: 'IBM Plex Mono', Consolas, 'Andale Mono WT', 'Andale Mono',
|
||||||
'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono',
|
'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono',
|
||||||
'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace;
|
'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco,
|
||||||
|
'Courier New', Courier, monospace;
|
||||||
|
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
--theme-accent: #006ce9;
|
--theme-accent: #006ce9;
|
||||||
--theme-text: #181818;
|
--theme-text: #181818;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 50em) {
|
@media (min-width: 50em) {
|
||||||
:root {
|
:root {
|
||||||
--max-width: 46em;
|
--max-width: 46em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
font-family: var(--font-body);
|
font-family: var(--font-body);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-size: clamp(0.9rem, 0.75rem + 0.375vw + var(--user-font-scale), 1rem);
|
font-size: clamp(0.9rem, 0.75rem + 0.375vw + var(--user-font-scale), 1rem);
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
background: var(--theme-bg);
|
background: var(--theme-bg);
|
||||||
color: var(--theme-text);
|
color: var(--theme-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
max-width: 960px;
|
max-width: 960px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: var(--theme-accent);
|
color: var(--theme-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
code,
|
code,
|
||||||
kbd,
|
kbd,
|
||||||
samp,
|
samp,
|
||||||
pre {
|
pre {
|
||||||
font-family: var(--font-mono);
|
font-family: var(--font-mono);
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
background-color: rgb(224, 224, 224);
|
background-color: rgb(224, 224, 224);
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
border-bottom: 2px solid #bfbfbf;
|
border-bottom: 2px solid #bfbfbf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,30 @@
|
|||||||
import { component$ } from '@builder.io/qwik';
|
import { component$ } from '@builder.io/qwik'
|
||||||
import { QwikCityProvider, RouterOutlet, ServiceWorkerRegister } from '@builder.io/qwik-city';
|
import {
|
||||||
import { RouterHead } from './components/router-head/router-head';
|
QwikCityProvider,
|
||||||
|
RouterOutlet,
|
||||||
|
ServiceWorkerRegister,
|
||||||
|
} from '@builder.io/qwik-city'
|
||||||
|
import { RouterHead } from './components/router-head/router-head'
|
||||||
|
|
||||||
import './global.css';
|
import './global.css'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
/*
|
/*
|
||||||
* The root of a QwikCity site always start with the <QwikCityProvider> component,
|
* The root of a QwikCity site always start with the <QwikCityProvider> component,
|
||||||
* immediately followed by the document's <head> and <body>.
|
* immediately followed by the document's <head> and <body>.
|
||||||
*
|
*
|
||||||
* Dont remove the `<head>` and `<body>` elements.
|
* Dont remove the `<head>` and `<body>` elements.
|
||||||
*/
|
*/
|
||||||
return (
|
return (
|
||||||
<QwikCityProvider>
|
<QwikCityProvider>
|
||||||
<head>
|
<head>
|
||||||
<meta charSet="utf-8" />
|
<meta charSet="utf-8" />
|
||||||
<RouterHead />
|
<RouterHead />
|
||||||
</head>
|
</head>
|
||||||
<body lang="en">
|
<body lang="en">
|
||||||
<RouterOutlet />
|
<RouterOutlet />
|
||||||
<ServiceWorkerRegister />
|
<ServiceWorkerRegister />
|
||||||
</body>
|
</body>
|
||||||
</QwikCityProvider>
|
</QwikCityProvider>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
.docs {
|
.docs {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 210px auto 190px;
|
grid-template-columns: 210px auto 190px;
|
||||||
grid-template-areas: 'menu article on-this-page';
|
grid-template-areas: 'menu article on-this-page';
|
||||||
gap: 40px;
|
gap: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs h1 {
|
.docs h1 {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs .menu {
|
.docs .menu {
|
||||||
grid-area: menu;
|
grid-area: menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs article {
|
.docs article {
|
||||||
grid-area: article;
|
grid-area: article;
|
||||||
}
|
}
|
||||||
|
|
||||||
.docs .on-this-page {
|
.docs .on-this-page {
|
||||||
grid-area: on-this-page;
|
grid-area: on-this-page;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
import { component$, Slot, useStyles$ } from '@builder.io/qwik';
|
import { component$, Slot, useStyles$ } from '@builder.io/qwik'
|
||||||
import type { DocumentHead } from '@builder.io/qwik-city';
|
import type { DocumentHead } from '@builder.io/qwik-city'
|
||||||
import Menu from '~/components/menu/menu';
|
import Menu from '~/components/menu/menu'
|
||||||
import OnThisPage from '~/components/on-this-page/on-this-page';
|
import OnThisPage from '~/components/on-this-page/on-this-page'
|
||||||
import styles from './docs.css?inline';
|
import styles from './docs.css?inline'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
useStyles$(styles);
|
useStyles$(styles)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="docs">
|
<div class="docs">
|
||||||
<Menu />
|
<Menu />
|
||||||
<article>
|
<article>
|
||||||
<Slot />
|
<Slot />
|
||||||
</article>
|
</article>
|
||||||
<OnThisPage />
|
<OnThisPage />
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|
||||||
export const head: DocumentHead = ({ head }) => {
|
export const head: DocumentHead = ({ head }) => {
|
||||||
return {
|
return {
|
||||||
title: `${head.title} - Documentation`,
|
title: `${head.title} - Documentation`,
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { component$, Slot } from '@builder.io/qwik';
|
import { component$, Slot } from '@builder.io/qwik'
|
||||||
import Footer from '~/components/footer/footer';
|
import Footer from '~/components/footer/footer'
|
||||||
import Header from '~/components/header/header';
|
import Header from '~/components/header/header'
|
||||||
|
|
||||||
export default component$(() => {
|
export default component$(() => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Header />
|
<Header />
|
||||||
<main>
|
<main>
|
||||||
<Slot />
|
<Slot />
|
||||||
</main>
|
</main>
|
||||||
<Footer />
|
<Footer />
|
||||||
</>
|
</>
|
||||||
);
|
)
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
* Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
|
||||||
* You can also use this file to add more functionality that runs in the service worker.
|
* You can also use this file to add more functionality that runs in the service worker.
|
||||||
*/
|
*/
|
||||||
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker';
|
import { setupServiceWorker } from '@builder.io/qwik-city/service-worker'
|
||||||
|
|
||||||
setupServiceWorker();
|
setupServiceWorker()
|
||||||
|
|
||||||
addEventListener('install', () => self.skipWaiting());
|
addEventListener('install', () => self.skipWaiting())
|
||||||
|
|
||||||
addEventListener('activate', () => self.clients.claim());
|
addEventListener('activate', () => self.clients.claim())
|
||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
|
||||||
const defaultTheme = require("tailwindcss/defaultTheme");
|
const defaultTheme = require('tailwindcss/defaultTheme')
|
||||||
const colors = require("tailwindcss/colors");
|
const colors = require('tailwindcss/colors')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
content: ["./src/**/*.{js,ts,jsx,tsx,mdx}"],
|
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}'],
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
colors: {
|
||||||
primary: colors.purple,
|
primary: colors.purple,
|
||||||
secondary: colors.sky,
|
secondary: colors.sky,
|
||||||
},
|
},
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
sans: ["'Inter'", ...defaultTheme.fontFamily.sans],
|
sans: ["'Inter'", ...defaultTheme.fontFamily.sans],
|
||||||
},
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
plugins: [],
|
||||||
plugins: [],
|
darkMode: 'class',
|
||||||
darkMode: "class",
|
}
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite'
|
||||||
import { qwikVite } from '@builder.io/qwik/optimizer';
|
import { qwikVite } from '@builder.io/qwik/optimizer'
|
||||||
import { qwikCity } from '@builder.io/qwik-city/vite';
|
import { qwikCity } from '@builder.io/qwik-city/vite'
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||||
|
|
||||||
export default defineConfig(() => {
|
export default defineConfig(() => {
|
||||||
return {
|
return {
|
||||||
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
|
plugins: [qwikCity(), qwikVite(), tsconfigPaths()],
|
||||||
preview: {
|
preview: {
|
||||||
headers: {
|
headers: {
|
||||||
'Cache-Control': 'public, max-age=600',
|
'Cache-Control': 'public, max-age=600',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
# @bot-whatsapp/provider
|
|
||||||
|
|
||||||
```js
|
|
||||||
// bootstrap.js Como iniciar el provider
|
|
||||||
const { inout, provider, database } = require('@bot-whatsapp')
|
|
||||||
|
|
||||||
provider.start()
|
|
||||||
provider.close()
|
|
||||||
```
|
|
||||||
|
|
||||||
- [ ] whatsapp-web.js _verificar update_
|
|
||||||
- [ ] Meta _verificar tokens_
|
|
||||||
- [ ] Twilio _verificar tokens_
|
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/provider",
|
"name": "@bot-whatsapp/provider",
|
||||||
"version": "0.0.1",
|
"version": "0.0.19-alpha.0",
|
||||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"private": true,
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
"files": [
|
||||||
|
"./lib/"
|
||||||
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bot-whatsapp/bot": "*",
|
"@bot-whatsapp/bot": "*",
|
||||||
"qr-image": "^3.2.0"
|
"qr-image": "^3.2.0"
|
||||||
|
|||||||
@@ -5,17 +5,23 @@ const TwilioWebHookServer = require('./server')
|
|||||||
const { parseNumber } = require('./utils')
|
const { parseNumber } = require('./utils')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* ⚙️TwilioProvider: Es un provedor que te ofrece enviar
|
||||||
|
* mensaje a Whatsapp via API
|
||||||
|
* info: https://www.twilio.com/es-mx/messaging/whatsapp
|
||||||
|
* video: https://youtu.be/KoOmsHylxUw
|
||||||
|
*
|
||||||
|
* Necesitas las siguientes tokens y valores
|
||||||
* { accountSid, authToken, vendorNumber }
|
* { accountSid, authToken, vendorNumber }
|
||||||
*/
|
*/
|
||||||
class TwilioProvider extends ProviderClass {
|
class TwilioProvider extends ProviderClass {
|
||||||
twilioHook
|
twilioHook
|
||||||
vendor
|
vendor
|
||||||
vendorNumber
|
vendorNumber
|
||||||
constructor({ accountSid, authToken, vendorNumber }) {
|
constructor({ accountSid, authToken, vendorNumber }, _port = 3000) {
|
||||||
super()
|
super()
|
||||||
this.vendor = new twilio(accountSid, authToken)
|
this.vendor = new twilio(accountSid, authToken)
|
||||||
this.twilioHook = new TwilioWebHookServer()
|
this.twilioHook = new TwilioWebHookServer(_port)
|
||||||
this.vendorNumber = vendorNumber
|
this.vendorNumber = parseNumber(vendorNumber)
|
||||||
|
|
||||||
this.twilioHook.start()
|
this.twilioHook.start()
|
||||||
const listEvents = this.busEvents()
|
const listEvents = this.busEvents()
|
||||||
@@ -25,14 +31,6 @@ class TwilioProvider extends ProviderClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage = async (number, message) => {
|
|
||||||
return this.vendor.messages.create({
|
|
||||||
body: message,
|
|
||||||
from: ['whatsapp:+', parseNumber(this.vendorNumber)].join(''),
|
|
||||||
to: ['whatsapp:+', parseNumber(number)].join(''),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapeamos los eventos nativos de whatsapp-web.js a los que la clase Provider espera
|
* Mapeamos los eventos nativos de whatsapp-web.js a los que la clase Provider espera
|
||||||
* para tener un standar de eventos
|
* para tener un standar de eventos
|
||||||
@@ -54,6 +52,65 @@ class TwilioProvider extends ProviderClass {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enviar un archivo multimedia
|
||||||
|
* https://www.twilio.com/es-mx/docs/whatsapp/tutorial/send-and-receive-media-messages-whatsapp-nodejs
|
||||||
|
* @private
|
||||||
|
* @param {*} number
|
||||||
|
* @param {*} mediaInput
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
sendMedia = async (number, message, mediaInput = null) => {
|
||||||
|
if (!mediaInput) throw new Error(`MEDIA_INPUT_NULL_: ${mediaInput}`)
|
||||||
|
number = parseNumber(number)
|
||||||
|
return this.vendor.messages.create({
|
||||||
|
mediaUrl: [`${mediaInput}`],
|
||||||
|
body: message,
|
||||||
|
from: `whatsapp:+${this.vendorNumber}`,
|
||||||
|
to: `whatsapp:+${number}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enviar botones
|
||||||
|
* https://www.twilio.com/es-mx/docs/whatsapp/buttons
|
||||||
|
* @private
|
||||||
|
* @param {*} number
|
||||||
|
* @param {*} message
|
||||||
|
* @param {*} buttons []
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
sendButtons = async () => {
|
||||||
|
console.log(``)
|
||||||
|
console.log(
|
||||||
|
`[NOTA]: Actualmente enviar botons con Twilio esta en desarrollo`
|
||||||
|
)
|
||||||
|
console.log(
|
||||||
|
`[NOTA]: https://www.twilio.com/es-mx/docs/whatsapp/buttons`
|
||||||
|
)
|
||||||
|
console.log(``)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {*} userId
|
||||||
|
* @param {*} message
|
||||||
|
* @param {*} param2
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
sendMessage = async (number, message, { options }) => {
|
||||||
|
number = parseNumber(number)
|
||||||
|
if (options?.buttons?.length)
|
||||||
|
this.sendButtons(number, message, options.buttons)
|
||||||
|
if (options?.media)
|
||||||
|
return this.sendMedia(number, message, options.media)
|
||||||
|
return this.vendor.messages.create({
|
||||||
|
body: message,
|
||||||
|
from: `whatsapp:+${this.vendorNumber}`,
|
||||||
|
to: `whatsapp:+${number}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = TwilioProvider
|
module.exports = TwilioProvider
|
||||||
|
|||||||
@@ -3,7 +3,25 @@ const polka = require('polka')
|
|||||||
const { urlencoded } = require('body-parser')
|
const { urlencoded } = require('body-parser')
|
||||||
const { parseNumber } = require('./utils')
|
const { parseNumber } = require('./utils')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encargado de levantar un servidor HTTP con una hook url
|
||||||
|
* [POST] /twilio-hook
|
||||||
|
*/
|
||||||
class TwilioWebHookServer extends EventEmitter {
|
class TwilioWebHookServer extends EventEmitter {
|
||||||
|
twilioServer
|
||||||
|
twilioPort
|
||||||
|
constructor(_twilioPort) {
|
||||||
|
super()
|
||||||
|
this.twilioServer = this.buildHTTPServer()
|
||||||
|
this.twilioPort = _twilioPort
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mensaje entrante
|
||||||
|
* emit: 'message'
|
||||||
|
* @param {*} req
|
||||||
|
* @param {*} res
|
||||||
|
*/
|
||||||
incomingMsg = (req, res) => {
|
incomingMsg = (req, res) => {
|
||||||
const { body } = req
|
const { body } = req
|
||||||
this.emit('message', {
|
this.emit('message', {
|
||||||
@@ -15,13 +33,31 @@ class TwilioWebHookServer extends EventEmitter {
|
|||||||
res.end(json)
|
res.end(json)
|
||||||
}
|
}
|
||||||
|
|
||||||
start = () => {
|
/**
|
||||||
polka()
|
* Contruir HTTP Server
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
buildHTTPServer = () => {
|
||||||
|
return polka()
|
||||||
.use(urlencoded({ extended: true }))
|
.use(urlencoded({ extended: true }))
|
||||||
.post('/hook', this.incomingMsg)
|
.post('/twilio-hook', this.incomingMsg)
|
||||||
.listen(3000, () => {
|
}
|
||||||
console.log(`> Running on localhost:3000 /hook`)
|
|
||||||
})
|
/**
|
||||||
|
* Puerto del HTTP
|
||||||
|
* @param {*} port default 3000
|
||||||
|
*/
|
||||||
|
start = () => {
|
||||||
|
this.twilioServer.listen(this.twilioPort, () => {
|
||||||
|
console.log(``)
|
||||||
|
console.log(`[Twilio]: Agregar esta url "WHEN A MESSAGE COMES IN"`)
|
||||||
|
console.log(
|
||||||
|
`[Twilio]: POST http://localhost:${this.twilioPort}/twilio-hook`
|
||||||
|
)
|
||||||
|
console.log(`[Twilio]: Más información en la documentacion`)
|
||||||
|
console.log(``)
|
||||||
|
})
|
||||||
|
this.emit('ready')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
const {
|
const { Client, LocalAuth, MessageMedia, Buttons } = require('whatsapp-web.js')
|
||||||
Client,
|
|
||||||
LocalAuth,
|
|
||||||
MessageMedia,
|
|
||||||
Buttons,
|
|
||||||
List,
|
|
||||||
} = require('whatsapp-web.js')
|
|
||||||
const { ProviderClass } = require('@bot-whatsapp/bot')
|
const { ProviderClass } = require('@bot-whatsapp/bot')
|
||||||
const { Console } = require('console')
|
const { Console } = require('console')
|
||||||
const { createWriteStream, existsSync } = require('fs')
|
const { createWriteStream } = require('fs')
|
||||||
const { cleanNumber, generateImage, isValidNumber } = require('./utils')
|
const {
|
||||||
|
cleanNumber,
|
||||||
|
generateImage,
|
||||||
|
isValidNumber,
|
||||||
|
downloadMedia,
|
||||||
|
} = require('./utils')
|
||||||
|
|
||||||
const logger = new Console({
|
const logger = new Console({
|
||||||
stdout: createWriteStream('./log'),
|
stdout: createWriteStream('./log'),
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebWhatsappProvider: Es una clase tipo adaptor
|
* ⚙️ WebWhatsappProvider: Es una clase tipo adaptor
|
||||||
* que extiende clases de ProviderClass (la cual es como interfaz para sber que funciones rqueridas)
|
* que extiende clases de ProviderClass (la cual es como interfaz para sber que funciones rqueridas)
|
||||||
* https://github.com/pedroslopez/whatsapp-web.js
|
* https://github.com/pedroslopez/whatsapp-web.js
|
||||||
*/
|
*/
|
||||||
@@ -97,9 +96,9 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
sendMedia = async (number, mediaInput = null) => {
|
sendMedia = async (number, mediaInput = null) => {
|
||||||
if (!existsSync(mediaInput))
|
if (!mediaInput) throw new Error(`NO_SE_ENCONTRO: ${mediaInput}`)
|
||||||
throw new Error(`NO_SE_ENCONTRO: ${mediaInput}`)
|
const fileDownloaded = await downloadMedia(mediaInput)
|
||||||
const media = MessageMedia.fromFilePath(mediaInput)
|
const media = MessageMedia.fromFilePath(fileDownloaded)
|
||||||
return this.vendor.sendMessage(number, media, {
|
return this.vendor.sendMessage(number, media, {
|
||||||
sendAudioAsVoice: true,
|
sendAudioAsVoice: true,
|
||||||
})
|
})
|
||||||
@@ -129,19 +128,19 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
* @param {*} buttons []
|
* @param {*} buttons []
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
sendList = async (number, message, listInput = []) => {
|
// sendList = async (number, message, listInput = []) => {
|
||||||
let sections = [
|
// let sections = [
|
||||||
{
|
// {
|
||||||
title: 'sectionTitle',
|
// title: 'sectionTitle',
|
||||||
rows: [
|
// rows: [
|
||||||
{ title: 'ListItem1', description: 'desc' },
|
// { title: 'ListItem1', description: 'desc' },
|
||||||
{ title: 'ListItem2' },
|
// { title: 'ListItem2' },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
]
|
// ]
|
||||||
let list = new List('List body', 'btnText', sections, 'Title', 'footer')
|
// let list = new List('List body', 'btnText', sections, 'Title', 'footer')
|
||||||
return this.vendor.sendMessage(number, list)
|
// return this.vendor.sendMessage(number, list)
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enviar un mensaje solo texto
|
* Enviar un mensaje solo texto
|
||||||
@@ -164,9 +163,9 @@ class WebWhatsappProvider extends ProviderClass {
|
|||||||
*/
|
*/
|
||||||
sendMessage = async (userId, message, { options }) => {
|
sendMessage = async (userId, message, { options }) => {
|
||||||
const number = cleanNumber(userId)
|
const number = cleanNumber(userId)
|
||||||
if (options?.media) return this.sendMedia(number, options.media)
|
|
||||||
if (options?.buttons?.length)
|
if (options?.buttons?.length)
|
||||||
return this.sendButtons(number, message, options.buttons)
|
return this.sendButtons(number, message, options.buttons)
|
||||||
|
if (options?.media) return this.sendMedia(number, options.media)
|
||||||
return this.sendText(number, message)
|
return this.sendText(number, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
const { createWriteStream } = require('fs')
|
const { createWriteStream } = require('fs')
|
||||||
const qr = require('qr-image')
|
const qr = require('qr-image')
|
||||||
|
const { tmpdir } = require('os')
|
||||||
|
const http = require('http')
|
||||||
|
const https = require('https')
|
||||||
|
|
||||||
const cleanNumber = (number, full = false) => {
|
const cleanNumber = (number, full = false) => {
|
||||||
number = number.replace('@c.us', '')
|
number = number.replace('@c.us', '')
|
||||||
@@ -18,4 +21,33 @@ const isValidNumber = (rawNumber) => {
|
|||||||
return !exist
|
return !exist
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { cleanNumber, generateImage, isValidNumber }
|
/**
|
||||||
|
* Incompleta
|
||||||
|
* Descargar archivo multimedia para enviar
|
||||||
|
* @param {*} url
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const downloadMedia = (url) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const ext = url.split('.').pop()
|
||||||
|
const checkProtocol = url.includes('https:')
|
||||||
|
const handleHttp = checkProtocol ? https : http
|
||||||
|
const name = `tmp-${Date.now()}.${ext}`
|
||||||
|
const fullPath = `${tmpdir()}/${name}`
|
||||||
|
const file = createWriteStream(fullPath)
|
||||||
|
handleHttp.get(url, function (response) {
|
||||||
|
response.pipe(file)
|
||||||
|
file.on('finish', function () {
|
||||||
|
file.close()
|
||||||
|
resolve(fullPath)
|
||||||
|
})
|
||||||
|
file.on('error', function () {
|
||||||
|
console.log('errro')
|
||||||
|
file.close()
|
||||||
|
reject(null)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { cleanNumber, generateImage, isValidNumber, downloadMedia }
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ Promise.all([
|
|||||||
copyLibPkg('bot', appDir),
|
copyLibPkg('bot', appDir),
|
||||||
copyLibPkg('database', appDir),
|
copyLibPkg('database', appDir),
|
||||||
copyLibPkg('provider', appDir),
|
copyLibPkg('provider', appDir),
|
||||||
]).then(() => console.log('Todas las lib copiadas'))
|
]).then(() => console.log('Todas las librerías copiadas'))
|
||||||
|
|||||||
167
scripts/release.js
Normal file
167
scripts/release.js
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
const { writeFile, readFileSync } = require('fs')
|
||||||
|
const { join } = require('path')
|
||||||
|
const { execFile } = require('node:child_process')
|
||||||
|
const process = require('node:process')
|
||||||
|
const util = require('node:util')
|
||||||
|
|
||||||
|
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
|
||||||
|
const semver = require('semver')
|
||||||
|
|
||||||
|
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
|
||||||
|
const [PKG_ARG, PKG_ARG_VERSION, NPM_TOKEN] = process.argv.slice(2) || [null]
|
||||||
|
const PATH_PACKAGES = join(__dirname, '..', `packages`)
|
||||||
|
|
||||||
|
const cmd = util.promisify(execFile)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Token
|
||||||
|
*/
|
||||||
|
const npmToken = (token = null) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
writeFile(
|
||||||
|
`${process.cwd()}/.npmrc`,
|
||||||
|
`//registry.npmjs.org/:_authToken=${token}`,
|
||||||
|
(error) => {
|
||||||
|
if (error) reject(error)
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leer package json
|
||||||
|
* @param {*} packageName
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const readPackage = (packageName = null) => {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName, 'package.json')
|
||||||
|
const rawFile = readFileSync(pkgJson, 'utf-8')
|
||||||
|
if (!rawFile) throw new Error(`ERROR_FILE_READ`)
|
||||||
|
|
||||||
|
return JSON.parse(rawFile)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualizar package json
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} newPkgJson
|
||||||
|
*/
|
||||||
|
const updatePackage = (packageName = null, newPkgJson) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName, 'package.json')
|
||||||
|
if (!Object.keys(newPkgJson).length) throw new Error(`ERROR_FILE_READ`)
|
||||||
|
writeFile(pkgJson, newPkgJson, (err) => {
|
||||||
|
if (err) reject(err)
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualizar version
|
||||||
|
* @param {*} packageName
|
||||||
|
*/
|
||||||
|
const updateVersion = async (packageName = null, number = null) => {
|
||||||
|
if (!packageName) throw new Error(`PATH_ERROR_PACKAGE: ${packageName}`)
|
||||||
|
|
||||||
|
const pkgJsonObject = readPackage(packageName)
|
||||||
|
const { version } = pkgJsonObject
|
||||||
|
const newVersion = !number
|
||||||
|
? semver.inc(version, 'prepatch', 'alpha')
|
||||||
|
: `${number}`
|
||||||
|
|
||||||
|
if (!semver.valid(newVersion))
|
||||||
|
throw new Error(`VERSION_ERROR: ${newVersion}`)
|
||||||
|
|
||||||
|
const newPkgJson = JSON.stringify(
|
||||||
|
{ ...pkgJsonObject, version: newVersion },
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
await updatePackage(packageName, newPkgJson)
|
||||||
|
return { version: newVersion }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revisar si la version nueva existe o no en npmjs
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} version
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const checkExistVersion = async (packageName = null, version = null) => {
|
||||||
|
try {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const pkgJsonObject = readPackage(packageName)
|
||||||
|
const { stdout } = await cmd(
|
||||||
|
NPM_COMMAND,
|
||||||
|
['view', `${pkgJsonObject.name}@${version}`],
|
||||||
|
{
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empaquetar
|
||||||
|
* @param {*} packageName
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const packRelease = async (packageName) => {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
})
|
||||||
|
return stdout
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lanzar release
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} latest
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
const publishRelease = async (packageName, latest = null) => {
|
||||||
|
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const { stdout } = await cmd(NPM_COMMAND, ['publish'].concat(args), {
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
})
|
||||||
|
console.log(stdout)
|
||||||
|
return stdout
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recibe los argumentos entrantes
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init
|
||||||
|
*/
|
||||||
|
const main = async () => {
|
||||||
|
if (PKG_ARG) {
|
||||||
|
let EXIST_VERSION = true
|
||||||
|
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
||||||
|
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||||
|
const pkgNumber = PKG_ARG_VERSION
|
||||||
|
? PKG_ARG_VERSION.split('=').at(1)
|
||||||
|
: null
|
||||||
|
if (tokenNpm) await npmToken(tokenNpm)
|
||||||
|
|
||||||
|
while (EXIST_VERSION) {
|
||||||
|
const { version } = await updateVersion(pkgName, pkgNumber)
|
||||||
|
EXIST_VERSION = await checkExistVersion(pkgName, version)
|
||||||
|
console.log(`[${pkgName} - Version]: `, version, EXIST_VERSION)
|
||||||
|
}
|
||||||
|
await packRelease(pkgName)
|
||||||
|
await publishRelease(pkgName, pkgNumber)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
12
starters/apps/base-twilio-memory/README.md
Normal file
12
starters/apps/base-twilio-memory/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-twilio-memory/app.js
Normal file
28
starters/apps/base-twilio-memory/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-twilio-memory/package.json
Normal file
16
starters/apps/base-twilio-memory/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
12
starters/apps/base-twilio-mongo/README.md
Normal file
12
starters/apps/base-twilio-mongo/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-twilio-mongo/app.js
Normal file
28
starters/apps/base-twilio-mongo/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-twilio-mongo/package.json
Normal file
16
starters/apps/base-twilio-mongo/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
12
starters/apps/base-twilio-mysql/README.md
Normal file
12
starters/apps/base-twilio-mysql/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-twilio-mysql/app.js
Normal file
28
starters/apps/base-twilio-mysql/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-twilio-mysql/package.json
Normal file
16
starters/apps/base-twilio-mysql/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
12
starters/apps/base-wweb-memory/README.md
Normal file
12
starters/apps/base-wweb-memory/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-wweb-memory/app.js
Normal file
28
starters/apps/base-wweb-memory/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-wweb-memory/package.json
Normal file
16
starters/apps/base-wweb-memory/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
12
starters/apps/base-wweb-mongo/README.md
Normal file
12
starters/apps/base-wweb-mongo/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-wweb-mongo/app.js
Normal file
28
starters/apps/base-wweb-mongo/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-wweb-mongo/package.json
Normal file
16
starters/apps/base-wweb-mongo/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
12
starters/apps/base-wweb-mysql/README.md
Normal file
12
starters/apps/base-wweb-mysql/README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
### BASE APP
|
||||||
|
|
||||||
|
Este bot contiene un flujo basico en el cual una persona (cliente) escribe **"hola"** y el bot responde.
|
||||||
|
- Bienvenido a mi tienda
|
||||||
|
- Como puedo ayudarte?
|
||||||
|
- Tengo: Zapatos Bolsos etc..
|
||||||
|
|
||||||
|
------
|
||||||
|
- [Discord](https://link.codigoencasa.com/DISCORD)
|
||||||
|
- [Twitter](https://twitter.com/leifermendez)
|
||||||
|
- [Youtube](https://www.youtube.com/watch?v=5lEMCeWEJ8o&list=PL_WGMLcL4jzWPhdhcUyhbFU6bC0oJd2BR)
|
||||||
|
- [Telegram](https://t.me/leifermendez)
|
||||||
28
starters/apps/base-wweb-mysql/app.js
Normal file
28
starters/apps/base-wweb-mysql/app.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
const {
|
||||||
|
createBot,
|
||||||
|
createProvider,
|
||||||
|
createFlow,
|
||||||
|
addKeyword,
|
||||||
|
} = require('@bot-whatsapp/bot')
|
||||||
|
|
||||||
|
const WebWhatsappProvider = require('@bot-whatsapp/provider/web-whatsapp')
|
||||||
|
const MockAdapter = require('@bot-whatsapp/database/mock')
|
||||||
|
|
||||||
|
const flowPrincipal = addKeyword(['hola', 'ole', 'HOLA'])
|
||||||
|
.addAnswer('Bienvenido a mi tienda')
|
||||||
|
.addAnswer('Como puedo ayudarte?')
|
||||||
|
.addAnswer(['Tengo:', 'Zapatos', 'Bolsos', 'etc..'])
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
const adapterDB = new MockAdapter()
|
||||||
|
const adapterFlow = createFlow([flowPrincipal])
|
||||||
|
const adapterProvider = createProvider(WebWhatsappProvider)
|
||||||
|
|
||||||
|
createBot({
|
||||||
|
flow: adapterFlow,
|
||||||
|
provider: adapterProvider,
|
||||||
|
database: adapterDB,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
16
starters/apps/base-wweb-mysql/package.json
Normal file
16
starters/apps/base-wweb-mysql/package.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "bot-whatsapp-base",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "app.js",
|
||||||
|
"scripts": {
|
||||||
|
"pre-copy": "cd .. && yarn run copy.lib example-app-base",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {
|
||||||
|
"whatsapp-web.js": "^1.18.3"
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
||||||
185
yarn.lock
185
yarn.lock
@@ -82,15 +82,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/client-cognito-identity@npm:3.222.0":
|
"@aws-sdk/client-cognito-identity@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/client-cognito-identity@npm:3.222.0"
|
resolution: "@aws-sdk/client-cognito-identity@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-crypto/sha256-browser": 2.0.0
|
"@aws-crypto/sha256-browser": 2.0.0
|
||||||
"@aws-crypto/sha256-js": 2.0.0
|
"@aws-crypto/sha256-js": 2.0.0
|
||||||
"@aws-sdk/client-sts": 3.222.0
|
"@aws-sdk/client-sts": 3.223.0
|
||||||
"@aws-sdk/config-resolver": 3.222.0
|
"@aws-sdk/config-resolver": 3.222.0
|
||||||
"@aws-sdk/credential-provider-node": 3.222.0
|
"@aws-sdk/credential-provider-node": 3.223.0
|
||||||
"@aws-sdk/fetch-http-handler": 3.222.0
|
"@aws-sdk/fetch-http-handler": 3.222.0
|
||||||
"@aws-sdk/hash-node": 3.222.0
|
"@aws-sdk/hash-node": 3.222.0
|
||||||
"@aws-sdk/invalid-dependency": 3.222.0
|
"@aws-sdk/invalid-dependency": 3.222.0
|
||||||
@@ -116,19 +116,18 @@ __metadata:
|
|||||||
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
||||||
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
||||||
"@aws-sdk/util-endpoints": 3.222.0
|
"@aws-sdk/util-endpoints": 3.222.0
|
||||||
"@aws-sdk/util-retry": 3.222.0
|
|
||||||
"@aws-sdk/util-user-agent-browser": 3.222.0
|
"@aws-sdk/util-user-agent-browser": 3.222.0
|
||||||
"@aws-sdk/util-user-agent-node": 3.222.0
|
"@aws-sdk/util-user-agent-node": 3.222.0
|
||||||
"@aws-sdk/util-utf8-browser": 3.188.0
|
"@aws-sdk/util-utf8-browser": 3.188.0
|
||||||
"@aws-sdk/util-utf8-node": 3.208.0
|
"@aws-sdk/util-utf8-node": 3.208.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: b733d9bad0232a17967da9b27311cb2adf41acaefc584173e6d74b3b966ed3908b9e9fa65b3a0f3e12709dc305e64b1a5351ea43ac666650a375cb10143368e3
|
checksum: ada894c3fbe943044617d719dc947af51546dbfea72e5b63f23c6230677c39dc0355248ed1ba119a29f2d4b7bc64e28400880b580a263bcd45d05fdf45007ad7
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/client-sso-oidc@npm:3.222.0":
|
"@aws-sdk/client-sso-oidc@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/client-sso-oidc@npm:3.222.0"
|
resolution: "@aws-sdk/client-sso-oidc@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-crypto/sha256-browser": 2.0.0
|
"@aws-crypto/sha256-browser": 2.0.0
|
||||||
"@aws-crypto/sha256-js": 2.0.0
|
"@aws-crypto/sha256-js": 2.0.0
|
||||||
@@ -157,19 +156,18 @@ __metadata:
|
|||||||
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
||||||
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
||||||
"@aws-sdk/util-endpoints": 3.222.0
|
"@aws-sdk/util-endpoints": 3.222.0
|
||||||
"@aws-sdk/util-retry": 3.222.0
|
|
||||||
"@aws-sdk/util-user-agent-browser": 3.222.0
|
"@aws-sdk/util-user-agent-browser": 3.222.0
|
||||||
"@aws-sdk/util-user-agent-node": 3.222.0
|
"@aws-sdk/util-user-agent-node": 3.222.0
|
||||||
"@aws-sdk/util-utf8-browser": 3.188.0
|
"@aws-sdk/util-utf8-browser": 3.188.0
|
||||||
"@aws-sdk/util-utf8-node": 3.208.0
|
"@aws-sdk/util-utf8-node": 3.208.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: 40674d89438b689480bdfa10bfb044d90341d87096ae6b0803e6ecc1695d48b1f7a8c513109e92001c380e2b2f5b18aa3e8af1c8ecd3d2f04f63f160cb039611
|
checksum: ab5b6142d897ec48a3bb246577c23d1b6e26ee228c7ce264f826d10f88caa83e03f0dac9d88e361c70b778ceef45f0ebd9712cd03ca5b60ab240a3d4382ecb7c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/client-sso@npm:3.222.0":
|
"@aws-sdk/client-sso@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/client-sso@npm:3.222.0"
|
resolution: "@aws-sdk/client-sso@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-crypto/sha256-browser": 2.0.0
|
"@aws-crypto/sha256-browser": 2.0.0
|
||||||
"@aws-crypto/sha256-js": 2.0.0
|
"@aws-crypto/sha256-js": 2.0.0
|
||||||
@@ -198,24 +196,23 @@ __metadata:
|
|||||||
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
||||||
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
||||||
"@aws-sdk/util-endpoints": 3.222.0
|
"@aws-sdk/util-endpoints": 3.222.0
|
||||||
"@aws-sdk/util-retry": 3.222.0
|
|
||||||
"@aws-sdk/util-user-agent-browser": 3.222.0
|
"@aws-sdk/util-user-agent-browser": 3.222.0
|
||||||
"@aws-sdk/util-user-agent-node": 3.222.0
|
"@aws-sdk/util-user-agent-node": 3.222.0
|
||||||
"@aws-sdk/util-utf8-browser": 3.188.0
|
"@aws-sdk/util-utf8-browser": 3.188.0
|
||||||
"@aws-sdk/util-utf8-node": 3.208.0
|
"@aws-sdk/util-utf8-node": 3.208.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: bc0cd1125bc5aa94b3fdec15167ce9539acf4a187da060d51fa8ad7c30d0bf6cfee9e3a0175d65e204aba92efee4087c99d1190e1b43927c01cd7a8b1bbbb93e
|
checksum: 856e3745182906d274dc894baa7d853966b0074f89ea892f29132e1cefdf49f267f1d0fffaa2de3de352d19ff3963d59290602057bd4510731e0156199bed664
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/client-sts@npm:3.222.0":
|
"@aws-sdk/client-sts@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/client-sts@npm:3.222.0"
|
resolution: "@aws-sdk/client-sts@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-crypto/sha256-browser": 2.0.0
|
"@aws-crypto/sha256-browser": 2.0.0
|
||||||
"@aws-crypto/sha256-js": 2.0.0
|
"@aws-crypto/sha256-js": 2.0.0
|
||||||
"@aws-sdk/config-resolver": 3.222.0
|
"@aws-sdk/config-resolver": 3.222.0
|
||||||
"@aws-sdk/credential-provider-node": 3.222.0
|
"@aws-sdk/credential-provider-node": 3.223.0
|
||||||
"@aws-sdk/fetch-http-handler": 3.222.0
|
"@aws-sdk/fetch-http-handler": 3.222.0
|
||||||
"@aws-sdk/hash-node": 3.222.0
|
"@aws-sdk/hash-node": 3.222.0
|
||||||
"@aws-sdk/invalid-dependency": 3.222.0
|
"@aws-sdk/invalid-dependency": 3.222.0
|
||||||
@@ -242,14 +239,13 @@ __metadata:
|
|||||||
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
"@aws-sdk/util-defaults-mode-browser": 3.222.0
|
||||||
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
"@aws-sdk/util-defaults-mode-node": 3.222.0
|
||||||
"@aws-sdk/util-endpoints": 3.222.0
|
"@aws-sdk/util-endpoints": 3.222.0
|
||||||
"@aws-sdk/util-retry": 3.222.0
|
|
||||||
"@aws-sdk/util-user-agent-browser": 3.222.0
|
"@aws-sdk/util-user-agent-browser": 3.222.0
|
||||||
"@aws-sdk/util-user-agent-node": 3.222.0
|
"@aws-sdk/util-user-agent-node": 3.222.0
|
||||||
"@aws-sdk/util-utf8-browser": 3.188.0
|
"@aws-sdk/util-utf8-browser": 3.188.0
|
||||||
"@aws-sdk/util-utf8-node": 3.208.0
|
"@aws-sdk/util-utf8-node": 3.208.0
|
||||||
fast-xml-parser: 4.0.11
|
fast-xml-parser: 4.0.11
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: 79f18e5b44541673213715e3465a8b000716c03120ea087e6920abba3542683dbd4b881ecb091ef90df34947eec00c82daf70089ea0e5e92cffbb4e57e2d76d7
|
checksum: 6976345f839b0028a0e83f6d11e3323da68cef103ae5381299c6d75df25a1ef336b83023c79896242fbc4b7d2a27f3deebb1b1922e815e6cc7780f3eee302210
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -266,15 +262,15 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/credential-provider-cognito-identity@npm:3.222.0":
|
"@aws-sdk/credential-provider-cognito-identity@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/credential-provider-cognito-identity@npm:3.222.0"
|
resolution: "@aws-sdk/credential-provider-cognito-identity@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/client-cognito-identity": 3.222.0
|
"@aws-sdk/client-cognito-identity": 3.223.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: e6a61cf601825907931ed0cc42050b895b150468feb95c1052e053ce00d33e8d225663ca337da1c5825eee7e24438311ba0d28b2a6021868d3e6796aa81fdeeb
|
checksum: e0f03110b120699ef9c458edd5b1a248f5e3f360931b2e8be7ebb7fc33da51ac1c3fdf96bb05a755a2d303c00c7effee7a582706da2333b4ee43c0040ff551a5
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -302,37 +298,37 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/credential-provider-ini@npm:3.222.0":
|
"@aws-sdk/credential-provider-ini@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/credential-provider-ini@npm:3.222.0"
|
resolution: "@aws-sdk/credential-provider-ini@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/credential-provider-env": 3.222.0
|
"@aws-sdk/credential-provider-env": 3.222.0
|
||||||
"@aws-sdk/credential-provider-imds": 3.222.0
|
"@aws-sdk/credential-provider-imds": 3.222.0
|
||||||
"@aws-sdk/credential-provider-sso": 3.222.0
|
"@aws-sdk/credential-provider-sso": 3.223.0
|
||||||
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: eac19a9b52066f76cf23bee102369df7d50097dfee3be14b12c2e178c16868acd1a79b13c00d3e3ac40d2fbc14b4e2b06119d0c51c5d875c6be3606c33514d62
|
checksum: f407fe591999f1da1d5580b182af261ceeb4455da9a53d18ae871c9cf244e6e72fa10ef28036419790e2b5787d64c5de5b4daf4c7f69acb866894410baa880d0
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/credential-provider-node@npm:3.222.0":
|
"@aws-sdk/credential-provider-node@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/credential-provider-node@npm:3.222.0"
|
resolution: "@aws-sdk/credential-provider-node@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/credential-provider-env": 3.222.0
|
"@aws-sdk/credential-provider-env": 3.222.0
|
||||||
"@aws-sdk/credential-provider-imds": 3.222.0
|
"@aws-sdk/credential-provider-imds": 3.222.0
|
||||||
"@aws-sdk/credential-provider-ini": 3.222.0
|
"@aws-sdk/credential-provider-ini": 3.223.0
|
||||||
"@aws-sdk/credential-provider-process": 3.222.0
|
"@aws-sdk/credential-provider-process": 3.222.0
|
||||||
"@aws-sdk/credential-provider-sso": 3.222.0
|
"@aws-sdk/credential-provider-sso": 3.223.0
|
||||||
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: f17ce6c9b45d48d9bebd63766b5d85e45f6a1d50b02bea4784d0055269a0f5c05e5ba343c6b138cd29086b94c6bb4511568e9fb59f340f3988526b2d7950cb4c
|
checksum: 6ce5f88f75a6e879344ea76fa2b390c779d74f1b3657fa15367b15797b09d9713ef0d2f14c95421254a6bc0b8bde1acd2634978a6549e02a74c33160ae6130fd
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -348,17 +344,17 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/credential-provider-sso@npm:3.222.0":
|
"@aws-sdk/credential-provider-sso@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/credential-provider-sso@npm:3.222.0"
|
resolution: "@aws-sdk/credential-provider-sso@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/client-sso": 3.222.0
|
"@aws-sdk/client-sso": 3.223.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
||||||
"@aws-sdk/token-providers": 3.222.0
|
"@aws-sdk/token-providers": 3.223.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: 8e0a39a722fd6548b9758ab4c711eac9128a64bae1fa9bfce5f0b92c2df34883fdcd544c9a48f501d3a7b695e6d0b51a9b5e1be1b7eac626a1818860cfc86072
|
checksum: 4593a94dc86ef7218517061cf875285c2c6087f1d4a1199442055e6165701f11f9921612a04ab3c1b3f29b3132d46a8ce8cd26070fad132509e20eca1b89f217
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -374,25 +370,25 @@ __metadata:
|
|||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/credential-providers@npm:^3.186.0":
|
"@aws-sdk/credential-providers@npm:^3.186.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/credential-providers@npm:3.222.0"
|
resolution: "@aws-sdk/credential-providers@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/client-cognito-identity": 3.222.0
|
"@aws-sdk/client-cognito-identity": 3.223.0
|
||||||
"@aws-sdk/client-sso": 3.222.0
|
"@aws-sdk/client-sso": 3.223.0
|
||||||
"@aws-sdk/client-sts": 3.222.0
|
"@aws-sdk/client-sts": 3.223.0
|
||||||
"@aws-sdk/credential-provider-cognito-identity": 3.222.0
|
"@aws-sdk/credential-provider-cognito-identity": 3.223.0
|
||||||
"@aws-sdk/credential-provider-env": 3.222.0
|
"@aws-sdk/credential-provider-env": 3.222.0
|
||||||
"@aws-sdk/credential-provider-imds": 3.222.0
|
"@aws-sdk/credential-provider-imds": 3.222.0
|
||||||
"@aws-sdk/credential-provider-ini": 3.222.0
|
"@aws-sdk/credential-provider-ini": 3.223.0
|
||||||
"@aws-sdk/credential-provider-node": 3.222.0
|
"@aws-sdk/credential-provider-node": 3.223.0
|
||||||
"@aws-sdk/credential-provider-process": 3.222.0
|
"@aws-sdk/credential-provider-process": 3.222.0
|
||||||
"@aws-sdk/credential-provider-sso": 3.222.0
|
"@aws-sdk/credential-provider-sso": 3.223.0
|
||||||
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
"@aws-sdk/credential-provider-web-identity": 3.222.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: a6c159abbc210d62ed7d1153278b423595493583f53ec2a9143b402ee149cc1ae39be41615c76c3b658e1e9f70e89019a594c8e7a6a320cf7ea37443714a79ac
|
checksum: 289d043f41460751e90c3adc323f3a56e517f67c0a7f8889249e0969b3302f19d093eef4a10d3528bdf34f1043f95fa41555ed5c91af4d2ca636cded1775c81c
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -678,16 +674,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/token-providers@npm:3.222.0":
|
"@aws-sdk/token-providers@npm:3.223.0":
|
||||||
version: 3.222.0
|
version: 3.223.0
|
||||||
resolution: "@aws-sdk/token-providers@npm:3.222.0"
|
resolution: "@aws-sdk/token-providers@npm:3.223.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@aws-sdk/client-sso-oidc": 3.222.0
|
"@aws-sdk/client-sso-oidc": 3.223.0
|
||||||
"@aws-sdk/property-provider": 3.222.0
|
"@aws-sdk/property-provider": 3.222.0
|
||||||
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
"@aws-sdk/shared-ini-file-loader": 3.222.0
|
||||||
"@aws-sdk/types": 3.222.0
|
"@aws-sdk/types": 3.222.0
|
||||||
tslib: ^2.3.1
|
tslib: ^2.3.1
|
||||||
checksum: e0d2d9af50570ca1e9ae4cfe32889a9146a0e49ce3004dfc4d5305ba0f64b7561da95d09ccaf18927638417d3bd1eb9772cb58256aef242beab03a56e4e68883
|
checksum: 08d724bc685b90761159b449413c9dddb581cc61cd982ee9a189e8682d1a703acc70663beec2ae31d1ebf6fe9a86480b63fb65da531e35b2e8772a2c3906969f
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@@ -819,16 +815,6 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@aws-sdk/util-retry@npm:3.222.0":
|
|
||||||
version: 3.222.0
|
|
||||||
resolution: "@aws-sdk/util-retry@npm:3.222.0"
|
|
||||||
dependencies:
|
|
||||||
"@aws-sdk/service-error-classification": 3.222.0
|
|
||||||
tslib: ^2.3.1
|
|
||||||
checksum: d4b38a23a310d44d211db2cfb2ae53ef41cf805308d08e56d9ca786fc69fd6b244f331d40ea35023bbc53625c7b2c1f4fab9fabd32d0a10396d4359ac50eff09
|
|
||||||
languageName: node
|
|
||||||
linkType: hard
|
|
||||||
|
|
||||||
"@aws-sdk/util-uri-escape@npm:3.201.0":
|
"@aws-sdk/util-uri-escape@npm:3.201.0":
|
||||||
version: 3.201.0
|
version: 3.201.0
|
||||||
resolution: "@aws-sdk/util-uri-escape@npm:3.201.0"
|
resolution: "@aws-sdk/util-uri-escape@npm:3.201.0"
|
||||||
@@ -918,7 +904,16 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@bot-whatsapp/bot@*, @bot-whatsapp/bot@workspace:packages/bot":
|
"@bot-whatsapp/bot@npm:*":
|
||||||
|
version: 0.0.1
|
||||||
|
resolution: "@bot-whatsapp/bot@npm:0.0.1"
|
||||||
|
dependencies:
|
||||||
|
dotenv: ^16.0.3
|
||||||
|
checksum: 4a9e6e4e3793149f65a569a2b672a6c71aa5ca34e169ca2230b4617c268ee0cd68a9bf10311f7a856a514a55e63fba97c2257f796056c25c3881646cebb18107
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@bot-whatsapp/bot@workspace:packages/bot":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@bot-whatsapp/bot@workspace:packages/bot"
|
resolution: "@bot-whatsapp/bot@workspace:packages/bot"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -930,7 +925,16 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@bot-whatsapp/cli@*, @bot-whatsapp/cli@workspace:packages/cli":
|
"@bot-whatsapp/cli@npm:*":
|
||||||
|
version: 0.0.1
|
||||||
|
resolution: "@bot-whatsapp/cli@npm:0.0.1"
|
||||||
|
bin:
|
||||||
|
bot: bin/cli.js
|
||||||
|
checksum: f58373f5cc4014bc22664452d20ec676645d04ba95c4ea8525db1a6adafa3b183e403c72c8ff670670bad8b56be6da098cc6767c1bffffa086b76e987cf79e86
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@bot-whatsapp/cli@workspace:packages/cli":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@bot-whatsapp/cli@workspace:packages/cli"
|
resolution: "@bot-whatsapp/cli@workspace:packages/cli"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -943,17 +947,38 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@bot-whatsapp/database@*, @bot-whatsapp/database@workspace:packages/database":
|
"@bot-whatsapp/database@npm:*":
|
||||||
|
version: 0.0.1
|
||||||
|
resolution: "@bot-whatsapp/database@npm:0.0.1"
|
||||||
|
dependencies:
|
||||||
|
dotenv: ^16.0.3
|
||||||
|
mongodb: ^4.11.0
|
||||||
|
checksum: cc86a9a1117d5a3b4092f42cb138f8d04f6cacf0b9d6994a2c6f8ead7317c1d4acd8aee824ad4dfb4d6294646d1a32a49d37847d3b44bd35df86cdc18af675c4
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@bot-whatsapp/database@workspace:packages/database":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@bot-whatsapp/database@workspace:packages/database"
|
resolution: "@bot-whatsapp/database@workspace:packages/database"
|
||||||
dependencies:
|
dependencies:
|
||||||
dotenv: ^16.0.3
|
dotenv: ^16.0.3
|
||||||
mongodb: ^4.11.0
|
mongodb: ^4.11.0
|
||||||
mysql2: ^2.3.3
|
mysql2: ^2.3.3
|
||||||
|
stormdb: ^0.6.0
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"@bot-whatsapp/provider@*, @bot-whatsapp/provider@workspace:packages/provider":
|
"@bot-whatsapp/provider@npm:*":
|
||||||
|
version: 0.0.1
|
||||||
|
resolution: "@bot-whatsapp/provider@npm:0.0.1"
|
||||||
|
dependencies:
|
||||||
|
"@bot-whatsapp/bot": "*"
|
||||||
|
qr-image: ^3.2.0
|
||||||
|
checksum: 01ffa3f06ed90cffd4157b2c81b7ed705ffd708ca49cb2b051de767959b97c100b84ab0ae2f1c46407007e42e3bbb29ad04e074829041b048317939ebf6569ca
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
|
"@bot-whatsapp/provider@workspace:packages/provider":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@bot-whatsapp/provider@workspace:packages/provider"
|
resolution: "@bot-whatsapp/provider@workspace:packages/provider"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -988,6 +1013,7 @@ __metadata:
|
|||||||
rollup: ^3.2.3
|
rollup: ^3.2.3
|
||||||
rollup-plugin-cleanup: ^3.2.1
|
rollup-plugin-cleanup: ^3.2.1
|
||||||
rollup-plugin-copy: ^3.4.0
|
rollup-plugin-copy: ^3.4.0
|
||||||
|
semver: ^7.3.8
|
||||||
standard-version: ^9.5.0
|
standard-version: ^9.5.0
|
||||||
uvu: ^0.5.6
|
uvu: ^0.5.6
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
@@ -3142,7 +3168,7 @@ __metadata:
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@bot-whatsapp/cli": "*"
|
"@bot-whatsapp/cli": "*"
|
||||||
bin:
|
bin:
|
||||||
bot: ./lib/bin/bundle.create.cjs
|
create-bot-whatsapp: ./bin/create.js
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@@ -7650,7 +7676,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7":
|
"semver@npm:^7.0.0, semver@npm:^7.1.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8":
|
||||||
version: 7.3.8
|
version: 7.3.8
|
||||||
resolution: "semver@npm:7.3.8"
|
resolution: "semver@npm:7.3.8"
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -7907,6 +7933,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"stormdb@npm:^0.6.0":
|
||||||
|
version: 0.6.0
|
||||||
|
resolution: "stormdb@npm:0.6.0"
|
||||||
|
checksum: 5974329c1c5af9f0829a5551bef8476dcf6df921f4b9e135acb96863ed0d20ece9bec32d9fd42b84b5d76de30c7d20d3095d14cc75c8f0777f4799b422bd4053
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"streamsearch@npm:^1.1.0":
|
"streamsearch@npm:^1.1.0":
|
||||||
version: 1.1.0
|
version: 1.1.0
|
||||||
resolution: "streamsearch@npm:1.1.0"
|
resolution: "streamsearch@npm:1.1.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user