mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 12:39:24 +00:00
fix(bot): ⚡ working nested new flow
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const { flatObject } = require('../../utils/flattener')
|
const { flatObject } = require('../../utils/flattener')
|
||||||
const { generateRef } = require('../../utils/hash')
|
const { generateRef } = require('../../utils/hash')
|
||||||
|
const { addChild } = require('./addChild')
|
||||||
const { toJson } = require('./toJson')
|
const { toJson } = require('./toJson')
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -28,9 +29,21 @@ const addAnswer =
|
|||||||
delay: typeof options?.delay === 'number' ? options?.delay : 0,
|
delay: typeof options?.delay === 'number' ? options?.delay : 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
const getNested = () => ({
|
const getNested = () => {
|
||||||
nested: Array.isArray(nested) ? nested : [],
|
let flatNested = []
|
||||||
})
|
if (Array.isArray(nested)) {
|
||||||
|
for (const iterator of nested) {
|
||||||
|
flatNested = [...flatNested, ...addChild(iterator)]
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
nested: flatNested,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
nested: addChild(nested),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Esta funcion aplana y busca los callback anidados de los hijos
|
* Esta funcion aplana y busca los callback anidados de los hijos
|
||||||
|
|||||||
Reference in New Issue
Block a user