@botonic/plugin-flow-builder 0.46.2 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/lib/cjs/action/ai-agent-from-user-input.d.ts +3 -0
  2. package/lib/cjs/action/ai-agent-from-user-input.js +23 -0
  3. package/lib/cjs/action/ai-agent-from-user-input.js.map +1 -0
  4. package/lib/cjs/action/context.d.ts +11 -0
  5. package/lib/cjs/action/context.js +17 -0
  6. package/lib/cjs/action/context.js.map +1 -0
  7. package/lib/cjs/action/fallback.d.ts +1 -1
  8. package/lib/cjs/action/first-interaction.d.ts +1 -1
  9. package/lib/cjs/action/first-interaction.js +4 -4
  10. package/lib/cjs/action/first-interaction.js.map +1 -1
  11. package/lib/cjs/action/get-contents.d.ts +3 -0
  12. package/lib/cjs/action/get-contents.js +44 -0
  13. package/lib/cjs/action/get-contents.js.map +1 -0
  14. package/lib/cjs/action/index.d.ts +6 -15
  15. package/lib/cjs/action/index.js +31 -94
  16. package/lib/cjs/action/index.js.map +1 -1
  17. package/lib/cjs/action/knowledge-bases.d.ts +1 -1
  18. package/lib/cjs/action/knowledge-bases.js +3 -3
  19. package/lib/cjs/action/knowledge-bases.js.map +1 -1
  20. package/lib/cjs/action/payload.d.ts +1 -1
  21. package/lib/cjs/api.d.ts +0 -1
  22. package/lib/cjs/api.js +0 -7
  23. package/lib/cjs/api.js.map +1 -1
  24. package/lib/cjs/content-fields/content-fields-base.d.ts +5 -4
  25. package/lib/cjs/content-fields/content-fields-base.js +7 -7
  26. package/lib/cjs/content-fields/content-fields-base.js.map +1 -1
  27. package/lib/cjs/content-fields/flow-ai-agent.d.ts +14 -6
  28. package/lib/cjs/content-fields/flow-ai-agent.js +100 -17
  29. package/lib/cjs/content-fields/flow-ai-agent.js.map +1 -1
  30. package/lib/cjs/content-fields/flow-bot-action.d.ts +4 -2
  31. package/lib/cjs/content-fields/flow-bot-action.js +10 -5
  32. package/lib/cjs/content-fields/flow-bot-action.js.map +1 -1
  33. package/lib/cjs/content-fields/flow-button.d.ts +4 -2
  34. package/lib/cjs/content-fields/flow-button.js +5 -2
  35. package/lib/cjs/content-fields/flow-button.js.map +1 -1
  36. package/lib/cjs/content-fields/flow-capture-user-input.d.ts +4 -3
  37. package/lib/cjs/content-fields/flow-capture-user-input.js +7 -5
  38. package/lib/cjs/content-fields/flow-capture-user-input.js.map +1 -1
  39. package/lib/cjs/content-fields/flow-carousel.d.ts +4 -3
  40. package/lib/cjs/content-fields/flow-carousel.js +11 -7
  41. package/lib/cjs/content-fields/flow-carousel.js.map +1 -1
  42. package/lib/cjs/content-fields/flow-channel-conditional.d.ts +5 -4
  43. package/lib/cjs/content-fields/flow-channel-conditional.js +10 -7
  44. package/lib/cjs/content-fields/flow-channel-conditional.js.map +1 -1
  45. package/lib/cjs/content-fields/flow-country-conditional.d.ts +5 -4
  46. package/lib/cjs/content-fields/flow-country-conditional.js +11 -7
  47. package/lib/cjs/content-fields/flow-country-conditional.js.map +1 -1
  48. package/lib/cjs/content-fields/flow-custom-conditional.d.ts +5 -4
  49. package/lib/cjs/content-fields/flow-custom-conditional.js +11 -7
  50. package/lib/cjs/content-fields/flow-custom-conditional.js.map +1 -1
  51. package/lib/cjs/content-fields/flow-element.d.ts +4 -4
  52. package/lib/cjs/content-fields/flow-element.js +7 -3
  53. package/lib/cjs/content-fields/flow-element.js.map +1 -1
  54. package/lib/cjs/content-fields/flow-go-to-flow.d.ts +3 -3
  55. package/lib/cjs/content-fields/flow-go-to-flow.js +7 -15
  56. package/lib/cjs/content-fields/flow-go-to-flow.js.map +1 -1
  57. package/lib/cjs/content-fields/flow-handoff.d.ts +5 -4
  58. package/lib/cjs/content-fields/flow-handoff.js +11 -7
  59. package/lib/cjs/content-fields/flow-handoff.js.map +1 -1
  60. package/lib/cjs/content-fields/flow-image.d.ts +4 -3
  61. package/lib/cjs/content-fields/flow-image.js +8 -4
  62. package/lib/cjs/content-fields/flow-image.js.map +1 -1
  63. package/lib/cjs/content-fields/flow-knowledge-base.d.ts +4 -3
  64. package/lib/cjs/content-fields/flow-knowledge-base.js +7 -3
  65. package/lib/cjs/content-fields/flow-knowledge-base.js.map +1 -1
  66. package/lib/cjs/content-fields/flow-queue-status-conditional.d.ts +3 -2
  67. package/lib/cjs/content-fields/flow-queue-status-conditional.js +7 -3
  68. package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +1 -1
  69. package/lib/cjs/content-fields/flow-rating.d.ts +4 -3
  70. package/lib/cjs/content-fields/flow-rating.js +13 -9
  71. package/lib/cjs/content-fields/flow-rating.js.map +1 -1
  72. package/lib/cjs/content-fields/flow-text.d.ts +4 -4
  73. package/lib/cjs/content-fields/flow-text.js +10 -6
  74. package/lib/cjs/content-fields/flow-text.js.map +1 -1
  75. package/lib/cjs/content-fields/flow-video.d.ts +4 -3
  76. package/lib/cjs/content-fields/flow-video.js +8 -4
  77. package/lib/cjs/content-fields/flow-video.js.map +1 -1
  78. package/lib/cjs/content-fields/flow-webview.d.ts +3 -2
  79. package/lib/cjs/content-fields/flow-webview.js +6 -3
  80. package/lib/cjs/content-fields/flow-webview.js.map +1 -1
  81. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +5 -3
  82. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +14 -10
  83. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
  84. package/lib/cjs/content-fields/flow-whatsapp-template.d.ts +5 -3
  85. package/lib/cjs/content-fields/flow-whatsapp-template.js +26 -22
  86. package/lib/cjs/content-fields/flow-whatsapp-template.js.map +1 -1
  87. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +4 -3
  88. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +6 -4
  89. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
  90. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -3
  91. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +7 -5
  92. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
  93. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -3
  94. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +10 -6
  95. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
  96. package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +3 -0
  97. package/lib/cjs/content-fields/whatsapp-button-list/index.js +10 -0
  98. package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +1 -0
  99. package/lib/cjs/filters/index.d.ts +1 -0
  100. package/lib/cjs/filters/index.js +15 -0
  101. package/lib/cjs/filters/index.js.map +1 -1
  102. package/lib/cjs/index.d.ts +1 -1
  103. package/lib/cjs/index.js +4 -8
  104. package/lib/cjs/index.js.map +1 -1
  105. package/lib/cjs/structured-output/flow-builder-content.js.map +1 -0
  106. package/lib/cjs/tracking.js +6 -6
  107. package/lib/cjs/tracking.js.map +1 -1
  108. package/lib/cjs/types.d.ts +1 -1
  109. package/lib/cjs/user-input/capture-user-input-api.js +4 -4
  110. package/lib/cjs/user-input/capture-user-input-api.js.map +1 -1
  111. package/lib/cjs/user-input/index.js +4 -4
  112. package/lib/cjs/user-input/index.js.map +1 -1
  113. package/lib/cjs/user-input/smart-intent.js +2 -2
  114. package/lib/cjs/user-input/smart-intent.js.map +1 -1
  115. package/lib/cjs/utils/ai-agent.d.ts +18 -0
  116. package/lib/cjs/utils/ai-agent.js +177 -0
  117. package/lib/cjs/utils/ai-agent.js.map +1 -0
  118. package/lib/cjs/utils/authentication.d.ts +2 -0
  119. package/lib/cjs/utils/authentication.js +21 -0
  120. package/lib/cjs/utils/authentication.js.map +1 -0
  121. package/lib/cjs/{helpers.d.ts → utils/get-flow-builder-plugin.d.ts} +1 -1
  122. package/lib/cjs/{helpers.js → utils/get-flow-builder-plugin.js} +1 -1
  123. package/lib/cjs/utils/get-flow-builder-plugin.js.map +1 -0
  124. package/lib/cjs/{utils.d.ts → utils/input.d.ts} +1 -2
  125. package/lib/cjs/{utils.js → utils/input.js} +3 -21
  126. package/lib/cjs/utils/input.js.map +1 -0
  127. package/lib/esm/action/ai-agent-from-user-input.d.ts +3 -0
  128. package/lib/esm/action/ai-agent-from-user-input.js +23 -0
  129. package/lib/esm/action/ai-agent-from-user-input.js.map +1 -0
  130. package/lib/esm/action/context.d.ts +11 -0
  131. package/lib/esm/action/context.js +17 -0
  132. package/lib/esm/action/context.js.map +1 -0
  133. package/lib/esm/action/fallback.d.ts +1 -1
  134. package/lib/esm/action/first-interaction.d.ts +1 -1
  135. package/lib/esm/action/first-interaction.js +4 -4
  136. package/lib/esm/action/first-interaction.js.map +1 -1
  137. package/lib/esm/action/get-contents.d.ts +3 -0
  138. package/lib/esm/action/get-contents.js +44 -0
  139. package/lib/esm/action/get-contents.js.map +1 -0
  140. package/lib/esm/action/index.d.ts +6 -15
  141. package/lib/esm/action/index.js +31 -94
  142. package/lib/esm/action/index.js.map +1 -1
  143. package/lib/esm/action/knowledge-bases.d.ts +1 -1
  144. package/lib/esm/action/knowledge-bases.js +3 -3
  145. package/lib/esm/action/knowledge-bases.js.map +1 -1
  146. package/lib/esm/action/payload.d.ts +1 -1
  147. package/lib/esm/api.d.ts +0 -1
  148. package/lib/esm/api.js +0 -7
  149. package/lib/esm/api.js.map +1 -1
  150. package/lib/esm/content-fields/content-fields-base.d.ts +5 -4
  151. package/lib/esm/content-fields/content-fields-base.js +7 -7
  152. package/lib/esm/content-fields/content-fields-base.js.map +1 -1
  153. package/lib/esm/content-fields/flow-ai-agent.d.ts +14 -6
  154. package/lib/esm/content-fields/flow-ai-agent.js +100 -17
  155. package/lib/esm/content-fields/flow-ai-agent.js.map +1 -1
  156. package/lib/esm/content-fields/flow-bot-action.d.ts +4 -2
  157. package/lib/esm/content-fields/flow-bot-action.js +10 -5
  158. package/lib/esm/content-fields/flow-bot-action.js.map +1 -1
  159. package/lib/esm/content-fields/flow-button.d.ts +4 -2
  160. package/lib/esm/content-fields/flow-button.js +5 -2
  161. package/lib/esm/content-fields/flow-button.js.map +1 -1
  162. package/lib/esm/content-fields/flow-capture-user-input.d.ts +4 -3
  163. package/lib/esm/content-fields/flow-capture-user-input.js +7 -5
  164. package/lib/esm/content-fields/flow-capture-user-input.js.map +1 -1
  165. package/lib/esm/content-fields/flow-carousel.d.ts +4 -3
  166. package/lib/esm/content-fields/flow-carousel.js +11 -7
  167. package/lib/esm/content-fields/flow-carousel.js.map +1 -1
  168. package/lib/esm/content-fields/flow-channel-conditional.d.ts +5 -4
  169. package/lib/esm/content-fields/flow-channel-conditional.js +10 -7
  170. package/lib/esm/content-fields/flow-channel-conditional.js.map +1 -1
  171. package/lib/esm/content-fields/flow-country-conditional.d.ts +5 -4
  172. package/lib/esm/content-fields/flow-country-conditional.js +11 -7
  173. package/lib/esm/content-fields/flow-country-conditional.js.map +1 -1
  174. package/lib/esm/content-fields/flow-custom-conditional.d.ts +5 -4
  175. package/lib/esm/content-fields/flow-custom-conditional.js +11 -7
  176. package/lib/esm/content-fields/flow-custom-conditional.js.map +1 -1
  177. package/lib/esm/content-fields/flow-element.d.ts +4 -4
  178. package/lib/esm/content-fields/flow-element.js +7 -3
  179. package/lib/esm/content-fields/flow-element.js.map +1 -1
  180. package/lib/esm/content-fields/flow-go-to-flow.d.ts +3 -3
  181. package/lib/esm/content-fields/flow-go-to-flow.js +7 -15
  182. package/lib/esm/content-fields/flow-go-to-flow.js.map +1 -1
  183. package/lib/esm/content-fields/flow-handoff.d.ts +5 -4
  184. package/lib/esm/content-fields/flow-handoff.js +11 -7
  185. package/lib/esm/content-fields/flow-handoff.js.map +1 -1
  186. package/lib/esm/content-fields/flow-image.d.ts +4 -3
  187. package/lib/esm/content-fields/flow-image.js +8 -4
  188. package/lib/esm/content-fields/flow-image.js.map +1 -1
  189. package/lib/esm/content-fields/flow-knowledge-base.d.ts +4 -3
  190. package/lib/esm/content-fields/flow-knowledge-base.js +7 -3
  191. package/lib/esm/content-fields/flow-knowledge-base.js.map +1 -1
  192. package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +3 -2
  193. package/lib/esm/content-fields/flow-queue-status-conditional.js +7 -3
  194. package/lib/esm/content-fields/flow-queue-status-conditional.js.map +1 -1
  195. package/lib/esm/content-fields/flow-rating.d.ts +4 -3
  196. package/lib/esm/content-fields/flow-rating.js +13 -9
  197. package/lib/esm/content-fields/flow-rating.js.map +1 -1
  198. package/lib/esm/content-fields/flow-text.d.ts +4 -4
  199. package/lib/esm/content-fields/flow-text.js +10 -6
  200. package/lib/esm/content-fields/flow-text.js.map +1 -1
  201. package/lib/esm/content-fields/flow-video.d.ts +4 -3
  202. package/lib/esm/content-fields/flow-video.js +8 -4
  203. package/lib/esm/content-fields/flow-video.js.map +1 -1
  204. package/lib/esm/content-fields/flow-webview.d.ts +3 -2
  205. package/lib/esm/content-fields/flow-webview.js +6 -3
  206. package/lib/esm/content-fields/flow-webview.js.map +1 -1
  207. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +5 -3
  208. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +14 -10
  209. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
  210. package/lib/esm/content-fields/flow-whatsapp-template.d.ts +5 -3
  211. package/lib/esm/content-fields/flow-whatsapp-template.js +26 -22
  212. package/lib/esm/content-fields/flow-whatsapp-template.js.map +1 -1
  213. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +4 -3
  214. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +6 -4
  215. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
  216. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -3
  217. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +7 -5
  218. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
  219. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -3
  220. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +10 -6
  221. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
  222. package/lib/esm/content-fields/whatsapp-button-list/index.d.ts +3 -0
  223. package/lib/esm/content-fields/whatsapp-button-list/index.js +10 -0
  224. package/lib/esm/content-fields/whatsapp-button-list/index.js.map +1 -0
  225. package/lib/esm/filters/index.d.ts +1 -0
  226. package/lib/esm/filters/index.js +15 -0
  227. package/lib/esm/filters/index.js.map +1 -1
  228. package/lib/esm/index.d.ts +1 -1
  229. package/lib/esm/index.js +4 -8
  230. package/lib/esm/index.js.map +1 -1
  231. package/lib/esm/structured-output/flow-builder-content.js.map +1 -0
  232. package/lib/esm/tracking.js +6 -6
  233. package/lib/esm/tracking.js.map +1 -1
  234. package/lib/esm/types.d.ts +1 -1
  235. package/lib/esm/user-input/capture-user-input-api.js +4 -4
  236. package/lib/esm/user-input/capture-user-input-api.js.map +1 -1
  237. package/lib/esm/user-input/index.js +4 -4
  238. package/lib/esm/user-input/index.js.map +1 -1
  239. package/lib/esm/user-input/smart-intent.js +2 -2
  240. package/lib/esm/user-input/smart-intent.js.map +1 -1
  241. package/lib/esm/utils/ai-agent.d.ts +18 -0
  242. package/lib/esm/utils/ai-agent.js +177 -0
  243. package/lib/esm/utils/ai-agent.js.map +1 -0
  244. package/lib/esm/utils/authentication.d.ts +2 -0
  245. package/lib/esm/utils/authentication.js +21 -0
  246. package/lib/esm/utils/authentication.js.map +1 -0
  247. package/lib/esm/{helpers.d.ts → utils/get-flow-builder-plugin.d.ts} +1 -1
  248. package/lib/esm/{helpers.js → utils/get-flow-builder-plugin.js} +1 -1
  249. package/lib/esm/utils/get-flow-builder-plugin.js.map +1 -0
  250. package/lib/esm/{utils.d.ts → utils/input.d.ts} +1 -2
  251. package/lib/esm/{utils.js → utils/input.js} +3 -21
  252. package/lib/esm/utils/input.js.map +1 -0
  253. package/package.json +2 -2
  254. package/src/action/ai-agent-from-user-input.ts +35 -0
  255. package/src/action/context.ts +29 -0
  256. package/src/action/fallback.ts +1 -1
  257. package/src/action/first-interaction.ts +4 -4
  258. package/src/action/get-contents.ts +51 -0
  259. package/src/action/index.tsx +42 -136
  260. package/src/action/knowledge-bases.ts +5 -2
  261. package/src/action/payload.ts +1 -1
  262. package/src/api.ts +0 -8
  263. package/src/content-fields/content-fields-base.ts +11 -9
  264. package/src/content-fields/flow-ai-agent.tsx +166 -31
  265. package/src/content-fields/flow-bot-action.tsx +17 -6
  266. package/src/content-fields/flow-button.tsx +8 -3
  267. package/src/content-fields/flow-capture-user-input.tsx +9 -6
  268. package/src/content-fields/flow-carousel.tsx +21 -11
  269. package/src/content-fields/flow-channel-conditional.tsx +16 -9
  270. package/src/content-fields/flow-country-conditional.tsx +17 -9
  271. package/src/content-fields/flow-custom-conditional.tsx +17 -9
  272. package/src/content-fields/flow-element.tsx +10 -11
  273. package/src/content-fields/flow-go-to-flow.tsx +10 -24
  274. package/src/content-fields/flow-handoff.tsx +21 -10
  275. package/src/content-fields/flow-image.tsx +11 -5
  276. package/src/content-fields/flow-knowledge-base.tsx +11 -5
  277. package/src/content-fields/flow-queue-status-conditional.tsx +13 -5
  278. package/src/content-fields/flow-rating.tsx +16 -16
  279. package/src/content-fields/flow-text.tsx +13 -7
  280. package/src/content-fields/flow-video.tsx +11 -5
  281. package/src/content-fields/flow-webview.tsx +12 -5
  282. package/src/content-fields/flow-whatsapp-cta-url-button.tsx +16 -12
  283. package/src/content-fields/flow-whatsapp-template.tsx +28 -24
  284. package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx +8 -5
  285. package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx +8 -6
  286. package/src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx +15 -15
  287. package/src/content-fields/whatsapp-button-list/index.ts +3 -0
  288. package/src/filters/index.ts +20 -0
  289. package/src/index.ts +3 -14
  290. package/src/tracking.ts +1 -1
  291. package/src/types.ts +1 -1
  292. package/src/user-input/capture-user-input-api.ts +2 -2
  293. package/src/user-input/index.ts +1 -1
  294. package/src/user-input/smart-intent.ts +1 -1
  295. package/src/utils/ai-agent.ts +233 -0
  296. package/src/utils/authentication.ts +23 -0
  297. package/src/{helpers.ts → utils/get-flow-builder-plugin.ts} +1 -1
  298. package/src/{utils.ts → utils/input.ts} +3 -23
  299. package/lib/cjs/action/ai-agent/index.d.ts +0 -3
  300. package/lib/cjs/action/ai-agent/index.js +0 -94
  301. package/lib/cjs/action/ai-agent/index.js.map +0 -1
  302. package/lib/cjs/action/ai-agent/structured-output/flow-builder-content.js.map +0 -1
  303. package/lib/cjs/helpers.js.map +0 -1
  304. package/lib/cjs/utils.js.map +0 -1
  305. package/lib/esm/action/ai-agent/index.d.ts +0 -3
  306. package/lib/esm/action/ai-agent/index.js +0 -94
  307. package/lib/esm/action/ai-agent/index.js.map +0 -1
  308. package/lib/esm/action/ai-agent/structured-output/flow-builder-content.js.map +0 -1
  309. package/lib/esm/helpers.js.map +0 -1
  310. package/lib/esm/utils.js.map +0 -1
  311. package/src/action/ai-agent/index.ts +0 -138
  312. /package/lib/cjs/{action/ai-agent/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
  313. /package/lib/cjs/{action/ai-agent/structured-output → structured-output}/flow-builder-content.js +0 -0
  314. /package/lib/esm/{action/ai-agent/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
  315. /package/lib/esm/{action/ai-agent/structured-output → structured-output}/flow-builder-content.js +0 -0
  316. /package/src/{action/ai-agent/structured-output → structured-output}/flow-builder-content.ts +0 -0
@@ -1,5 +1,4 @@
1
1
  import type {
2
- ActionRequest,
3
2
  WhatsappButtonListRowProps,
4
3
  WhatsappButtonListSectionProps,
5
4
  } from '@botonic/react'
@@ -29,15 +28,18 @@ export class FlowWhatsappButtonListSection extends ContentFieldsBase {
29
28
  return newButton
30
29
  }
31
30
 
32
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
33
- async trackFlow(_request: ActionRequest): Promise<void> {
34
- // Not apply for this content, because it is a child of the FlowWhatsappButtonList content
31
+ async trackFlow(): Promise<void> {
32
+ return
35
33
  }
36
34
 
37
- toBotonic(sectionIndex: number): WhatsappButtonListSectionProps {
35
+ async processContent(): Promise<void> {
36
+ return
37
+ }
38
+
39
+ renderSection(sectionIndex: number): WhatsappButtonListSectionProps {
38
40
  const rows = this.rows.reduce(
39
41
  (acc: WhatsappButtonListRowProps[], row, rowIndex) => {
40
- const botonicRow = row.toBotonic(rowIndex, sectionIndex)
42
+ const botonicRow = row.renderRow(rowIndex, sectionIndex)
41
43
  if (botonicRow) {
42
44
  acc.push(botonicRow)
43
45
  }
@@ -1,10 +1,5 @@
1
- import { isWhatsapp } from '@botonic/core'
2
- import {
3
- type ActionRequest,
4
- Button,
5
- Text,
6
- WhatsappButtonList,
7
- } from '@botonic/react'
1
+ import { type BotContext, isWhatsapp } from '@botonic/core'
2
+ import { Button, Text, WhatsappButtonList } from '@botonic/react'
8
3
 
9
4
  import type { FlowBuilderApi } from '../../api'
10
5
  import { trackOneContent } from '../../tracking'
@@ -41,14 +36,19 @@ export class FlowWhatsappButtonList extends ContentFieldsBase {
41
36
  return newWhatsappButtonList
42
37
  }
43
38
 
44
- async trackFlow(request: ActionRequest): Promise<void> {
45
- await trackOneContent(request, this)
39
+ async trackFlow(botContext: BotContext): Promise<void> {
40
+ await trackOneContent(botContext, this)
46
41
  }
47
42
 
48
- toBotonic(id: string, request: ActionRequest): JSX.Element {
49
- const replacedText = this.replaceVariables(this.text, request)
43
+ async processContent(botContext: BotContext): Promise<void> {
44
+ await this.trackFlow(botContext)
45
+ return
46
+ }
47
+
48
+ toBotonic(botContext: BotContext): JSX.Element {
49
+ const replacedText = this.replaceVariables(this.text, botContext)
50
50
 
51
- if (!isWhatsapp(request.session)) {
51
+ if (!isWhatsapp(botContext.session)) {
52
52
  const rows = this.sections.flatMap(section => section.rows)
53
53
  const buttons = rows.map(row => (
54
54
  <Button key={row.id} payload={row.targetId}>
@@ -66,13 +66,13 @@ export class FlowWhatsappButtonList extends ContentFieldsBase {
66
66
 
67
67
  return (
68
68
  <WhatsappButtonList
69
- key={id}
69
+ key={this.id}
70
70
  body={replacedText}
71
71
  button={this.listButtonText}
72
72
  sections={this.sections.map((section, sectionIndex) =>
73
- section.toBotonic(sectionIndex)
73
+ section.renderSection(sectionIndex)
74
74
  )}
75
- ></WhatsappButtonList>
75
+ />
76
76
  )
77
77
  }
78
78
  }
@@ -0,0 +1,3 @@
1
+ export { FlowWhatsappButtonList } from './flow-whatsapp-button-list'
2
+ export { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'
3
+ export { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'
@@ -2,6 +2,7 @@ import type { BotContext } from '@botonic/core'
2
2
 
3
3
  import type { FlowContent } from '../content-fields'
4
4
  import type { ContentFilter } from '../types'
5
+ import { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'
5
6
 
6
7
  interface ContentFilterExecutorOptions {
7
8
  filters: ContentFilter[]
@@ -25,3 +26,22 @@ export class ContentFilterExecutor {
25
26
  return content
26
27
  }
27
28
  }
29
+
30
+ export async function filterContents(
31
+ request: BotContext,
32
+ contents: FlowContent[]
33
+ ): Promise<FlowContent[]> {
34
+ const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
35
+ const contentFilters = flowBuilderPlugin.contentFilters
36
+ const contentFilterExecutor = new ContentFilterExecutor({
37
+ filters: contentFilters,
38
+ })
39
+
40
+ const filteredContents: FlowContent[] = []
41
+ for (const content of contents) {
42
+ const filteredContent = await contentFilterExecutor.filter(request, content)
43
+ filteredContents.push(filteredContent)
44
+ }
45
+
46
+ return filteredContents
47
+ }
package/src/index.ts CHANGED
@@ -16,11 +16,10 @@ import {
16
16
  SEPARATOR,
17
17
  SOURCE_INFO_SEPARATOR,
18
18
  } from './constants'
19
- import { type FlowContent, FlowGoToFlow } from './content-fields'
19
+ import type { FlowContent } from './content-fields'
20
20
  import {
21
21
  type HtBotActionNode,
22
22
  type HtFlowBuilderData,
23
- type HtGoToFlow,
24
23
  type HtNodeWithContent,
25
24
  HtNodeWithContentType,
26
25
  } from './content-fields/hubtype-fields'
@@ -39,7 +38,8 @@ import {
39
38
  } from './types'
40
39
  import { getNextPayloadByUserInput } from './user-input'
41
40
  import type { SmartIntentsInferenceConfig } from './user-input/smart-intent'
42
- import { inputHasTextOrTranscript, resolveGetAccessToken } from './utils'
41
+ import { resolveGetAccessToken } from './utils/authentication'
42
+ import { inputHasTextOrTranscript } from './utils/input'
43
43
 
44
44
  // TODO: Create a proper service to wrap all calls and allow api versioning
45
45
 
@@ -158,17 +158,6 @@ export default class BotonicPluginFlowBuilder implements Plugin {
158
158
  // the case that a BotAction has a payload equals to EMPTY_PAYLOAD
159
159
  this.convertWhatsappAiAgentEmptyPayloads(request)
160
160
  }
161
-
162
- if (this.cmsApi.isGoToFlow(request.input.payload)) {
163
- const cmsGoToFlow = this.cmsApi.getNodeById<HtGoToFlow>(
164
- request.input.payload
165
- )
166
- await FlowGoToFlow.resolveToAiAgentsFlow(
167
- request,
168
- cmsGoToFlow,
169
- this.cmsApi
170
- )
171
- }
172
161
  }
173
162
  }
174
163
 
package/src/tracking.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  type HtNodeWithContent,
9
9
  HtNodeWithContentType,
10
10
  } from './content-fields/hubtype-fields'
11
- import { getFlowBuilderPlugin } from './helpers'
11
+ import { getFlowBuilderPlugin } from './utils/get-flow-builder-plugin'
12
12
 
13
13
  export async function trackEvent(
14
14
  request: ActionRequest,
package/src/types.ts CHANGED
@@ -7,12 +7,12 @@ import {
7
7
  type PluginPreRequest,
8
8
  type ResolvedPlugins,
9
9
  } from '@botonic/core'
10
- import type { FlowBuilderContentMessage } from './action/ai-agent/structured-output/flow-builder-content'
11
10
  import type { FlowContent } from './content-fields'
12
11
  import type {
13
12
  HtFlowBuilderData,
14
13
  HtRatingButton,
15
14
  } from './content-fields/hubtype-fields'
15
+ import type { FlowBuilderContentMessage } from './structured-output/flow-builder-content'
16
16
 
17
17
  export interface InShadowingConfig {
18
18
  allowKeywords: boolean
@@ -8,12 +8,12 @@ import {
8
8
  HtAiValidationType,
9
9
  type HtCaptureUserInputNode,
10
10
  } from '../content-fields/hubtype-fields'
11
- import { getFlowBuilderPlugin } from '../helpers'
12
11
  import {
13
12
  getCommonFlowContentEventArgsForContentId,
14
13
  trackEvent,
15
14
  } from '../tracking'
16
- import { inputHasTextOrTranscript } from '../utils'
15
+ import { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'
16
+ import { inputHasTextOrTranscript } from '../utils/input'
17
17
 
18
18
  interface AiCaptureResponseSuccess {
19
19
  success: true
@@ -5,7 +5,7 @@ import {
5
5
  getTextOrTranscript,
6
6
  isKeywordsAllowed,
7
7
  isSmartIntentsAllowed,
8
- } from '../utils'
8
+ } from '../utils/input'
9
9
  import { CaptureUserInputApi } from './capture-user-input-api'
10
10
  import { KeywordMatcher } from './keyword'
11
11
  import {
@@ -4,12 +4,12 @@ import axios from 'axios'
4
4
 
5
5
  import type { FlowBuilderApi } from '../api'
6
6
  import type { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent'
7
- import { getFlowBuilderPlugin } from '../helpers'
8
7
  import {
9
8
  getCommonFlowContentEventArgsForContentId,
10
9
  trackEvent,
11
10
  } from '../tracking'
12
11
  import type { SmartIntentResponse } from '../types'
12
+ import { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'
13
13
 
14
14
  export interface SmartIntentsInferenceParams {
15
15
  bot_id: string
@@ -0,0 +1,233 @@
1
+ import { WhatsappCTAUrlHeaderType } from '@botonic/react'
2
+
3
+ import type { FlowButton } from '../content-fields/flow-button'
4
+ import { HtButtonStyle } from '../content-fields/hubtype-fields'
5
+ import {
6
+ FlowAiAgent,
7
+ FlowCarousel,
8
+ type FlowContent,
9
+ FlowImage,
10
+ FlowText,
11
+ FlowVideo,
12
+ FlowWhatsappButtonList,
13
+ FlowWhatsappCtaUrlButtonNode,
14
+ FlowWhatsappTemplate,
15
+ } from '../content-fields/index'
16
+
17
+ interface AiAgentContentAndContentsBeforeAiAgent {
18
+ aiAgentContent: FlowAiAgent
19
+ contentsBeforeAiAgent: FlowContent[]
20
+ }
21
+
22
+ export function splitAiAgentContents(
23
+ contents: FlowContent[]
24
+ ): AiAgentContentAndContentsBeforeAiAgent | undefined {
25
+ const aiAgentIndex = contents.findIndex(
26
+ content => content instanceof FlowAiAgent
27
+ )
28
+ if (aiAgentIndex < 0) {
29
+ return undefined
30
+ }
31
+
32
+ const aiAgentContent = contents[aiAgentIndex] as FlowAiAgent
33
+ const contentsBeforeAiAgent = contents.slice(0, aiAgentIndex)
34
+
35
+ return { aiAgentContent, contentsBeforeAiAgent }
36
+ }
37
+
38
+ // biome-ignore lint/complexity/noStaticOnlyClass: namespace-like adapter with private static helpers
39
+ export class HubtypeAssistantContent {
40
+ static adapt(content: FlowContent): string {
41
+ if (content instanceof FlowText) {
42
+ return HubtypeAssistantContent.formatFlowTextContent(content)
43
+ }
44
+ if (content instanceof FlowCarousel) {
45
+ return HubtypeAssistantContent.formatCarouselContent(content)
46
+ }
47
+ if (content instanceof FlowImage) {
48
+ return content.src ? `[Image]\n${content.src}` : '[Image]'
49
+ }
50
+ if (content instanceof FlowVideo) {
51
+ return content.src ? `[Video]\n${content.src}` : '[Video]'
52
+ }
53
+ if (content instanceof FlowWhatsappButtonList) {
54
+ return HubtypeAssistantContent.formatWhatsappButtonListContent(content)
55
+ }
56
+ if (content instanceof FlowWhatsappCtaUrlButtonNode) {
57
+ return HubtypeAssistantContent.formatWhatsappCtaContent(content)
58
+ }
59
+ if (content instanceof FlowWhatsappTemplate) {
60
+ return HubtypeAssistantContent.formatWhatsappTemplateContent(content)
61
+ }
62
+ return ''
63
+ }
64
+
65
+ private static quickReplyLabel(button: FlowButton): string {
66
+ const buttonText = button.text?.trim()
67
+ if (buttonText) {
68
+ return buttonText
69
+ }
70
+
71
+ return button.payload || 'Option'
72
+ }
73
+
74
+ private static persistentButtonLabel(button: FlowButton): string {
75
+ return button.text?.trim() || 'Button'
76
+ }
77
+
78
+ private static carouselButtonLabel(button: FlowButton): string {
79
+ return button.text?.trim() || 'Action'
80
+ }
81
+
82
+ private static formatFlowTextContent(text: FlowText): string {
83
+ const body = text.text?.trim() ?? ''
84
+ const buttons = text.buttons
85
+
86
+ if (!body && buttons.length === 0) {
87
+ return ''
88
+ }
89
+
90
+ if (buttons.length === 0) {
91
+ return text.text
92
+ }
93
+
94
+ const isQuickReply = text.buttonStyle === HtButtonStyle.QUICK_REPLY
95
+ const blockTitle = isQuickReply ? 'Quick replies:' : 'Buttons:'
96
+ const lines = buttons.map((button, i) => {
97
+ const label = isQuickReply
98
+ ? HubtypeAssistantContent.quickReplyLabel(button)
99
+ : HubtypeAssistantContent.persistentButtonLabel(button)
100
+ return ` [${i + 1}] ${label}`
101
+ })
102
+
103
+ const block = [blockTitle, ...lines].join('\n')
104
+ if (!body) {
105
+ return block
106
+ }
107
+
108
+ return `${body}\n\n${block}`
109
+ }
110
+
111
+ private static formatCarouselContent(carousel: FlowCarousel): string {
112
+ const elements = carousel.elements
113
+ const n = elements.length
114
+ const mainText = (carousel.whatsappText ?? '').trim()
115
+
116
+ if (n === 0) {
117
+ return mainText
118
+ }
119
+
120
+ let header: string
121
+ if (!mainText) {
122
+ header = `Carousel displayed with ${n} items:`
123
+ } else if (mainText.endsWith(':')) {
124
+ header = mainText
125
+ } else {
126
+ header = `${mainText}\nCarousel with ${n} items:`
127
+ }
128
+
129
+ const itemLines = elements.map((element, index) => {
130
+ const title = element.title?.trim() || 'Item'
131
+ const subtitle = element.subtitle?.trim()
132
+ const subtitlePart = subtitle ? ` - ${subtitle}` : ''
133
+ const btnLabels: string[] = []
134
+ if (element.button) {
135
+ btnLabels.push(
136
+ HubtypeAssistantContent.carouselButtonLabel(element.button)
137
+ )
138
+ }
139
+ const btnPart = btnLabels.length > 0 ? ` [${btnLabels.join(', ')}]` : ''
140
+
141
+ return ` ${index + 1}. "${title}"${subtitlePart}${btnPart}`
142
+ })
143
+
144
+ return [header, ...itemLines].join('\n')
145
+ }
146
+
147
+ private static formatWhatsappButtonListContent(
148
+ list: FlowWhatsappButtonList
149
+ ): string {
150
+ const body = list.text?.trim() ?? ''
151
+ const hasSections = list.sections.some(s => s.rows.length > 0)
152
+
153
+ if (!body && !hasSections) {
154
+ return '[WhatsApp Button List]'
155
+ }
156
+
157
+ const parts: string[] = []
158
+ if (body) {
159
+ parts.push(body)
160
+ }
161
+
162
+ if (hasSections) {
163
+ const sectionBlocks = list.sections.map(section => {
164
+ const rowLines = section.rows.map(row => {
165
+ const rowTitle = row.title?.trim() ?? ''
166
+ const rowDescription = row.description?.trim() ?? ''
167
+ if (!rowTitle && !rowDescription) {
168
+ return ' - '
169
+ }
170
+ if (!rowTitle) {
171
+ return ` - ${rowDescription}`
172
+ }
173
+ if (!rowDescription) {
174
+ return ` - ${rowTitle}`
175
+ }
176
+ return ` - ${rowTitle}: ${rowDescription}`
177
+ })
178
+ const rowsText = rowLines.join('\n')
179
+
180
+ const sectionTitle = section.title?.trim()
181
+ if (sectionTitle) {
182
+ return `${sectionTitle}:\n${rowsText}`
183
+ }
184
+
185
+ return rowsText
186
+ })
187
+ parts.push(sectionBlocks.join('\n'))
188
+ }
189
+
190
+ return parts.join('\n\n')
191
+ }
192
+
193
+ private static formatWhatsappCtaContent(
194
+ cta: FlowWhatsappCtaUrlButtonNode
195
+ ): string {
196
+ const hasStructuredData =
197
+ (cta.headerType === WhatsappCTAUrlHeaderType.Text &&
198
+ !!cta.header?.trim()) ||
199
+ cta.text?.trim() ||
200
+ cta.footer?.trim() ||
201
+ cta.displayText?.trim() ||
202
+ cta.url
203
+
204
+ if (!hasStructuredData) {
205
+ return cta.text?.trim() || '[WhatsApp CTA Button]'
206
+ }
207
+
208
+ const lines: string[] = []
209
+ if (
210
+ cta.headerType === WhatsappCTAUrlHeaderType.Text &&
211
+ cta.header?.trim()
212
+ ) {
213
+ lines.push(cta.header.trim())
214
+ }
215
+ if (cta.text?.trim()) {
216
+ lines.push(cta.text.trim())
217
+ }
218
+ if (cta.footer?.trim()) {
219
+ lines.push(cta.footer.trim())
220
+ }
221
+ const ctaLine = `[${cta.displayText || ''}]${cta.url ? ` (${cta.url})` : ''}`
222
+ lines.push(ctaLine)
223
+
224
+ return lines.join('\n')
225
+ }
226
+
227
+ private static formatWhatsappTemplateContent(
228
+ template: FlowWhatsappTemplate
229
+ ): string {
230
+ const { name, language } = template.htWhatsappTemplate
231
+ return `WhatsApp Template: ${name} (${language})`
232
+ }
233
+ }
@@ -0,0 +1,23 @@
1
+ import type { Session } from '@botonic/core'
2
+
3
+ import { ProcessEnvNodeEnvs } from '../types'
4
+
5
+ function getAccessTokenFromSession(session: Session): string {
6
+ if (!session._access_token) {
7
+ throw new Error('No access token found in session')
8
+ }
9
+ return session._access_token
10
+ }
11
+
12
+ export function resolveGetAccessToken(
13
+ getAccessToken: (session: Session) => string
14
+ ): (session: Session) => string {
15
+ switch (process.env.NODE_ENV) {
16
+ case ProcessEnvNodeEnvs.PRODUCTION:
17
+ return getAccessTokenFromSession
18
+ case ProcessEnvNodeEnvs.DEVELOPMENT:
19
+ return getAccessToken
20
+ default:
21
+ throw new Error('No method defined for getting access token')
22
+ }
23
+ }
@@ -1,6 +1,6 @@
1
1
  import type { ResolvedPlugins } from '@botonic/core'
2
2
 
3
- import type BotonicPluginFlowBuilder from './index'
3
+ import type BotonicPluginFlowBuilder from '../index'
4
4
 
5
5
  const FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder'
6
6
 
@@ -1,28 +1,8 @@
1
- import { INPUT, type Input, type Session } from '@botonic/core'
1
+ import { INPUT, type Input } from '@botonic/core'
2
2
  import type { ActionRequest } from '@botonic/react'
3
3
 
4
- import { getFlowBuilderPlugin } from './helpers'
5
- import { type InShadowingConfig, ProcessEnvNodeEnvs } from './types'
6
-
7
- function getAccessTokenFromSession(session: Session): string {
8
- if (!session._access_token) {
9
- throw new Error('No access token found in session')
10
- }
11
- return session._access_token
12
- }
13
-
14
- export function resolveGetAccessToken(
15
- getAccessToken: (session: Session) => string
16
- ): (session: Session) => string {
17
- switch (process.env.NODE_ENV) {
18
- case ProcessEnvNodeEnvs.PRODUCTION:
19
- return getAccessTokenFromSession
20
- case ProcessEnvNodeEnvs.DEVELOPMENT:
21
- return getAccessToken
22
- default:
23
- throw new Error('No method defined for getting access token')
24
- }
25
- }
4
+ import type { InShadowingConfig } from '../types'
5
+ import { getFlowBuilderPlugin } from './get-flow-builder-plugin'
26
6
 
27
7
  export function inputHasTextOrTranscript(input: Input): boolean {
28
8
  const isTextInput = Boolean(input.data) && input.type === INPUT.TEXT
@@ -1,3 +0,0 @@
1
- import { type FlowContent } from '../../content-fields';
2
- import type { FlowBuilderContext } from '../index';
3
- export declare function getContentsByAiAgent({ cmsApi, flowBuilderPlugin, request, }: FlowBuilderContext): Promise<FlowContent[]>;
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getContentsByAiAgent = getContentsByAiAgent;
4
- const core_1 = require("@botonic/core");
5
- const content_fields_1 = require("../../content-fields");
6
- const helpers_1 = require("../../helpers");
7
- const tracking_1 = require("../../tracking");
8
- const flow_builder_content_1 = require("./structured-output/flow-builder-content");
9
- async function getContentsByAiAgent({ cmsApi, flowBuilderPlugin, request, }) {
10
- const startNodeAiAgentFlow = cmsApi.getStartNodeAiAgentFlow();
11
- const isAiAgentEnabled = cmsApi.isAiAgentEnabled();
12
- if (!startNodeAiAgentFlow || !isAiAgentEnabled) {
13
- return [];
14
- }
15
- const contents = await flowBuilderPlugin.getContentsByNode(startNodeAiAgentFlow);
16
- const aiAgentContent = contents.find(content => content instanceof content_fields_1.FlowAiAgent);
17
- if (!aiAgentContent) {
18
- return [];
19
- }
20
- const activeInputGuardrailRules = aiAgentContent.inputGuardrailRules
21
- ?.filter(rule => rule.is_active)
22
- ?.map(rule => ({
23
- name: rule.name,
24
- description: rule.description,
25
- })) || [];
26
- const aiAgentResponse = await flowBuilderPlugin.getAiAgentResponse?.(request, {
27
- name: aiAgentContent.name,
28
- instructions: aiAgentContent.instructions,
29
- model: aiAgentContent.model,
30
- verbosity: aiAgentContent.verbosity,
31
- activeTools: aiAgentContent.activeTools,
32
- inputGuardrailRules: activeInputGuardrailRules,
33
- sourceIds: aiAgentContent.sources?.map(source => source.id),
34
- outputMessagesSchemas: [flow_builder_content_1.FlowBuilderContentSchema],
35
- });
36
- if (!aiAgentResponse) {
37
- return [];
38
- }
39
- await trackAiAgentResponse(aiAgentResponse, request, aiAgentContent);
40
- if (aiAgentResponse.exit) {
41
- return [];
42
- }
43
- const regularMessages = [];
44
- const flowBuilderContentMessages = [];
45
- for (const message of aiAgentResponse.messages) {
46
- if (message.type === 'flowBuilderContent') {
47
- flowBuilderContentMessages.push(message);
48
- }
49
- else {
50
- regularMessages.push(message);
51
- }
52
- }
53
- const result = [];
54
- if (regularMessages.length > 0) {
55
- aiAgentContent.responses = regularMessages;
56
- result.push(...contents);
57
- }
58
- for (const fbMessage of flowBuilderContentMessages) {
59
- try {
60
- const node = cmsApi.getNodeByContentID(fbMessage.contentId);
61
- const targetNode = cmsApi.getNodeById(node.id);
62
- const flowContents = await flowBuilderPlugin.getContentsByNode(targetNode);
63
- result.push(...flowContents);
64
- }
65
- catch (error) {
66
- console.warn(`Could not resolve flowBuilderContent with contentId "${fbMessage.contentId}":`, error);
67
- }
68
- }
69
- return result;
70
- }
71
- async function trackAiAgentResponse(aiAgentResponse, request, aiAgentContent) {
72
- const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
73
- const flowId = flowBuilderPlugin.cmsApi.getNodeById(aiAgentContent.id).flow_id;
74
- const flowName = flowBuilderPlugin.getFlowName(flowId);
75
- const event = {
76
- action: core_1.EventAction.AiAgent,
77
- flowThreadId: request.session.flow_thread_id,
78
- flowId: flowId,
79
- flowName: flowName,
80
- flowNodeId: aiAgentContent.id,
81
- flowNodeContentId: aiAgentContent.name,
82
- flowNodeIsMeaningful: true,
83
- toolsExecuted: aiAgentResponse?.toolsExecuted ?? [],
84
- memoryLength: aiAgentResponse?.memoryLength ?? 0,
85
- inputMessageId: request.input.message_id,
86
- exit: aiAgentResponse?.exit ?? true,
87
- inputGuardrailsTriggered: aiAgentResponse?.inputGuardrailsTriggered ?? [],
88
- outputGuardrailsTriggered: [], //aiAgentResponse.outputGuardrailsTriggered,
89
- error: aiAgentResponse.error,
90
- };
91
- const { action, ...eventArgs } = event;
92
- await (0, tracking_1.trackEvent)(request, action, eventArgs);
93
- }
94
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/action/ai-agent/index.ts"],"names":[],"mappings":";;AAmBA,oDAsFC;AAzGD,wCAMsB;AAEtB,yDAAoE;AAEpE,2CAAoD;AACpD,6CAA2C;AAG3C,mFAGiD;AAE1C,KAAK,UAAU,oBAAoB,CAAC,EACzC,MAAM,EACN,iBAAiB,EACjB,OAAO,GACY;IACnB,MAAM,oBAAoB,GAAG,MAAM,CAAC,uBAAuB,EAAE,CAAA;IAC7D,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAA;IAClD,IAAI,CAAC,oBAAoB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC/C,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,QAAQ,GACZ,MAAM,iBAAiB,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAA;IAEjE,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAClC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,4BAAW,CAC3B,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MAAM,EAAE,kBAAW,CAAC,OAAO;QAC3B,YAAY,EAAE,OAAO,CAAC,OAAO,CAAC,cAAe;QAC7C,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,cAAc,CAAC,EAAE;QAC7B,iBAAiB,EAAE,cAAc,CAAC,IAAI;QACtC,oBAAoB,EAAE,IAAI;QAC1B,aAAa,EAAE,eAAe,EAAE,aAAa,IAAI,EAAE;QACnD,YAAY,EAAE,eAAe,EAAE,YAAY,IAAI,CAAC;QAChD,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,UAAW;QACzC,IAAI,EAAE,eAAe,EAAE,IAAI,IAAI,IAAI;QACnC,wBAAwB,EAAE,eAAe,EAAE,wBAAwB,IAAI,EAAE;QACzE,yBAAyB,EAAE,EAAE,EAAE,4CAA4C;QAC3E,KAAK,EAAE,eAAe,CAAC,KAAK;KAC7B,CAAA;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAEtC,MAAM,IAAA,qBAAU,EAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;AAC9C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"flow-builder-content.js","sourceRoot":"","sources":["../../../../../src/action/ai-agent/structured-output/flow-builder-content.ts"],"names":[],"mappings":";;;;AACA,sDAAmB;AAQN,QAAA,wBAAwB,GAAG,aAAC;KACtC,MAAM,CAAC;IACN,IAAI,EAAE,aAAC,CAAC,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;IACpC,SAAS,EAAE,aAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,QAAQ,CACP,4EAA4E,CAC7E,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;AAMA,oDAkBC;AApBD,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAE3D,SAAgB,oBAAoB,C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O,YAAY,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAA;AACrD,CAAC"}
@@ -1,3 +0,0 @@
1
- import { type FlowContent } from '../../content-fields';
2
- import type { FlowBuilderContext } from '../index';
3
- export declare function getContentsByAiAgent({ cmsApi, flowBuilderPlugin, request, }: FlowBuilderContext): Promise<FlowContent[]>;