working child flow

This commit is contained in:
Leifer Mendez
2022-11-23 20:56:17 +01:00
parent 368bf29e63
commit f6d70b4f7d
4 changed files with 6 additions and 4 deletions

View File

@@ -2,4 +2,5 @@
- [ ] Posibilidad de en el capture meter todo un nuevo CTX de FLOW .addAnswer('Marca la opcion',{capture:true, join:CTX})
- [ ] .addKeyword('1') no funciona con 1 caracter
- [ ] sensitivy viene activado por defecto
- [ ] colocar mensaje esperando conectando whatsapp (provider)
- [ ] colocar mensaje esperando conectando whatsapp (provider)
- [ ] fallback respuesta en hijo

View File

@@ -77,7 +77,7 @@ class CoreClass {
if (prevMsg?.options?.nested?.length) {
const nestedRef = prevMsg.options.nested
const flowStandalone = nestedRef.map((f) => ({
...this.flowClass.findBySerialize(f),
...nestedRef.find((r) => r.refSerialize === f.refSerialize),
}))
msgToSend = this.flowClass.find(body, false, flowStandalone) || []

View File

@@ -12,6 +12,7 @@ const toSerialize = (flowJson) => {
...row,
refSerialize: `${generateRefSerialize({
index,
keyword: row.keyword,
answer: row.answer,
})}`,
}))

View File

@@ -15,10 +15,10 @@ const generateRef = (prefix = false) => {
* @param {*} param0
* @returns
*/
const generateRefSerialize = ({ index, answer }) =>
const generateRefSerialize = ({ index, answer, keyword }) =>
crypto
.createHash('md5')
.update(JSON.stringify({ index, answer }))
.update(JSON.stringify({ index, answer, keyword }))
.digest('hex')
module.exports = { generateRef, generateRefSerialize }