@botonic/plugin-flow-builder 0.56.0-alpha.0 → 0.57.0-rslib-esm.1

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 (733) hide show
  1. package/README.md +1 -1
  2. package/lib/{cjs/action → action}/ai-agent-from-user-input.d.ts +2 -2
  3. package/lib/{cjs/action → action}/ai-agent-from-user-input.js +9 -6
  4. package/lib/action/ai-agent-from-user-input.js.map +1 -0
  5. package/lib/{esm/action → action}/context.d.ts +2 -2
  6. package/lib/action/context.js +20 -0
  7. package/lib/action/context.js.map +1 -0
  8. package/lib/{cjs/action → action}/fallback.d.ts +2 -2
  9. package/lib/{cjs/action → action}/fallback.js +16 -11
  10. package/lib/action/fallback.js.map +1 -0
  11. package/lib/action/first-interaction.d.ts +3 -0
  12. package/lib/{cjs/action → action}/first-interaction.js +39 -27
  13. package/lib/action/first-interaction.js.map +1 -0
  14. package/lib/{cjs/action → action}/get-contents.d.ts +1 -1
  15. package/lib/action/get-contents.js +56 -0
  16. package/lib/action/get-contents.js.map +1 -0
  17. package/lib/{esm/action → action}/index.d.ts +1 -1
  18. package/lib/{esm/action → action}/index.js +68 -32
  19. package/lib/action/index.js.map +1 -0
  20. package/lib/action/payload.d.ts +3 -0
  21. package/lib/{cjs/action → action}/payload.js +27 -23
  22. package/lib/action/payload.js.map +1 -0
  23. package/lib/{cjs/api.d.ts → api.d.ts} +2 -2
  24. package/lib/{esm/api.js → api.js} +55 -44
  25. package/lib/api.js.map +1 -0
  26. package/lib/constants.js +17 -0
  27. package/lib/constants.js.map +1 -0
  28. package/lib/{esm/content-fields → content-fields}/content-fields-base.d.ts +2 -2
  29. package/lib/content-fields/content-fields-base.js +78 -0
  30. package/lib/content-fields/content-fields-base.js.map +1 -0
  31. package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.d.ts +1 -1
  32. package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +73 -0
  33. package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
  34. package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.d.ts +1 -1
  35. package/lib/{cjs/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.js +15 -15
  36. package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
  37. package/lib/{cjs/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.d.ts +3 -3
  38. package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js +94 -0
  39. package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
  40. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.d.ts +4 -4
  41. package/lib/content-fields/flow-ai-agent-base.js +100 -0
  42. package/lib/content-fields/flow-ai-agent-base.js.map +1 -0
  43. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.d.ts +5 -5
  44. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.js +57 -46
  45. package/lib/content-fields/flow-ai-agent-router.js.map +1 -0
  46. package/lib/{cjs/content-fields → content-fields}/flow-ai-agent.d.ts +4 -4
  47. package/lib/{cjs/content-fields → content-fields}/flow-ai-agent.js +33 -22
  48. package/lib/content-fields/flow-ai-agent.js.map +1 -0
  49. package/lib/{esm/content-fields → content-fields}/flow-bot-action.d.ts +3 -3
  50. package/lib/{esm/content-fields → content-fields}/flow-bot-action.js +23 -15
  51. package/lib/content-fields/flow-bot-action.js.map +1 -0
  52. package/lib/{esm/content-fields → content-fields}/flow-button.d.ts +5 -5
  53. package/lib/{esm/content-fields → content-fields}/flow-button.js +48 -29
  54. package/lib/content-fields/flow-button.js.map +1 -0
  55. package/lib/{cjs/content-fields → content-fields}/flow-capture-user-input.d.ts +2 -2
  56. package/lib/content-fields/flow-capture-user-input.js +46 -0
  57. package/lib/content-fields/flow-capture-user-input.js.map +1 -0
  58. package/lib/{esm/content-fields → content-fields}/flow-carousel.d.ts +4 -4
  59. package/lib/content-fields/flow-carousel.js +193 -0
  60. package/lib/content-fields/flow-carousel.js.map +1 -0
  61. package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.d.ts +3 -3
  62. package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.js +26 -22
  63. package/lib/content-fields/flow-channel-conditional.js.map +1 -0
  64. package/lib/{cjs/content-fields → content-fields}/flow-country-conditional.d.ts +3 -3
  65. package/lib/{esm/content-fields → content-fields}/flow-country-conditional.js +26 -21
  66. package/lib/content-fields/flow-country-conditional.js.map +1 -0
  67. package/lib/{cjs/content-fields → content-fields}/flow-custom-conditional.d.ts +4 -4
  68. package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.js +31 -33
  69. package/lib/content-fields/flow-custom-conditional.js.map +1 -0
  70. package/lib/{cjs/content-fields → content-fields}/flow-element.d.ts +4 -4
  71. package/lib/content-fields/flow-element.js +67 -0
  72. package/lib/content-fields/flow-element.js.map +1 -0
  73. package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.d.ts +3 -3
  74. package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.js +25 -20
  75. package/lib/content-fields/flow-go-to-flow.js.map +1 -0
  76. package/lib/{cjs/content-fields → content-fields}/flow-handoff.d.ts +3 -3
  77. package/lib/{cjs/content-fields → content-fields}/flow-handoff.js +30 -19
  78. package/lib/content-fields/flow-handoff.js.map +1 -0
  79. package/lib/{cjs/content-fields → content-fields}/flow-image.d.ts +2 -2
  80. package/lib/content-fields/flow-image.js +42 -0
  81. package/lib/content-fields/flow-image.js.map +1 -0
  82. package/lib/{cjs/content-fields → content-fields}/flow-queue-status-conditional.d.ts +3 -3
  83. package/lib/{cjs/content-fields → content-fields}/flow-queue-status-conditional.js +45 -40
  84. package/lib/content-fields/flow-queue-status-conditional.js.map +1 -0
  85. package/lib/{esm/content-fields → content-fields}/flow-rating.d.ts +3 -3
  86. package/lib/content-fields/flow-rating.js +88 -0
  87. package/lib/content-fields/flow-rating.js.map +1 -0
  88. package/lib/{cjs/content-fields → content-fields}/flow-text.d.ts +4 -4
  89. package/lib/content-fields/flow-text.js +82 -0
  90. package/lib/content-fields/flow-text.js.map +1 -0
  91. package/lib/{esm/content-fields → content-fields}/flow-video.d.ts +2 -2
  92. package/lib/content-fields/flow-video.js +42 -0
  93. package/lib/content-fields/flow-video.js.map +1 -0
  94. package/lib/{esm/content-fields → content-fields}/flow-webview.d.ts +2 -2
  95. package/lib/{cjs/content-fields → content-fields}/flow-webview.js +31 -28
  96. package/lib/content-fields/flow-webview.js.map +1 -0
  97. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.d.ts +3 -3
  98. package/lib/content-fields/flow-whatsapp-cta-url-button.js +131 -0
  99. package/lib/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
  100. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.d.ts +3 -4
  101. package/lib/content-fields/flow-whatsapp-request-contact-info.js +51 -0
  102. package/lib/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
  103. package/lib/{cjs/content-fields → content-fields}/flow-whatsapp-template.d.ts +2 -2
  104. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.js +119 -102
  105. package/lib/content-fields/flow-whatsapp-template.js.map +1 -0
  106. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/ai-agent-router.d.ts +3 -3
  107. package/lib/content-fields/hubtype-fields/ai-agent-router.js +4 -0
  108. package/lib/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
  109. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/ai-agent.d.ts +2 -2
  110. package/lib/content-fields/hubtype-fields/ai-agent.js +4 -0
  111. package/lib/content-fields/hubtype-fields/ai-agent.js.map +1 -0
  112. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/bot-action.d.ts +2 -2
  113. package/lib/content-fields/hubtype-fields/bot-action.js +4 -0
  114. package/lib/content-fields/hubtype-fields/bot-action.js.map +1 -0
  115. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/button.d.ts +1 -1
  116. package/lib/content-fields/hubtype-fields/button.js +4 -0
  117. package/lib/content-fields/hubtype-fields/button.js.map +1 -0
  118. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/capture-user-input.d.ts +2 -2
  119. package/lib/content-fields/hubtype-fields/capture-user-input.js +12 -0
  120. package/lib/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
  121. package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.d.ts +3 -3
  122. package/lib/content-fields/hubtype-fields/carousel.js +4 -0
  123. package/lib/content-fields/hubtype-fields/carousel.js.map +1 -0
  124. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/channel-conditional.d.ts +3 -3
  125. package/lib/content-fields/hubtype-fields/channel-conditional.js +4 -0
  126. package/lib/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
  127. package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.d.ts +2 -2
  128. package/lib/content-fields/hubtype-fields/common.js +4 -0
  129. package/lib/content-fields/hubtype-fields/common.js.map +1 -0
  130. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/country-conditional.d.ts +3 -3
  131. package/lib/content-fields/hubtype-fields/country-conditional.js +4 -0
  132. package/lib/content-fields/hubtype-fields/country-conditional.js.map +1 -0
  133. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.d.ts +2 -2
  134. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.js +15 -15
  135. package/lib/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
  136. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.d.ts +3 -3
  137. package/lib/content-fields/hubtype-fields/custom-conditional.js +4 -0
  138. package/lib/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
  139. package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.d.ts +2 -2
  140. package/lib/content-fields/hubtype-fields/fallback.js +4 -0
  141. package/lib/content-fields/hubtype-fields/fallback.js.map +1 -0
  142. package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.d.ts +2 -2
  143. package/lib/content-fields/hubtype-fields/function.js +11 -0
  144. package/lib/content-fields/hubtype-fields/function.js.map +1 -0
  145. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/go-to-flow.d.ts +2 -2
  146. package/lib/content-fields/hubtype-fields/go-to-flow.js +4 -0
  147. package/lib/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
  148. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/handoff.d.ts +2 -2
  149. package/lib/content-fields/hubtype-fields/handoff.js +4 -0
  150. package/lib/content-fields/hubtype-fields/handoff.js.map +1 -0
  151. package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.d.ts +2 -2
  152. package/lib/content-fields/hubtype-fields/image.js +4 -0
  153. package/lib/content-fields/hubtype-fields/image.js.map +1 -0
  154. package/lib/content-fields/hubtype-fields/index.d.ts +27 -0
  155. package/lib/content-fields/hubtype-fields/index.js +57 -0
  156. package/lib/content-fields/hubtype-fields/index.js.map +1 -0
  157. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/keyword.d.ts +2 -2
  158. package/lib/content-fields/hubtype-fields/keyword.js +4 -0
  159. package/lib/content-fields/hubtype-fields/keyword.js.map +1 -0
  160. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/node-types.js +12 -12
  161. package/lib/content-fields/hubtype-fields/node-types.js.map +1 -0
  162. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/nodes.d.ts +23 -23
  163. package/lib/content-fields/hubtype-fields/nodes.js +4 -0
  164. package/lib/content-fields/hubtype-fields/nodes.js.map +1 -0
  165. package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.d.ts +1 -1
  166. package/lib/content-fields/hubtype-fields/payload.js +4 -0
  167. package/lib/content-fields/hubtype-fields/payload.js.map +1 -0
  168. package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.d.ts +3 -3
  169. package/lib/content-fields/hubtype-fields/queue-status-conditional.js +4 -0
  170. package/lib/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
  171. package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.d.ts +2 -2
  172. package/lib/content-fields/hubtype-fields/rating.js +9 -0
  173. package/lib/content-fields/hubtype-fields/rating.js.map +1 -0
  174. package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.d.ts +2 -2
  175. package/lib/content-fields/hubtype-fields/smart-intent.js +4 -0
  176. package/lib/content-fields/hubtype-fields/smart-intent.js.map +1 -0
  177. package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.d.ts +3 -3
  178. package/lib/content-fields/hubtype-fields/text.js +4 -0
  179. package/lib/content-fields/hubtype-fields/text.js.map +1 -0
  180. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/url.d.ts +1 -1
  181. package/lib/content-fields/hubtype-fields/url.js +4 -0
  182. package/lib/content-fields/hubtype-fields/url.js.map +1 -0
  183. package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.d.ts +2 -2
  184. package/lib/content-fields/hubtype-fields/video.js +4 -0
  185. package/lib/content-fields/hubtype-fields/video.js.map +1 -0
  186. package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.d.ts +2 -2
  187. package/lib/content-fields/hubtype-fields/webview.js +4 -0
  188. package/lib/content-fields/hubtype-fields/webview.js.map +1 -0
  189. package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.d.ts +2 -2
  190. package/lib/content-fields/hubtype-fields/whatsapp-button-list.js +4 -0
  191. package/lib/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
  192. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.d.ts +3 -3
  193. package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js +4 -0
  194. package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
  195. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.d.ts +2 -2
  196. package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js +4 -0
  197. package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
  198. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-template.d.ts +3 -3
  199. package/lib/content-fields/hubtype-fields/whatsapp-template.js +9 -0
  200. package/lib/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
  201. package/lib/content-fields/index.d.ts +25 -0
  202. package/lib/content-fields/index.js +73 -0
  203. package/lib/content-fields/index.js.map +1 -0
  204. package/lib/{cjs/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +3 -3
  205. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.js +16 -14
  206. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
  207. package/lib/{cjs/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -4
  208. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +41 -0
  209. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
  210. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -4
  211. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +66 -0
  212. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
  213. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.d.ts +3 -3
  214. package/lib/content-fields/whatsapp-button-list/index.js +12 -0
  215. package/lib/content-fields/whatsapp-button-list/index.js.map +1 -0
  216. package/lib/{cjs/filters → filters}/index.d.ts +2 -2
  217. package/lib/filters/index.js +16 -0
  218. package/lib/filters/index.js.map +1 -0
  219. package/lib/{cjs/flow-factory.d.ts → flow-factory.d.ts} +3 -3
  220. package/lib/flow-factory.js +75 -0
  221. package/lib/flow-factory.js.map +1 -0
  222. package/lib/{esm/functions → functions}/index.d.ts +1 -1
  223. package/lib/{cjs/functions → functions}/index.js +25 -19
  224. package/lib/functions/index.js.map +1 -0
  225. package/lib/{cjs/index.d.ts → index.d.ts} +12 -12
  226. package/lib/{esm/index.js → index.js} +94 -77
  227. package/lib/index.js.map +1 -0
  228. package/lib/services/hubtype-queues-api.js +26 -0
  229. package/lib/services/hubtype-queues-api.js.map +1 -0
  230. package/lib/structured-output/flow-builder-content.js +16 -0
  231. package/lib/structured-output/flow-builder-content.js.map +1 -0
  232. package/lib/{cjs/tracking.d.ts → tracking.d.ts} +2 -2
  233. package/lib/{cjs/tracking.js → tracking.js} +27 -21
  234. package/lib/tracking.js.map +1 -0
  235. package/lib/{esm/types.d.ts → types.d.ts} +5 -5
  236. package/lib/types.js +14 -0
  237. package/lib/types.js.map +1 -0
  238. package/lib/{esm/user-input → user-input}/capture-user-input-api.d.ts +2 -2
  239. package/lib/{cjs/user-input → user-input}/capture-user-input-api.js +44 -33
  240. package/lib/user-input/capture-user-input-api.js.map +1 -0
  241. package/lib/{esm/user-input → user-input}/index.d.ts +2 -2
  242. package/lib/user-input/index.js +46 -0
  243. package/lib/user-input/index.js.map +1 -0
  244. package/lib/{esm/user-input → user-input}/keyword.d.ts +2 -2
  245. package/lib/{esm/user-input → user-input}/keyword.js +31 -26
  246. package/lib/user-input/keyword.js.map +1 -0
  247. package/lib/{cjs/user-input → user-input}/smart-intent.d.ts +2 -2
  248. package/lib/{cjs/user-input → user-input}/smart-intent.js +36 -32
  249. package/lib/user-input/smart-intent.js.map +1 -0
  250. package/lib/{cjs/utils → utils}/ai-agent.d.ts +3 -3
  251. package/lib/utils/ai-agent.js +33 -0
  252. package/lib/utils/ai-agent.js.map +1 -0
  253. package/lib/{cjs/utils → utils}/authentication.js +10 -7
  254. package/lib/utils/authentication.js.map +1 -0
  255. package/lib/{cjs/utils → utils}/flow-locale.js +14 -18
  256. package/lib/utils/flow-locale.js.map +1 -0
  257. package/lib/{cjs/utils → utils}/get-flow-builder-plugin.d.ts +1 -1
  258. package/lib/{cjs/utils → utils}/get-flow-builder-plugin.js +4 -4
  259. package/lib/utils/get-flow-builder-plugin.js.map +1 -0
  260. package/lib/{cjs/utils → utils}/hubtype-assistant-content.d.ts +1 -2
  261. package/lib/{cjs/utils → utils}/hubtype-assistant-content.js +57 -54
  262. package/lib/utils/hubtype-assistant-content.js.map +1 -0
  263. package/lib/utils/input.js +37 -0
  264. package/lib/utils/input.js.map +1 -0
  265. package/lib/{cjs/webview → webview}/contents-context.d.ts +1 -1
  266. package/lib/webview/contents-context.js +14 -0
  267. package/lib/webview/contents-context.js.map +1 -0
  268. package/lib/webview/index.d.ts +3 -0
  269. package/lib/webview/index.js +11 -0
  270. package/lib/webview/index.js.map +1 -0
  271. package/lib/{esm/webview → webview}/types.d.ts +1 -1
  272. package/lib/webview/types.js +9 -0
  273. package/lib/webview/types.js.map +1 -0
  274. package/lib/{cjs/webview → webview}/use-webview-contents.d.ts +1 -1
  275. package/lib/webview/use-webview-contents.js +90 -0
  276. package/lib/webview/use-webview-contents.js.map +1 -0
  277. package/package.json +10 -8
  278. package/src/content-fields/flow-ai-agent-base.tsx +0 -11
  279. package/src/content-fields/flow-whatsapp-request-contact-info.tsx +1 -17
  280. package/src/content-fields/index.ts +2 -2
  281. package/src/index.ts +5 -5
  282. package/src/types.ts +6 -6
  283. package/src/utils/hubtype-assistant-content.ts +0 -14
  284. package/lib/cjs/action/ai-agent-from-user-input.js.map +0 -1
  285. package/lib/cjs/action/context.d.ts +0 -11
  286. package/lib/cjs/action/context.js +0 -17
  287. package/lib/cjs/action/context.js.map +0 -1
  288. package/lib/cjs/action/fallback.js.map +0 -1
  289. package/lib/cjs/action/first-interaction.d.ts +0 -3
  290. package/lib/cjs/action/first-interaction.js.map +0 -1
  291. package/lib/cjs/action/get-contents.js +0 -39
  292. package/lib/cjs/action/get-contents.js.map +0 -1
  293. package/lib/cjs/action/index.d.ts +0 -25
  294. package/lib/cjs/action/index.js +0 -90
  295. package/lib/cjs/action/index.js.map +0 -1
  296. package/lib/cjs/action/payload.d.ts +0 -3
  297. package/lib/cjs/action/payload.js.map +0 -1
  298. package/lib/cjs/api.js +0 -205
  299. package/lib/cjs/api.js.map +0 -1
  300. package/lib/cjs/constants.js +0 -19
  301. package/lib/cjs/constants.js.map +0 -1
  302. package/lib/cjs/content-fields/content-fields-base.d.ts +0 -20
  303. package/lib/cjs/content-fields/content-fields-base.js +0 -74
  304. package/lib/cjs/content-fields/content-fields-base.js.map +0 -1
  305. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -15
  306. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
  307. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  308. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -9
  309. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  310. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
  311. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  312. package/lib/cjs/content-fields/flow-ai-agent-base.d.ts +0 -25
  313. package/lib/cjs/content-fields/flow-ai-agent-base.js +0 -97
  314. package/lib/cjs/content-fields/flow-ai-agent-base.js.map +0 -1
  315. package/lib/cjs/content-fields/flow-ai-agent-router.d.ts +0 -21
  316. package/lib/cjs/content-fields/flow-ai-agent-router.js +0 -125
  317. package/lib/cjs/content-fields/flow-ai-agent-router.js.map +0 -1
  318. package/lib/cjs/content-fields/flow-ai-agent.js.map +0 -1
  319. package/lib/cjs/content-fields/flow-bot-action.d.ts +0 -14
  320. package/lib/cjs/content-fields/flow-bot-action.js +0 -45
  321. package/lib/cjs/content-fields/flow-bot-action.js.map +0 -1
  322. package/lib/cjs/content-fields/flow-button.d.ts +0 -31
  323. package/lib/cjs/content-fields/flow-button.js +0 -86
  324. package/lib/cjs/content-fields/flow-button.js.map +0 -1
  325. package/lib/cjs/content-fields/flow-capture-user-input.js +0 -45
  326. package/lib/cjs/content-fields/flow-capture-user-input.js.map +0 -1
  327. package/lib/cjs/content-fields/flow-carousel.d.ts +0 -22
  328. package/lib/cjs/content-fields/flow-carousel.js +0 -152
  329. package/lib/cjs/content-fields/flow-carousel.js.map +0 -1
  330. package/lib/cjs/content-fields/flow-channel-conditional.d.ts +0 -14
  331. package/lib/cjs/content-fields/flow-channel-conditional.js +0 -57
  332. package/lib/cjs/content-fields/flow-channel-conditional.js.map +0 -1
  333. package/lib/cjs/content-fields/flow-country-conditional.js +0 -59
  334. package/lib/cjs/content-fields/flow-country-conditional.js.map +0 -1
  335. package/lib/cjs/content-fields/flow-custom-conditional.js +0 -89
  336. package/lib/cjs/content-fields/flow-custom-conditional.js.map +0 -1
  337. package/lib/cjs/content-fields/flow-element.js +0 -50
  338. package/lib/cjs/content-fields/flow-element.js.map +0 -1
  339. package/lib/cjs/content-fields/flow-go-to-flow.d.ts +0 -13
  340. package/lib/cjs/content-fields/flow-go-to-flow.js +0 -51
  341. package/lib/cjs/content-fields/flow-go-to-flow.js.map +0 -1
  342. package/lib/cjs/content-fields/flow-handoff.js.map +0 -1
  343. package/lib/cjs/content-fields/flow-image.js +0 -33
  344. package/lib/cjs/content-fields/flow-image.js.map +0 -1
  345. package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +0 -1
  346. package/lib/cjs/content-fields/flow-rating.d.ts +0 -15
  347. package/lib/cjs/content-fields/flow-rating.js +0 -66
  348. package/lib/cjs/content-fields/flow-rating.js.map +0 -1
  349. package/lib/cjs/content-fields/flow-text.js +0 -60
  350. package/lib/cjs/content-fields/flow-text.js.map +0 -1
  351. package/lib/cjs/content-fields/flow-video.d.ts +0 -10
  352. package/lib/cjs/content-fields/flow-video.js +0 -33
  353. package/lib/cjs/content-fields/flow-video.js.map +0 -1
  354. package/lib/cjs/content-fields/flow-webview.d.ts +0 -16
  355. package/lib/cjs/content-fields/flow-webview.js.map +0 -1
  356. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +0 -21
  357. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +0 -92
  358. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  359. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.d.ts +0 -11
  360. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js +0 -45
  361. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
  362. package/lib/cjs/content-fields/flow-whatsapp-template.js +0 -264
  363. package/lib/cjs/content-fields/flow-whatsapp-template.js.map +0 -1
  364. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js +0 -3
  365. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  366. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +0 -3
  367. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  368. package/lib/cjs/content-fields/hubtype-fields/bot-action.js +0 -3
  369. package/lib/cjs/content-fields/hubtype-fields/bot-action.js.map +0 -1
  370. package/lib/cjs/content-fields/hubtype-fields/button.js +0 -3
  371. package/lib/cjs/content-fields/hubtype-fields/button.js.map +0 -1
  372. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js +0 -12
  373. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  374. package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +0 -17
  375. package/lib/cjs/content-fields/hubtype-fields/carousel.js +0 -3
  376. package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +0 -1
  377. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +0 -3
  378. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  379. package/lib/cjs/content-fields/hubtype-fields/common.d.ts +0 -83
  380. package/lib/cjs/content-fields/hubtype-fields/common.js +0 -3
  381. package/lib/cjs/content-fields/hubtype-fields/common.js.map +0 -1
  382. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +0 -3
  383. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  384. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.d.ts +0 -56
  385. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js +0 -36
  386. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  387. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +0 -11
  388. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +0 -3
  389. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  390. package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +0 -9
  391. package/lib/cjs/content-fields/hubtype-fields/fallback.js +0 -3
  392. package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +0 -1
  393. package/lib/cjs/content-fields/hubtype-fields/function.d.ts +0 -30
  394. package/lib/cjs/content-fields/hubtype-fields/function.js +0 -11
  395. package/lib/cjs/content-fields/hubtype-fields/function.js.map +0 -1
  396. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js +0 -3
  397. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  398. package/lib/cjs/content-fields/hubtype-fields/handoff.js +0 -3
  399. package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +0 -1
  400. package/lib/cjs/content-fields/hubtype-fields/image.d.ts +0 -8
  401. package/lib/cjs/content-fields/hubtype-fields/image.js +0 -3
  402. package/lib/cjs/content-fields/hubtype-fields/image.js.map +0 -1
  403. package/lib/cjs/content-fields/hubtype-fields/index.d.ts +0 -27
  404. package/lib/cjs/content-fields/hubtype-fields/index.js +0 -31
  405. package/lib/cjs/content-fields/hubtype-fields/index.js.map +0 -1
  406. package/lib/cjs/content-fields/hubtype-fields/keyword.js +0 -3
  407. package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +0 -1
  408. package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +0 -1
  409. package/lib/cjs/content-fields/hubtype-fields/nodes.js +0 -3
  410. package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +0 -1
  411. package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +0 -8
  412. package/lib/cjs/content-fields/hubtype-fields/payload.js +0 -3
  413. package/lib/cjs/content-fields/hubtype-fields/payload.js.map +0 -1
  414. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +0 -25
  415. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
  416. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  417. package/lib/cjs/content-fields/hubtype-fields/rating.d.ts +0 -23
  418. package/lib/cjs/content-fields/hubtype-fields/rating.js +0 -9
  419. package/lib/cjs/content-fields/hubtype-fields/rating.js.map +0 -1
  420. package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +0 -12
  421. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +0 -3
  422. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  423. package/lib/cjs/content-fields/hubtype-fields/text.d.ts +0 -11
  424. package/lib/cjs/content-fields/hubtype-fields/text.js +0 -3
  425. package/lib/cjs/content-fields/hubtype-fields/text.js.map +0 -1
  426. package/lib/cjs/content-fields/hubtype-fields/url.js +0 -3
  427. package/lib/cjs/content-fields/hubtype-fields/url.js.map +0 -1
  428. package/lib/cjs/content-fields/hubtype-fields/video.d.ts +0 -8
  429. package/lib/cjs/content-fields/hubtype-fields/video.js +0 -3
  430. package/lib/cjs/content-fields/hubtype-fields/video.js.map +0 -1
  431. package/lib/cjs/content-fields/hubtype-fields/webview.d.ts +0 -17
  432. package/lib/cjs/content-fields/hubtype-fields/webview.js +0 -3
  433. package/lib/cjs/content-fields/hubtype-fields/webview.js.map +0 -1
  434. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +0 -21
  435. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
  436. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  437. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
  438. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  439. package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js +0 -3
  440. package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
  441. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js +0 -9
  442. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  443. package/lib/cjs/content-fields/index.d.ts +0 -25
  444. package/lib/cjs/content-fields/index.js +0 -52
  445. package/lib/cjs/content-fields/index.js.map +0 -1
  446. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -41
  447. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  448. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
  449. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  450. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -14
  451. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
  452. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  453. package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +0 -3
  454. package/lib/cjs/content-fields/whatsapp-button-list/index.js +0 -10
  455. package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +0 -1
  456. package/lib/cjs/filters/index.js +0 -17
  457. package/lib/cjs/filters/index.js.map +0 -1
  458. package/lib/cjs/flow-factory.js +0 -69
  459. package/lib/cjs/flow-factory.js.map +0 -1
  460. package/lib/cjs/functions/index.d.ts +0 -11
  461. package/lib/cjs/functions/index.js.map +0 -1
  462. package/lib/cjs/index.js +0 -178
  463. package/lib/cjs/index.js.map +0 -1
  464. package/lib/cjs/services/hubtype-queues-api.js +0 -26
  465. package/lib/cjs/services/hubtype-queues-api.js.map +0 -1
  466. package/lib/cjs/structured-output/flow-builder-content.js +0 -15
  467. package/lib/cjs/structured-output/flow-builder-content.js.map +0 -1
  468. package/lib/cjs/tracking.js.map +0 -1
  469. package/lib/cjs/types.d.ts +0 -62
  470. package/lib/cjs/types.js +0 -14
  471. package/lib/cjs/types.js.map +0 -1
  472. package/lib/cjs/user-input/capture-user-input-api.d.ts +0 -21
  473. package/lib/cjs/user-input/capture-user-input-api.js.map +0 -1
  474. package/lib/cjs/user-input/index.d.ts +0 -4
  475. package/lib/cjs/user-input/index.js +0 -37
  476. package/lib/cjs/user-input/index.js.map +0 -1
  477. package/lib/cjs/user-input/keyword.d.ts +0 -27
  478. package/lib/cjs/user-input/keyword.js +0 -84
  479. package/lib/cjs/user-input/keyword.js.map +0 -1
  480. package/lib/cjs/user-input/smart-intent.js.map +0 -1
  481. package/lib/cjs/utils/ai-agent.js +0 -28
  482. package/lib/cjs/utils/ai-agent.js.map +0 -1
  483. package/lib/cjs/utils/authentication.js.map +0 -1
  484. package/lib/cjs/utils/flow-locale.js.map +0 -1
  485. package/lib/cjs/utils/get-flow-builder-plugin.js.map +0 -1
  486. package/lib/cjs/utils/hubtype-assistant-content.js.map +0 -1
  487. package/lib/cjs/utils/input.js +0 -35
  488. package/lib/cjs/utils/input.js.map +0 -1
  489. package/lib/cjs/webview/contents-context.js +0 -12
  490. package/lib/cjs/webview/contents-context.js.map +0 -1
  491. package/lib/cjs/webview/index.d.ts +0 -3
  492. package/lib/cjs/webview/index.js +0 -10
  493. package/lib/cjs/webview/index.js.map +0 -1
  494. package/lib/cjs/webview/types.d.ts +0 -47
  495. package/lib/cjs/webview/types.js +0 -9
  496. package/lib/cjs/webview/types.js.map +0 -1
  497. package/lib/cjs/webview/use-webview-contents.js +0 -83
  498. package/lib/cjs/webview/use-webview-contents.js.map +0 -1
  499. package/lib/esm/action/ai-agent-from-user-input.d.ts +0 -3
  500. package/lib/esm/action/ai-agent-from-user-input.js +0 -32
  501. package/lib/esm/action/ai-agent-from-user-input.js.map +0 -1
  502. package/lib/esm/action/context.js +0 -17
  503. package/lib/esm/action/context.js.map +0 -1
  504. package/lib/esm/action/fallback.d.ts +0 -3
  505. package/lib/esm/action/fallback.js +0 -36
  506. package/lib/esm/action/fallback.js.map +0 -1
  507. package/lib/esm/action/first-interaction.d.ts +0 -3
  508. package/lib/esm/action/first-interaction.js +0 -88
  509. package/lib/esm/action/first-interaction.js.map +0 -1
  510. package/lib/esm/action/get-contents.d.ts +0 -3
  511. package/lib/esm/action/get-contents.js +0 -39
  512. package/lib/esm/action/get-contents.js.map +0 -1
  513. package/lib/esm/action/index.js.map +0 -1
  514. package/lib/esm/action/payload.d.ts +0 -3
  515. package/lib/esm/action/payload.js +0 -74
  516. package/lib/esm/action/payload.js.map +0 -1
  517. package/lib/esm/api.d.ts +0 -40
  518. package/lib/esm/api.js.map +0 -1
  519. package/lib/esm/constants.d.ts +0 -13
  520. package/lib/esm/constants.js +0 -19
  521. package/lib/esm/constants.js.map +0 -1
  522. package/lib/esm/content-fields/content-fields-base.js +0 -74
  523. package/lib/esm/content-fields/content-fields-base.js.map +0 -1
  524. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
  525. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  526. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js +0 -58
  527. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  528. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +0 -17
  529. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
  530. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  531. package/lib/esm/content-fields/flow-ai-agent-base.js +0 -97
  532. package/lib/esm/content-fields/flow-ai-agent-base.js.map +0 -1
  533. package/lib/esm/content-fields/flow-ai-agent-router.js.map +0 -1
  534. package/lib/esm/content-fields/flow-ai-agent.d.ts +0 -17
  535. package/lib/esm/content-fields/flow-ai-agent.js +0 -64
  536. package/lib/esm/content-fields/flow-ai-agent.js.map +0 -1
  537. package/lib/esm/content-fields/flow-bot-action.js.map +0 -1
  538. package/lib/esm/content-fields/flow-button.js.map +0 -1
  539. package/lib/esm/content-fields/flow-capture-user-input.d.ts +0 -14
  540. package/lib/esm/content-fields/flow-capture-user-input.js +0 -45
  541. package/lib/esm/content-fields/flow-capture-user-input.js.map +0 -1
  542. package/lib/esm/content-fields/flow-carousel.js +0 -152
  543. package/lib/esm/content-fields/flow-carousel.js.map +0 -1
  544. package/lib/esm/content-fields/flow-channel-conditional.js.map +0 -1
  545. package/lib/esm/content-fields/flow-country-conditional.d.ts +0 -13
  546. package/lib/esm/content-fields/flow-country-conditional.js.map +0 -1
  547. package/lib/esm/content-fields/flow-custom-conditional.d.ts +0 -17
  548. package/lib/esm/content-fields/flow-custom-conditional.js.map +0 -1
  549. package/lib/esm/content-fields/flow-element.d.ts +0 -22
  550. package/lib/esm/content-fields/flow-element.js +0 -50
  551. package/lib/esm/content-fields/flow-element.js.map +0 -1
  552. package/lib/esm/content-fields/flow-go-to-flow.js.map +0 -1
  553. package/lib/esm/content-fields/flow-handoff.d.ts +0 -17
  554. package/lib/esm/content-fields/flow-handoff.js +0 -68
  555. package/lib/esm/content-fields/flow-handoff.js.map +0 -1
  556. package/lib/esm/content-fields/flow-image.d.ts +0 -10
  557. package/lib/esm/content-fields/flow-image.js +0 -33
  558. package/lib/esm/content-fields/flow-image.js.map +0 -1
  559. package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +0 -30
  560. package/lib/esm/content-fields/flow-queue-status-conditional.js +0 -95
  561. package/lib/esm/content-fields/flow-queue-status-conditional.js.map +0 -1
  562. package/lib/esm/content-fields/flow-rating.js +0 -66
  563. package/lib/esm/content-fields/flow-rating.js.map +0 -1
  564. package/lib/esm/content-fields/flow-text.d.ts +0 -15
  565. package/lib/esm/content-fields/flow-text.js +0 -60
  566. package/lib/esm/content-fields/flow-text.js.map +0 -1
  567. package/lib/esm/content-fields/flow-video.js +0 -33
  568. package/lib/esm/content-fields/flow-video.js.map +0 -1
  569. package/lib/esm/content-fields/flow-webview.js +0 -78
  570. package/lib/esm/content-fields/flow-webview.js.map +0 -1
  571. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +0 -92
  572. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  573. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +0 -45
  574. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
  575. package/lib/esm/content-fields/flow-whatsapp-template.d.ts +0 -37
  576. package/lib/esm/content-fields/flow-whatsapp-template.js.map +0 -1
  577. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.d.ts +0 -21
  578. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js +0 -3
  579. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  580. package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +0 -25
  581. package/lib/esm/content-fields/hubtype-fields/ai-agent.js +0 -3
  582. package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  583. package/lib/esm/content-fields/hubtype-fields/bot-action.d.ts +0 -10
  584. package/lib/esm/content-fields/hubtype-fields/bot-action.js +0 -3
  585. package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +0 -1
  586. package/lib/esm/content-fields/hubtype-fields/button.d.ts +0 -8
  587. package/lib/esm/content-fields/hubtype-fields/button.js +0 -3
  588. package/lib/esm/content-fields/hubtype-fields/button.js.map +0 -1
  589. package/lib/esm/content-fields/hubtype-fields/capture-user-input.d.ts +0 -19
  590. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js +0 -12
  591. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  592. package/lib/esm/content-fields/hubtype-fields/carousel.js +0 -3
  593. package/lib/esm/content-fields/hubtype-fields/carousel.js.map +0 -1
  594. package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +0 -10
  595. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +0 -3
  596. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  597. package/lib/esm/content-fields/hubtype-fields/common.js +0 -3
  598. package/lib/esm/content-fields/hubtype-fields/common.js.map +0 -1
  599. package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +0 -10
  600. package/lib/esm/content-fields/hubtype-fields/country-conditional.js +0 -3
  601. package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  602. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  603. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +0 -3
  604. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  605. package/lib/esm/content-fields/hubtype-fields/fallback.js +0 -3
  606. package/lib/esm/content-fields/hubtype-fields/fallback.js.map +0 -1
  607. package/lib/esm/content-fields/hubtype-fields/function.js +0 -11
  608. package/lib/esm/content-fields/hubtype-fields/function.js.map +0 -1
  609. package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +0 -9
  610. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +0 -3
  611. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  612. package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +0 -11
  613. package/lib/esm/content-fields/hubtype-fields/handoff.js +0 -3
  614. package/lib/esm/content-fields/hubtype-fields/handoff.js.map +0 -1
  615. package/lib/esm/content-fields/hubtype-fields/image.js +0 -3
  616. package/lib/esm/content-fields/hubtype-fields/image.js.map +0 -1
  617. package/lib/esm/content-fields/hubtype-fields/index.d.ts +0 -27
  618. package/lib/esm/content-fields/hubtype-fields/index.js +0 -31
  619. package/lib/esm/content-fields/hubtype-fields/index.js.map +0 -1
  620. package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +0 -9
  621. package/lib/esm/content-fields/hubtype-fields/keyword.js +0 -3
  622. package/lib/esm/content-fields/hubtype-fields/keyword.js.map +0 -1
  623. package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +0 -31
  624. package/lib/esm/content-fields/hubtype-fields/node-types.js +0 -38
  625. package/lib/esm/content-fields/hubtype-fields/node-types.js.map +0 -1
  626. package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +0 -26
  627. package/lib/esm/content-fields/hubtype-fields/nodes.js +0 -3
  628. package/lib/esm/content-fields/hubtype-fields/nodes.js.map +0 -1
  629. package/lib/esm/content-fields/hubtype-fields/payload.js +0 -3
  630. package/lib/esm/content-fields/hubtype-fields/payload.js.map +0 -1
  631. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
  632. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  633. package/lib/esm/content-fields/hubtype-fields/rating.js +0 -9
  634. package/lib/esm/content-fields/hubtype-fields/rating.js.map +0 -1
  635. package/lib/esm/content-fields/hubtype-fields/smart-intent.js +0 -3
  636. package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  637. package/lib/esm/content-fields/hubtype-fields/text.js +0 -3
  638. package/lib/esm/content-fields/hubtype-fields/text.js.map +0 -1
  639. package/lib/esm/content-fields/hubtype-fields/url.d.ts +0 -8
  640. package/lib/esm/content-fields/hubtype-fields/url.js +0 -3
  641. package/lib/esm/content-fields/hubtype-fields/url.js.map +0 -1
  642. package/lib/esm/content-fields/hubtype-fields/video.js +0 -3
  643. package/lib/esm/content-fields/hubtype-fields/video.js.map +0 -1
  644. package/lib/esm/content-fields/hubtype-fields/webview.js +0 -3
  645. package/lib/esm/content-fields/hubtype-fields/webview.js.map +0 -1
  646. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
  647. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  648. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -17
  649. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
  650. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  651. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +0 -8
  652. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js +0 -3
  653. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
  654. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.d.ts +0 -96
  655. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js +0 -9
  656. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  657. package/lib/esm/content-fields/index.d.ts +0 -25
  658. package/lib/esm/content-fields/index.js +0 -52
  659. package/lib/esm/content-fields/index.js.map +0 -1
  660. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -14
  661. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  662. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -13
  663. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
  664. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  665. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
  666. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  667. package/lib/esm/content-fields/whatsapp-button-list/index.js +0 -10
  668. package/lib/esm/content-fields/whatsapp-button-list/index.js.map +0 -1
  669. package/lib/esm/filters/index.d.ts +0 -12
  670. package/lib/esm/filters/index.js +0 -17
  671. package/lib/esm/filters/index.js.map +0 -1
  672. package/lib/esm/flow-factory.d.ts +0 -12
  673. package/lib/esm/flow-factory.js +0 -69
  674. package/lib/esm/flow-factory.js.map +0 -1
  675. package/lib/esm/functions/index.js +0 -49
  676. package/lib/esm/functions/index.js.map +0 -1
  677. package/lib/esm/index.d.ts +0 -45
  678. package/lib/esm/index.js.map +0 -1
  679. package/lib/esm/services/hubtype-queues-api.d.ts +0 -14
  680. package/lib/esm/services/hubtype-queues-api.js +0 -26
  681. package/lib/esm/services/hubtype-queues-api.js.map +0 -1
  682. package/lib/esm/structured-output/flow-builder-content.d.ts +0 -13
  683. package/lib/esm/structured-output/flow-builder-content.js +0 -15
  684. package/lib/esm/structured-output/flow-builder-content.js.map +0 -1
  685. package/lib/esm/tracking.d.ts +0 -16
  686. package/lib/esm/tracking.js +0 -71
  687. package/lib/esm/tracking.js.map +0 -1
  688. package/lib/esm/types.js +0 -14
  689. package/lib/esm/types.js.map +0 -1
  690. package/lib/esm/user-input/capture-user-input-api.js +0 -88
  691. package/lib/esm/user-input/capture-user-input-api.js.map +0 -1
  692. package/lib/esm/user-input/index.js +0 -37
  693. package/lib/esm/user-input/index.js.map +0 -1
  694. package/lib/esm/user-input/keyword.js.map +0 -1
  695. package/lib/esm/user-input/smart-intent.d.ts +0 -24
  696. package/lib/esm/user-input/smart-intent.js +0 -89
  697. package/lib/esm/user-input/smart-intent.js.map +0 -1
  698. package/lib/esm/utils/ai-agent.d.ts +0 -11
  699. package/lib/esm/utils/ai-agent.js +0 -28
  700. package/lib/esm/utils/ai-agent.js.map +0 -1
  701. package/lib/esm/utils/authentication.d.ts +0 -2
  702. package/lib/esm/utils/authentication.js +0 -21
  703. package/lib/esm/utils/authentication.js.map +0 -1
  704. package/lib/esm/utils/flow-locale.d.ts +0 -22
  705. package/lib/esm/utils/flow-locale.js +0 -79
  706. package/lib/esm/utils/flow-locale.js.map +0 -1
  707. package/lib/esm/utils/get-flow-builder-plugin.d.ts +0 -3
  708. package/lib/esm/utils/get-flow-builder-plugin.js +0 -16
  709. package/lib/esm/utils/get-flow-builder-plugin.js.map +0 -1
  710. package/lib/esm/utils/hubtype-assistant-content.d.ts +0 -13
  711. package/lib/esm/utils/hubtype-assistant-content.js +0 -184
  712. package/lib/esm/utils/hubtype-assistant-content.js.map +0 -1
  713. package/lib/esm/utils/input.d.ts +0 -6
  714. package/lib/esm/utils/input.js +0 -35
  715. package/lib/esm/utils/input.js.map +0 -1
  716. package/lib/esm/webview/contents-context.d.ts +0 -2
  717. package/lib/esm/webview/contents-context.js +0 -12
  718. package/lib/esm/webview/contents-context.js.map +0 -1
  719. package/lib/esm/webview/index.d.ts +0 -3
  720. package/lib/esm/webview/index.js +0 -10
  721. package/lib/esm/webview/index.js.map +0 -1
  722. package/lib/esm/webview/types.js +0 -9
  723. package/lib/esm/webview/types.js.map +0 -1
  724. package/lib/esm/webview/use-webview-contents.d.ts +0 -2
  725. package/lib/esm/webview/use-webview-contents.js +0 -83
  726. package/lib/esm/webview/use-webview-contents.js.map +0 -1
  727. /package/lib/{cjs/constants.d.ts → constants.d.ts} +0 -0
  728. /package/lib/{cjs/content-fields → content-fields}/hubtype-fields/node-types.d.ts +0 -0
  729. /package/lib/{cjs/services → services}/hubtype-queues-api.d.ts +0 -0
  730. /package/lib/{cjs/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
  731. /package/lib/{cjs/utils → utils}/authentication.d.ts +0 -0
  732. /package/lib/{cjs/utils → utils}/flow-locale.d.ts +0 -0
  733. /package/lib/{cjs/utils → utils}/input.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type {\n AiAgentArgs,\n BotContext,\n GuardrailRule,\n InferenceResponse,\n PluginPreRequest,\n ResolvedPlugins,\n} from '@botonic/core'\nimport type { FlowContent } from './content-fields'\nimport type {\n HtFlowBuilderData,\n HtRatingButton,\n} from './content-fields/hubtype-fields'\nimport type { FlowBuilderContentMessage } from './structured-output/flow-builder-content'\n\nexport interface InShadowingConfig {\n allowKeywords: boolean\n allowSmartIntents: boolean\n allowAiAgents: boolean\n}\n\nexport interface BotonicPluginFlowBuilderOptions<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> {\n apiUrl?: string\n jsonVersion?: FlowBuilderJSONVersion\n flow?: HtFlowBuilderData\n customFunctions?: Record<any, any>\n getAccessToken: () => string\n trackEvent?: TrackEventFunction<TPlugins, TExtraData>\n getAiAgentResponse?: AiAgentFunction<TPlugins, TExtraData>\n smartIntentsConfig?: { numSmartIntentsToUse: number }\n inShadowing?: Partial<InShadowingConfig>\n contentFilters?: ContentFilter<TPlugins, TExtraData>[]\n customRatingMessageEnabled?: boolean\n disableAIAgentInFirstInteraction?: boolean\n}\n\nexport type TrackEventFunction<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n eventAction: string,\n args?: Record<string, any>\n) => Promise<void>\n\nexport type AiAgentFunction<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n aiAgentArgs: AiAgentArgs\n) => Promise<InferenceResponse<FlowBuilderContentMessage>>\n\nexport type ContentFilter<\n TPlugins extends ResolvedPlugins = ResolvedPlugins,\n TExtraData = any,\n> = (\n request: BotContext<TPlugins, TExtraData>,\n content: FlowContent\n) => Promise<FlowContent> | FlowContent\n\nexport interface FlowBuilderApiOptions {\n url: string\n flowUrl: string\n flow?: HtFlowBuilderData\n accessToken: string\n request: PluginPreRequest\n}\n\nexport enum ProcessEnvNodeEnvs {\n PRODUCTION = 'production',\n DEVELOPMENT = 'development',\n}\n\nexport enum FlowBuilderJSONVersion {\n DRAFT = 'draft',\n LATEST = 'latest',\n}\n\nexport interface SmartIntentResponse {\n data: {\n smart_intent_title: string\n text: string\n smart_intents_used: {\n title: string\n description: string\n }[]\n }\n}\n\nexport interface PayloadParamsBase {\n contentID: string\n followUpContentID?: string\n}\n\nexport interface RatingSubmittedInfo extends HtRatingButton {\n possibleOptions: string[]\n possibleValues: number[]\n}\n\nexport type { AiAgentArgs, GuardrailRule }\n"],"names":["ProcessEnvNodeEnvs","FlowBuilderJSONVersion"],"mappings":"AAwEO,IAAKA,wBAAkBA,0BAAlBA;;;WAAAA;MAGX;AAEM,IAAKC,4BAAsBA,0BAAtBA;;;WAAAA;MAGX"}
@@ -1,6 +1,6 @@
1
1
  import type { ActionRequest } from '@botonic/react';
2
- import type { FlowBuilderApi } from '../api';
3
- import { type HtCaptureUserInputNode } from '../content-fields/hubtype-fields';
2
+ import type { FlowBuilderApi } from '../api.js';
3
+ import { type HtCaptureUserInputNode } from '../content-fields/hubtype-fields/index.js';
4
4
  interface AiCaptureResponseSuccess {
5
5
  success: true;
6
6
  value: string;
@@ -1,29 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CaptureUserInputApi = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@botonic/core");
6
- const axios_1 = tslib_1.__importDefault(require("axios"));
7
- const content_fields_1 = require("../content-fields");
8
- const hubtype_fields_1 = require("../content-fields/hubtype-fields");
9
- const tracking_1 = require("../tracking");
10
- const get_flow_builder_plugin_1 = require("../utils/get-flow-builder-plugin");
11
- const input_1 = require("../utils/input");
1
+ import { EventAction } from "@botonic/core";
2
+ import axios from "axios";
3
+ import { FlowCaptureUserInput } from "../content-fields/index.js";
4
+ import { HtAiValidationType } from "../content-fields/hubtype-fields/index.js";
5
+ import { getCommonFlowContentEventArgsForContentId, trackEvent } from "../tracking.js";
6
+ import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
7
+ import { inputHasTextOrTranscript } from "../utils/input.js";
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
12
23
  class CaptureUserInputApi {
13
- constructor(cmsApi, request, textOrTranscript) {
14
- this.cmsApi = cmsApi;
15
- this.request = request;
16
- this.textOrTranscript = textOrTranscript;
17
- }
18
24
  async getNextNodeId() {
19
- if ((0, input_1.inputHasTextOrTranscript)(this.request.input) &&
20
- this.cmsApi.shouldCaptureUserInput()) {
25
+ if (inputHasTextOrTranscript(this.request.input) && this.cmsApi.shouldCaptureUserInput()) {
21
26
  const captureUserInputNode = this.cmsApi.getCaptureUserInputNode();
22
27
  if (!captureUserInputNode || !this.textOrTranscript) {
23
28
  return undefined;
24
29
  }
25
- const captureUserInput = content_fields_1.FlowCaptureUserInput.fromHubtypeCMS(captureUserInputNode);
26
- if (captureUserInput.aiValidationType === hubtype_fields_1.HtAiValidationType.NONE) {
30
+ const captureUserInput = FlowCaptureUserInput.fromHubtypeCMS(captureUserInputNode);
31
+ if (captureUserInput.aiValidationType === HtAiValidationType.NONE) {
27
32
  this.cmsApi.setUserExtraDataVariable(captureUserInputNode.content.field_name, this.textOrTranscript);
28
33
  await this.trackUserInputCapture(captureUserInputNode, true);
29
34
  return captureUserInput.captureSuccessId;
@@ -45,30 +50,29 @@ class CaptureUserInputApi {
45
50
  const data = {
46
51
  field_name: captureUserInputNode.content.field_name,
47
52
  validation_instructions: captureUserInputNode.content.ai_validation_instructions,
48
- user_input: this.textOrTranscript,
53
+ user_input: this.textOrTranscript
49
54
  };
50
- const pluginFlowBuilder = (0, get_flow_builder_plugin_1.getFlowBuilderPlugin)(this.request.plugins);
55
+ const pluginFlowBuilder = getFlowBuilderPlugin(this.request.plugins);
51
56
  const token = pluginFlowBuilder.getAccessToken(this.request.session);
52
57
  const config = {
53
58
  headers: {
54
59
  'Content-Type': 'application/json',
55
- Authorization: `Bearer ${token}`,
56
- },
60
+ Authorization: `Bearer ${token}`
61
+ }
57
62
  };
58
- const aiCaptureResponse = await axios_1.default.post(url, data, config);
63
+ const aiCaptureResponse = await axios.post(url, data, config);
59
64
  return aiCaptureResponse.data;
60
- }
61
- catch (error) {
65
+ } catch (error) {
62
66
  console.warn('Error getting ai/capture_user_input', error);
63
67
  }
64
68
  return {
65
- success: false,
69
+ success: false
66
70
  };
67
71
  }
68
72
  async trackUserInputCapture(captureUserInputNode, captureSuccess) {
69
- const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(this.request, captureUserInputNode.id);
73
+ const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(this.request, captureUserInputNode.id);
70
74
  const event = {
71
- action: core_1.EventAction.CaptureUserInput,
75
+ action: EventAction.CaptureUserInput,
72
76
  flowThreadId,
73
77
  flowId,
74
78
  flowName,
@@ -78,11 +82,18 @@ class CaptureUserInputApi {
78
82
  fieldName: captureUserInputNode.content.field_name,
79
83
  userInput: this.textOrTranscript,
80
84
  captureSuccess,
81
- messageId: this.request.input.message_id,
85
+ messageId: this.request.input.message_id
82
86
  };
83
87
  const { action, ...eventArgs } = event;
84
- await (0, tracking_1.trackEvent)(this.request, action, eventArgs);
88
+ await trackEvent(this.request, action, eventArgs);
89
+ }
90
+ constructor(cmsApi, request, textOrTranscript){
91
+ this.cmsApi = cmsApi;
92
+ this.request = request;
93
+ this.textOrTranscript = textOrTranscript;
85
94
  }
86
95
  }
87
- exports.CaptureUserInputApi = CaptureUserInputApi;
96
+
97
+ export { CaptureUserInputApi };
98
+
88
99
  //# sourceMappingURL=capture-user-input-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-input/capture-user-input-api.js","sources":["../../src/user-input/capture-user-input-api.ts"],"sourcesContent":["import { EventAction, type EventCaptureUserInput } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport axios from 'axios'\n\nimport type { FlowBuilderApi } from '../api'\nimport { FlowCaptureUserInput } from '../content-fields'\nimport {\n HtAiValidationType,\n type HtCaptureUserInputNode,\n} from '../content-fields/hubtype-fields'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { inputHasTextOrTranscript } from '../utils/input'\n\ninterface AiCaptureResponseSuccess {\n success: true\n value: string\n}\n\ninterface AiCaptureResponseFailure {\n success: false\n}\n\ntype AiCaptureResponse = AiCaptureResponseSuccess | AiCaptureResponseFailure\n\nexport class CaptureUserInputApi {\n private cmsApi: FlowBuilderApi\n private request: ActionRequest\n private textOrTranscript: string\n\n constructor(\n cmsApi: FlowBuilderApi,\n request: ActionRequest,\n textOrTranscript: string\n ) {\n this.cmsApi = cmsApi\n this.request = request\n this.textOrTranscript = textOrTranscript\n }\n\n async getNextNodeId(): Promise<string | undefined> {\n if (\n inputHasTextOrTranscript(this.request.input) &&\n this.cmsApi.shouldCaptureUserInput()\n ) {\n const captureUserInputNode = this.cmsApi.getCaptureUserInputNode()\n if (!captureUserInputNode || !this.textOrTranscript) {\n return undefined\n }\n const captureUserInput =\n FlowCaptureUserInput.fromHubtypeCMS(captureUserInputNode)\n\n if (captureUserInput.aiValidationType === HtAiValidationType.NONE) {\n this.cmsApi.setUserExtraDataVariable(\n captureUserInputNode.content.field_name,\n this.textOrTranscript\n )\n await this.trackUserInputCapture(captureUserInputNode, true)\n return captureUserInput.captureSuccessId\n }\n\n const aiCaptureResponse =\n await this.getAiCaptureResponse(captureUserInputNode)\n if (!aiCaptureResponse.success) {\n await this.trackUserInputCapture(captureUserInputNode, false)\n return captureUserInput.captureFailId\n }\n\n this.cmsApi.setUserExtraDataVariable(\n captureUserInputNode.content.field_name,\n aiCaptureResponse.value\n )\n await this.trackUserInputCapture(captureUserInputNode, true)\n return captureUserInput.captureSuccessId\n }\n return undefined\n }\n\n async getAiCaptureResponse(\n captureUserInputNode: HtCaptureUserInputNode\n ): Promise<AiCaptureResponse> {\n try {\n const url = `${process.env.HUBTYPE_API_URL}/external/v1/capture_user_input/`\n const data = {\n field_name: captureUserInputNode.content.field_name,\n validation_instructions:\n captureUserInputNode.content.ai_validation_instructions,\n user_input: this.textOrTranscript,\n }\n const pluginFlowBuilder = getFlowBuilderPlugin(this.request.plugins)\n const token = pluginFlowBuilder.getAccessToken(this.request.session)\n\n const config = {\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n }\n\n const aiCaptureResponse = await axios.post<AiCaptureResponse>(\n url,\n data,\n config\n )\n\n return aiCaptureResponse.data\n } catch (error) {\n console.warn('Error getting ai/capture_user_input', error)\n }\n\n return {\n success: false,\n }\n }\n\n async trackUserInputCapture(\n captureUserInputNode: HtCaptureUserInputNode,\n captureSuccess: boolean\n ): Promise<void> {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(\n this.request,\n captureUserInputNode.id\n )\n const event: EventCaptureUserInput = {\n action: EventAction.CaptureUserInput,\n flowThreadId,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowNodeIsMeaningful: false,\n fieldName: captureUserInputNode.content.field_name,\n userInput: this.textOrTranscript,\n captureSuccess,\n messageId: this.request.input.message_id,\n }\n const { action, ...eventArgs } = event\n await trackEvent(this.request, action, eventArgs)\n }\n}\n"],"names":["EventAction","axios","FlowCaptureUserInput","HtAiValidationType","getCommonFlowContentEventArgsForContentId","trackEvent","getFlowBuilderPlugin","inputHasTextOrTranscript","CaptureUserInputApi","captureUserInputNode","undefined","captureUserInput","aiCaptureResponse","url","process","data","pluginFlowBuilder","token","config","error","console","captureSuccess","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","event","action","eventArgs","cmsApi","request","textOrTranscript"],"mappings":";;;;;;;;;;;;;;;AAAuE;AAE9C;AAG+B;AAIf;AAIrB;AACmD;AACd;AAalD,MAAMQ,mBAAmBA;IAe9B,MAAM,gBAA6C;QACjD,IACED,wBAAwBA,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,KAC3C,IAAI,CAAC,MAAM,CAAC,sBAAsB,IAClC;YACA,MAAME,uBAAuB,IAAI,CAAC,MAAM,CAAC,uBAAuB;YAChE,IAAI,CAACA,wBAAwB,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBACnD,OAAOC;YACT;YACA,MAAMC,mBACJT,mCAAmC,CAACO;YAEtC,IAAIE,iBAAiB,gBAAgB,KAAKR,uBAAuB,EAAE;gBACjE,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAClCM,qBAAqB,OAAO,CAAC,UAAU,EACvC,IAAI,CAAC,gBAAgB;gBAEvB,MAAM,IAAI,CAAC,qBAAqB,CAACA,sBAAsB;gBACvD,OAAOE,iBAAiB,gBAAgB;YAC1C;YAEA,MAAMC,oBACJ,MAAM,IAAI,CAAC,oBAAoB,CAACH;YAClC,IAAI,CAACG,kBAAkB,OAAO,EAAE;gBAC9B,MAAM,IAAI,CAAC,qBAAqB,CAACH,sBAAsB;gBACvD,OAAOE,iBAAiB,aAAa;YACvC;YAEA,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAClCF,qBAAqB,OAAO,CAAC,UAAU,EACvCG,kBAAkB,KAAK;YAEzB,MAAM,IAAI,CAAC,qBAAqB,CAACH,sBAAsB;YACvD,OAAOE,iBAAiB,gBAAgB;QAC1C;QACA,OAAOD;IACT;IAEA,MAAM,qBACJD,oBAA4C,EAChB;QAC5B,IAAI;YACF,MAAMI,MAAM,GAAGC,QAAQ,GAAG,CAAC,eAAe,CAAC,gCAAgC,CAAC;YAC5E,MAAMC,OAAO;gBACX,YAAYN,qBAAqB,OAAO,CAAC,UAAU;gBACnD,yBACEA,qBAAqB,OAAO,CAAC,0BAA0B;gBACzD,YAAY,IAAI,CAAC,gBAAgB;YACnC;YACA,MAAMO,oBAAoBV,oBAAoBA,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO;YACnE,MAAMW,QAAQD,kBAAkB,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO;YAEnE,MAAME,SAAS;gBACb,SAAS;oBACP,gBAAgB;oBAChB,eAAe,CAAC,OAAO,EAAED,OAAO;gBAClC;YACF;YAEA,MAAML,oBAAoB,MAAMX,UAAU,CACxCY,KACAE,MACAG;YAGF,OAAON,kBAAkB,IAAI;QAC/B,EAAE,OAAOO,OAAO;YACdC,QAAQ,IAAI,CAAC,uCAAuCD;QACtD;QAEA,OAAO;YACL,SAAS;QACX;IACF;IAEA,MAAM,sBACJV,oBAA4C,EAC5CY,cAAuB,EACR;QACf,MAAM,EAAEC,YAAY,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,iBAAiB,EAAE,GACrEtB,yCAAyCA,CACvC,IAAI,CAAC,OAAO,EACZK,qBAAqB,EAAE;QAE3B,MAAMkB,QAA+B;YACnC,QAAQ3B,4BAA4B;YACpCsB;YACAC;YACAC;YACAC;YACAC;YACA,sBAAsB;YACtB,WAAWjB,qBAAqB,OAAO,CAAC,UAAU;YAClD,WAAW,IAAI,CAAC,gBAAgB;YAChCY;YACA,WAAW,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU;QAC1C;QACA,MAAM,EAAEO,MAAM,EAAE,GAAGC,WAAW,GAAGF;QACjC,MAAMtB,UAAUA,CAAC,IAAI,CAAC,OAAO,EAAEuB,QAAQC;IACzC;IA7GA,YACEC,MAAsB,EACtBC,OAAsB,EACtBC,gBAAwB,CACxB;QACA,IAAI,CAAC,MAAM,GAAGF;QACd,IAAI,CAAC,OAAO,GAAGC;QACf,IAAI,CAAC,gBAAgB,GAAGC;IAC1B;AAsGF"}
@@ -1,4 +1,4 @@
1
1
  import type { ActionRequest } from '@botonic/react';
2
- import type { FlowBuilderApi } from '../api';
3
- import { type SmartIntentsInferenceConfig } from './smart-intent';
2
+ import type { FlowBuilderApi } from '../api.js';
3
+ import { type SmartIntentsInferenceConfig } from './smart-intent.js';
4
4
  export declare function getNextPayloadByUserInput(cmsApi: FlowBuilderApi, locale: string, request: ActionRequest, smartIntentsConfig: SmartIntentsInferenceConfig): Promise<string | undefined>;
@@ -0,0 +1,46 @@
1
+ import { getTextOrTranscript, isKeywordsAllowed, isSmartIntentsAllowed } from "../utils/input.js";
2
+ import { CaptureUserInputApi } from "./capture-user-input-api.js";
3
+ import { KeywordMatcher } from "./keyword.js";
4
+ import { SmartIntentsApi } from "./smart-intent.js";
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ async function getNextPayloadByUserInput(cmsApi, locale, request, smartIntentsConfig) {
15
+ const userTextOrTranscript = getTextOrTranscript(request.input);
16
+ if (userTextOrTranscript) {
17
+ if (cmsApi.shouldCaptureUserInput()) {
18
+ const captureUserInputApi = new CaptureUserInputApi(cmsApi, request, userTextOrTranscript);
19
+ return await captureUserInputApi.getNextNodeId();
20
+ }
21
+ if (isKeywordsAllowed(request)) {
22
+ const keywordMatcher = new KeywordMatcher({
23
+ cmsApi,
24
+ locale,
25
+ request,
26
+ userTextOrTranscript
27
+ });
28
+ const keywordNode = await keywordMatcher.getNodeByInput();
29
+ if (keywordNode) {
30
+ return cmsApi.getPayload(keywordNode.target);
31
+ }
32
+ }
33
+ if (isSmartIntentsAllowed(request)) {
34
+ const smartIntentsApi = new SmartIntentsApi(cmsApi, request, smartIntentsConfig, userTextOrTranscript);
35
+ const smartIntentNode = await smartIntentsApi.getNodeByInput();
36
+ if (smartIntentNode) {
37
+ return cmsApi.getPayload(smartIntentNode.target);
38
+ }
39
+ }
40
+ }
41
+ return undefined;
42
+ }
43
+
44
+ export { getNextPayloadByUserInput };
45
+
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-input/index.js","sources":["../../src/user-input/index.ts"],"sourcesContent":["import type { ActionRequest } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport {\n getTextOrTranscript,\n isKeywordsAllowed,\n isSmartIntentsAllowed,\n} from '../utils/input'\nimport { CaptureUserInputApi } from './capture-user-input-api'\nimport { KeywordMatcher } from './keyword'\nimport {\n SmartIntentsApi,\n type SmartIntentsInferenceConfig,\n} from './smart-intent'\n\nexport async function getNextPayloadByUserInput(\n cmsApi: FlowBuilderApi,\n locale: string,\n request: ActionRequest,\n smartIntentsConfig: SmartIntentsInferenceConfig\n): Promise<string | undefined> {\n const userTextOrTranscript = getTextOrTranscript(request.input)\n if (userTextOrTranscript) {\n if (cmsApi.shouldCaptureUserInput()) {\n const captureUserInputApi = new CaptureUserInputApi(\n cmsApi,\n request,\n userTextOrTranscript\n )\n return await captureUserInputApi.getNextNodeId()\n }\n\n if (isKeywordsAllowed(request)) {\n const keywordMatcher = new KeywordMatcher({\n cmsApi,\n locale,\n request,\n userTextOrTranscript,\n })\n const keywordNode = await keywordMatcher.getNodeByInput()\n if (keywordNode) {\n return cmsApi.getPayload(keywordNode.target)\n }\n }\n\n if (isSmartIntentsAllowed(request)) {\n const smartIntentsApi = new SmartIntentsApi(\n cmsApi,\n request,\n smartIntentsConfig,\n userTextOrTranscript\n )\n const smartIntentNode = await smartIntentsApi.getNodeByInput()\n if (smartIntentNode) {\n return cmsApi.getPayload(smartIntentNode.target)\n }\n }\n }\n\n return undefined\n}\n"],"names":["getTextOrTranscript","isKeywordsAllowed","isSmartIntentsAllowed","CaptureUserInputApi","KeywordMatcher","SmartIntentsApi","getNextPayloadByUserInput","cmsApi","locale","request","smartIntentsConfig","userTextOrTranscript","captureUserInputApi","keywordMatcher","keywordNode","smartIntentsApi","smartIntentNode","undefined"],"mappings":";;;;;;;;;AAOuB;AACuC;AACpB;AAInB;AAEhB,eAAeM,yBAAyBA,CAC7CC,MAAsB,EACtBC,MAAc,EACdC,OAAsB,EACtBC,kBAA+C;IAE/C,MAAMC,uBAAuBX,mBAAmBA,CAACS,QAAQ,KAAK;IAC9D,IAAIE,sBAAsB;QACxB,IAAIJ,OAAO,sBAAsB,IAAI;YACnC,MAAMK,sBAAsB,IAAIT,mBAAmBA,CACjDI,QACAE,SACAE;YAEF,OAAO,MAAMC,oBAAoB,aAAa;QAChD;QAEA,IAAIX,iBAAiBA,CAACQ,UAAU;YAC9B,MAAMI,iBAAiB,IAAIT,cAAcA,CAAC;gBACxCG;gBACAC;gBACAC;gBACAE;YACF;YACA,MAAMG,cAAc,MAAMD,eAAe,cAAc;YACvD,IAAIC,aAAa;gBACf,OAAOP,OAAO,UAAU,CAACO,YAAY,MAAM;YAC7C;QACF;QAEA,IAAIZ,qBAAqBA,CAACO,UAAU;YAClC,MAAMM,kBAAkB,IAAIV,eAAeA,CACzCE,QACAE,SACAC,oBACAC;YAEF,MAAMK,kBAAkB,MAAMD,gBAAgB,cAAc;YAC5D,IAAIC,iBAAiB;gBACnB,OAAOT,OAAO,UAAU,CAACS,gBAAgB,MAAM;YACjD;QACF;IACF;IAEA,OAAOC;AACT"}
@@ -1,6 +1,6 @@
1
1
  import type { ActionRequest } from '@botonic/react';
2
- import type { FlowBuilderApi } from '../api';
3
- import type { HtKeywordNode } from '../content-fields/hubtype-fields';
2
+ import type { FlowBuilderApi } from '../api.js';
3
+ import type { HtKeywordNode } from '../content-fields/hubtype-fields/index.js';
4
4
  interface KeywordProps {
5
5
  cmsApi: FlowBuilderApi;
6
6
  locale: string;
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KeywordMatcher = void 0;
4
- const core_1 = require("@botonic/core");
5
- const constants_1 = require("../constants");
6
- const tracking_1 = require("../tracking");
1
+ import { EventAction, NluType } from "@botonic/core";
2
+ import { REG_EXP_PATTERN } from "../constants.js";
3
+ import { getCommonFlowContentEventArgsForContentId, trackEvent } from "../tracking.js";
4
+
5
+
6
+
7
+
8
+
9
+
10
+
7
11
  class KeywordMatcher {
8
- constructor({ cmsApi, locale, request, userTextOrTranscript }) {
9
- this.cmsApi = cmsApi;
10
- this.locale = locale;
11
- this.request = request;
12
- this.isRegExp = false;
13
- this.userTextOrTranscript = userTextOrTranscript;
14
- }
15
12
  async getNodeByInput() {
16
13
  const keywordNodes = this.cmsApi.getKeywordNodes();
17
14
  const keywordNode = this.getNodeByKeyword(this.userTextOrTranscript, keywordNodes);
@@ -20,19 +17,19 @@ class KeywordMatcher {
20
17
  }
21
18
  const targetPayload = this.cmsApi.getPayload(keywordNode.target);
22
19
  this.request.input.nluResolution = {
23
- type: core_1.NluType.Keyword,
20
+ type: NluType.Keyword,
24
21
  matchedValue: this.matchedKeyword,
25
- payload: targetPayload,
22
+ payload: targetPayload
26
23
  };
27
24
  await this.trackKeywordEvent();
28
25
  return keywordNode;
29
26
  }
30
27
  getNodeByKeyword(userInput, keywordNodes) {
31
- const matchedKeywordNode = keywordNodes.find(node => this.matchKeywords(userInput, node));
28
+ const matchedKeywordNode = keywordNodes.find((node)=>this.matchKeywords(userInput, node));
32
29
  return matchedKeywordNode?.target ? matchedKeywordNode : undefined;
33
30
  }
34
31
  matchKeywords(userInput, node) {
35
- const result = node.content.keywords.find(keywords => {
32
+ const result = node.content.keywords.find((keywords)=>{
36
33
  if (keywords.locale === this.locale) {
37
34
  this.keywordNodeId = node.id;
38
35
  this.flowId = this.cmsApi.getNodeById(node.id).flow_id;
@@ -43,15 +40,14 @@ class KeywordMatcher {
43
40
  return Boolean(result);
44
41
  }
45
42
  inputMatchesAnyKeyword(userInput, keywords) {
46
- return keywords.some(keyword => {
47
- const regExpMatchArray = keyword.match(constants_1.REG_EXP_PATTERN);
43
+ return keywords.some((keyword)=>{
44
+ const regExpMatchArray = keyword.match(REG_EXP_PATTERN);
48
45
  if (regExpMatchArray) {
49
46
  const keywordAsRegExp = this.resolveKeywordAsRegExp(regExpMatchArray);
50
47
  const match = userInput.match(keywordAsRegExp);
51
48
  this.isRegExp = true;
52
49
  this.matchedKeyword = match ? match[0] : undefined;
53
- }
54
- else {
50
+ } else {
55
51
  this.isRegExp = false;
56
52
  this.matchedKeyword = userInput.includes(keyword) ? keyword : undefined;
57
53
  }
@@ -63,9 +59,9 @@ class KeywordMatcher {
63
59
  return new RegExp(pattern, flags);
64
60
  }
65
61
  async trackKeywordEvent() {
66
- const { flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(this.request, this.keywordNodeId);
62
+ const { flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(this.request, this.keywordNodeId);
67
63
  const event = {
68
- action: core_1.EventAction.Keyword,
64
+ action: EventAction.Keyword,
69
65
  flowNodeId,
70
66
  flowId,
71
67
  flowName,
@@ -74,11 +70,20 @@ class KeywordMatcher {
74
70
  nluKeywordName: this.matchedKeyword,
75
71
  nluKeywordIsRegex: this.isRegExp,
76
72
  nluKeywordMessageId: this.request.input.message_id,
77
- userInput: this.userTextOrTranscript,
73
+ userInput: this.userTextOrTranscript
78
74
  };
79
75
  const { action, ...eventArgs } = event;
80
- await (0, tracking_1.trackEvent)(this.request, action, eventArgs);
76
+ await trackEvent(this.request, action, eventArgs);
77
+ }
78
+ constructor({ cmsApi, locale, request, userTextOrTranscript }){
79
+ this.cmsApi = cmsApi;
80
+ this.locale = locale;
81
+ this.request = request;
82
+ this.isRegExp = false;
83
+ this.userTextOrTranscript = userTextOrTranscript;
81
84
  }
82
85
  }
83
- exports.KeywordMatcher = KeywordMatcher;
86
+
87
+ export { KeywordMatcher };
88
+
84
89
  //# sourceMappingURL=keyword.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-input/keyword.js","sources":["../../src/user-input/keyword.ts"],"sourcesContent":["import { EventAction, type EventKeyword, NluType } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport { REG_EXP_PATTERN } from '../constants'\nimport type {\n HtKeywordNode,\n HtNodeWithContent,\n} from '../content-fields/hubtype-fields'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\n\ninterface KeywordProps {\n cmsApi: FlowBuilderApi\n locale: string\n request: ActionRequest\n userTextOrTranscript: string\n}\nexport class KeywordMatcher {\n public cmsApi: FlowBuilderApi\n public locale: string\n public request: ActionRequest\n public isRegExp: boolean\n public matchedKeyword?: string\n public keywordNodeId?: string\n public flowId?: string\n public userTextOrTranscript: string\n\n constructor({ cmsApi, locale, request, userTextOrTranscript }: KeywordProps) {\n this.cmsApi = cmsApi\n this.locale = locale\n this.request = request\n this.isRegExp = false\n this.userTextOrTranscript = userTextOrTranscript\n }\n\n async getNodeByInput(): Promise<HtKeywordNode | undefined> {\n const keywordNodes = this.cmsApi.getKeywordNodes()\n const keywordNode = this.getNodeByKeyword(\n this.userTextOrTranscript,\n keywordNodes\n )\n if (!keywordNode || !this.matchedKeyword) {\n return undefined\n }\n const targetPayload = this.cmsApi.getPayload(keywordNode.target)\n\n this.request.input.nluResolution = {\n type: NluType.Keyword,\n matchedValue: this.matchedKeyword,\n payload: targetPayload,\n }\n await this.trackKeywordEvent()\n return keywordNode\n }\n\n private getNodeByKeyword(\n userInput: string,\n keywordNodes: HtKeywordNode[]\n ): HtKeywordNode | undefined {\n const matchedKeywordNode = keywordNodes.find(node =>\n this.matchKeywords(userInput, node)\n )\n\n return matchedKeywordNode?.target ? matchedKeywordNode : undefined\n }\n\n private matchKeywords(userInput: string, node: HtKeywordNode): boolean {\n const result = node.content.keywords.find(keywords => {\n if (keywords.locale === this.locale) {\n this.keywordNodeId = node.id\n this.flowId = this.cmsApi.getNodeById<HtNodeWithContent>(\n node.id\n ).flow_id\n return this.inputMatchesAnyKeyword(userInput, keywords.values)\n }\n\n return false\n })\n\n return Boolean(result)\n }\n\n private inputMatchesAnyKeyword(\n userInput: string,\n keywords: string[]\n ): boolean {\n return keywords.some(keyword => {\n const regExpMatchArray = keyword.match(REG_EXP_PATTERN)\n\n if (regExpMatchArray) {\n const keywordAsRegExp = this.resolveKeywordAsRegExp(regExpMatchArray)\n const match = userInput.match(keywordAsRegExp)\n this.isRegExp = true\n this.matchedKeyword = match ? match[0] : undefined\n } else {\n this.isRegExp = false\n this.matchedKeyword = userInput.includes(keyword) ? keyword : undefined\n }\n\n return this.matchedKeyword !== undefined\n })\n }\n\n private resolveKeywordAsRegExp(regExpMatchArray: RegExpMatchArray): RegExp {\n const [, pattern, flags] = regExpMatchArray\n return new RegExp(pattern, flags)\n }\n\n private async trackKeywordEvent() {\n const { flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(\n this.request,\n this.keywordNodeId as string\n )\n\n const event: EventKeyword = {\n action: EventAction.Keyword,\n flowNodeId,\n flowId,\n flowName,\n flowNodeContentId,\n flowThreadId: this.request.session.flow_thread_id as string,\n nluKeywordName: this.matchedKeyword as string,\n nluKeywordIsRegex: this.isRegExp,\n nluKeywordMessageId: this.request.input.message_id,\n userInput: this.userTextOrTranscript,\n }\n const { action, ...eventArgs } = event\n await trackEvent(this.request, action, eventArgs)\n }\n}\n"],"names":["EventAction","NluType","REG_EXP_PATTERN","getCommonFlowContentEventArgsForContentId","trackEvent","KeywordMatcher","keywordNodes","keywordNode","undefined","targetPayload","userInput","matchedKeywordNode","node","result","keywords","Boolean","keyword","regExpMatchArray","keywordAsRegExp","match","pattern","flags","RegExp","flowId","flowName","flowNodeId","flowNodeContentId","event","action","eventArgs","cmsApi","locale","request","userTextOrTranscript"],"mappings":"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"}
@@ -1,6 +1,6 @@
1
1
  import type { ActionRequest } from '@botonic/react';
2
- import type { FlowBuilderApi } from '../api';
3
- import type { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent';
2
+ import type { FlowBuilderApi } from '../api.js';
3
+ import type { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent.js';
4
4
  export interface SmartIntentsInferenceParams {
5
5
  bot_id: string;
6
6
  text: string;
@@ -1,18 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SmartIntentsApi = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@botonic/core");
6
- const axios_1 = tslib_1.__importDefault(require("axios"));
7
- const tracking_1 = require("../tracking");
8
- const get_flow_builder_plugin_1 = require("../utils/get-flow-builder-plugin");
1
+ import { EventAction, NluType } from "@botonic/core";
2
+ import axios from "axios";
3
+ import { getCommonFlowContentEventArgsForContentId, trackEvent } from "../tracking.js";
4
+ import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
9
14
  class SmartIntentsApi {
10
- constructor(cmsApi, currentRequest, smartIntentsConfig, userTextOrTranscript) {
11
- this.cmsApi = cmsApi;
12
- this.currentRequest = currentRequest;
13
- this.smartIntentsConfig = smartIntentsConfig;
14
- this.userTextOrTranscript = userTextOrTranscript;
15
- }
16
15
  async getNodeByInput() {
17
16
  if (!this.userTextOrTranscript) {
18
17
  return undefined;
@@ -21,29 +20,27 @@ class SmartIntentsApi {
21
20
  if (!smartIntentNodes.length) {
22
21
  return undefined;
23
22
  }
24
- const disabledSmartIntentTitles = smartIntentNodes
25
- .filter(smartIntentNode => smartIntentNode.content.is_active === false)
26
- .map(smartIntentNode => smartIntentNode.content.title);
23
+ const disabledSmartIntentTitles = smartIntentNodes.filter((smartIntentNode)=>smartIntentNode.content.is_active === false).map((smartIntentNode)=>smartIntentNode.content.title);
27
24
  const params = {
28
25
  bot_id: this.currentRequest.session.bot.id,
29
26
  text: this.userTextOrTranscript,
30
27
  num_smart_intents_to_use: this.smartIntentsConfig.numSmartIntentsToUse,
31
28
  use_latest: this.resolveUseLatest(),
32
- disabled_smart_intent_titles: disabledSmartIntentTitles,
29
+ disabled_smart_intent_titles: disabledSmartIntentTitles
33
30
  };
34
31
  try {
35
32
  const response = await this.getInference(params);
36
- const smartIntentNode = smartIntentNodes.find(smartIntentNode => smartIntentNode.content.title === response.data.smart_intent_title);
33
+ const smartIntentNode = smartIntentNodes.find((smartIntentNode)=>smartIntentNode.content.title === response.data.smart_intent_title);
37
34
  if (smartIntentNode) {
38
35
  const targetPayload = this.cmsApi.getPayload(smartIntentNode.target);
39
36
  this.currentRequest.input.nluResolution = {
40
- type: core_1.NluType.SmartIntent,
37
+ type: NluType.SmartIntent,
41
38
  matchedValue: smartIntentNode.content.title,
42
- payload: targetPayload,
39
+ payload: targetPayload
43
40
  };
44
- const { flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(this.currentRequest, smartIntentNode.id);
41
+ const { flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(this.currentRequest, smartIntentNode.id);
45
42
  const event = {
46
- action: core_1.EventAction.IntentSmart,
43
+ action: EventAction.IntentSmart,
47
44
  nluIntentSmartTitle: response.data.smart_intent_title,
48
45
  nluIntentSmartNumUsed: response.data.smart_intents_used.length,
49
46
  nluIntentSmartMessageId: this.currentRequest.input.message_id,
@@ -52,14 +49,13 @@ class SmartIntentsApi {
52
49
  flowId,
53
50
  flowName,
54
51
  flowNodeContentId,
55
- flowNodeId,
52
+ flowNodeId
56
53
  };
57
54
  const { action, ...eventArgs } = event;
58
- await (0, tracking_1.trackEvent)(this.currentRequest, action, eventArgs);
55
+ await trackEvent(this.currentRequest, action, eventArgs);
59
56
  return smartIntentNode;
60
57
  }
61
- }
62
- catch (e) {
58
+ } catch (e) {
63
59
  console.error(e);
64
60
  }
65
61
  return undefined;
@@ -71,19 +67,27 @@ class SmartIntentsApi {
71
67
  return this.smartIntentsConfig.useLatest;
72
68
  }
73
69
  async getInference(inferenceParams) {
74
- const pluginFlowBuilder = (0, get_flow_builder_plugin_1.getFlowBuilderPlugin)(this.currentRequest.plugins);
70
+ const pluginFlowBuilder = getFlowBuilderPlugin(this.currentRequest.plugins);
75
71
  const token = pluginFlowBuilder.getAccessToken(this.currentRequest.session);
76
- return await (0, axios_1.default)({
72
+ return await axios({
77
73
  method: 'POST',
78
74
  url: `${process.env.HUBTYPE_API_URL}/external/v2/ai/smart_intents/inference/`,
79
75
  headers: {
80
76
  Authorization: `Bearer ${token}`,
81
- 'Content-Type': 'application/json',
77
+ 'Content-Type': 'application/json'
82
78
  },
83
79
  data: inferenceParams,
84
- timeout: 10000,
80
+ timeout: 10000
85
81
  });
86
82
  }
83
+ constructor(cmsApi, currentRequest, smartIntentsConfig, userTextOrTranscript){
84
+ this.cmsApi = cmsApi;
85
+ this.currentRequest = currentRequest;
86
+ this.smartIntentsConfig = smartIntentsConfig;
87
+ this.userTextOrTranscript = userTextOrTranscript;
88
+ }
87
89
  }
88
- exports.SmartIntentsApi = SmartIntentsApi;
90
+
91
+ export { SmartIntentsApi };
92
+
89
93
  //# sourceMappingURL=smart-intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-input/smart-intent.js","sources":["../../src/user-input/smart-intent.ts"],"sourcesContent":["import { EventAction, type EventIntentSmart, NluType } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport axios from 'axios'\n\nimport type { FlowBuilderApi } from '../api'\nimport type { HtSmartIntentNode } from '../content-fields/hubtype-fields/smart-intent'\nimport {\n getCommonFlowContentEventArgsForContentId,\n trackEvent,\n} from '../tracking'\nimport type { SmartIntentResponse } from '../types'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\n\nexport interface SmartIntentsInferenceParams {\n bot_id: string\n text: string\n num_smart_intents_to_use?: number\n use_latest: boolean\n disabled_smart_intent_titles: string[]\n}\n\nexport interface SmartIntentsInferenceConfig {\n useLatest: boolean\n numSmartIntentsToUse?: number\n}\n\nexport class SmartIntentsApi {\n constructor(\n public cmsApi: FlowBuilderApi,\n public currentRequest: ActionRequest,\n public smartIntentsConfig: SmartIntentsInferenceConfig,\n public userTextOrTranscript: string\n ) {}\n\n async getNodeByInput(): Promise<HtSmartIntentNode | undefined> {\n if (!this.userTextOrTranscript) {\n return undefined\n }\n const smartIntentNodes = this.cmsApi.getSmartIntentNodes()\n if (!smartIntentNodes.length) {\n return undefined\n }\n\n const disabledSmartIntentTitles = smartIntentNodes\n .filter(smartIntentNode => smartIntentNode.content.is_active === false)\n .map(smartIntentNode => smartIntentNode.content.title)\n\n const params = {\n bot_id: this.currentRequest.session.bot.id,\n text: this.userTextOrTranscript,\n num_smart_intents_to_use: this.smartIntentsConfig.numSmartIntentsToUse,\n use_latest: this.resolveUseLatest(),\n disabled_smart_intent_titles: disabledSmartIntentTitles,\n }\n\n try {\n const response = await this.getInference(params)\n const smartIntentNode = smartIntentNodes.find(\n smartIntentNode =>\n smartIntentNode.content.title === response.data.smart_intent_title\n )\n\n if (smartIntentNode) {\n const targetPayload = this.cmsApi.getPayload(smartIntentNode.target)\n this.currentRequest.input.nluResolution = {\n type: NluType.SmartIntent,\n matchedValue: smartIntentNode.content.title,\n payload: targetPayload,\n }\n\n const { flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgsForContentId(\n this.currentRequest,\n smartIntentNode.id\n )\n\n const event: EventIntentSmart = {\n action: EventAction.IntentSmart,\n nluIntentSmartTitle: response.data.smart_intent_title,\n nluIntentSmartNumUsed: response.data.smart_intents_used.length,\n nluIntentSmartMessageId: this.currentRequest.input.message_id,\n userInput: this.userTextOrTranscript,\n flowThreadId: this.currentRequest.session.flow_thread_id as string,\n flowId,\n flowName,\n flowNodeContentId,\n flowNodeId,\n }\n const { action, ...eventArgs } = event\n\n await trackEvent(this.currentRequest, action, eventArgs)\n\n return smartIntentNode\n }\n } catch (e) {\n console.error(e)\n }\n return undefined\n }\n\n private resolveUseLatest(): boolean {\n if (this.currentRequest.session.is_test_integration) {\n return false\n }\n return this.smartIntentsConfig.useLatest\n }\n\n private async getInference(\n inferenceParams: SmartIntentsInferenceParams\n ): Promise<SmartIntentResponse> {\n const pluginFlowBuilder = getFlowBuilderPlugin(this.currentRequest.plugins)\n const token = pluginFlowBuilder.getAccessToken(this.currentRequest.session)\n\n return await axios({\n method: 'POST',\n url: `${process.env.HUBTYPE_API_URL}/external/v2/ai/smart_intents/inference/`,\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n data: inferenceParams,\n timeout: 10000,\n })\n }\n}\n"],"names":["EventAction","NluType","axios","getCommonFlowContentEventArgsForContentId","trackEvent","getFlowBuilderPlugin","SmartIntentsApi","undefined","smartIntentNodes","disabledSmartIntentTitles","smartIntentNode","params","response","targetPayload","flowId","flowName","flowNodeId","flowNodeContentId","event","action","eventArgs","e","console","inferenceParams","pluginFlowBuilder","token","process","cmsApi","currentRequest","smartIntentsConfig","userTextOrTranscript"],"mappings":"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"}
@@ -1,6 +1,6 @@
1
- import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router';
2
- import { FlowAiAgent, type FlowContent } from '../content-fields/index';
3
- export { HubtypeAssistantContent } from './hubtype-assistant-content';
1
+ import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router.js';
2
+ import { FlowAiAgent, type FlowContent } from '../content-fields/index.js';
3
+ export { HubtypeAssistantContent } from './hubtype-assistant-content.js';
4
4
  type AiAgentContentAndContentsBeforeAiAgent = {
5
5
  aiAgentWorkerContent: FlowAiAgent;
6
6
  contentsBeforeAiAgentWorker: FlowContent[];
@@ -0,0 +1,33 @@
1
+ import { FlowAiAgentRouter } from "../content-fields/flow-ai-agent-router.js";
2
+ import { FlowAiAgent } from "../content-fields/index.js";
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+ function splitAiAgentContents(contents) {
11
+ const aiAgentRouterIndex = contents.findIndex((content)=>content instanceof FlowAiAgentRouter);
12
+ if (aiAgentRouterIndex >= 0) {
13
+ return {
14
+ aiAgentRouterContent: contents[aiAgentRouterIndex],
15
+ contentsBeforeAiAgentRouter: contents.slice(0, aiAgentRouterIndex)
16
+ };
17
+ }
18
+ const aiAgentIndex = contents.findIndex((content)=>content instanceof FlowAiAgent);
19
+ if (aiAgentIndex < 0) {
20
+ return undefined;
21
+ }
22
+ const aiAgentWorkerContent = contents[aiAgentIndex];
23
+ const contentsBeforeAiAgentWorker = contents.slice(0, aiAgentIndex);
24
+ return {
25
+ aiAgentWorkerContent,
26
+ contentsBeforeAiAgentWorker
27
+ };
28
+ }
29
+
30
+ export { splitAiAgentContents };
31
+ export { HubtypeAssistantContent } from "./hubtype-assistant-content.js";
32
+
33
+ //# sourceMappingURL=ai-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/ai-agent.js","sources":["../../src/utils/ai-agent.ts"],"sourcesContent":["import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router'\nimport { FlowAiAgent, type FlowContent } from '../content-fields/index'\n\nexport { HubtypeAssistantContent } from './hubtype-assistant-content'\n\ntype AiAgentContentAndContentsBeforeAiAgent =\n | {\n aiAgentWorkerContent: FlowAiAgent\n contentsBeforeAiAgentWorker: FlowContent[]\n }\n | {\n aiAgentRouterContent: FlowAiAgentRouter\n contentsBeforeAiAgentRouter: FlowContent[]\n }\n\nexport function splitAiAgentContents(\n contents: FlowContent[]\n): AiAgentContentAndContentsBeforeAiAgent | undefined {\n const aiAgentRouterIndex = contents.findIndex(\n content => content instanceof FlowAiAgentRouter\n )\n if (aiAgentRouterIndex >= 0) {\n return {\n aiAgentRouterContent: contents[aiAgentRouterIndex] as FlowAiAgentRouter,\n contentsBeforeAiAgentRouter: contents.slice(0, aiAgentRouterIndex),\n }\n }\n\n const aiAgentIndex = contents.findIndex(\n content => content instanceof FlowAiAgent\n )\n if (aiAgentIndex < 0) {\n return undefined\n }\n\n const aiAgentWorkerContent = contents[aiAgentIndex] as FlowAiAgent\n const contentsBeforeAiAgentWorker = contents.slice(0, aiAgentIndex)\n\n return {\n aiAgentWorkerContent,\n contentsBeforeAiAgentWorker,\n }\n}\n"],"names":["FlowAiAgentRouter","FlowAiAgent","HubtypeAssistantContent","splitAiAgentContents","contents","aiAgentRouterIndex","content","aiAgentIndex","undefined","aiAgentWorkerContent","contentsBeforeAiAgentWorker"],"mappings":";;;;;;AAA0E;AACH;AAEF;AAY9D,SAASG,oBAAoBA,CAClCC,QAAuB;IAEvB,MAAMC,qBAAqBD,SAAS,SAAS,CAC3CE,CAAAA,UAAWA,mBAAmBN,iBAAiBA;IAEjD,IAAIK,sBAAsB,GAAG;QAC3B,OAAO;YACL,sBAAsBD,QAAQ,CAACC,mBAAmB;YAClD,6BAA6BD,SAAS,KAAK,CAAC,GAAGC;QACjD;IACF;IAEA,MAAME,eAAeH,SAAS,SAAS,CACrCE,CAAAA,UAAWA,mBAAmBL,WAAWA;IAE3C,IAAIM,eAAe,GAAG;QACpB,OAAOC;IACT;IAEA,MAAMC,uBAAuBL,QAAQ,CAACG,aAAa;IACnD,MAAMG,8BAA8BN,SAAS,KAAK,CAAC,GAAGG;IAEtD,OAAO;QACLE;QACAC;IACF;AACF"}
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveGetAccessToken = resolveGetAccessToken;
4
- const types_1 = require("../types");
1
+ import { ProcessEnvNodeEnvs } from "../types.js";
2
+
3
+
4
+
5
5
  function getAccessTokenFromSession(session) {
6
6
  if (!session._access_token) {
7
7
  throw new Error('No access token found in session');
@@ -9,13 +9,16 @@ function getAccessTokenFromSession(session) {
9
9
  return session._access_token;
10
10
  }
11
11
  function resolveGetAccessToken(getAccessToken) {
12
- switch (process.env.NODE_ENV) {
13
- case types_1.ProcessEnvNodeEnvs.PRODUCTION:
12
+ switch(process.env.NODE_ENV){
13
+ case ProcessEnvNodeEnvs.PRODUCTION:
14
14
  return getAccessTokenFromSession;
15
- case types_1.ProcessEnvNodeEnvs.DEVELOPMENT:
15
+ case ProcessEnvNodeEnvs.DEVELOPMENT:
16
16
  return getAccessToken;
17
17
  default:
18
18
  throw new Error('No method defined for getting access token');
19
19
  }
20
20
  }
21
+
22
+ export { resolveGetAccessToken };
23
+
21
24
  //# sourceMappingURL=authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/authentication.js","sources":["../../src/utils/authentication.ts"],"sourcesContent":["import type { Session } from '@botonic/core'\n\nimport { ProcessEnvNodeEnvs } from '../types'\n\nfunction getAccessTokenFromSession(session: Session): string {\n if (!session._access_token) {\n throw new Error('No access token found in session')\n }\n return session._access_token\n}\n\nexport function resolveGetAccessToken(\n getAccessToken: (session: Session) => string\n): (session: Session) => string {\n switch (process.env.NODE_ENV) {\n case ProcessEnvNodeEnvs.PRODUCTION:\n return getAccessTokenFromSession\n case ProcessEnvNodeEnvs.DEVELOPMENT:\n return getAccessToken\n default:\n throw new Error('No method defined for getting access token')\n }\n}\n"],"names":["ProcessEnvNodeEnvs","getAccessTokenFromSession","session","Error","resolveGetAccessToken","getAccessToken","process"],"mappings":";;;AAE6C;AAE7C,SAASC,yBAAyBA,CAACC,OAAgB;IACjD,IAAI,CAACA,QAAQ,aAAa,EAAE;QAC1B,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOD,QAAQ,aAAa;AAC9B;AAEO,SAASE,qBAAqBA,CACnCC,cAA4C;IAE5C,OAAQC,oBAAoB;QAC1B,KAAKN,6BAA6B;YAChC,OAAOC,yBAAyBA;QAClC,KAAKD,8BAA8B;YACjC,OAAOK;QACT;YACE,MAAM,IAAIF,MAAM;IACpB;AACF"}