@botonic/plugin-flow-builder 0.57.0-rslib-esm.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 (380) hide show
  1. package/README.md +1 -1
  2. package/lib/action/ai-agent-from-user-input.js.map +1 -0
  3. package/lib/action/context.js.map +1 -0
  4. package/lib/action/fallback.js.map +1 -0
  5. package/lib/action/first-interaction.js.map +1 -0
  6. package/lib/action/get-contents.js.map +1 -0
  7. package/lib/action/index.js.map +1 -0
  8. package/lib/action/payload.js.map +1 -0
  9. package/lib/api.js.map +1 -0
  10. package/lib/constants.js.map +1 -0
  11. package/lib/content-fields/content-fields-base.js.map +1 -0
  12. package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
  13. package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
  14. package/lib/{esm/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.d.ts +1 -1
  15. package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
  16. package/lib/content-fields/flow-ai-agent-base.js.map +1 -0
  17. package/lib/content-fields/flow-ai-agent-router.js.map +1 -0
  18. package/lib/content-fields/flow-ai-agent.js.map +1 -0
  19. package/lib/content-fields/flow-bot-action.js.map +1 -0
  20. package/lib/content-fields/flow-button.js.map +1 -0
  21. package/lib/content-fields/flow-capture-user-input.js.map +1 -0
  22. package/lib/content-fields/flow-carousel.js.map +1 -0
  23. package/lib/content-fields/flow-channel-conditional.js.map +1 -0
  24. package/lib/content-fields/flow-country-conditional.js.map +1 -0
  25. package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.d.ts +1 -1
  26. package/lib/content-fields/flow-custom-conditional.js.map +1 -0
  27. package/lib/content-fields/flow-element.js.map +1 -0
  28. package/lib/content-fields/flow-go-to-flow.js.map +1 -0
  29. package/lib/content-fields/flow-handoff.js.map +1 -0
  30. package/lib/content-fields/flow-image.js.map +1 -0
  31. package/lib/content-fields/flow-queue-status-conditional.js.map +1 -0
  32. package/lib/content-fields/flow-rating.js.map +1 -0
  33. package/lib/content-fields/flow-text.js.map +1 -0
  34. package/lib/content-fields/flow-video.js.map +1 -0
  35. package/lib/content-fields/flow-webview.js.map +1 -0
  36. package/lib/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
  37. package/lib/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
  38. package/lib/content-fields/flow-whatsapp-template.js.map +1 -0
  39. package/lib/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
  40. package/lib/content-fields/hubtype-fields/ai-agent.js.map +1 -0
  41. package/lib/content-fields/hubtype-fields/bot-action.js.map +1 -0
  42. package/lib/content-fields/hubtype-fields/button.js.map +1 -0
  43. package/lib/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
  44. package/lib/content-fields/hubtype-fields/carousel.js.map +1 -0
  45. package/lib/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
  46. package/lib/content-fields/hubtype-fields/common.js.map +1 -0
  47. package/lib/content-fields/hubtype-fields/country-conditional.js.map +1 -0
  48. package/lib/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
  49. package/lib/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
  50. package/lib/content-fields/hubtype-fields/fallback.js.map +1 -0
  51. package/lib/content-fields/hubtype-fields/function.js.map +1 -0
  52. package/lib/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
  53. package/lib/content-fields/hubtype-fields/handoff.js.map +1 -0
  54. package/lib/content-fields/hubtype-fields/image.js.map +1 -0
  55. package/lib/content-fields/hubtype-fields/index.js.map +1 -0
  56. package/lib/content-fields/hubtype-fields/keyword.js.map +1 -0
  57. package/lib/content-fields/hubtype-fields/node-types.js.map +1 -0
  58. package/lib/content-fields/hubtype-fields/nodes.js.map +1 -0
  59. package/lib/content-fields/hubtype-fields/payload.js.map +1 -0
  60. package/lib/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
  61. package/lib/content-fields/hubtype-fields/rating.js.map +1 -0
  62. package/lib/content-fields/hubtype-fields/smart-intent.js.map +1 -0
  63. package/lib/content-fields/hubtype-fields/text.js.map +1 -0
  64. package/lib/content-fields/hubtype-fields/url.js.map +1 -0
  65. package/lib/content-fields/hubtype-fields/video.js.map +1 -0
  66. package/lib/content-fields/hubtype-fields/webview.js.map +1 -0
  67. package/lib/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
  68. package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
  69. package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
  70. package/lib/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
  71. package/lib/{esm/content-fields → content-fields}/index.d.ts +1 -1
  72. package/lib/content-fields/index.js.map +1 -0
  73. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
  74. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
  75. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
  76. package/lib/content-fields/whatsapp-button-list/index.js.map +1 -0
  77. package/lib/filters/index.js.map +1 -0
  78. package/lib/flow-factory.js.map +1 -0
  79. package/lib/functions/index.js.map +1 -0
  80. package/lib/index.js.map +1 -0
  81. package/lib/services/hubtype-queues-api.js.map +1 -0
  82. package/lib/structured-output/flow-builder-content.js.map +1 -0
  83. package/lib/tracking.js.map +1 -0
  84. package/lib/types.js.map +1 -0
  85. package/lib/user-input/capture-user-input-api.js.map +1 -0
  86. package/lib/user-input/index.js.map +1 -0
  87. package/lib/user-input/keyword.js.map +1 -0
  88. package/lib/user-input/smart-intent.js.map +1 -0
  89. package/lib/utils/ai-agent.js.map +1 -0
  90. package/lib/utils/authentication.js.map +1 -0
  91. package/lib/utils/flow-locale.js.map +1 -0
  92. package/lib/utils/get-flow-builder-plugin.js.map +1 -0
  93. package/lib/utils/hubtype-assistant-content.js.map +1 -0
  94. package/lib/utils/input.js.map +1 -0
  95. package/lib/webview/contents-context.js.map +1 -0
  96. package/lib/webview/index.js.map +1 -0
  97. package/lib/webview/types.js.map +1 -0
  98. package/lib/webview/use-webview-contents.js.map +1 -0
  99. package/package.json +8 -7
  100. package/src/content-fields/index.ts +2 -2
  101. package/lib/esm/action/ai-agent-from-user-input.js.map +0 -1
  102. package/lib/esm/action/context.js.map +0 -1
  103. package/lib/esm/action/fallback.js.map +0 -1
  104. package/lib/esm/action/first-interaction.js.map +0 -1
  105. package/lib/esm/action/get-contents.js.map +0 -1
  106. package/lib/esm/action/index.js.map +0 -1
  107. package/lib/esm/action/payload.js.map +0 -1
  108. package/lib/esm/api.js.map +0 -1
  109. package/lib/esm/constants.js.map +0 -1
  110. package/lib/esm/content-fields/content-fields-base.js.map +0 -1
  111. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  112. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  113. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  114. package/lib/esm/content-fields/flow-ai-agent-base.js.map +0 -1
  115. package/lib/esm/content-fields/flow-ai-agent-router.js.map +0 -1
  116. package/lib/esm/content-fields/flow-ai-agent.js.map +0 -1
  117. package/lib/esm/content-fields/flow-bot-action.js.map +0 -1
  118. package/lib/esm/content-fields/flow-button.js.map +0 -1
  119. package/lib/esm/content-fields/flow-capture-user-input.js.map +0 -1
  120. package/lib/esm/content-fields/flow-carousel.js.map +0 -1
  121. package/lib/esm/content-fields/flow-channel-conditional.js.map +0 -1
  122. package/lib/esm/content-fields/flow-country-conditional.js.map +0 -1
  123. package/lib/esm/content-fields/flow-custom-conditional.js.map +0 -1
  124. package/lib/esm/content-fields/flow-element.js.map +0 -1
  125. package/lib/esm/content-fields/flow-go-to-flow.js.map +0 -1
  126. package/lib/esm/content-fields/flow-handoff.js.map +0 -1
  127. package/lib/esm/content-fields/flow-image.js.map +0 -1
  128. package/lib/esm/content-fields/flow-queue-status-conditional.js.map +0 -1
  129. package/lib/esm/content-fields/flow-rating.js.map +0 -1
  130. package/lib/esm/content-fields/flow-text.js.map +0 -1
  131. package/lib/esm/content-fields/flow-video.js.map +0 -1
  132. package/lib/esm/content-fields/flow-webview.js.map +0 -1
  133. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  134. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
  135. package/lib/esm/content-fields/flow-whatsapp-template.js.map +0 -1
  136. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  137. package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  138. package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +0 -1
  139. package/lib/esm/content-fields/hubtype-fields/button.js.map +0 -1
  140. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  141. package/lib/esm/content-fields/hubtype-fields/carousel.js.map +0 -1
  142. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  143. package/lib/esm/content-fields/hubtype-fields/common.js.map +0 -1
  144. package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  145. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  146. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  147. package/lib/esm/content-fields/hubtype-fields/fallback.js.map +0 -1
  148. package/lib/esm/content-fields/hubtype-fields/function.js.map +0 -1
  149. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  150. package/lib/esm/content-fields/hubtype-fields/handoff.js.map +0 -1
  151. package/lib/esm/content-fields/hubtype-fields/image.js.map +0 -1
  152. package/lib/esm/content-fields/hubtype-fields/index.js.map +0 -1
  153. package/lib/esm/content-fields/hubtype-fields/keyword.js.map +0 -1
  154. package/lib/esm/content-fields/hubtype-fields/node-types.js.map +0 -1
  155. package/lib/esm/content-fields/hubtype-fields/nodes.js.map +0 -1
  156. package/lib/esm/content-fields/hubtype-fields/payload.js.map +0 -1
  157. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  158. package/lib/esm/content-fields/hubtype-fields/rating.js.map +0 -1
  159. package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  160. package/lib/esm/content-fields/hubtype-fields/text.js.map +0 -1
  161. package/lib/esm/content-fields/hubtype-fields/url.js.map +0 -1
  162. package/lib/esm/content-fields/hubtype-fields/video.js.map +0 -1
  163. package/lib/esm/content-fields/hubtype-fields/webview.js.map +0 -1
  164. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  165. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  166. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
  167. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  168. package/lib/esm/content-fields/index.js.map +0 -1
  169. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  170. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  171. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  172. package/lib/esm/content-fields/whatsapp-button-list/index.js.map +0 -1
  173. package/lib/esm/filters/index.js.map +0 -1
  174. package/lib/esm/flow-factory.js.map +0 -1
  175. package/lib/esm/functions/index.js.map +0 -1
  176. package/lib/esm/index.js.map +0 -1
  177. package/lib/esm/package.json +0 -3
  178. package/lib/esm/services/hubtype-queues-api.js.map +0 -1
  179. package/lib/esm/structured-output/flow-builder-content.js.map +0 -1
  180. package/lib/esm/tracking.js.map +0 -1
  181. package/lib/esm/types.js.map +0 -1
  182. package/lib/esm/user-input/capture-user-input-api.js.map +0 -1
  183. package/lib/esm/user-input/index.js.map +0 -1
  184. package/lib/esm/user-input/keyword.js.map +0 -1
  185. package/lib/esm/user-input/smart-intent.js.map +0 -1
  186. package/lib/esm/utils/ai-agent.js.map +0 -1
  187. package/lib/esm/utils/authentication.js.map +0 -1
  188. package/lib/esm/utils/flow-locale.js.map +0 -1
  189. package/lib/esm/utils/get-flow-builder-plugin.js.map +0 -1
  190. package/lib/esm/utils/hubtype-assistant-content.js.map +0 -1
  191. package/lib/esm/utils/input.js.map +0 -1
  192. package/lib/esm/webview/contents-context.js.map +0 -1
  193. package/lib/esm/webview/index.js.map +0 -1
  194. package/lib/esm/webview/types.js.map +0 -1
  195. package/lib/esm/webview/use-webview-contents.js.map +0 -1
  196. /package/lib/{esm/action → action}/ai-agent-from-user-input.d.ts +0 -0
  197. /package/lib/{esm/action → action}/ai-agent-from-user-input.js +0 -0
  198. /package/lib/{esm/action → action}/context.d.ts +0 -0
  199. /package/lib/{esm/action → action}/context.js +0 -0
  200. /package/lib/{esm/action → action}/fallback.d.ts +0 -0
  201. /package/lib/{esm/action → action}/fallback.js +0 -0
  202. /package/lib/{esm/action → action}/first-interaction.d.ts +0 -0
  203. /package/lib/{esm/action → action}/first-interaction.js +0 -0
  204. /package/lib/{esm/action → action}/get-contents.d.ts +0 -0
  205. /package/lib/{esm/action → action}/get-contents.js +0 -0
  206. /package/lib/{esm/action → action}/index.d.ts +0 -0
  207. /package/lib/{esm/action → action}/index.js +0 -0
  208. /package/lib/{esm/action → action}/payload.d.ts +0 -0
  209. /package/lib/{esm/action → action}/payload.js +0 -0
  210. /package/lib/{esm/api.d.ts → api.d.ts} +0 -0
  211. /package/lib/{esm/api.js → api.js} +0 -0
  212. /package/lib/{esm/constants.d.ts → constants.d.ts} +0 -0
  213. /package/lib/{esm/constants.js → constants.js} +0 -0
  214. /package/lib/{esm/content-fields → content-fields}/content-fields-base.d.ts +0 -0
  215. /package/lib/{esm/content-fields → content-fields}/content-fields-base.js +0 -0
  216. /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -0
  217. /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.js +0 -0
  218. /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -0
  219. /package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.js +0 -0
  220. /package/lib/{esm/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.js +0 -0
  221. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.d.ts +0 -0
  222. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.js +0 -0
  223. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.d.ts +0 -0
  224. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.js +0 -0
  225. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent.d.ts +0 -0
  226. /package/lib/{esm/content-fields → content-fields}/flow-ai-agent.js +0 -0
  227. /package/lib/{esm/content-fields → content-fields}/flow-bot-action.d.ts +0 -0
  228. /package/lib/{esm/content-fields → content-fields}/flow-bot-action.js +0 -0
  229. /package/lib/{esm/content-fields → content-fields}/flow-button.d.ts +0 -0
  230. /package/lib/{esm/content-fields → content-fields}/flow-button.js +0 -0
  231. /package/lib/{esm/content-fields → content-fields}/flow-capture-user-input.d.ts +0 -0
  232. /package/lib/{esm/content-fields → content-fields}/flow-capture-user-input.js +0 -0
  233. /package/lib/{esm/content-fields → content-fields}/flow-carousel.d.ts +0 -0
  234. /package/lib/{esm/content-fields → content-fields}/flow-carousel.js +0 -0
  235. /package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.d.ts +0 -0
  236. /package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.js +0 -0
  237. /package/lib/{esm/content-fields → content-fields}/flow-country-conditional.d.ts +0 -0
  238. /package/lib/{esm/content-fields → content-fields}/flow-country-conditional.js +0 -0
  239. /package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.js +0 -0
  240. /package/lib/{esm/content-fields → content-fields}/flow-element.d.ts +0 -0
  241. /package/lib/{esm/content-fields → content-fields}/flow-element.js +0 -0
  242. /package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.d.ts +0 -0
  243. /package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.js +0 -0
  244. /package/lib/{esm/content-fields → content-fields}/flow-handoff.d.ts +0 -0
  245. /package/lib/{esm/content-fields → content-fields}/flow-handoff.js +0 -0
  246. /package/lib/{esm/content-fields → content-fields}/flow-image.d.ts +0 -0
  247. /package/lib/{esm/content-fields → content-fields}/flow-image.js +0 -0
  248. /package/lib/{esm/content-fields → content-fields}/flow-queue-status-conditional.d.ts +0 -0
  249. /package/lib/{esm/content-fields → content-fields}/flow-queue-status-conditional.js +0 -0
  250. /package/lib/{esm/content-fields → content-fields}/flow-rating.d.ts +0 -0
  251. /package/lib/{esm/content-fields → content-fields}/flow-rating.js +0 -0
  252. /package/lib/{esm/content-fields → content-fields}/flow-text.d.ts +0 -0
  253. /package/lib/{esm/content-fields → content-fields}/flow-text.js +0 -0
  254. /package/lib/{esm/content-fields → content-fields}/flow-video.d.ts +0 -0
  255. /package/lib/{esm/content-fields → content-fields}/flow-video.js +0 -0
  256. /package/lib/{esm/content-fields → content-fields}/flow-webview.d.ts +0 -0
  257. /package/lib/{esm/content-fields → content-fields}/flow-webview.js +0 -0
  258. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.d.ts +0 -0
  259. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.js +0 -0
  260. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.d.ts +0 -0
  261. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.js +0 -0
  262. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.d.ts +0 -0
  263. /package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.js +0 -0
  264. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent-router.d.ts +0 -0
  265. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent-router.js +0 -0
  266. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent.d.ts +0 -0
  267. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/ai-agent.js +0 -0
  268. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/bot-action.d.ts +0 -0
  269. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/bot-action.js +0 -0
  270. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/button.d.ts +0 -0
  271. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/button.js +0 -0
  272. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/capture-user-input.d.ts +0 -0
  273. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/capture-user-input.js +0 -0
  274. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.d.ts +0 -0
  275. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.js +0 -0
  276. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/channel-conditional.d.ts +0 -0
  277. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/channel-conditional.js +0 -0
  278. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.d.ts +0 -0
  279. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.js +0 -0
  280. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/country-conditional.d.ts +0 -0
  281. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/country-conditional.js +0 -0
  282. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.d.ts +0 -0
  283. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.js +0 -0
  284. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.d.ts +0 -0
  285. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.js +0 -0
  286. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.d.ts +0 -0
  287. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.js +0 -0
  288. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.d.ts +0 -0
  289. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.js +0 -0
  290. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/go-to-flow.d.ts +0 -0
  291. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/go-to-flow.js +0 -0
  292. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/handoff.d.ts +0 -0
  293. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/handoff.js +0 -0
  294. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.d.ts +0 -0
  295. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.js +0 -0
  296. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/index.d.ts +0 -0
  297. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/index.js +0 -0
  298. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/keyword.d.ts +0 -0
  299. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/keyword.js +0 -0
  300. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/node-types.d.ts +0 -0
  301. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/node-types.js +0 -0
  302. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/nodes.d.ts +0 -0
  303. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/nodes.js +0 -0
  304. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.d.ts +0 -0
  305. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.js +0 -0
  306. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.d.ts +0 -0
  307. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.js +0 -0
  308. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.d.ts +0 -0
  309. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.js +0 -0
  310. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.d.ts +0 -0
  311. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.js +0 -0
  312. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.d.ts +0 -0
  313. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.js +0 -0
  314. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/url.d.ts +0 -0
  315. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/url.js +0 -0
  316. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.d.ts +0 -0
  317. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.js +0 -0
  318. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.d.ts +0 -0
  319. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.js +0 -0
  320. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.d.ts +0 -0
  321. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.js +0 -0
  322. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -0
  323. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.js +0 -0
  324. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.d.ts +0 -0
  325. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.js +0 -0
  326. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-template.d.ts +0 -0
  327. /package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-template.js +0 -0
  328. /package/lib/{esm/content-fields → content-fields}/index.js +0 -0
  329. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -0
  330. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -0
  331. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -0
  332. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -0
  333. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -0
  334. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.js +0 -0
  335. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.d.ts +0 -0
  336. /package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.js +0 -0
  337. /package/lib/{esm/filters → filters}/index.d.ts +0 -0
  338. /package/lib/{esm/filters → filters}/index.js +0 -0
  339. /package/lib/{esm/flow-factory.d.ts → flow-factory.d.ts} +0 -0
  340. /package/lib/{esm/flow-factory.js → flow-factory.js} +0 -0
  341. /package/lib/{esm/functions → functions}/index.d.ts +0 -0
  342. /package/lib/{esm/functions → functions}/index.js +0 -0
  343. /package/lib/{esm/index.d.ts → index.d.ts} +0 -0
  344. /package/lib/{esm/index.js → index.js} +0 -0
  345. /package/lib/{esm/services → services}/hubtype-queues-api.d.ts +0 -0
  346. /package/lib/{esm/services → services}/hubtype-queues-api.js +0 -0
  347. /package/lib/{esm/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
  348. /package/lib/{esm/structured-output → structured-output}/flow-builder-content.js +0 -0
  349. /package/lib/{esm/tracking.d.ts → tracking.d.ts} +0 -0
  350. /package/lib/{esm/tracking.js → tracking.js} +0 -0
  351. /package/lib/{esm/types.d.ts → types.d.ts} +0 -0
  352. /package/lib/{esm/types.js → types.js} +0 -0
  353. /package/lib/{esm/user-input → user-input}/capture-user-input-api.d.ts +0 -0
  354. /package/lib/{esm/user-input → user-input}/capture-user-input-api.js +0 -0
  355. /package/lib/{esm/user-input → user-input}/index.d.ts +0 -0
  356. /package/lib/{esm/user-input → user-input}/index.js +0 -0
  357. /package/lib/{esm/user-input → user-input}/keyword.d.ts +0 -0
  358. /package/lib/{esm/user-input → user-input}/keyword.js +0 -0
  359. /package/lib/{esm/user-input → user-input}/smart-intent.d.ts +0 -0
  360. /package/lib/{esm/user-input → user-input}/smart-intent.js +0 -0
  361. /package/lib/{esm/utils → utils}/ai-agent.d.ts +0 -0
  362. /package/lib/{esm/utils → utils}/ai-agent.js +0 -0
  363. /package/lib/{esm/utils → utils}/authentication.d.ts +0 -0
  364. /package/lib/{esm/utils → utils}/authentication.js +0 -0
  365. /package/lib/{esm/utils → utils}/flow-locale.d.ts +0 -0
  366. /package/lib/{esm/utils → utils}/flow-locale.js +0 -0
  367. /package/lib/{esm/utils → utils}/get-flow-builder-plugin.d.ts +0 -0
  368. /package/lib/{esm/utils → utils}/get-flow-builder-plugin.js +0 -0
  369. /package/lib/{esm/utils → utils}/hubtype-assistant-content.d.ts +0 -0
  370. /package/lib/{esm/utils → utils}/hubtype-assistant-content.js +0 -0
  371. /package/lib/{esm/utils → utils}/input.d.ts +0 -0
  372. /package/lib/{esm/utils → utils}/input.js +0 -0
  373. /package/lib/{esm/webview → webview}/contents-context.d.ts +0 -0
  374. /package/lib/{esm/webview → webview}/contents-context.js +0 -0
  375. /package/lib/{esm/webview → webview}/index.d.ts +0 -0
  376. /package/lib/{esm/webview → webview}/index.js +0 -0
  377. /package/lib/{esm/webview → webview}/types.d.ts +0 -0
  378. /package/lib/{esm/webview → webview}/types.js +0 -0
  379. /package/lib/{esm/webview → webview}/use-webview-contents.d.ts +0 -0
  380. /package/lib/{esm/webview → webview}/use-webview-contents.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/flow-whatsapp-cta-url-button.js","sources":["../../src/content-fields/flow-whatsapp-cta-url-button.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport {\n Button,\n Text,\n WhatsappCTAUrlButton,\n WhatsappCTAUrlHeaderType,\n} from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../api'\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport { FlowButton } from './flow-button'\nimport type { HtUrlNode, HtWhatsappCTAUrlButtonNode } from './hubtype-fields'\n\nexport class FlowWhatsappCtaUrlButtonNode extends ContentFieldsBase {\n public text = ''\n public header?: string\n public headerType?: WhatsappCTAUrlHeaderType\n public headerImage?: string\n public headerVideo?: string\n public headerDocument?: string\n public footer?: string\n public displayText = ''\n public url: string = ''\n\n static fromHubtypeCMS(\n component: HtWhatsappCTAUrlButtonNode,\n locale: string,\n cmsApi: FlowBuilderApi,\n botContext: BotContext\n ): FlowWhatsappCtaUrlButtonNode {\n const whatsappCtaUrlButton = new FlowWhatsappCtaUrlButtonNode(component.id)\n whatsappCtaUrlButton.code = component.code\n whatsappCtaUrlButton.text = FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.text\n )\n FlowWhatsappCtaUrlButtonNode.setHeader(\n whatsappCtaUrlButton,\n component,\n locale\n )\n whatsappCtaUrlButton.footer = FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.footer\n )\n const button = FlowButton.fromHubtypeCMS(\n component.content.button,\n locale,\n cmsApi,\n botContext\n )\n whatsappCtaUrlButton.displayText = button.text\n const urlId = FlowButton.getUrlId(component.content.button, locale)\n if (urlId) {\n const urlNode = cmsApi.getNodeById<HtUrlNode>(urlId)\n whatsappCtaUrlButton.url = urlNode.content.url\n }\n whatsappCtaUrlButton.followUp = component.follow_up\n\n return whatsappCtaUrlButton\n }\n\n private static setHeader(\n whatsappCtaUrlButton: FlowWhatsappCtaUrlButtonNode,\n component: HtWhatsappCTAUrlButtonNode,\n locale: string\n ) {\n // If header is set, set header_type to text, this is need to be compatible with the old version of the component\n if (component.content.header.length > 0) {\n component.content.header_type = WhatsappCTAUrlHeaderType.Text\n }\n\n whatsappCtaUrlButton.headerType = component.content\n .header_type as WhatsappCTAUrlHeaderType\n\n if (component.content.header_type === WhatsappCTAUrlHeaderType.Text) {\n whatsappCtaUrlButton.header =\n FlowWhatsappCtaUrlButtonNode.getTextByLocale(\n locale,\n component.content.header\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Image &&\n component.content.header_image\n ) {\n whatsappCtaUrlButton.headerImage =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_image\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Video &&\n component.content.header_video\n ) {\n whatsappCtaUrlButton.headerVideo =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_video\n )\n }\n\n if (\n component.content.header_type === WhatsappCTAUrlHeaderType.Document &&\n component.content.header_document\n ) {\n whatsappCtaUrlButton.headerDocument =\n FlowWhatsappCtaUrlButtonNode.getAssetByLocale(\n locale,\n component.content.header_document\n )\n }\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.filterContent(botContext, this)\n await this.trackFlow(botContext)\n return\n }\n\n toBotonic(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n return (\n <Text>\n {replacedText}\n <Button url={this.url}>{this.displayText}</Button>\n </Text>\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Image &&\n this.headerImage\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerImage={this.headerImage}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Video &&\n this.headerVideo\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerVideo={this.headerVideo}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (\n this.headerType === WhatsappCTAUrlHeaderType.Document &&\n this.headerDocument\n ) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n headerType={this.headerType}\n headerDocument={this.headerDocument}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n if (this.headerType === WhatsappCTAUrlHeaderType.Text && this.header) {\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n header={this.header}\n headerType={this.headerType}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n\n return (\n <WhatsappCTAUrlButton\n key={this.id}\n body={replacedText}\n footer={this.footer}\n displayText={this.displayText}\n url={this.url}\n />\n )\n }\n}\n"],"names":["isWhatsapp","Button","Text","WhatsappCTAUrlButton","WhatsappCTAUrlHeaderType","trackOneContent","ContentFieldsBase","FlowButton","FlowWhatsappCtaUrlButtonNode","component","locale","cmsApi","botContext","whatsappCtaUrlButton","button","urlId","urlNode","replacedText"],"mappings":";;;;;;;;;;;;;;AAA2D;AAMpC;AAGsB;AACY;AACf;AAGnC,MAAMQ,4BAA4BA,SAASF,iBAAiBA;IAWjE,OAAO,eACLG,SAAqC,EACrCC,MAAc,EACdC,MAAsB,EACtBC,UAAsB,EACQ;QAC9B,MAAMC,uBAAuB,IAAIL,4BAA4BA,CAACC,UAAU,EAAE;QAC1EI,qBAAqB,IAAI,GAAGJ,UAAU,IAAI;QAC1CI,qBAAqB,IAAI,GAAGL,4BAA4BA,CAAC,eAAe,CACtEE,QACAD,UAAU,OAAO,CAAC,IAAI;QAExBD,4BAA4BA,CAAC,SAAS,CACpCK,sBACAJ,WACAC;QAEFG,qBAAqB,MAAM,GAAGL,4BAA4BA,CAAC,eAAe,CACxEE,QACAD,UAAU,OAAO,CAAC,MAAM;QAE1B,MAAMK,SAASP,yBAAyB,CACtCE,UAAU,OAAO,CAAC,MAAM,EACxBC,QACAC,QACAC;QAEFC,qBAAqB,WAAW,GAAGC,OAAO,IAAI;QAC9C,MAAMC,QAAQR,mBAAmB,CAACE,UAAU,OAAO,CAAC,MAAM,EAAEC;QAC5D,IAAIK,OAAO;YACT,MAAMC,UAAUL,OAAO,WAAW,CAAYI;YAC9CF,qBAAqB,GAAG,GAAGG,QAAQ,OAAO,CAAC,G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,KAAKb,6BAA6B,IAAI,IAAI,CAAC,MAAM,EAAE;YACpE,qBACE,IAACD,oBAAoBA;gBAEnB,MAAMc;gBACN,QAAQ,IAAI,CAAC,MAAM;gBACnB,YAAY,IAAI,CAAC,UAAU;gBAC3B,QAAQ,IAAI,CAAC,MAAM;gBACnB,aAAa,IAAI,CAAC,WAAW;gBAC7B,KAAK,IAAI,CAAC,GAAG;eANR,IAAI,CAAC,EAAE;QASlB;QAEA,qBACE,IAACd,oBAAoBA;YAEnB,MAAMc;YACN,QAAQ,IAAI,CAAC,MAAM;YACnB,aAAa,IAAI,CAAC,WAAW;YAC7B,KAAK,IAAI,CAAC,GAAG;WAJR,IAAI,CAAC,EAAE;IAOlB;;QAxMK,qBACE,OAAO,SAOP,cAAc,SACd,MAAc;;AAgMvB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/flow-whatsapp-request-contact-info.js","sources":["../../src/content-fields/flow-whatsapp-request-contact-info.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport { Text, WhatsappRequestContactInfo } from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { ContentFieldsBase } from './content-fields-base'\nimport type { HtWhatsappRequestContactInfoNode } from './hubtype-fields'\n\nexport class FlowWhatsappRequestContactInfoNode extends ContentFieldsBase {\n public text = ''\n\n static fromHubtypeCMS(\n component: HtWhatsappRequestContactInfoNode,\n locale: string\n ): FlowWhatsappRequestContactInfoNode {\n const requestContactInfo = new FlowWhatsappRequestContactInfoNode(\n component.id\n )\n requestContactInfo.code = component.code\n requestContactInfo.text =\n FlowWhatsappRequestContactInfoNode.getTextByLocale(\n locale,\n component.content.text\n )\n requestContactInfo.followUp = component.follow_up\n\n return requestContactInfo\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.filterContent(botContext, this)\n await this.trackFlow(botContext)\n return\n }\n\n toBotonic(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n return <Text>{replacedText}</Text>\n }\n\n return <WhatsappRequestContactInfo key={this.id} body={replacedText} />\n }\n}\n"],"names":["isWhatsapp","Text","WhatsappRequestContactInfo","trackOneContent","ContentFieldsBase","FlowWhatsappRequestContactInfoNode","component","locale","requestContactInfo","botContext","replacedText"],"mappings":";;;;;;;;;;;;AAA2D;AACM;AAEpB;AACY;AAGlD,MAAMK,kCAAkCA,SAASD,iBAAiBA;IAGvE,OAAO,eACLE,SAA2C,EAC3CC,MAAc,EACsB;QACpC,MAAMC,qBAAqB,IAAIH,kCAAkCA,CAC/DC,UAAU,EAAE;QAEdE,mBAAmB,IAAI,GAAGF,UAAU,IAAI;QACxCE,mBAAmB,IAAI,GACrBH,kCAAkCA,CAAC,eAAe,CAChDE,QACAD,UAAU,OAAO,CAAC,IAAI;QAE1BE,mBAAmB,QAAQ,GAAGF,UAAU,SAAS;QAEjD,OAAOE;IACT;IAEA,MAAM,UAAUC,UAAsB,EAAiB;QACrD,MAAMN,eAAeA,CAACM,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB;IACF;IAEA,UAAUA,UAAsB,EAAe;QAC7C,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAED;QAEtD,IAAI,CAACT,UAAUA,CAACS,WAAW,OAAO,GAAG;YACnC,qBAAO,IAACR,IAAIA;0BAAES;;QAChB;QAEA,qBAAO,IAACR,0BAA0BA;YAAe,MAAMQ;WAAf,IAAI,CAAC,EAAE;IACjD;;QAvCK,qBACE,OAAO;;AAuChB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/flow-whatsapp-template.js","sources":["../../src/content-fields/flow-whatsapp-template.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport {\n Text,\n WhatsAppTemplateButtonSubType,\n WhatsAppTemplateComponentType,\n WhatsAppTemplateParameterType,\n WhatsappTemplate,\n type WhatsappTemplateButton,\n type WhatsappTemplateComponentBody,\n type WhatsappTemplateComponentButtons,\n type WhatsappTemplateComponentHeader,\n type WhatsappTemplateFlowAction,\n type WhatsappTemplateFlowButton,\n type WhatsappTemplatePhoneNumberButton,\n type WhatsappTemplateQuickReplyButton,\n type WhatsappTemplateRequestContactInfoButton,\n type WhatsappTemplateUrlButton,\n type WhatsappTemplateVoiceCallButton,\n} from '@botonic/react'\n\nimport { trackOneContent } from '../tracking'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport { ContentFieldsBase } from './content-fields-base'\nimport {\n type HtButton,\n type HtFlowButtonActionValue,\n type HtMediaFileLocale,\n type HtWhatsAppTemplate,\n type HtWhatsAppTemplateButtonsComponent,\n HtWhatsAppTemplateFlowActionType,\n type HtWhatsAppTemplateHeaderComponent,\n type HtWhatsappTemplateContentByLocale,\n type HtWhatsappTemplateNode,\n} from './hubtype-fields'\n\ninterface HeaderVariables {\n type: WhatsAppTemplateParameterType\n text?: Record<string, string>\n media?: HtMediaFileLocale[]\n}\n\nexport class FlowWhatsappTemplate extends ContentFieldsBase {\n public htWhatsappTemplate: HtWhatsAppTemplate\n public variableValues: Record<string, string> = {}\n public headerVariables?: HeaderVariables\n public buttons?: HtButton[]\n public urlVariableValues?: Record<string, string>\n public flowButtonActionValues?: Record<string, HtFlowButtonActionValue>\n\n static fromHubtypeCMS(\n component: HtWhatsappTemplateNode,\n currentLocale: string\n ): FlowWhatsappTemplate {\n const whatsappTemplate = new FlowWhatsappTemplate(component.id)\n whatsappTemplate.code = component.code\n whatsappTemplate.buttons = component.content.buttons\n const contentByLocale = FlowWhatsappTemplate.getContentByLocale(\n component,\n currentLocale\n )\n\n if (!contentByLocale.template) {\n throw new Error(\n `Whatsapp template not configured for locale: ${currentLocale}`\n )\n }\n\n whatsappTemplate.htWhatsappTemplate = contentByLocale.template\n whatsappTemplate.headerVariables = contentByLocale.header_variables\n whatsappTemplate.variableValues = contentByLocale.variable_values || {}\n whatsappTemplate.urlVariableValues = contentByLocale.url_variable_values\n whatsappTemplate.flowButtonActionValues =\n contentByLocale.flow_button_action_values\n\n whatsappTemplate.followUp = component.follow_up\n\n return whatsappTemplate\n }\n\n private static getContentByLocale(\n component: HtWhatsappTemplateNode,\n currentLocale: string\n ) {\n const content: HtWhatsappTemplateContentByLocale | undefined =\n component.content.by_locale[currentLocale]\n if (!content) {\n throw new Error(\n `Whatsapp template content not found for locale: ${currentLocale}`\n )\n }\n return content\n }\n\n private getHeaderComponent(\n whatsappTemplate: HtWhatsAppTemplate,\n headerVariables: HeaderVariables,\n locale: string,\n botContext: BotContext\n ): WhatsappTemplateComponentHeader | undefined {\n const headerComponent = whatsappTemplate.components.find(\n component => component.type === WhatsAppTemplateComponentType.HEADER\n ) as HtWhatsAppTemplateHeaderComponent | undefined\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.TEXT\n ) {\n return this.createHeaderTextComponent(headerVariables, botContext)\n }\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.IMAGE\n ) {\n return this.createHeaderImageComponent(headerVariables, locale)\n }\n\n if (\n headerComponent &&\n headerComponent.format === WhatsAppTemplateParameterType.VIDEO\n ) {\n return this.createHeaderVideoComponent(headerVariables, locale)\n }\n\n return undefined\n }\n\n private createHeaderTextComponent(\n headerVariables: HeaderVariables,\n botContext: BotContext\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: Object.values(headerVariables.text || {}).map(value => {\n const valueVariable = this.replaceVariables(value, botContext)\n return {\n type: WhatsAppTemplateParameterType.TEXT,\n text: valueVariable,\n }\n }),\n }\n }\n\n private createHeaderImageComponent(\n headerVariables: HeaderVariables,\n locale: string\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.IMAGE,\n image: {\n link:\n headerVariables.media?.find(m => m.locale === locale)?.file || '',\n },\n },\n ],\n }\n }\n\n private createHeaderVideoComponent(\n headerVariables: HeaderVariables,\n locale: string\n ): WhatsappTemplateComponentHeader {\n return {\n type: WhatsAppTemplateComponentType.HEADER,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.VIDEO,\n video: {\n link:\n headerVariables.media?.find(m => m.locale === locale)?.file || '',\n },\n },\n ],\n }\n }\n\n // TODO: To use named variables (contact_info_fields) we need to take it from botContext.session.user.contact_info, this only be able in toBotonic method\n private getBodyComponent(\n variableValues: Record<string, string>,\n botContext: BotContext\n ): WhatsappTemplateComponentBody {\n return {\n type: WhatsAppTemplateComponentType.BODY,\n parameters: Object.entries(variableValues).map(([key, value]) => {\n const valueVariable = this.replaceVariables(value, botContext)\n return {\n type: WhatsAppTemplateParameterType.TEXT,\n parameter_name: key,\n text: valueVariable,\n }\n }),\n }\n }\n\n private getButtons(\n whatsappTemplate: HtWhatsAppTemplate,\n buttonNodes: HtButton[],\n urlVariableValues: Record<string, string>,\n flowButtonActionValues: Record<string, HtFlowButtonActionValue>,\n botContext: BotContext\n ): WhatsappTemplateComponentButtons | undefined {\n const htWhatsappTemplateButtons = whatsappTemplate.components.find(\n component => component.type === WhatsAppTemplateComponentType.BUTTONS\n ) as HtWhatsAppTemplateButtonsComponent | undefined\n\n if (!htWhatsappTemplateButtons) {\n return undefined\n }\n\n const buttons = htWhatsappTemplateButtons.buttons\n .map((button, index) =>\n this.mapTemplateButton(\n button,\n index,\n whatsappTemplate.name,\n buttonNodes,\n urlVariableValues,\n flowButtonActionValues,\n botContext\n )\n )\n .filter(button => button !== null)\n\n return {\n type: WhatsAppTemplateComponentType.BUTTONS,\n buttons: buttons as WhatsappTemplateButton[],\n }\n }\n\n private mapTemplateButton(\n button: HtWhatsAppTemplateButtonsComponent['buttons'][number],\n index: number,\n templateName: string,\n buttonNodes: HtButton[],\n urlVariableValues: Record<string, string>,\n flowButtonActionValues: Record<string, HtFlowButtonActionValue>,\n botContext: BotContext\n ): WhatsappTemplateButton | null {\n if (button.type === WhatsAppTemplateButtonSubType.URL) {\n const urlParam: string | undefined = urlVariableValues?.[String(index)]\n if (!urlParam) {\n return null\n }\n return this.createUrlButtonComponent(index, urlParam, botContext)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.QUICK_REPLY) {\n const payload = buttonNodes[index].target?.id || ''\n return this.createQuickReplyButtonComponent(index, payload)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.PHONE_NUMBER) {\n return this.createPhoneNumberButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.VOICE_CALL) {\n return this.createVoiceCallButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO) {\n return this.createRequestContactInfoButtonComponent(index)\n }\n\n if (button.type === WhatsAppTemplateButtonSubType.FLOW) {\n const actionValue = flowButtonActionValues?.[String(index)]\n if (!actionValue) {\n throw new Error(\n `WhatsApp template '${templateName}' FLOW button at index ${index} requires flow_button_action_values`\n )\n }\n return this.createFlowButtonComponent(\n index,\n button,\n actionValue,\n botContext,\n templateName\n )\n }\n\n throw new Error(\n `WhatsApp template '${templateName}' has unsupported button at index ${index}`\n )\n }\n\n private createUrlButtonComponent(\n index: number,\n urlParam: string,\n botContext: BotContext\n ): WhatsappTemplateUrlButton {\n const variableUrlParam = this.replaceVariables(urlParam, botContext)\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.URL,\n index: index,\n parameters: urlParam\n ? [\n {\n type: WhatsAppTemplateParameterType.TEXT,\n text: variableUrlParam,\n },\n ]\n : [],\n }\n }\n\n private createQuickReplyButtonComponent(\n index: number,\n payload: string\n ): WhatsappTemplateQuickReplyButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.QUICK_REPLY,\n index: index,\n parameters: [\n {\n type: WhatsAppTemplateParameterType.PAYLOAD,\n payload: payload,\n },\n ],\n }\n }\n\n private createVoiceCallButtonComponent(\n index: number\n ): WhatsappTemplateVoiceCallButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.VOICE_CALL,\n index: index,\n parameters: [],\n }\n }\n\n private createPhoneNumberButtonComponent(\n index: number\n ): WhatsappTemplatePhoneNumberButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.PHONE_NUMBER,\n index: index,\n parameters: [],\n }\n }\n\n private createRequestContactInfoButtonComponent(\n index: number\n ): WhatsappTemplateRequestContactInfoButton {\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO,\n index: index,\n parameters: [],\n }\n }\n\n private resolveFlowActionData(\n flowActionData: Record<string, string> | undefined,\n botContext: BotContext\n ): Record<string, string> | undefined {\n if (!flowActionData) {\n return undefined\n }\n\n const resolvedData = Object.fromEntries(\n Object.entries(flowActionData).map(([key, value]) => [\n key,\n this.replaceVariables(value, botContext),\n ])\n )\n\n return Object.keys(resolvedData).length > 0 ? resolvedData : undefined\n }\n\n private createFlowButtonComponent(\n index: number,\n templateButton: Extract<\n HtWhatsAppTemplateButtonsComponent['buttons'][number],\n { type: WhatsAppTemplateButtonSubType.FLOW }\n >,\n actionValue: HtFlowButtonActionValue,\n botContext: BotContext,\n templateName: string\n ): WhatsappTemplateFlowButton {\n const flowToken = this.replaceVariables(actionValue.flow_token, botContext)\n if (!flowToken.trim()) {\n throw new Error(\n `WhatsApp template '${templateName}' FLOW button at index ${index} requires a non-empty flow_token`\n )\n }\n\n const action: WhatsappTemplateFlowAction = {\n flow_token: flowToken,\n }\n\n if (\n templateButton.flow_action !==\n HtWhatsAppTemplateFlowActionType.DATA_EXCHANGE\n ) {\n const flowActionData = this.resolveFlowActionData(\n actionValue.flow_action_data,\n botContext\n )\n if (flowActionData) {\n action.flow_action_data = flowActionData\n }\n }\n\n return {\n type: WhatsAppTemplateComponentType.BUTTON,\n sub_type: WhatsAppTemplateButtonSubType.FLOW,\n index: String(index),\n parameters: [\n {\n type: WhatsAppTemplateParameterType.ACTION,\n action,\n },\n ],\n }\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.filterContent(botContext, this)\n await this.trackFlow(botContext)\n return\n }\n\n toBotonic(botContext: BotContext): JSX.Element {\n const templateName = this.htWhatsappTemplate.name\n const templateLanguage = this.htWhatsappTemplate.language\n const body = this.getBodyComponent(this.variableValues, botContext)\n const pluginFlowBuilder = getFlowBuilderPlugin(botContext.plugins)\n const resolvedLocale = pluginFlowBuilder.cmsApi.getResolvedLocale()\n\n const header = this.getHeaderComponent(\n this.htWhatsappTemplate,\n this.headerVariables || ({} as HeaderVariables),\n resolvedLocale,\n botContext\n )\n const buttons = this.getButtons(\n this.htWhatsappTemplate,\n this.buttons || [],\n this.urlVariableValues || {},\n this.flowButtonActionValues || {},\n botContext\n )\n\n if (isWhatsapp(botContext.session)) {\n return (\n <WhatsappTemplate\n key={this.id}\n name={templateName}\n language={templateLanguage}\n header={header}\n body={body}\n buttons={buttons}\n />\n )\n }\n\n return (\n <Text key={this.id}>\n {`WhatsApp Template: ${templateName} (${templateLanguage})`}\n {header && `${JSON.stringify(header, null, 2)}`}\n {body && `${JSON.stringify(body, null, 2)}`}\n {buttons && `${JSON.stringify(buttons, null, 2)}`}\n </Text>\n )\n }\n}\n"],"names":["isWhatsapp","Text","WhatsAppTemplateButtonSubType","WhatsAppTemplateComponentType","WhatsAppTemplateParameterType","WhatsappTemplate","trackOneContent","getFlowBuilderPlugin","ContentFieldsBase","HtWhatsAppTemplateFlowActionType","FlowWhatsappTemplate","component","currentLocale","whatsappTemplate","contentByLocale","Error","content","headerVariables","locale","botContext","headerComponent","undefined","Object","value","valueVariable","m","variableValues","key","buttonNodes","urlVariableValues","flowButtonActionValues","htWhatsappTemplateButtons","buttons","button","index","templateName","urlParam","String","payload","actionValue","variableUrlParam","flowActionData","resolvedData","templateButton","flowToken","action","templateLanguage","body","pluginFlowBuilder","resolvedLocale","header","JSON"],"mappings":";;;;;;;;;;;;;;;;AAA2D;AAkBpC;AAEsB;AAC0B;AACd;AAWhC;AAQlB,MAAMU,oBAAoBA,SAASF,iBAAiBA;IAQzD,OAAO,eACLG,SAAiC,EACjCC,aAAqB,EACC;QACtB,MAAMC,mBAAmB,IAAIH,oBAAoBA,CAACC,UAAU,EAAE;QAC9DE,iBAAiB,IAAI,GAAGF,UAAU,IAAI;QACtCE,iBAAiB,OAAO,GAAGF,UAAU,OAAO,CAAC,OAAO;QACpD,MAAMG,kBAAkBJ,oBAAoBA,CAAC,kBAAkB,CAC7DC,WACAC;QAGF,IAAI,CAACE,gBAAgB,QAAQ,EAAE;YAC7B,MAAM,IAAIC,MACR,CAAC,6CAA6C,EAAEH,eAAe;QAEnE;QAEAC,iBAAiB,kBAAkB,GAAGC,gBAAgB,QAAQ;QAC9DD,iBAAiB,eAAe,GAAGC,gBAAgB,gBAAgB;QACnED,iBAAiB,cAAc,GAAGC,gBAAgB,eAAe,IAAI,CAAC;QACtED,iBAAiB,iBAAiB,GAAGC,gBAAgB,mBAAmB;QACxED,iBAAiB,sBAAsB,GACrCC,gBAAgB,yBAAyB;QAE3CD,iBAAiB,QAAQ,GAAGF,UAAU,SAAS;QAE/C,OAAOE;IACT;IAEA,OAAe,mBACbF,SAAiC,EACjCC,aAAqB,EACrB;QACA,MAAMI,UACJL,UAAU,OAAO,CAAC,SAAS,CAACC,cAAc;QAC5C,IAAI,CAACI,SAAS;YACZ,MAAM,IAAID,MACR,CAAC,gDAAgD,EAAEH,eAAe;QAEtE;QACA,OAAOI;IACT;IAEQ,mBACNH,gBAAoC,EACpCI,eAAgC,EAChCC,MAA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KAAK,SAAS,CAACD,QAAQ,MAAM,IAAI;gBAC9CH,QAAQ,GAAGI,KAAK,SAAS,CAACJ,MAAM,MAAM,IAAI;gBAC1Cf,WAAW,GAAGmB,KAAK,SAAS,CAACnB,SAAS,MAAM,IAAI;;WAJxC,IAAI,CAAC,EAAE;IAOtB;;QAlbK,qBAEE,iBAAyC,CAAC;;AAibnD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/ai-agent-router.js","sources":["../../../src/content-fields/hubtype-fields/ai-agent-router.ts"],"sourcesContent":["import type { VerbosityLevel } from '@botonic/core'\nimport type { HtInputGuardrailRule } from './ai-agent'\nimport type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtAiAgentSpecialistNode {\n id: string\n target: HtNodeLink\n name?: string\n description?: string\n}\n\nexport interface HtAiAgentRouterNode extends HtBaseNode {\n type: HtNodeWithContentType.AI_AGENT_ROUTER\n content: {\n name: string\n instructions: string\n model: string\n verbosity: VerbosityLevel\n available_specialists: HtAiAgentSpecialistNode[]\n input_guardrail_rules?: HtInputGuardrailRule[]\n }\n}\n"],"names":[],"mappings":"AAsBC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/ai-agent.js","sources":["../../../src/content-fields/hubtype-fields/ai-agent.ts"],"sourcesContent":["import type { VerbosityLevel } from '@botonic/core'\nimport type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtInputGuardrailRule {\n name: string\n description: string\n is_active: boolean\n}\n\nexport interface HtAiAgentNode extends HtBaseNode {\n type: HtNodeWithContentType.AI_AGENT\n content: {\n name: string\n instructions: string\n model: string\n verbosity: VerbosityLevel\n active_tools?: { name: string }[]\n input_guardrail_rules?: HtInputGuardrailRule[]\n sources?: { id: string; name: string }[]\n }\n}\n"],"names":[],"mappings":"AAqBC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/bot-action.js","sources":["../../../src/content-fields/hubtype-fields/bot-action.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtBotActionNode extends HtBaseNode {\n id: string\n type: HtNodeWithContentType.BOT_ACTION\n content: {\n payload_id: string\n payload_params?: string\n }\n}\n"],"names":[],"mappings":"AAUC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/button.js","sources":["../../../src/content-fields/hubtype-fields/button.ts"],"sourcesContent":["import type { HtNodeLink, HtTextLocale, HtUrlLocale } from './common'\n\nexport interface HtButton {\n id: string\n text: HtTextLocale[]\n url: HtUrlLocale[]\n target?: HtNodeLink\n hidden: string[]\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/capture-user-input.js","sources":["../../../src/content-fields/hubtype-fields/capture-user-input.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtAiValidationType {\n NONE = 'none',\n NAME = 'name',\n EMAIL = 'email',\n PHONE = 'phone',\n CUSTOM = 'custom',\n}\n\nexport interface HtCaptureUserInputNode extends HtBaseNode {\n type: HtNodeWithContentType.CAPTURE_USER_INPUT\n content: {\n field_name: string\n ai_validation_type?: HtAiValidationType\n ai_validation_instructions?: string\n capture_success: HtNodeLink\n capture_fail: HtNodeLink\n }\n}\n"],"names":["HtAiValidationType"],"mappings":"AAGO,IAAKA,qCAAkBA,0BAAlBA;;;;;;WAAAA;MAMX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/carousel.js","sources":["../../../src/content-fields/hubtype-fields/carousel.ts"],"sourcesContent":["import type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCarouselElement {\n id: string\n title: HtTextLocale[]\n subtitle: HtTextLocale[]\n image: HtMediaFileLocale[]\n button: HtButton\n}\n\nexport interface HtCarouselNode extends HtBaseNode {\n type: HtNodeWithContentType.CAROUSEL\n content: {\n whatsapp_text: HtTextLocale[]\n elements: HtCarouselElement[]\n }\n}\n"],"names":[],"mappings":"AAkBC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/channel-conditional.js","sources":["../../../src/content-fields/hubtype-fields/channel-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtChannelConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'get-channel-type'\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAUC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/common.js","sources":["../../../src/content-fields/hubtype-fields/common.ts"],"sourcesContent":["import type {\n HtNodeWithContentType,\n HtNodeWithoutContentType,\n} from './node-types'\nimport type { HtNodeComponent } from './nodes'\n\nexport interface HtFlowBuilderData {\n version: string\n name: string\n locales: string[]\n default_locale_code: string\n start_node_id?: string\n ai_model_id?: string\n is_ai_agent_active?: boolean\n nodes: HtNodeComponent[]\n flows: HtFlows[]\n webviews: HtFlowWebview[]\n campaigns: HtCampaign[]\n bot_variable_definitions: HtBotVariableDefinition[]\n}\n\nexport interface HtFlows {\n id: string\n name: string\n start_node_id: string\n}\n\nexport interface HtFlowWebview {\n id: string\n name: string\n component_name: string\n}\n\nexport interface HtCampaign {\n id: string\n name: string\n start_node_id: string\n}\n\nexport interface HtBotVariableDefinition {\n key_path: string\n is_from_bot_config: boolean\n type?: string\n}\n\nexport interface HtNodeLink {\n id: string\n type: HtNodeWithContentType | HtNodeWithoutContentType\n}\n\nexport interface HtBaseNode {\n id: string\n code: string\n meta: {\n x: number\n y: number\n }\n follow_up?: HtNodeLink\n target?: HtNodeLink\n flow_id: string // TODO: Review if this field is necessary in all HtBaseNode\n is_meaningful?: boolean\n}\n\nexport interface HtTextLocale {\n message: string\n locale: string\n}\n\nexport interface HtMediaFileLocale {\n id: string\n file: string\n locale: string\n}\n\nexport interface HtVideoLocale {\n url: string\n is_embedded: boolean\n locale: string\n}\n\nexport interface HtQueueLocale {\n id: string\n name: string\n locale: string\n}\n\nexport interface HtInputLocale {\n values: string[]\n locale: string\n}\n\nexport interface HtUrlLocale {\n id: string\n locale: string\n}\n\nexport interface HtPayloadLocale {\n id: string\n locale: string\n}\n"],"names":[],"mappings":"AAmGC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/country-conditional.js","sources":["../../../src/content-fields/hubtype-fields/country-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCountryConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'check-country'\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAUC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/custom-conditional-v2.js","sources":["../../../src/content-fields/hubtype-fields/custom-conditional-v2.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum VariableFormat {\n Boolean = 'boolean',\n Number = 'number',\n String = 'string',\n}\n\nexport enum StringConditionOperator {\n Contains = 'contains',\n NotContains = 'notContains',\n EqualsTo = 'equalsTo',\n NotEqualsTo = 'notEqualsTo',\n StartsWith = 'startsWith',\n NotStartsWith = 'notStartsWith',\n EndsWith = 'endsWith',\n NotEndsWith = 'notEndsWith',\n}\n\nexport interface HtStringCondition {\n operator: StringConditionOperator\n value?: string\n target?: HtNodeLink\n}\n\nexport enum NumberConditionOperator {\n EqualsTo = 'equalsTo',\n NotEqualsTo = 'notEqualsTo',\n GreaterThan = 'greaterThan',\n LessThan = 'lessThan',\n GreaterThanOrEqualTo = 'greaterThanOrEqualTo',\n LessThanOrEqualTo = 'lessThanOrEqualTo',\n Between = 'between',\n NotBetween = 'notBetween',\n}\n\nexport interface HtNumberCondition {\n operator: NumberConditionOperator\n value?: number\n min?: number\n max?: number\n target?: HtNodeLink\n}\n\nexport enum BooleanConditionOperator {\n IsTruthy = 'isTruthy',\n}\n\nexport interface HtBooleanCondition {\n operator: BooleanConditionOperator\n target?: HtNodeLink\n}\n\nexport type HtCondition =\n | HtStringCondition\n | HtNumberCondition\n | HtBooleanCondition\n\nexport interface HtCustomConditionalV2Node extends HtBaseNode {\n type: HtNodeWithContentType.CUSTOM_CONDITION\n content: {\n type: VariableFormat\n key_path: string\n conditions: HtCondition[]\n default_target: HtNodeLink\n }\n}\n"],"names":["VariableFormat","StringConditionOperator","NumberConditionOperator","BooleanConditionOperator"],"mappings":"AAGO,IAAKA,oCAAcA,0BAAdA;;;;WAAAA;MAIX;AAEM,IAAKC,6CAAuBA,0BAAvBA;;;;;;;;;WAAAA;MASX;AAQM,IAAKC,6CAAuBA,0BAAvBA;;;;;;;;;WAAAA;MASX;AAUM,IAAKC,8CAAwBA,0BAAxBA;;WAAAA;MAEX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/custom-conditional.js","sources":["../../../src/content-fields/hubtype-fields/custom-conditional.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtFunctionArguments, HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtCustomConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'check-bot-variable'\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAWC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/fallback.js","sources":["../../../src/content-fields/hubtype-fields/fallback.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtFallbackNode extends HtBaseNode {\n type: HtNodeWithContentType.FALLBACK\n content: {\n first_message?: HtNodeLink\n second_message?: HtNodeLink\n }\n}\n"],"names":[],"mappings":"AASC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/function.js","sources":["../../../src/content-fields/hubtype-fields/function.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtArgumentType {\n BOOLEAN = 'boolean',\n NUMBER = 'number',\n STRING = 'string',\n JSON = 'json',\n}\n\nexport interface HtFunctionArgument {\n type: HtArgumentType\n name: string\n value: string\n}\n\nexport interface HtFunctionArgumentLocale {\n locale: string\n values: HtFunctionArgument[]\n}\n\nexport interface HtFunctionResult {\n result: string | boolean | number\n target?: HtNodeLink\n}\n\nexport type HtFunctionArguments = HtFunctionArgumentLocale | HtFunctionArgument\n\nexport interface HtFunctionNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":["HtArgumentType"],"mappings":"AAGO,IAAKA,uBAAcA,0BAAdA;;;;;WAAAA;MAKX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/go-to-flow.js","sources":["../../../src/content-fields/hubtype-fields/go-to-flow.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtGoToFlow extends HtBaseNode {\n id: string\n type: HtNodeWithContentType.GO_TO_FLOW\n content: {\n flow_id: string\n }\n}\n"],"names":[],"mappings":"AASC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/handoff.js","sources":["../../../src/content-fields/hubtype-fields/handoff.ts"],"sourcesContent":["import type { HtBaseNode, HtPayloadLocale, HtQueueLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtHandoffNode extends HtBaseNode {\n type: HtNodeWithContentType.HANDOFF\n content: {\n queue: HtQueueLocale[]\n payload: HtPayloadLocale[]\n has_auto_assign: boolean\n has_queue_position_changed_notifications_enabled: boolean\n }\n}\n"],"names":[],"mappings":"AAWC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/image.js","sources":["../../../src/content-fields/hubtype-fields/image.ts"],"sourcesContent":["import type { HtBaseNode, HtMediaFileLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtImageNode extends HtBaseNode {\n type: HtNodeWithContentType.IMAGE\n content: {\n image: HtMediaFileLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/index.js","sources":["../../../src/content-fields/hubtype-fields/index.ts"],"sourcesContent":["export * from './ai-agent'\nexport * from './ai-agent-router'\nexport * from './bot-action'\nexport * from './button'\nexport * from './capture-user-input'\nexport * from './carousel'\nexport * from './common'\nexport * from './custom-conditional-v2'\nexport * from './fallback'\nexport * from './function'\nexport * from './go-to-flow'\nexport * from './handoff'\nexport * from './image'\nexport * from './keyword'\nexport * from './node-types'\nexport * from './nodes'\nexport * from './payload'\nexport * from './rating'\nexport * from './smart-intent'\nexport * from './text'\nexport * from './url'\nexport * from './video'\nexport * from './webview'\nexport * from './whatsapp-button-list'\nexport * from './whatsapp-cta-url-button'\nexport * from './whatsapp-request-contact-info'\nexport * from './whatsapp-template'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAA0B;AACO;AACL;AACJ;AACY;AACV;AACF;AACe;AACb;AACA;AACE;AACH;AACF;AACE;AACG;AACL;AACE;AACD;AACM;AACR;AACD;AACE;AACE;AACa;AACG;AACM;AACZ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/keyword.js","sources":["../../../src/content-fields/hubtype-fields/keyword.ts"],"sourcesContent":["import type { HtBaseNode, HtInputLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtKeywordNode extends HtBaseNode {\n type: HtNodeWithContentType.KEYWORD\n content: {\n title: HtTextLocale[]\n keywords: HtInputLocale[]\n }\n}\n"],"names":[],"mappings":"AASC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/node-types.js","sources":["../../../src/content-fields/hubtype-fields/node-types.ts"],"sourcesContent":["export enum HtNodeWithContentType {\n CAROUSEL = 'carousel',\n HANDOFF = 'handoff',\n IMAGE = 'image',\n TEXT = 'text',\n KEYWORD = 'keyword',\n SMART_INTENT = 'smart-intent',\n FUNCTION = 'function',\n FALLBACK = 'fallback',\n VIDEO = 'video',\n WHATSAPP_BUTTON_LIST = 'whatsapp-button-list',\n WHATSAPP_CTA_URL_BUTTON = 'whatsapp-cta-url-button',\n WHATSAPP_REQUEST_CONTACT_INFO = 'whatsapp-request-contact-info',\n WHATSAPP_TEMPLATE = 'whatsapp-template',\n BOT_ACTION = 'bot-action',\n AI_AGENT = 'ai-agent',\n AI_AGENT_ROUTER = 'ai-agent-router',\n RATING = 'rating',\n WEBVIEW = 'webview',\n GO_TO_FLOW = 'go-to-flow',\n CAPTURE_USER_INPUT = 'capture-user-input',\n CUSTOM_CONDITION = 'custom-condition',\n}\n\nexport enum HtNodeWithoutContentType {\n URL = 'url',\n PAYLOAD = 'payload',\n}\n\nexport enum HtButtonStyle {\n BUTTON = 'button',\n QUICK_REPLY = 'quick-reply',\n}\n"],"names":["HtNodeWithContentType","HtNodeWithoutContentType","HtButtonStyle"],"mappings":"AAAO,IAAKA,gCAAqBA,0BAArBA;;;;;;;;;;;;;;;;;;;;;;WAAAA;MAsBX;AAEM,IAAKC,mCAAwBA,0BAAxBA;;;WAAAA;MAGX;AAEM,IAAKC,wBAAaA,0BAAbA;;;WAAAA;MAGX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/nodes.js","sources":["../../../src/content-fields/hubtype-fields/nodes.ts"],"sourcesContent":["import type { HtAiAgentNode } from './ai-agent'\nimport type { HtAiAgentRouterNode } from './ai-agent-router'\nimport type { HtBotActionNode } from './bot-action'\nimport type { HtCaptureUserInputNode } from './capture-user-input'\nimport type { HtCarouselNode } from './carousel'\nimport type { HtCustomConditionalV2Node } from './custom-conditional-v2'\n// import { HtChannelConditionalNode } from './channel-conditional'\n// import { HtCountryConditionalNode } from './country-conditional'\n// import { HtCustomConditionalNode } from './custom-conditional'\nimport type { HtFallbackNode } from './fallback'\nimport type { HtFunctionNode } from './function'\nimport type { HtGoToFlow } from './go-to-flow'\nimport type { HtHandoffNode } from './handoff'\nimport type { HtImageNode } from './image'\nimport type { HtKeywordNode } from './keyword'\nimport type { HtPayloadNode } from './payload'\n// import { HtQueueStatusConditionalNode } from './queue-status-conditional'\nimport type { HtRatingNode } from './rating'\nimport type { HtSmartIntentNode } from './smart-intent'\nimport type { HtTextNode } from './text'\nimport type { HtUrlNode } from './url'\nimport type { HtVideoNode } from './video'\nimport type { HtWebviewNode } from './webview'\nimport type { HtWhatsappButtonListNode } from './whatsapp-button-list'\nimport type { HtWhatsappCTAUrlButtonNode } from './whatsapp-cta-url-button'\nimport type { HtWhatsappRequestContactInfoNode } from './whatsapp-request-contact-info'\nimport type { HtWhatsappTemplateNode } from './whatsapp-template'\n\nexport type HtNodeWithContent =\n | HtTextNode\n | HtImageNode\n | HtVideoNode\n | HtCarouselNode\n | HtHandoffNode\n | HtKeywordNode\n | HtFunctionNode\n | HtFallbackNode\n | HtWhatsappButtonListNode\n | HtWhatsappCTAUrlButtonNode\n | HtWhatsappRequestContactInfoNode\n | HtSmartIntentNode\n | HtBotActionNode\n | HtAiAgentNode\n | HtAiAgentRouterNode\n | HtRatingNode\n | HtWebviewNode\n | HtGoToFlow\n | HtWhatsappTemplateNode\n | HtCaptureUserInputNode\n | HtCustomConditionalV2Node\n// | HtChannelConditionalNode\n// | HtCountryConditionalNode\n// | HtCustomConditionalNode\n// | HtQueueStatusConditionalNode\n\nexport type HtNodeWithoutContent = HtUrlNode | HtPayloadNode\n\nexport type HtNodeComponent = HtNodeWithContent | HtNodeWithoutContent\n"],"names":[],"mappings":"AAyDsE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/payload.js","sources":["../../../src/content-fields/hubtype-fields/payload.ts"],"sourcesContent":["import type { HtNodeWithoutContentType } from './node-types'\n\nexport interface HtPayloadNode {\n id: string\n type: HtNodeWithoutContentType.PAYLOAD\n content: {\n payload: string\n }\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/queue-status-conditional.js","sources":["../../../src/content-fields/hubtype-fields/queue-status-conditional.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtFunctionArguments, HtFunctionResult } from './function'\nimport type { HtNodeWithContentType } from './node-types'\n\n/* TODO: In the future, refactor the conditional nodes so they are not of type FUNCTION and can use type-hints for all exact arguments and results. */\n\n// interface HtQueueArgument {\n// locale: string\n// values: [\n// {\n// type: 'string'\n// name: 'queue_id'\n// value: string\n// },\n// {\n// type: 'string'\n// name: 'queue_name'\n// value: string\n// },\n// ]\n// }\n\n// interface HtCheckAvailableAgentsArgument {\n// type: 'boolean'\n// name: 'check_available_agents'\n// value: boolean\n// }\n\n// export interface HtQueueStatusConditionalArguments {\n// values: HtQueueArgument[] | HtCheckAvailableAgentsArgument[]\n// }\n\nexport type HtQueueStatusConditionalResultMapping = [\n {\n result: 'open'\n target: HtNodeLink\n },\n {\n result: 'closed'\n target: HtNodeLink\n },\n {\n result: 'open-without-agents'\n target: HtNodeLink\n },\n]\n\nexport interface HtQueueStatusConditionalNode extends HtBaseNode {\n type: HtNodeWithContentType.FUNCTION\n content: {\n action: string //'get-channel-type'\n arguments: HtFunctionArguments[]\n result_mapping: HtFunctionResult[]\n }\n}\n"],"names":[],"mappings":"AAsDC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/rating.js","sources":["../../../src/content-fields/hubtype-fields/rating.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum RatingType {\n Stars = 'stars',\n Smileys = 'smileys',\n}\n\nexport interface HtRatingButton {\n id: string\n text: string\n payload: string\n value: number\n target?: HtNodeLink\n}\n\nexport interface HtRatingNode extends HtBaseNode {\n type: HtNodeWithContentType.RATING\n content: {\n text: HtTextLocale[]\n buttons: HtRatingButton[]\n rating_type: RatingType\n send_button_text: HtTextLocale[]\n open_list_button_text: HtTextLocale[]\n }\n}\n"],"names":["RatingType"],"mappings":"AAGO,IAAKA,iBAAUA,0BAAVA;;;WAAAA;MAGX"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/smart-intent.js","sources":["../../../src/content-fields/hubtype-fields/smart-intent.ts"],"sourcesContent":["import type { HtBaseNode } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\ninterface SmartIntent {\n title: string\n description: string\n is_active?: boolean\n}\n\nexport interface HtSmartIntentNode extends HtBaseNode {\n type: HtNodeWithContentType.SMART_INTENT\n content: SmartIntent\n}\n"],"names":[],"mappings":"AAYC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/text.js","sources":["../../../src/content-fields/hubtype-fields/text.ts"],"sourcesContent":["import type { HtButton } from './button'\nimport type { HtBaseNode, HtTextLocale } from './common'\nimport type { HtButtonStyle, HtNodeWithContentType } from './node-types'\n\nexport interface HtTextNode extends HtBaseNode {\n type: HtNodeWithContentType.TEXT\n content: {\n text: HtTextLocale[]\n buttons_style?: HtButtonStyle\n buttons: HtButton[]\n }\n}\n"],"names":[],"mappings":"AAWC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/url.js","sources":["../../../src/content-fields/hubtype-fields/url.ts"],"sourcesContent":["import type { HtNodeWithoutContentType } from './node-types'\n\nexport interface HtUrlNode {\n id: string\n type: HtNodeWithoutContentType.URL\n content: {\n url: string\n }\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/video.js","sources":["../../../src/content-fields/hubtype-fields/video.ts"],"sourcesContent":["import type { HtBaseNode, HtVideoLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtVideoNode extends HtBaseNode {\n type: HtNodeWithContentType.VIDEO\n content: {\n video: HtVideoLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/webview.js","sources":["../../../src/content-fields/hubtype-fields/webview.ts"],"sourcesContent":["import type { HtBaseNode, HtNodeLink } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWebviewExits {\n id: string\n name: string\n target?: HtNodeLink\n}\n\nexport interface HtWebviewNode extends HtBaseNode {\n type: HtNodeWithContentType.WEBVIEW\n content: {\n webview_target_id: string\n webview_name: string\n webview_component_name: string\n webview_params: Record<string, string>\n exits: HtWebviewExits[]\n }\n}\n"],"names":[],"mappings":"AAkBC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/whatsapp-button-list.js","sources":["../../../src/content-fields/hubtype-fields/whatsapp-button-list.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { HtBaseNode, HtNodeLink, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappButtonListRow {\n id: string\n text: HtTextLocale[]\n description: HtTextLocale[]\n target?: HtNodeLink\n}\n\nexport interface HtWhatsappButtonListSection {\n id: string\n title: HtTextLocale[]\n rows: HtWhatsappButtonListRow[]\n}\n\nexport interface HtWhatsappButtonListNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_BUTTON_LIST\n content: {\n text: HtTextLocale[]\n button_text: HtTextLocale[]\n sections: HtWhatsappButtonListSection[]\n }\n}\n"],"names":[],"mappings":"AAAA,uDAAuD,GAwBtD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/whatsapp-cta-url-button.js","sources":["../../../src/content-fields/hubtype-fields/whatsapp-cta-url-button.ts"],"sourcesContent":["import type { WhatsappCTAUrlHeaderType } from '@botonic/react'\n\nimport type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappCTAUrlButtonNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON\n content: {\n text: HtTextLocale[]\n header: HtTextLocale[]\n header_type?: WhatsappCTAUrlHeaderType\n header_image?: HtMediaFileLocale[]\n header_video?: HtMediaFileLocale[]\n header_document?: HtMediaFileLocale[]\n footer: HtTextLocale[]\n button: HtButton\n }\n}\n"],"names":[],"mappings":"AAkBC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/whatsapp-request-contact-info.js","sources":["../../../src/content-fields/hubtype-fields/whatsapp-request-contact-info.ts"],"sourcesContent":["import type { HtBaseNode, HtTextLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport interface HtWhatsappRequestContactInfoNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO\n content: {\n text: HtTextLocale[]\n }\n}\n"],"names":[],"mappings":"AAQC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/hubtype-fields/whatsapp-template.js","sources":["../../../src/content-fields/hubtype-fields/whatsapp-template.ts"],"sourcesContent":["import type {\n WhatsAppTemplateButtonSubType,\n WhatsAppTemplateComponentType,\n WhatsAppTemplateParameterType,\n} from '@botonic/react'\n\nimport type { HtButton } from './button'\nimport type { HtBaseNode, HtMediaFileLocale } from './common'\nimport type { HtNodeWithContentType } from './node-types'\n\nexport enum HtWhatsAppTemplateFlowActionType {\n NAVIGATE = 'navigate',\n DATA_EXCHANGE = 'data_exchange',\n}\n\ntype HtWhatsAppTemplateButton =\n | {\n type: WhatsAppTemplateButtonSubType.URL\n text: string\n url?: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.QUICK_REPLY\n text: string\n id: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.PHONE_NUMBER\n text: string\n phone_number: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.VOICE_CALL\n text: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.REQUEST_CONTACT_INFO\n text?: string\n index: number\n }\n | {\n type: WhatsAppTemplateButtonSubType.FLOW\n text: string\n flow_id: string\n flow_action?: HtWhatsAppTemplateFlowActionType\n navigate_screen?: string\n index: number\n }\n\nexport interface HtFlowButtonActionValue {\n flow_token: string\n flow_action_data?: Record<string, string>\n}\n\nexport interface HtWhatsAppTemplateHeaderComponent {\n type: WhatsAppTemplateComponentType.HEADER\n format:\n | WhatsAppTemplateParameterType.TEXT\n | WhatsAppTemplateParameterType.IMAGE\n | WhatsAppTemplateParameterType.VIDEO\n text?: string\n image?: { link: string }\n video?: { link: string }\n}\n\nexport interface HtWhatsAppTemplateBodyComponent {\n type: WhatsAppTemplateComponentType.BODY\n text: string\n}\n\nexport interface HtWhatsAppTemplateFooterComponent {\n type: WhatsAppTemplateComponentType.FOOTER\n text: string\n}\n\nexport interface HtWhatsAppTemplateButtonsComponent {\n type: WhatsAppTemplateComponentType.BUTTONS\n buttons: HtWhatsAppTemplateButton[]\n}\nexport type HtWhatsAppTemplateComponent =\n | HtWhatsAppTemplateHeaderComponent\n | HtWhatsAppTemplateBodyComponent\n | HtWhatsAppTemplateFooterComponent\n | HtWhatsAppTemplateButtonsComponent\n\nexport interface HtWhatsAppTemplate {\n id: string\n name: string\n language: string\n status: string\n category: string\n components: HtWhatsAppTemplateComponent[]\n namespace: string\n parameter_format: string\n}\n\nexport interface HtWhatsappTemplateContentByLocale {\n template?: HtWhatsAppTemplate\n header_variables?: {\n type: WhatsAppTemplateParameterType\n text?: Record<string, string>\n media?: HtMediaFileLocale[]\n }\n variable_values?: Record<string, string>\n url_variable_values?: Record<string, string>\n flow_button_action_values?: Record<string, HtFlowButtonActionValue>\n}\n\nexport interface HtWhatsappTemplateNode extends HtBaseNode {\n type: HtNodeWithContentType.WHATSAPP_TEMPLATE\n content: {\n by_locale: Record<string, HtWhatsappTemplateContentByLocale>\n buttons: HtButton[]\n }\n}\n"],"names":["HtWhatsAppTemplateFlowActionType"],"mappings":"AAUO,IAAKA,kDAAgCA,0BAAhCA;;;WAAAA;MAGX"}
@@ -21,5 +21,5 @@ import { FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonLi
21
21
  export { ContentFieldsBase } from './content-fields-base.js';
22
22
  export { FlowButton } from './flow-button.js';
23
23
  export { FlowElement } from './flow-element.js';
24
- export { FlowAiAgentRouter, FlowAiAgent, FlowBotAction, FlowCaptureUserInput, FlowCarousel, FlowChannelConditional, FlowCountryConditional, FlowCustomConditional, FlowGoToFlow, FlowHandoff, FlowImage, FlowQueueStatusConditional, FlowRating, FlowText, FlowVideo, FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonListSection, FlowWhatsappCtaUrlButtonNode, FlowWhatsappRequestContactInfoNode, FlowWhatsappTemplate, FlowCustomConditionalV2, };
24
+ export { FlowAiAgent, FlowAiAgentRouter, FlowBotAction, FlowCaptureUserInput, FlowCarousel, FlowChannelConditional, FlowCountryConditional, FlowCustomConditional, FlowCustomConditionalV2, FlowGoToFlow, FlowHandoff, FlowImage, FlowQueueStatusConditional, FlowRating, FlowText, FlowVideo, FlowWhatsappButtonList, FlowWhatsappButtonListRow, FlowWhatsappButtonListSection, FlowWhatsappCtaUrlButtonNode, FlowWhatsappRequestContactInfoNode, FlowWhatsappTemplate, };
25
25
  export type FlowContent = FlowCarousel | FlowImage | FlowText | FlowVideo | FlowWhatsappButtonList | FlowWhatsappCtaUrlButtonNode | FlowWhatsappRequestContactInfoNode | FlowWhatsappTemplate | FlowHandoff | FlowBotAction | FlowAiAgent | FlowRating | FlowCountryConditional | FlowChannelConditional | FlowQueueStatusConditional | FlowCustomConditional | FlowGoToFlow | FlowCaptureUserInput | FlowAiAgentRouter | FlowCustomConditionalV2;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/index.js","sources":["../../src/content-fields/index.ts"],"sourcesContent":["import { FlowCustomConditionalV2 } from './custom-conditional/flow-custom-condition-v2'\nimport { FlowAiAgent } from './flow-ai-agent'\nimport { FlowAiAgentRouter } from './flow-ai-agent-router'\nimport { FlowBotAction } from './flow-bot-action'\nimport { FlowCaptureUserInput } from './flow-capture-user-input'\nimport { FlowCarousel } from './flow-carousel'\nimport { FlowChannelConditional } from './flow-channel-conditional'\nimport { FlowCountryConditional } from './flow-country-conditional'\nimport { FlowCustomConditional } from './flow-custom-conditional'\nimport { FlowGoToFlow } from './flow-go-to-flow'\nimport { FlowHandoff } from './flow-handoff'\nimport { FlowImage } from './flow-image'\nimport { FlowQueueStatusConditional } from './flow-queue-status-conditional'\nimport { FlowRating } from './flow-rating'\nimport { FlowText } from './flow-text'\nimport { FlowVideo } from './flow-video'\nimport { FlowWhatsappCtaUrlButtonNode } from './flow-whatsapp-cta-url-button'\nimport { FlowWhatsappRequestContactInfoNode } from './flow-whatsapp-request-contact-info'\nimport { FlowWhatsappTemplate } from './flow-whatsapp-template'\nimport {\n FlowWhatsappButtonList,\n FlowWhatsappButtonListRow,\n FlowWhatsappButtonListSection,\n} from './whatsapp-button-list'\n\nexport { ContentFieldsBase } from './content-fields-base'\nexport { FlowButton } from './flow-button'\nexport { FlowElement } from './flow-element'\nexport {\n FlowAiAgent,\n FlowAiAgentRouter,\n FlowBotAction,\n FlowCaptureUserInput,\n FlowCarousel,\n FlowChannelConditional,\n FlowCountryConditional,\n FlowCustomConditional,\n FlowCustomConditionalV2,\n FlowGoToFlow,\n FlowHandoff,\n FlowImage,\n FlowQueueStatusConditional,\n FlowRating,\n FlowText,\n FlowVideo,\n FlowWhatsappButtonList,\n FlowWhatsappButtonListRow,\n FlowWhatsappButtonListSection,\n FlowWhatsappCtaUrlButtonNode,\n FlowWhatsappRequestContactInfoNode,\n FlowWhatsappTemplate,\n}\n\nexport type FlowContent =\n | FlowCarousel\n | FlowImage\n | FlowText\n | FlowVideo\n | FlowWhatsappButtonList\n | FlowWhatsappCtaUrlButtonNode\n | FlowWhatsappRequestContactInfoNode\n | FlowWhatsappTemplate\n | FlowHandoff\n | FlowBotAction\n | FlowAiAgent\n | FlowRating\n | FlowCountryConditional\n | FlowChannelConditional\n | FlowQueueStatusConditional\n | FlowCustomConditional\n | FlowGoToFlow\n | FlowCaptureUserInput\n | FlowAiAgentRouter\n | FlowCustomConditionalV2\n"],"names":["FlowCustomConditionalV2","FlowAiAgent","FlowAiAgentRouter","FlowBotAction","FlowCaptureUserInput","FlowCarousel","FlowChannelConditional","FlowCountryConditional","FlowCustomConditional","FlowGoToFlow","FlowHandoff","FlowImage","FlowQueueStatusConditional","FlowRating","FlowText","FlowVideo","FlowWhatsappCtaUrlButtonNode","FlowWhatsappRequestContactInfoNode","FlowWhatsappTemplate","FlowWhatsappButtonList","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection","ContentFieldsBase","FlowButton","FlowElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAuF;AAC1C;AACa;AACT;AACe;AAClB;AACqB;AACA;AACF;AACjB;AACJ;AACJ;AACoC;AAClC;AACJ;AACE;AACqC;AACY;AAC1B;AAKhC;AAE0B;AACf;AACE;AAwB3C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js","sources":["../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.tsx"],"sourcesContent":["import type { WhatsappButtonListRowProps } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { SOURCE_INFO_SEPARATOR } from '../../constants'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListRow } from '../hubtype-fields'\n\nexport class FlowWhatsappButtonListRow extends ContentFieldsBase {\n public title = ''\n public description = ''\n public targetId?: string\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListRow,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonListRow {\n const newRow = new FlowWhatsappButtonListRow(component.id)\n newRow.title = FlowWhatsappButtonListRow.getTextByLocale(\n locale,\n component.text\n )\n newRow.description = FlowWhatsappButtonListRow.getTextByLocale(\n locale,\n component.description\n )\n newRow.targetId = cmsApi.getPayload(component.target)\n\n return newRow\n }\n\n async trackFlow(): Promise<void> {\n return\n }\n\n async processContent(): Promise<void> {\n return\n }\n\n renderRow(\n rowIndex: number,\n sectionIndex: number\n ): WhatsappButtonListRowProps | undefined {\n if (!this.targetId) {\n console.error(`Row with title: '${this.title}' has no target`)\n return undefined\n }\n return {\n id: this.getRowId(rowIndex, sectionIndex),\n title: this.title,\n description: this.description,\n }\n }\n\n private getRowId(rowIndex: number, sectionIndex: number): string {\n return `${this.targetId}${SOURCE_INFO_SEPARATOR}${sectionIndex}.${rowIndex}`\n }\n}\n"],"names":["SOURCE_INFO_SEPARATOR","ContentFieldsBase","FlowWhatsappButtonListRow","component","locale","cmsApi","newRow","rowIndex","sectionIndex","console","undefined"],"mappings":";;;;;AAGuD;AACG;AAGnD,MAAME,yBAAyBA,SAASD,iBAAiBA;IAK9D,OAAO,eACLE,SAAkC,EAClCC,MAAc,EACdC,MAAsB,EACK;QAC3B,MAAMC,SAAS,IAAIJ,yBAAyBA,CAACC,UAAU,EAAE;QACzDG,OAAO,KAAK,GAAGJ,yBAAyBA,CAAC,eAAe,CACtDE,QACAD,UAAU,IAAI;QAEhBG,OAAO,WAAW,GAAGJ,yBAAyBA,CAAC,eAAe,CAC5DE,QACAD,UAAU,WAAW;QAEvBG,OAAO,QAAQ,GAAGD,OAAO,UAAU,CAACF,UAAU,MAAM;QAEpD,OAAOG;IACT;IAEA,MAAM,YAA2B;QAC/B;IACF;IAEA,MAAM,iBAAgC;QACpC;IACF;IAEA,UACEC,QAAgB,EAChBC,YAAoB,EACoB;QACxC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClBC,QAAQ,KAAK,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;YAC7D,OAAOC;QACT;QACA,OAAO;YACL,IAAI,IAAI,CAAC,QAAQ,CAACH,UAAUC;YAC5B,OAAO,IAAI,CAAC,KAAK;YACjB,aAAa,IAAI,CAAC,WAAW;QAC/B;IACF;IAEQ,SAASD,QAAgB,EAAEC,YAAoB,EAAU;QAC/D,OAAO,GAAG,IAAI,CAAC,QAAQ,GAAGR,qBAAqBA,GAAGQ,aAAa,CAAC,EAAED,UAAU;IAC9E;;QAjDK,qBACE,QAAQ,SACR,cAAc;;AAgDvB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js","sources":["../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.tsx"],"sourcesContent":["import type {\n WhatsappButtonListRowProps,\n WhatsappButtonListSectionProps,\n} from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListSection } from '../hubtype-fields'\nimport { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'\n\nexport class FlowWhatsappButtonListSection extends ContentFieldsBase {\n public title = ''\n public rows: FlowWhatsappButtonListRow[] = []\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListSection,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonListSection {\n const newButton = new FlowWhatsappButtonListSection(component.id)\n newButton.title = FlowWhatsappButtonListSection.getTextByLocale(\n locale,\n component.title\n )\n newButton.rows = component.rows.map(row =>\n FlowWhatsappButtonListRow.fromHubtypeCMS(row, locale, cmsApi)\n )\n return newButton\n }\n\n async trackFlow(): Promise<void> {\n return\n }\n\n async processContent(): Promise<void> {\n return\n }\n\n renderSection(sectionIndex: number): WhatsappButtonListSectionProps {\n const rows = this.rows.reduce(\n (acc: WhatsappButtonListRowProps[], row, rowIndex) => {\n const botonicRow = row.renderRow(rowIndex, sectionIndex)\n if (botonicRow) {\n acc.push(botonicRow)\n }\n return acc\n },\n []\n )\n\n return { title: this.title, rows }\n }\n}\n"],"names":["ContentFieldsBase","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection","component","locale","cmsApi","newButton","row","sectionIndex","rows","acc","rowIndex","botonicRow"],"mappings":";;;;;AAM0D;AAEiB;AAEpE,MAAME,6BAA6BA,SAASF,iBAAiBA;IAIlE,OAAO,eACLG,SAAsC,EACtCC,MAAc,EACdC,MAAsB,EACS;QAC/B,MAAMC,YAAY,IAAIJ,6BAA6BA,CAACC,UAAU,EAAE;QAChEG,UAAU,KAAK,GAAGJ,6BAA6BA,CAAC,eAAe,CAC7DE,QACAD,UAAU,KAAK;QAEjBG,UAAU,IAAI,GAAGH,UAAU,IAAI,CAAC,GAAG,CAACI,CAAAA,MAClCN,wCAAwC,CAACM,KAAKH,QAAQC;QAExD,OAAOC;IACT;IAEA,MAAM,YAA2B;QAC/B;IACF;IAEA,MAAM,iBAAgC;QACpC;IACF;IAEA,cAAcE,YAAoB,EAAkC;QAClE,MAAMC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAC3B,CAACC,KAAmCH,KAAKI;YACvC,MAAMC,aAAaL,IAAI,SAAS,CAACI,UAAUH;YAC3C,IAAII,YAAY;gBACdF,IAAI,IAAI,CAACE;YACX;YACA,OAAOF;QACT,GACA,EAAE;QAGJ,OAAO;YAAE,OAAO,IAAI,CAAC,KAAK;YAAED;QAAK;IACnC;;QAzCK,qBACE,QAAQ,SACR,OAAoC,EAAE;;AAwC/C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/whatsapp-button-list/flow-whatsapp-button-list.js","sources":["../../../src/content-fields/whatsapp-button-list/flow-whatsapp-button-list.tsx"],"sourcesContent":["import { type BotContext, isWhatsapp } from '@botonic/core'\nimport { Button, Text, WhatsappButtonList } from '@botonic/react'\n\nimport type { FlowBuilderApi } from '../../api'\nimport { trackOneContent } from '../../tracking'\nimport { ContentFieldsBase } from '../content-fields-base'\nimport type { HtWhatsappButtonListNode } from '../hubtype-fields'\nimport { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'\n\nexport class FlowWhatsappButtonList extends ContentFieldsBase {\n public text = ''\n public listButtonText = ''\n public sections: FlowWhatsappButtonListSection[] = []\n\n static fromHubtypeCMS(\n component: HtWhatsappButtonListNode,\n locale: string,\n cmsApi: FlowBuilderApi\n ): FlowWhatsappButtonList {\n const newWhatsappButtonList = new FlowWhatsappButtonList(component.id)\n newWhatsappButtonList.code = component.code\n newWhatsappButtonList.text = FlowWhatsappButtonList.getTextByLocale(\n locale,\n component.content.text\n )\n newWhatsappButtonList.listButtonText =\n FlowWhatsappButtonList.getTextByLocale(\n locale,\n component.content.button_text\n )\n newWhatsappButtonList.sections = component.content.sections.map(section =>\n FlowWhatsappButtonListSection.fromHubtypeCMS(section, locale, cmsApi)\n )\n newWhatsappButtonList.followUp = component.follow_up\n\n return newWhatsappButtonList\n }\n\n async trackFlow(botContext: BotContext): Promise<void> {\n await trackOneContent(botContext, this)\n }\n\n async processContent(botContext: BotContext): Promise<void> {\n await this.trackFlow(botContext)\n await this.filterContent(botContext, this)\n return\n }\n\n toBotonic(botContext: BotContext): JSX.Element {\n const replacedText = this.replaceVariables(this.text, botContext)\n\n if (!isWhatsapp(botContext.session)) {\n const rows = this.sections.flatMap(section => section.rows)\n const buttons = rows.map(row => (\n <Button key={row.id} payload={row.targetId}>\n {row.title}\n </Button>\n ))\n\n return (\n <Text>\n {replacedText}\n {buttons}\n </Text>\n )\n }\n\n return (\n <WhatsappButtonList\n key={this.id}\n body={replacedText}\n button={this.listButtonText}\n sections={this.sections.map((section, sectionIndex) =>\n section.renderSection(sectionIndex)\n )}\n />\n )\n }\n}\n"],"names":["isWhatsapp","Button","Text","WhatsappButtonList","trackOneContent","ContentFieldsBase","FlowWhatsappButtonListSection","FlowWhatsappButtonList","component","locale","cmsApi","newWhatsappButtonList","section","botContext","replacedText","rows","buttons","row","sectionIndex"],"mappings":";;;;;;;;;;;;;;AAA2D;AACM;AAGjB;AACU;AAEyB;AAE5E,MAAMO,sBAAsBA,SAASF,iBAAiBA;IAK3D,OAAO,eACLG,SAAmC,EACnCC,MAAc,EACdC,MAAsB,EACE;QACxB,MAAMC,wBAAwB,IAAIJ,sBAAsBA,CAACC,UAAU,EAAE;QACrEG,sBAAsB,IAAI,GAAGH,UAAU,IAAI;QAC3CG,sBAAsB,IAAI,GAAGJ,sBAAsBA,CAAC,eAAe,CACjEE,QACAD,UAAU,OAAO,CAAC,IAAI;QAExBG,sBAAsB,cAAc,GAClCJ,sBAAsBA,CAAC,eAAe,CACpCE,QACAD,UAAU,OAAO,CAAC,WAAW;QAEjCG,sBAAsB,QAAQ,GAAGH,UAAU,OAAO,CAAC,QAAQ,CAAC,GAAG,CAACI,CAAAA,UAC9DN,4CAA4C,CAACM,SAASH,QAAQC;QAEhEC,sBAAsB,QAAQ,GAAGH,UAAU,SAAS;QAEpD,OAAOG;IACT;IAEA,MAAM,UAAUE,UAAsB,EAAiB;QACrD,MAAMT,eAAeA,CAACS,YAAY,IAAI;IACxC;IAEA,MAAM,eAAeA,UAAsB,EAAiB;QAC1D,MAAM,IAAI,CAAC,SAAS,CAACA;QACrB,MAAM,IAAI,CAAC,aAAa,CAACA,YAAY,IAAI;QACzC;IACF;IAEA,UAAUA,UAAsB,EAAe;QAC7C,MAAMC,eAAe,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAED;QAEtD,IAAI,CAACb,UAAUA,CAACa,WAAW,OAAO,GAAG;YACnC,MAAME,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACH,CAAAA,UAAWA,QAAQ,IAAI;YAC1D,MAAMI,UAAUD,KAAK,GAAG,CAACE,CAAAA,oBACvB,IAAChB,MAAMA;oBAAc,SAASgB,IAAI,QAAQ;8BACvCA,IAAI,KAAK;mBADCA,IAAI,EAAE;YAKrB,qBACE,KAACf,IAAIA;;oBACFY;oBACAE;;;QAGP;QAEA,qBACE,IAACb,kBAAkBA;YAEjB,MAAMW;YACN,QAAQ,IAAI,CAAC,cAAc;YAC3B,UAAU,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAACF,SAASM,eACpCN,QAAQ,aAAa,CAACM;WAJnB,IAAI,CAAC,EAAE;IAQlB;;QApEK,qBACE,OAAO,SACP,iBAAiB,SACjB,WAA4C,EAAE;;AAkEvD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/whatsapp-button-list/index.js","sources":["../../../src/content-fields/whatsapp-button-list/index.ts"],"sourcesContent":["export { FlowWhatsappButtonList } from './flow-whatsapp-button-list'\nexport { FlowWhatsappButtonListRow } from './flow-whatsapp-button-list-row'\nexport { FlowWhatsappButtonListSection } from './flow-whatsapp-button-list-section'\n"],"names":["FlowWhatsappButtonList","FlowWhatsappButtonListRow","FlowWhatsappButtonListSection"],"mappings":";;;AAAoE;AACO;AACQ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filters/index.js","sources":["../../src/filters/index.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\n\nimport type { FlowContent } from '../content-fields'\nimport type { ContentFilter } from '../types'\n\ninterface ContentFilterExecutorOptions {\n filters: ContentFilter[]\n}\n\nexport class ContentFilterExecutor {\n private filters: ContentFilter[] = []\n\n constructor(options: ContentFilterExecutorOptions) {\n this.filters = options.filters\n }\n\n async filter(\n request: BotContext,\n content: FlowContent\n ): Promise<FlowContent> {\n for (const filter of this.filters) {\n content = await filter(request, content)\n }\n\n return content\n }\n}\n"],"names":["ContentFilterExecutor","request","content","filter","options"],"mappings":"AASO,MAAMA,qBAAqBA;IAOhC,MAAM,OACJC,OAAmB,EACnBC,OAAoB,EACE;QACtB,KAAK,MAAMC,UAAU,IAAI,CAAC,OAAO,CAAE;YACjCD,UAAU,MAAMC,OAAOF,SAASC;QAClC;QAEA,OAAOA;IACT;IAbA,YAAYE,OAAqC,CAAE;aAF3C,UAA2B,EAAE;QAGnC,IAAI,CAAC,OAAO,GAAGA,QAAQ,OAAO;IAChC;AAYF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-factory.js","sources":["../src/flow-factory.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\n\nimport type { FlowBuilderApi } from './api'\nimport {\n FlowAiAgent,\n FlowAiAgentRouter,\n FlowBotAction,\n FlowCarousel,\n FlowChannelConditional,\n type FlowContent,\n FlowCountryConditional,\n FlowCustomConditional,\n FlowCustomConditionalV2,\n FlowGoToFlow,\n FlowHandoff,\n FlowImage,\n FlowQueueStatusConditional,\n FlowRating,\n FlowText,\n FlowVideo,\n FlowWhatsappButtonList,\n FlowWhatsappCtaUrlButtonNode,\n FlowWhatsappRequestContactInfoNode,\n FlowWhatsappTemplate,\n} from './content-fields'\nimport { FlowCaptureUserInput } from './content-fields/flow-capture-user-input'\nimport {\n type HtFunctionNode,\n type HtNodeComponent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\n\nexport class FlowFactory {\n public botContext: BotContext\n public cmsApi: FlowBuilderApi\n public locale: string\n\n constructor(botContext: BotContext, cmsApi: FlowBuilderApi, locale: string) {\n this.botContext = botContext\n this.cmsApi = cmsApi\n this.locale = locale\n }\n\n async getFlowContent(\n hubtypeContent: HtNodeComponent\n ): Promise<FlowContent | undefined> {\n switch (hubtypeContent.type) {\n case HtNodeWithContentType.TEXT:\n return FlowText.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.IMAGE:\n return FlowImage.fromHubtypeCMS(hubtypeContent, this.locale)\n case HtNodeWithContentType.CAROUSEL:\n return FlowCarousel.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.VIDEO:\n return FlowVideo.fromHubtypeCMS(hubtypeContent, this.locale)\n case HtNodeWithContentType.WHATSAPP_BUTTON_LIST:\n return FlowWhatsappButtonList.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi\n )\n case HtNodeWithContentType.WHATSAPP_CTA_URL_BUTTON:\n return FlowWhatsappCtaUrlButtonNode.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi,\n this.botContext\n )\n case HtNodeWithContentType.WHATSAPP_REQUEST_CONTACT_INFO:\n return FlowWhatsappRequestContactInfoNode.fromHubtypeCMS(\n hubtypeContent,\n this.locale\n )\n case HtNodeWithContentType.HANDOFF:\n return FlowHandoff.fromHubtypeCMS(\n hubtypeContent,\n this.locale,\n this.cmsApi\n )\n\n case HtNodeWithContentType.AI_AGENT_ROUTER:\n return FlowAiAgentRouter.fromHubtypeCMS(hubtypeContent, this.botContext)\n\n case HtNodeWithContentType.AI_AGENT:\n return FlowAiAgent.fromHubtypeCMS(hubtypeContent, this.botContext)\n\n case HtNodeWithContentType.RATING:\n return FlowRating.fromHubtypeCMS(hubtypeContent, this.locale)\n\n case HtNodeWithContentType.BOT_ACTION:\n return FlowBotAction.fromHubtypeCMS(hubtypeContent, this.cmsApi)\n\n case HtNodeWithContentType.FUNCTION:\n return this.resolveFlowFunctionContent(hubtypeContent)\n\n case HtNodeWithContentType.GO_TO_FLOW:\n return FlowGoToFlow.fromHubtypeCMS(hubtypeContent, this.cmsApi)\n\n case HtNodeWithContentType.WHATSAPP_TEMPLATE:\n return FlowWhatsappTemplate.fromHubtypeCMS(hubtypeContent, this.locale)\n\n case HtNodeWithContentType.CAPTURE_USER_INPUT:\n return FlowCaptureUserInput.fromHubtypeCMS(hubtypeContent)\n\n case HtNodeWithContentType.CUSTOM_CONDITION:\n return FlowCustomConditionalV2.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n\n default:\n return undefined\n }\n }\n\n private async resolveFlowFunctionContent(\n hubtypeContent: HtFunctionNode\n ): Promise<FlowContent | undefined> {\n switch (hubtypeContent.content.action) {\n case 'check-country':\n return FlowCountryConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n case 'get-channel-type':\n return FlowChannelConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n case 'check-queue-status':\n return FlowQueueStatusConditional.fromHubtypeCMS(\n hubtypeContent,\n this.locale\n )\n case 'check-bot-variable':\n return FlowCustomConditional.fromHubtypeCMS(\n hubtypeContent,\n this.botContext\n )\n default:\n return undefined\n }\n }\n}\n"],"names":["FlowAiAgent","FlowAiAgentRouter","FlowBotAction","FlowCarousel","FlowChannelConditional","FlowCountryConditional","FlowCustomConditional","FlowCustomConditionalV2","FlowGoToFlow","FlowHandoff","FlowImage","FlowQueueStatusConditional","FlowRating","FlowText","FlowVideo","FlowWhatsappButtonList","FlowWhatsappCtaUrlButtonNode","FlowWhatsappRequestContactInfoNode","FlowWhatsappTemplate","FlowCaptureUserInput","HtNodeWithContentType","FlowFactory","hubtypeContent","undefined","botContext","cmsApi","locale"],"mappings":";;;;;;;AAwByB;AACsD;AAKvC;AAEjC,MAAMqB,WAAWA;IAWtB,MAAM,eACJC,cAA+B,EACG;QAClC,OAAQA,eAAe,IAAI;YACzB,KAAKF,0BAA0B;gBAC7B,OAAOP,uBAAuB,CAC5BS,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU;YAEnB,KAAKF,2BAA2B;gBAC9B,OAAOV,wBAAwB,CAACY,gBAAgB,IAAI,CAAC,MAAM;YAC7D,KAAKF,8BAA8B;gBACjC,OAAOjB,2BAA2B,CAChCmB,gBACA,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,UAAU;YAEnB,KAAKF,2BAA2B;gBAC9B,OAAON,wBAAwB,CAACQ,gB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,CAC1CiB,gBACA,IAAI,CAAC,UAAU;YAEnB,KAAK;gBACH,OAAOlB,qCAAqC,CAC1CkB,gBACA,IAAI,CAAC,UAAU;YAEnB,KAAK;gBACH,OAAOX,yCAAyC,CAC9CW,gBACA,IAAI,CAAC,MAAM;YAEf,KAAK;gBACH,OAAOhB,oCAAoC,CACzCgB,gBACA,IAAI,CAAC,UAAU;YAEnB;gBACE,OAAOC;QACX;IACF;IAnHA,YAAYC,UAAsB,EAAEC,MAAsB,EAAEC,MAAc,CAAE;QAC1E,IAAI,CAAC,UAAU,GAAGF;QAClB,IAAI,CAAC,MAAM,GAAGC;QACd,IAAI,CAAC,MAAM,GAAGC;IAChB;AAgHF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions/index.js","sources":["../../src/functions/index.ts"],"sourcesContent":["import type { ActionRequest } from '@botonic/react'\n\nimport type {\n HtFunctionArgument,\n HtFunctionArguments,\n HtFunctionNode,\n} from '../content-fields/hubtype-fields'\n\nexport const DEFAULT_FUNCTION_NAMES = [\n 'check-queue-status',\n 'get-channel-type',\n 'check-country',\n 'check-bot-variable',\n]\n\nexport class CustomFunction {\n public functions: Record<any, any>\n public currentRequest: ActionRequest\n public locale: string\n\n constructor(\n functions: Record<any, any>,\n currentRequest: ActionRequest,\n locale: string\n ) {\n this.functions = functions\n this.currentRequest = currentRequest\n this.locale = locale\n }\n\n async call(functionNode: HtFunctionNode): Promise<string> {\n const functionNodeId = functionNode.id\n const functionArguments = getArgumentsByLocale(\n functionNode.content.arguments,\n this.locale\n )\n const nameValues = functionArguments.map(arg => {\n return { [arg.name]: arg.value }\n })\n\n const args = Object.assign(\n {\n request: this.currentRequest,\n results: functionNode.content.result_mapping.map(r => r.result),\n },\n ...nameValues\n )\n const functionResult =\n await this.functions[functionNode.content.action](args)\n // TODO define result_mapping per locale??\n const result = functionNode.content.result_mapping.find(\n r => r.result === functionResult\n )\n if (!result?.target) {\n throw new Error(\n `No result found for result_mapping for node with id: ${functionNodeId}`\n )\n }\n return result.target.id\n }\n}\n\nexport function getArgumentsByLocale(\n args: HtFunctionArguments[],\n locale: string\n): HtFunctionArgument[] {\n let resultArguments: HtFunctionArgument[] = []\n for (const arg of args) {\n if ('locale' in arg && arg.locale === locale) {\n resultArguments = [...resultArguments, ...arg.values]\n }\n if ('type' in arg) {\n resultArguments = [...resultArguments, arg]\n }\n }\n\n return resultArguments\n}\n"],"names":["DEFAULT_FUNCTION_NAMES","CustomFunction","functionNode","functionNodeId","functionArguments","getArgumentsByLocale","nameValues","arg","args","Object","r","functionResult","result","Error","functions","currentRequest","locale","resultArguments"],"mappings":"AAQO,MAAMA,sBAAsBA,GAAG;IACpC;IACA;IACA;IACA;CACD;AAEM,MAAMC,cAAcA;IAezB,MAAM,KAAKC,YAA4B,EAAmB;QACxD,MAAMC,iBAAiBD,aAAa,EAAE;QACtC,MAAME,oBAAoBC,oBAAoBA,CAC5CH,aAAa,OAAO,CAAC,SAAS,EAC9B,IAAI,CAAC,MAAM;QAEb,MAAMI,aAAaF,kBAAkB,GAAG,CAACG,CAAAA;YACvC,OAAO;gBAAE,CAACA,IAAI,IAAI,CAAC,EAAEA,IAAI,KAAK;YAAC;QACjC;QAEA,MAAMC,OAAOC,OAAO,MAAM,CACxB;YACE,SAAS,IAAI,CAAC,cAAc;YAC5B,SAASP,aAAa,OAAO,CAAC,cAAc,CAAC,GAAG,CAACQ,CAAAA,IAAKA,EAAE,MAAM;QAChE,MACGJ;QAEL,MAAMK,iBACJ,MAAM,IAAI,CAAC,SAAS,CAACT,aAAa,OAAO,CAAC,MAAM,CAAC,CAACM;QACpD,0CAA0C;QAC1C,MAAMI,SAASV,aAAa,OAAO,CAAC,cAAc,CAAC,IAAI,CACrDQ,CAAAA,IAAKA,EAAE,MAAM,KAAKC;QAEpB,IAAI,CAACC,QAAQ,QAAQ;YACnB,MAAM,IAAIC,MACR,CAAC,qDAAqD,EAAEV,gBAAgB;QAE5E;QACA,OAAOS,OAAO,MAAM,CAAC,EAAE;IACzB;IAvCA,YACEE,SAA2B,EAC3BC,cAA6B,EAC7BC,MAAc,CACd;QACA,IAAI,CAAC,SAAS,GAAGF;QACjB,IAAI,CAAC,cAAc,GAAGC;QACtB,IAAI,CAAC,MAAM,GAAGC;IAChB;AAgCF;AAEO,SAASX,oBAAoBA,CAClCG,IAA2B,EAC3BQ,MAAc;IAEd,IAAIC,kBAAwC,EAAE;IAC9C,KAAK,MAAMV,OAAOC,KAAM;QACtB,IAAI,YAAYD,OAAOA,IAAI,MAAM,KAAKS,QAAQ;YAC5CC,kBAAkB;mBAAIA;mBAAoBV,IAAI,MAAM;aAAC;QACvD;QACA,IAAI,UAAUA,KAAK;YACjBU,kBAAkB;mBAAIA;gBAAiBV;aAAI;QAC7C;IACF;IAEA,OAAOU;AACT"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {\n INPUT,\n type Plugin,\n type PluginPreRequest,\n PROVIDER,\n type ResolvedPlugins,\n type Session,\n} from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport { v7 as uuidv7 } from 'uuid'\n\nimport { FlowBuilderApi } from './api'\nimport {\n EMPTY_PAYLOAD,\n FLOW_BUILDER_API_URL_PROD,\n SEPARATOR,\n SOURCE_INFO_SEPARATOR,\n} from './constants'\nimport type { FlowContent } from './content-fields'\nimport {\n type HtBotActionNode,\n type HtFlowBuilderData,\n type HtNodeWithContent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\nimport { FlowFactory } from './flow-factory'\nimport { CustomFunction, DEFAULT_FUNCTION_NAMES } from './functions'\nimport {\n type AiAgentFunction,\n type BotonicPluginFlowBuilderOptions,\n type ContentFilter,\n FlowBuilderJSONVersion,\n type InShadowingConfig,\n type PayloadParamsBase,\n type RatingSubmittedInfo,\n type TrackEventFunction,\n} from './types'\nimport { getNextPayloadByUserInput } from './user-input'\nimport type { SmartIntentsInferenceConfig } from './user-input/smart-intent'\nimport { resolveGetAccessToken } from './utils/authentication'\nimport { inputHasTextOrTranscript } from './utils/input'\n\n// TODO: Create a proper service to wrap all calls and allow api versioning\n\nexport default class BotonicPluginFlowBuilder implements Plugin {\n public cmsApi: FlowBuilderApi\n private flow?: HtFlowBuilderData\n private functions: Record<any, any>\n private currentRequest: PluginPreRequest\n public getAccessToken: (session: Session) => string\n public trackEvent?: TrackEventFunction\n public getAiAgentResponse?: AiAgentFunction\n public smartIntentsConfig: SmartIntentsInferenceConfig\n public inShadowing: InShadowingConfig\n public contentFilters: ContentFilter[]\n\n // TODO: Rethink how we construct FlowBuilderApi to be simpler\n public jsonVersion: FlowBuilderJSONVersion\n public apiUrl: string\n public customRatingMessageEnabled: boolean\n public disableAIAgentInFirstInteraction: boolean\n\n constructor(options: BotonicPluginFlowBuilderOptions<ResolvedPlugins, any>) {\n this.apiUrl = options.apiUrl || FLOW_BUILDER_API_URL_PROD\n this.jsonVersion = options.jsonVersion || FlowBuilderJSONVersion.LATEST\n this.flow = options.flow\n this.getAccessToken = resolveGetAccessToken(options.getAccessToken)\n this.trackEvent = options.trackEvent\n this.getAiAgentResponse = options.getAiAgentResponse\n this.smartIntentsConfig = {\n ...options?.smartIntentsConfig,\n useLatest: this.jsonVersion === FlowBuilderJSONVersion.LATEST,\n }\n const customFunctions = options.customFunctions || {}\n this.functions = customFunctions\n this.inShadowing = {\n allowKeywords: options.inShadowing?.allowKeywords || false,\n allowSmartIntents: options.inShadowing?.allowSmartIntents || false,\n allowAiAgents: options.inShadowing?.allowAiAgents || false,\n }\n this.contentFilters = options.contentFilters || []\n this.customRatingMessageEnabled =\n options.customRatingMessageEnabled || false\n this.disableAIAgentInFirstInteraction =\n options.disableAIAgentInFirstInteraction || false\n }\n\n resolveFlowUrl(request: PluginPreRequest): string {\n if (request.session.is_test_integration) {\n return `${this.apiUrl}/v1/bot_flows/{bot_id}/versions/${FlowBuilderJSONVersion.DRAFT}/`\n }\n return `${this.apiUrl}/v1/bot_flows/{bot_id}/versions/${this.jsonVersion}/`\n }\n\n async pre(request: PluginPreRequest): Promise<void> {\n // When AI Agent is executed in Whatsapp, button payloads come as referral and must be converted to text being processed by the agent.\n this.convertWhatsappAiAgentEmptyPayloads(request)\n\n this.currentRequest = request\n this.cmsApi = await FlowBuilderApi.create({\n flowUrl: this.resolveFlowUrl(request),\n url: this.apiUrl,\n flow: this.flow,\n accessToken: this.getAccessToken(request.session),\n request: this.currentRequest,\n })\n\n const checkUserTextInput =\n inputHasTextOrTranscript(request.input) && !request.input.payload\n\n if (checkUserTextInput) {\n const resolvedLocale = this.cmsApi.getResolvedLocale()\n const nextPayload = await getNextPayloadByUserInput(\n this.cmsApi,\n resolvedLocale,\n request as unknown as ActionRequest,\n this.smartIntentsConfig\n )\n request.input.payload = nextPayload\n }\n\n await this.updateRequestBeforeRoutes(request)\n }\n\n private convertWhatsappAiAgentEmptyPayloads(request: PluginPreRequest): void {\n if (request.session.user.provider === PROVIDER.WHATSAPP) {\n const shouldUseReferral =\n request.input.referral &&\n request.input.payload?.startsWith(EMPTY_PAYLOAD)\n\n if (shouldUseReferral) {\n request.input.type = INPUT.TEXT\n request.input.data = request.input.referral\n }\n }\n }\n\n private async updateRequestBeforeRoutes(\n request: PluginPreRequest\n ): Promise<void> {\n this.cmsApi.removeCaptureUserInputId()\n if (request.input.payload) {\n request.input.payload = this.removeSourceSuffix(request.input.payload)\n\n if (this.cmsApi.isBotAction(request.input.payload)) {\n const cmsBotAction = this.cmsApi.getNodeById<HtBotActionNode>(\n request.input.payload\n )\n\n request.input.payload =\n this.cmsApi.createPayloadWithParams(cmsBotAction)\n\n // Re-execute convertWhatsappAiAgentEmptyPayloads function to handle\n // the case that a BotAction has a payload equals to EMPTY_PAYLOAD\n this.convertWhatsappAiAgentEmptyPayloads(request)\n }\n }\n }\n\n private removeSourceSuffix(payload: string): string {\n return payload.split(SOURCE_INFO_SEPARATOR)[0]\n }\n\n post(request: PluginPreRequest): void {\n request.input.nluResolution = undefined\n delete request.session.user.system_locale_updated\n }\n\n async getContentsByContentID(\n contentID: string,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const node = this.cmsApi.getNodeByContentID(contentID) as HtNodeWithContent\n return await this.getContentsByNode(node, prevContents)\n }\n\n getUUIDByContentID(contentID: string): string {\n const node = this.cmsApi.getNodeByContentID(contentID)\n return node.id\n }\n\n private async getContentsById(\n id: string,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const node = this.cmsApi.getNodeById(id) as HtNodeWithContent\n return await this.getContentsByNode(node, prevContents)\n }\n\n async getStartContents(): Promise<FlowContent[]> {\n const startNode = this.cmsApi.getStartNode()\n this.currentRequest.session.flow_thread_id = uuidv7()\n return await this.getContentsByNode(startNode)\n }\n\n async getContentsByNode(\n node: HtNodeWithContent,\n prevContents?: FlowContent[]\n ): Promise<FlowContent[]> {\n const contents = prevContents || []\n const resolvedLocale = this.cmsApi.getResolvedLocale()\n\n if (\n node.type === HtNodeWithContentType.FUNCTION &&\n !DEFAULT_FUNCTION_NAMES.includes(node.content.action)\n ) {\n const customFunctionResolver = new CustomFunction(\n this.functions,\n this.currentRequest,\n resolvedLocale\n )\n const targetId = await customFunctionResolver.call(node)\n return this.getContentsById(targetId, contents)\n }\n\n const flowFactory = new FlowFactory(\n this.currentRequest,\n this.cmsApi,\n resolvedLocale\n )\n const content = await flowFactory.getFlowContent(node)\n if (content) {\n contents.push(content)\n }\n\n // If node is BOT_ACTION not add more contents to render, next nodes render after execute action\n if (node.type === HtNodeWithContentType.BOT_ACTION) {\n return contents\n }\n\n // TODO: prevent infinite recursive calls\n if (content?.followUp) {\n return this.getContentsById(content.followUp.id, contents)\n } else if (node.follow_up) {\n console.log('FOLLOWUP FROM NODE-------> OLD SYSTEM')\n return this.getContentsById(node.follow_up.id, contents)\n }\n\n return contents\n }\n\n getPayloadParams<T extends PayloadParamsBase>(payload: string): T {\n const payloadParams = JSON.parse(payload.split(SEPARATOR)[1] || '{}')\n return payloadParams\n }\n\n getFlowName(flowId: string): string {\n return this.cmsApi.getFlowName(flowId)\n }\n\n getRatingSubmittedInfo(payload: string): RatingSubmittedInfo {\n const buttonId = payload?.split(SEPARATOR)[1]\n const ratingNode = this.cmsApi.getRatingNodeByButtonId(buttonId)\n\n const ratingButton = this.cmsApi.getRatingButtonById(ratingNode, buttonId)\n const possibleOptions = ratingNode.content.buttons.map(\n button => button.text\n )\n const possibleValues = ratingNode.content.buttons.map(\n button => button.value\n )\n\n return {\n ...ratingButton,\n possibleOptions,\n possibleValues,\n }\n }\n\n setInShadowing(inShadowing: InShadowingConfig): void {\n this.inShadowing = inShadowing\n }\n}\n\nexport * from './action'\nexport { AGENT_RATING_PAYLOAD, EMPTY_PAYLOAD } from './constants'\nexport * from './content-fields'\nexport type { HtBotActionNode } from './content-fields/hubtype-fields'\nexport {\n getCommonFlowContentEventArgsForContentId,\n trackFlowContent,\n} from './tracking'\nexport {\n type BotonicPluginFlowBuilderOptions,\n type ContentFilter,\n FlowBuilderJSONVersion,\n type PayloadParamsBase,\n type RatingSubmittedInfo,\n} from './types'\nexport * from './webview'\n"],"names":["INPUT","PROVIDER","v7","uuidv7","FlowBuilderApi","EMPTY_PAYLOAD","FLOW_BUILDER_API_URL_PROD","SEPARATOR","SOURCE_INFO_SEPARATOR","HtNodeWithContentType","FlowFactory","CustomFunction","DEFAULT_FUNCTION_NAMES","FlowBuilderJSONVersion","getNextPayloadByUserInput","resolveGetAccessToken","inputHasTextOrTranscript","BotonicPluginFlowBuilder","request","checkUserTextInput","resolvedLocale","nextPayload","shouldUseReferral","cmsBotAction","payload","undefined","contentID","prevContents","node","id","startNode","contents","customFunctionResolver","targetId","flowFactory","content","console","payloadParams","JSON","flowId","buttonId","ratingNode","ratingButton","possibleOptions","button","possibleValues","inShadowing","options","customFunctions","AGENT_RATING_PAYLOAD","getCommonFlowContentEventArgsForContentId","trackFlowContent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAOsB;AAEa;AAEG;AAMlB;AAOoB;AACI;AACwB;AAUpD;AAC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AC/D;QACA,MAAMmC,kBAAkBD,QAAQ,eAAe,IAAI,CAAC;QACpD,IAAI,CAAC,SAAS,GAAGC;QACjB,IAAI,CAAC,WAAW,GAAG;YACjB,eAAeD,QAAQ,WAAW,EAAE,iBAAiB;YACrD,mBAAmBA,QAAQ,WAAW,EAAE,qBAAqB;YAC7D,eAAeA,QAAQ,WAAW,EAAE,iBAAiB;QACvD;QACA,IAAI,CAAC,cAAc,GAAGA,QAAQ,cAAc,IAAI,EAAE;QAClD,IAAI,CAAC,0BAA0B,GAC7BA,QAAQ,0BAA0B,IAAI;QACxC,IAAI,CAAC,gCAAgC,GACnCA,QAAQ,gCAAgC,IAAI;IAChD;AA2LF;AAtOA,2EAA2E;AAsO1E;AAEuB;AACyC;AACjC;AAKb;AAOH;AACS"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services/hubtype-queues-api.js","sources":["../../src/services/hubtype-queues-api.ts"],"sourcesContent":["import axios from 'axios'\n\nconst HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'\n\nexport interface AvailabilityData {\n available: boolean\n waiting_cases: number\n availability_threshold_waiting_cases: number\n open: boolean\n name: string\n available_agents: number\n}\nexport class HubtypeQueuesApi {\n public queueId: string\n public checkAvailableAgents: boolean\n\n constructor(queueId: string, checkAvailableAgents?: boolean) {\n this.queueId = queueId\n this.checkAvailableAgents = checkAvailableAgents || false\n }\n\n async getAvailability(): Promise<AvailabilityData> {\n const response = await axios.get(\n `${HUBTYPE_API_URL}/external/v1/queues/${this.queueId}/availability/`,\n // TODO: Make it configurable in the future\n {\n params: {\n check_queue_schedule: true,\n check_waiting_cases: false,\n check_available_agents: this.checkAvailableAgents,\n },\n }\n )\n return response.data\n }\n}\n"],"names":["axios","HUBTYPE_API_URL","process","HubtypeQueuesApi","response","queueId","checkAvailableAgents"],"mappings":";;;AAAyB;AAEzB,MAAMC,eAAeA,GAAGC,QAAQ,GAAG,CAAC,eAAe,IAAI;AAUhD,MAAMC,gBAAgBA;IAS3B,MAAM,kBAA6C;QACjD,MAAMC,WAAW,MAAMJ,SAAS,CAC9B,GAAGC,eAAeA,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EACrE,2CAA2C;QAC3C;YACE,QAAQ;gBACN,sBAAsB;gBACtB,qBAAqB;gBACrB,wBAAwB,IAAI,CAAC,oBAAoB;YACnD;QACF;QAEF,OAAOG,SAAS,IAAI;IACtB;IAlBA,YAAYC,OAAe,EAAEC,oBAA8B,CAAE;QAC3D,IAAI,CAAC,OAAO,GAAGD;QACf,IAAI,CAAC,oBAAoB,GAAGC,wBAAwB;IACtD;AAgBF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-output/flow-builder-content.js","sources":["../../src/structured-output/flow-builder-content.ts"],"sourcesContent":["import type { BaseMessage } from '@botonic/core'\nimport { z } from 'zod'\n\nexport enum FlowBuilderOutputMessageType {\n FlowBuilderContent = 'flowBuilderContent',\n}\n\nexport interface FlowBuilderContentMessage\n extends BaseMessage<FlowBuilderOutputMessageType.FlowBuilderContent> {\n type: FlowBuilderOutputMessageType.FlowBuilderContent\n contentId: string\n}\n\nexport const FlowBuilderContentSchema = z\n .object({\n type: z.literal(FlowBuilderOutputMessageType.FlowBuilderContent),\n contentId: z.string(),\n })\n .describe(\n 'A Flow Builder content ID. Use it only when asked explicitly in the prompt'\n )\n"],"names":["z","FlowBuilderOutputMessageType","FlowBuilderContentSchema"],"mappings":";;;AACuB;AAEhB,IAAKC,iDAA4BA,0BAA5BA;;WAAAA;MAEX;AAQM,MAAMC,wBAAwBA,GAAGF,QAC/B,CAAC;IACN,MAAMA,SAAS;IACf,WAAWA,QAAQ;AACrB,GACC,QAAQ,CACP,8EACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracking.js","sources":["../src/tracking.ts"],"sourcesContent":["import { type BotContext, EventAction, type EventFlow } from '@botonic/core'\nimport type { ActionRequest } from '@botonic/react'\nimport { v7 as uuidv7 } from 'uuid'\n\nimport type { FlowBuilderApi } from './api'\nimport type { FlowContent } from './content-fields'\nimport {\n type HtNodeWithContent,\n HtNodeWithContentType,\n} from './content-fields/hubtype-fields'\nimport { getFlowBuilderPlugin } from './utils/get-flow-builder-plugin'\n\nexport async function trackEvent(\n request: ActionRequest,\n eventAction: EventAction,\n args?: Record<string, any>\n): Promise<void> {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n if (flowBuilderPlugin.trackEvent) {\n await flowBuilderPlugin.trackEvent(request, eventAction, args)\n }\n return\n}\n\nexport async function trackFlowContent(\n request: ActionRequest,\n contents: FlowContent[]\n) {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n for (const content of contents) {\n await trackOneContent(request, content, cmsApi)\n }\n}\n\nexport async function trackOneContent(\n request: ActionRequest,\n content: FlowContent,\n cmsApi?: FlowBuilderApi\n) {\n if (!cmsApi) {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n cmsApi = flowBuilderPlugin.cmsApi\n }\n\n const nodeContent = cmsApi.getNodeById<HtNodeWithContent>(content.id)\n if (nodeContent.type !== HtNodeWithContentType.AI_AGENT) {\n const event = getContentEventArgs(request, nodeContent)\n const { action, ...eventArgs } = event\n await trackEvent(request, action, eventArgs)\n }\n}\n\nfunction setSessionFlowThreadId(\n request: ActionRequest,\n flowThreadId: string\n): void {\n request.session.flow_thread_id = flowThreadId\n}\n\nfunction getContentEventArgs(\n request: ActionRequest,\n nodeContent: HtNodeWithContent\n): EventFlow {\n const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } =\n getCommonFlowContentEventArgs(request, nodeContent)\n\n setSessionFlowThreadId(request, flowThreadId)\n\n return {\n action: EventAction.FlowNode,\n flowId,\n flowName,\n flowNodeId,\n flowNodeContentId,\n flowThreadId,\n flowNodeIsMeaningful: nodeContent.is_meaningful ?? false,\n }\n}\n\ntype CommonFlowContentEventArgs = {\n flowThreadId: string\n flowId: string\n flowName: string\n flowNodeId: string\n flowNodeContentId: string\n}\n\nfunction getCommonFlowContentEventArgs(\n request: ActionRequest,\n nodeContent: HtNodeWithContent\n): CommonFlowContentEventArgs {\n const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)\n const flowName = flowBuilderPlugin.getFlowName(nodeContent.flow_id)\n const flowThreadId = request.session.flow_thread_id ?? uuidv7()\n\n return {\n flowThreadId,\n flowId: nodeContent.flow_id,\n flowName,\n flowNodeId: nodeContent.id,\n flowNodeContentId: nodeContent.code ?? '',\n }\n}\n\nexport function getCommonFlowContentEventArgsForContentId(\n botContext: BotContext,\n id: string\n): CommonFlowContentEventArgs {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const cmsApi = flowBuilderPlugin.cmsApi\n const nodeContent = cmsApi.getNodeById<HtNodeWithContent>(id)\n\n return getCommonFlowContentEventArgs(botContext, nodeContent)\n}\n"],"names":["EventAction","v7","uuidv7","HtNodeWithContentType","getFlowBuilderPlugin","trackEvent","request","eventAction","args","flowBuilderPlugin","trackFlowContent","contents","cmsApi","content","trackOneContent","nodeContent","event","getContentEventArgs","action","eventArgs","setSessionFlowThreadId","flowThreadId","flowId","flowName","flowNodeId","flowNodeContentId","getCommonFlowContentEventArgs","getCommonFlowContentEventArgsForContentId","botContext","id"],"mappings":";;;;;;;;;AAA4E;AAEzC;AAOK;AAC8B;AAE/D,eAAeK,UAAUA,CAC9BC,OAAsB,EACtBC,WAAwB,EACxBC,IAA0B;IAE1B,MAAMC,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;IAC9D,IAAIG,kBAAkB,UAAU,EAAE;QAChC,MAAMA,kBAAkB,UAAU,CAACH,SAASC,aAAaC;IAC3D;IACA;AACF;AAEO,eAAeE,gBAAgBA,CACpCJ,OAAsB,EACtBK,QAAuB;IAEvB,MAAMF,oBAAoBL,oBAAoBA,CAACE,QAAQ,OAAO;IAC9D,MAAMM,SAASH,kBAAkB,MAAM;IACvC,KAAK,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IAAI,IAAI;IACzC;AACF;AAEO,SAASY,yCAAyCA,CACvDC,UAAsB,EACtBC,EAAU;IAEV,MAAMpB,oBAAoBL,oBAAoBA,CAACwB,WAAW,OAAO;IACjE,MAAMhB,SAASH,kBAAkB,MAAM;IACvC,MAAMM,cAAcH,OAAO,WAAW,CAAoBiB;IAE1D,OAAOH,6BAA6BA,CAACE,YAAYb;AACnD"}
@@ -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"}
@@ -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,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,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"}
@@ -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"}
@@ -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":";;;;;;;AAAuE;AAIzB;AAQ1B;AAQb,MAAMK,cAAcA;IAkBzB,MAAM,iBAAqD;QACzD,MAAMC,eAAe,IAAI,CAAC,MAAM,CAAC,eAAe;QAChD,MAAMC,cAAc,IAAI,CAAC,gBAAgB,CACvC,IAAI,CAAC,oBAAoB,EACzBD;QAEF,IAAI,CAACC,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE;YACxC,OAAOC;QACT;QACA,MAAMC,gBAAgB,IAAI,CAAC,MAAM,CAAC,UAAU,CAACF,YAAY,MAAM;QAE/D,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG;YACjC,MAAMN,eAAe;YACrB,cAAc,IAAI,CAAC,cAAc;YACjC,SAASQ;QACX;QACA,MAAM,IAAI,CAAC,iBAAiB;QAC5B,OAAOF;IACT;IAEQ,iBACNG,SAAiB,EACjBJ,YAA6B,EACF;QAC3B,MAAMK,qBAAqBL,aAAa,IAAI,CAACM,CAAAA,OAC3C,IAAI,CAAC,aAAa,CAACF,WAAWE;QAGhC,OAAOD,oBAAoB,SAASA,qBAAqBH;IAC3D;IAEQ,cAAcE,SAAiB,EAAEE,IAAmB,EAAW;QACrE,MAAMC,SAASD,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,CAACE,CAAAA;YACxC,IAAIA,SAAS,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE;gBACnC,IAAI,CAAC,aAAa,GAAGF,KAAK,EAAE;gBAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CACnCA,KAAK,EAAE,EACP,OAAO;gBACT,OAAO,IAAI,CAAC,s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,CAAC,OAAO,EAAEwB,QAAQC;IACzC;IAtGA,YAAY,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,oBAAoB,EAAgB,CAAE;QAC3E,IAAI,CAAC,MAAM,GAAGH;QACd,IAAI,CAAC,MAAM,GAAGC;QACd,IAAI,CAAC,OAAO,GAAGC;QACf,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,oBAAoB,GAAGC;IAC9B;AAiGF"}
@@ -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":";;;;;;;;;AAA2E;AAElD;AAOL;AAEmD;AAehE,MAAMM,eAAeA;IAQ1B,MAAM,iBAAyD;QAC7D,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC9B,OAAOC;QACT;QACA,MAAMC,mBAAmB,IAAI,CAAC,MAAM,CAAC,mBAAmB;QACxD,IAAI,CAACA,iBAAiB,MAAM,EAAE;YAC5B,OAAOD;QACT;QAEA,MAAME,4BAA4BD,iBAC/B,MAAM,CAACE,CAAAA,kBAAmBA,gBAAgB,OAAO,CAAC,SAAS,KAAK,OAChE,GAAG,CAACA,CAAAA,kBAAmBA,gBAAgB,OAAO,CAAC,KAAK;QAEvD,MAAMC,SAAS;YACb,QAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAC1C,MAAM,IAAI,CAAC,oBAAoB;YAC/B,0BAA0B,IAAI,CAAC,kBAAkB,CAAC,oBAAoB;YACtE,YAAY,IAAI,CAAC,gBAAgB;YACjC,8BAA8BF;QAChC;QAEA,IAAI;YACF,MAAMG,WAAW,MAAM,IAAI,CAAC,YAAY,CAACD;YACzC,MAAMD,kBAAkBF,iBAAiB,IAAI,CAC3CE,CAAAA,kBACEA,gBAAgB,OAAO,CAAC,KAAK,KAAKE,SAAS,IAAI,CAAC,kBAAkB;YAGtE,IAAIF,iBAAiB;gBACnB,MAAMG,gBAAgB,IAAI,CAAC,MAAM,CAAC,UAAU,CAACH,gBAAgB,MAAM;gBACnE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,aAAa,GAAG;oBACxC,MAAMT,mBAAmB;oBACzB,cAAcS,gBAAgB,OAAO,CAAC,KAAK;oBAC3C,S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A,YACSI,MAAsB,EACtBC,cAA6B,EAC7BC,kBAA+C,EAC/CC,oBAA4B,CACnC;aAJOH,SAAAA;aACAC,iBAAAA;aACAC,qBAAAA;aACAC,uBAAAA;IACN;AA4FL"}
@@ -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"}
@@ -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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/flow-locale.js","sources":["../../src/utils/flow-locale.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\n\nexport class FlowLocale {\n constructor(\n private readonly botContext: BotContext,\n private readonly flowLocales: string[],\n private readonly defaultLocaleCode: string\n ) {}\n\n resolve(): string {\n const priorityLocale = this.isLanguageDetectionEnabled()\n ? this.getPriorityLocale()\n : this.botContext.getSystemLocale()\n\n if (priorityLocale) {\n const exactMatch = this.matchExactLocale(priorityLocale)\n if (exactMatch) {\n return this.applyLocale(exactMatch)\n }\n\n const languageMatch = this.matchLanguage(priorityLocale)\n if (languageMatch) {\n return this.applyLocale(languageMatch)\n }\n }\n\n return this.applyLocale(this.getDefaultLocale())\n }\n\n private isLanguageDetectionEnabled(): boolean {\n return !!this.botContext.settings?.LANGUAGE_DETECTION_ENABLED\n }\n\n /**\n * Rules:\n * - If user and system languages differ, user locale takes priority.\n * - If both share the same language, the more specific locale wins.\n * - If both have the same specificity, user locale wins.\n */\n private getPriorityLocale(): string | undefined {\n const userLocale = this.botContext.getUserLocale()\n const systemLocale = this.botContext.getSystemLocale()\n\n if (!userLocale || !systemLocale) {\n return undefined\n }\n\n const userLanguage = this.getLanguage(userLocale)\n const systemLanguage = this.getLanguage(systemLocale)\n\n if (userLanguage !== systemLanguage) {\n return userLocale\n }\n const userIsSpecific = this.isSpecificLocale(userLocale)\n const systemIsSpecific = this.isSpecificLocale(systemLocale)\n\n if (userIsSpecific && !systemIsSpecific) {\n return userLocale\n }\n if (!userIsSpecific && systemIsSpecific) {\n return systemLocale\n }\n\n return userLocale\n }\n\n private matchExactLocale(locale: string): string | undefined {\n return this.flowLocales.includes(locale) ? locale : undefined\n }\n\n private matchLanguage(locale: string): string | undefined {\n const language = this.getLanguage(locale)\n return this.flowLocales.includes(language) ? language : undefined\n }\n\n private getDefaultLocale(): string {\n return this.defaultLocaleCode || 'en'\n }\n\n private applyLocale(locale: string): string {\n this.botContext.setSystemLocale(locale)\n this.botContext.session.user.system_locale_updated = true\n return locale\n }\n\n private getLanguage(locale: string): string {\n return locale.split('-')[0]\n }\n\n private isSpecificLocale(locale: string): boolean {\n return locale.includes('-')\n }\n}\n"],"names":["FlowLocale","priorityLocale","exactMatch","languageMatch","userLocale","systemLocale","undefined","userLanguage","systemLanguage","userIsSpecific","systemIsSpecific","locale","language","botContext","flowLocales","defaultLocaleCode"],"mappings":"AAEO,MAAMA,UAAUA;IAOrB,UAAkB;QAChB,MAAMC,iBAAiB,IAAI,CAAC,0BAA0B,KAClD,IAAI,CAAC,iBAAiB,KACtB,IAAI,CAAC,UAAU,CAAC,eAAe;QAEnC,IAAIA,gBAAgB;YAClB,MAAMC,aAAa,IAAI,CAAC,gBAAgB,CAACD;YACzC,IAAIC,YAAY;gBACd,OAAO,IAAI,CAAC,WAAW,CAACA;YAC1B;YAEA,MAAMC,gBAAgB,IAAI,CAAC,aAAa,CAACF;YACzC,IAAIE,eAAe;gBACjB,OAAO,IAAI,CAAC,WAAW,CAACA;YAC1B;QACF;QAEA,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,gBAAgB;IAC/C;IAEQ,6BAAsC;QAC5C,OAAO,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;IACrC;IAEA;;;;;GAKC,GACO,oBAAwC;QAC9C,MAAMC,aAAa,IAAI,CAAC,UAAU,CAAC,aAAa;QAChD,MAAMC,eAAe,IAAI,CAAC,UAAU,CAAC,eAAe;QAEpD,IAAI,CAACD,cAAc,CAACC,cAAc;YAChC,OAAOC;QACT;QAEA,MAAMC,eAAe,IAAI,CAAC,WAAW,CAACH;QACtC,MAAMI,iBAAiB,IAAI,CAAC,WAAW,CAACH;QAExC,IAAIE,iBAAiBC,gBAAgB;YACnC,OAAOJ;QACT;QACA,MAAMK,iBAAiB,IAAI,CAAC,gBAAgB,CAACL;QAC7C,MAAMM,mBAAmB,IAAI,CAAC,gBAAgB,CAACL;QAE/C,IAAII,kBAAkB,CAACC,kBAAkB;YACvC,OAAON;QACT;QACA,IAAI,CAACK,kBAAkBC,kBAAkB;YACvC,OAAOL;QACT;QAEA,OAAOD;IACT;IAEQ,iBAAiBO,MAAc,EAAsB;QAC3D,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAACA,UAAUA,SAASL;IACtD;IAEQ,cAAcK,MAAc,EAAsB;QACxD,MAAMC,WAAW,IAAI,CAAC,WAAW,CAACD;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAACC,YAAYA,WAAWN;IAC1D;IAEQ,mBAA2B;QACjC,OAAO,IAAI,CAAC,iBAAiB,IAAI;IACnC;IAEQ,YAAYK,MAAc,EAAU;QAC1C,IAAI,CAAC,UAAU,CAAC,eAAe,CAACA;QAChC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,GAAG;QACrD,OAAOA;IACT;IAEQ,YAAYA,MAAc,EAAU;QAC1C,OAAOA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE;IAC7B;IAEQ,iBAAiBA,MAAc,EAAW;QAChD,OAAOA,OAAO,QAAQ,CAAC;IACzB;IAxFA,YACmBE,UAAsB,EACtBC,WAAqB,EACrBC,iBAAyB,CAC1C;aAHiBF,aAAAA;aACAC,cAAAA;aACAC,oBAAAA;IAChB;AAqFL"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils/get-flow-builder-plugin.js","sources":["../../src/utils/get-flow-builder-plugin.ts"],"sourcesContent":["import type { ResolvedPlugins } from '@botonic/core'\n\nimport type BotonicPluginFlowBuilder from '../index'\n\nconst FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder'\n\nexport function getFlowBuilderPlugin(\n plugins: ResolvedPlugins\n): BotonicPluginFlowBuilder {\n const ERROR_MESSAGE = `You must include '@botonic/plugin-flow-builder' in your plugins file.`\n\n if (Object.values(plugins).length === 0) {\n throw new Error(ERROR_MESSAGE)\n }\n\n const flowBuilderPlugin = Object.values(plugins).find(\n plugin => plugin.constructor.name === FLOW_BUILDER_PLUGIN_NAME\n ) as unknown as BotonicPluginFlowBuilder\n\n if (!flowBuilderPlugin) {\n throw new Error(ERROR_MESSAGE)\n }\n\n return flowBuilderPlugin\n}\n"],"names":["FLOW_BUILDER_PLUGIN_NAME","getFlowBuilderPlugin","plugins","ERROR_MESSAGE","Object","Error","flowBuilderPlugin","plugin"],"mappings":"AAIA,MAAMA,wBAAwBA,GAAG;AAE1B,SAASC,oBAAoBA,CAClCC,OAAwB;IAExB,MAAMC,gBAAgB,CAAC,qEAAqE,CAAC;IAE7F,IAAIC,OAAO,MAAM,CAACF,SAAS,MAAM,KAAK,GAAG;QACvC,MAAM,IAAIG,MAAMF;IAClB;IAEA,MAAMG,oBAAoBF,OAAO,MAAM,CAACF,SAAS,IAAI,CACnDK,CAAAA,SAAUA,OAAO,WAAW,CAAC,IAAI,KAAKP,wBAAwBA;IAGhE,IAAI,CAACM,mBAAmB;QACtB,MAAM,IAAID,MAAMF;IAClB;IAEA,OAAOG;AACT"}