Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flow builder: tracking with Hubtype analytics events (#2537)
<!-- _Set as [Draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/) if it's not ready to be merged_. [PR best practices Reference](https://blog.codeminer42.com/on-writing-a-great-pull-request-37c60ce6f31d/) --> ## Description Add tracking to each FlowBuilder action option. Events are created which are those defined in hubtype-analytics. Although I have put as a dependency @botonic/plugin-hubtype-analytics I am only using the types to create the events. The call to the trackEvent function will enter as a FlowBuilder dependency. <!-- - Must be clear and concise (2-3 lines). - Don't make reviewers think. The description should explain what has been implemented or what it's used for. If a pull request is not descriptive, people will be lazy or not willing to spend much time on it. - Be explicit with the names (don't abbreviate and don't use acronyms that can lead to misleading understanding). - If you consider it appropriate, include the steps to try the new features. --> ## Context The most important thing in this PR is to generate the concrete event at each point. When I tried to do this I saw that the files were getting too big and I applied a refactor to separate everything better. So I have transformed the action file into a folder and created a file for the way to get the node: by user input, by intent, by keyword and another one with the logic to call the trackEvent function that will not always be defined in the flow builder plugin <!-- - What problem is trying to solve this pull request? - What are the reasons or business goals of this implementation? - Can I provide visual resources or links to understand better the situation? --> ## Approach taken / Explain the design Apply a refactor in the action splitting it into several files: - one with the logic to do the tracking function, - one for the intents logic, creating the events and doing the tracking - one for the keywords logic, creating the events and doing the tracking It also refactors the doHandoff function, making a request to obtain the availability of the queue and do the corresponding tracking. <!-- - Explain what the code does. - If it's a complex solution, try to provide a sketch. --> ## To document / Usage example <!-- - How this is used? - If possible, provide a snippet of code with a usage example. --> ## Testing The flow builder plugin logic is yet to be tested.
- Loading branch information