@botonic/plugin-flow-builder 0.55.2 → 0.57.0-rslib-esm.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/lib/esm/action/ai-agent-from-user-input.d.ts +2 -2
  2. package/lib/esm/action/ai-agent-from-user-input.js +9 -6
  3. package/lib/esm/action/ai-agent-from-user-input.js.map +1 -1
  4. package/lib/esm/action/context.d.ts +2 -2
  5. package/lib/esm/action/context.js +9 -6
  6. package/lib/esm/action/context.js.map +1 -1
  7. package/lib/esm/action/fallback.d.ts +2 -2
  8. package/lib/esm/action/fallback.js +16 -11
  9. package/lib/esm/action/fallback.js.map +1 -1
  10. package/lib/esm/action/first-interaction.d.ts +2 -2
  11. package/lib/esm/action/first-interaction.js +39 -27
  12. package/lib/esm/action/first-interaction.js.map +1 -1
  13. package/lib/esm/action/get-contents.d.ts +1 -1
  14. package/lib/esm/action/get-contents.js +37 -20
  15. package/lib/esm/action/get-contents.js.map +1 -1
  16. package/lib/esm/action/index.d.ts +1 -1
  17. package/lib/esm/action/index.js +68 -32
  18. package/lib/esm/action/index.js.map +1 -1
  19. package/lib/esm/action/payload.d.ts +2 -2
  20. package/lib/esm/action/payload.js +27 -23
  21. package/lib/esm/action/payload.js.map +1 -1
  22. package/lib/esm/api.d.ts +2 -2
  23. package/lib/esm/api.js +55 -44
  24. package/lib/esm/api.js.map +1 -1
  25. package/lib/esm/constants.js +16 -18
  26. package/lib/esm/constants.js.map +1 -1
  27. package/lib/esm/content-fields/content-fields-base.d.ts +2 -2
  28. package/lib/esm/content-fields/content-fields-base.js +33 -29
  29. package/lib/esm/content-fields/content-fields-base.js.map +1 -1
  30. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +1 -1
  31. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +35 -33
  32. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -1
  33. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +1 -1
  34. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js +15 -15
  35. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -1
  36. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +2 -2
  37. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js +50 -35
  38. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -1
  39. package/lib/esm/content-fields/flow-ai-agent-base.d.ts +4 -4
  40. package/lib/esm/content-fields/flow-ai-agent-base.js +50 -43
  41. package/lib/esm/content-fields/flow-ai-agent-base.js.map +1 -1
  42. package/lib/esm/content-fields/flow-ai-agent-router.d.ts +5 -5
  43. package/lib/esm/content-fields/flow-ai-agent-router.js +57 -46
  44. package/lib/esm/content-fields/flow-ai-agent-router.js.map +1 -1
  45. package/lib/esm/content-fields/flow-ai-agent.d.ts +4 -4
  46. package/lib/esm/content-fields/flow-ai-agent.js +33 -22
  47. package/lib/esm/content-fields/flow-ai-agent.js.map +1 -1
  48. package/lib/esm/content-fields/flow-bot-action.d.ts +3 -3
  49. package/lib/esm/content-fields/flow-bot-action.js +23 -15
  50. package/lib/esm/content-fields/flow-bot-action.js.map +1 -1
  51. package/lib/esm/content-fields/flow-button.d.ts +5 -5
  52. package/lib/esm/content-fields/flow-button.js +48 -29
  53. package/lib/esm/content-fields/flow-button.js.map +1 -1
  54. package/lib/esm/content-fields/flow-capture-user-input.d.ts +2 -2
  55. package/lib/esm/content-fields/flow-capture-user-input.js +24 -23
  56. package/lib/esm/content-fields/flow-capture-user-input.js.map +1 -1
  57. package/lib/esm/content-fields/flow-carousel.d.ts +4 -4
  58. package/lib/esm/content-fields/flow-carousel.js +99 -58
  59. package/lib/esm/content-fields/flow-carousel.js.map +1 -1
  60. package/lib/esm/content-fields/flow-channel-conditional.d.ts +3 -3
  61. package/lib/esm/content-fields/flow-channel-conditional.js +26 -22
  62. package/lib/esm/content-fields/flow-channel-conditional.js.map +1 -1
  63. package/lib/esm/content-fields/flow-country-conditional.d.ts +3 -3
  64. package/lib/esm/content-fields/flow-country-conditional.js +26 -21
  65. package/lib/esm/content-fields/flow-country-conditional.js.map +1 -1
  66. package/lib/esm/content-fields/flow-custom-conditional.d.ts +3 -3
  67. package/lib/esm/content-fields/flow-custom-conditional.js +31 -33
  68. package/lib/esm/content-fields/flow-custom-conditional.js.map +1 -1
  69. package/lib/esm/content-fields/flow-element.d.ts +4 -4
  70. package/lib/esm/content-fields/flow-element.js +37 -20
  71. package/lib/esm/content-fields/flow-element.js.map +1 -1
  72. package/lib/esm/content-fields/flow-go-to-flow.d.ts +3 -3
  73. package/lib/esm/content-fields/flow-go-to-flow.js +25 -20
  74. package/lib/esm/content-fields/flow-go-to-flow.js.map +1 -1
  75. package/lib/esm/content-fields/flow-handoff.d.ts +3 -3
  76. package/lib/esm/content-fields/flow-handoff.js +30 -19
  77. package/lib/esm/content-fields/flow-handoff.js.map +1 -1
  78. package/lib/esm/content-fields/flow-image.d.ts +2 -2
  79. package/lib/esm/content-fields/flow-image.js +24 -15
  80. package/lib/esm/content-fields/flow-image.js.map +1 -1
  81. package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +3 -3
  82. package/lib/esm/content-fields/flow-queue-status-conditional.js +45 -40
  83. package/lib/esm/content-fields/flow-queue-status-conditional.js.map +1 -1
  84. package/lib/esm/content-fields/flow-rating.d.ts +3 -3
  85. package/lib/esm/content-fields/flow-rating.js +62 -40
  86. package/lib/esm/content-fields/flow-rating.js.map +1 -1
  87. package/lib/esm/content-fields/flow-text.d.ts +4 -4
  88. package/lib/esm/content-fields/flow-text.js +51 -29
  89. package/lib/esm/content-fields/flow-text.js.map +1 -1
  90. package/lib/esm/content-fields/flow-video.d.ts +2 -2
  91. package/lib/esm/content-fields/flow-video.js +24 -15
  92. package/lib/esm/content-fields/flow-video.js.map +1 -1
  93. package/lib/esm/content-fields/flow-webview.d.ts +2 -2
  94. package/lib/esm/content-fields/flow-webview.js +31 -28
  95. package/lib/esm/content-fields/flow-webview.js.map +1 -1
  96. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.d.ts +3 -3
  97. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +91 -52
  98. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +1 -1
  99. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.d.ts +10 -0
  100. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +51 -0
  101. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
  102. package/lib/esm/content-fields/flow-whatsapp-template.d.ts +3 -2
  103. package/lib/esm/content-fields/flow-whatsapp-template.js +126 -98
  104. package/lib/esm/content-fields/flow-whatsapp-template.js.map +1 -1
  105. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.d.ts +3 -3
  106. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js +3 -2
  107. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +1 -1
  108. package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +2 -2
  109. package/lib/esm/content-fields/hubtype-fields/ai-agent.js +3 -2
  110. package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +1 -1
  111. package/lib/esm/content-fields/hubtype-fields/bot-action.d.ts +2 -2
  112. package/lib/esm/content-fields/hubtype-fields/bot-action.js +3 -2
  113. package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +1 -1
  114. package/lib/esm/content-fields/hubtype-fields/button.d.ts +1 -1
  115. package/lib/esm/content-fields/hubtype-fields/button.js +3 -2
  116. package/lib/esm/content-fields/hubtype-fields/button.js.map +1 -1
  117. package/lib/esm/content-fields/hubtype-fields/capture-user-input.d.ts +2 -2
  118. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js +6 -6
  119. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +1 -1
  120. package/lib/esm/content-fields/hubtype-fields/carousel.d.ts +3 -3
  121. package/lib/esm/content-fields/hubtype-fields/carousel.js +3 -2
  122. package/lib/esm/content-fields/hubtype-fields/carousel.js.map +1 -1
  123. package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +3 -3
  124. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +3 -2
  125. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +1 -1
  126. package/lib/esm/content-fields/hubtype-fields/common.d.ts +2 -2
  127. package/lib/esm/content-fields/hubtype-fields/common.js +3 -2
  128. package/lib/esm/content-fields/hubtype-fields/common.js.map +1 -1
  129. package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +3 -3
  130. package/lib/esm/content-fields/hubtype-fields/country-conditional.js +3 -2
  131. package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +1 -1
  132. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.d.ts +2 -2
  133. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js +15 -15
  134. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -1
  135. package/lib/esm/content-fields/hubtype-fields/custom-conditional.d.ts +3 -3
  136. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +3 -2
  137. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +1 -1
  138. package/lib/esm/content-fields/hubtype-fields/fallback.d.ts +2 -2
  139. package/lib/esm/content-fields/hubtype-fields/fallback.js +3 -2
  140. package/lib/esm/content-fields/hubtype-fields/fallback.js.map +1 -1
  141. package/lib/esm/content-fields/hubtype-fields/function.d.ts +2 -2
  142. package/lib/esm/content-fields/hubtype-fields/function.js +6 -6
  143. package/lib/esm/content-fields/hubtype-fields/function.js.map +1 -1
  144. package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +2 -2
  145. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +3 -2
  146. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +1 -1
  147. package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +2 -2
  148. package/lib/esm/content-fields/hubtype-fields/handoff.js +3 -2
  149. package/lib/esm/content-fields/hubtype-fields/handoff.js.map +1 -1
  150. package/lib/esm/content-fields/hubtype-fields/image.d.ts +2 -2
  151. package/lib/esm/content-fields/hubtype-fields/image.js +3 -2
  152. package/lib/esm/content-fields/hubtype-fields/image.js.map +1 -1
  153. package/lib/esm/content-fields/hubtype-fields/index.d.ts +27 -26
  154. package/lib/esm/content-fields/hubtype-fields/index.js +56 -29
  155. package/lib/esm/content-fields/hubtype-fields/index.js.map +1 -1
  156. package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +2 -2
  157. package/lib/esm/content-fields/hubtype-fields/keyword.js +3 -2
  158. package/lib/esm/content-fields/hubtype-fields/keyword.js.map +1 -1
  159. package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +1 -0
  160. package/lib/esm/content-fields/hubtype-fields/node-types.js +13 -12
  161. package/lib/esm/content-fields/hubtype-fields/node-types.js.map +1 -1
  162. package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +24 -23
  163. package/lib/esm/content-fields/hubtype-fields/nodes.js +3 -2
  164. package/lib/esm/content-fields/hubtype-fields/nodes.js.map +1 -1
  165. package/lib/esm/content-fields/hubtype-fields/payload.d.ts +1 -1
  166. package/lib/esm/content-fields/hubtype-fields/payload.js +3 -2
  167. package/lib/esm/content-fields/hubtype-fields/payload.js.map +1 -1
  168. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.d.ts +3 -3
  169. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +3 -2
  170. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -1
  171. package/lib/esm/content-fields/hubtype-fields/rating.d.ts +2 -2
  172. package/lib/esm/content-fields/hubtype-fields/rating.js +6 -6
  173. package/lib/esm/content-fields/hubtype-fields/rating.js.map +1 -1
  174. package/lib/esm/content-fields/hubtype-fields/smart-intent.d.ts +2 -2
  175. package/lib/esm/content-fields/hubtype-fields/smart-intent.js +3 -2
  176. package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +1 -1
  177. package/lib/esm/content-fields/hubtype-fields/text.d.ts +3 -3
  178. package/lib/esm/content-fields/hubtype-fields/text.js +3 -2
  179. package/lib/esm/content-fields/hubtype-fields/text.js.map +1 -1
  180. package/lib/esm/content-fields/hubtype-fields/url.d.ts +1 -1
  181. package/lib/esm/content-fields/hubtype-fields/url.js +3 -2
  182. package/lib/esm/content-fields/hubtype-fields/url.js.map +1 -1
  183. package/lib/esm/content-fields/hubtype-fields/video.d.ts +2 -2
  184. package/lib/esm/content-fields/hubtype-fields/video.js +3 -2
  185. package/lib/esm/content-fields/hubtype-fields/video.js.map +1 -1
  186. package/lib/esm/content-fields/hubtype-fields/webview.d.ts +2 -2
  187. package/lib/esm/content-fields/hubtype-fields/webview.js +3 -2
  188. package/lib/esm/content-fields/hubtype-fields/webview.js.map +1 -1
  189. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.d.ts +2 -2
  190. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +3 -2
  191. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -1
  192. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +3 -3
  193. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js +3 -2
  194. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -1
  195. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +8 -0
  196. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js +4 -0
  197. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
  198. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.d.ts +7 -3
  199. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js +6 -6
  200. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +1 -1
  201. package/lib/esm/content-fields/index.d.ts +25 -24
  202. package/lib/esm/content-fields/index.js +72 -49
  203. package/lib/esm/content-fields/index.js.map +1 -1
  204. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +3 -3
  205. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +16 -14
  206. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -1
  207. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -4
  208. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +20 -15
  209. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -1
  210. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -4
  211. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +46 -26
  212. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -1
  213. package/lib/esm/content-fields/whatsapp-button-list/index.d.ts +3 -3
  214. package/lib/esm/content-fields/whatsapp-button-list/index.js +11 -9
  215. package/lib/esm/content-fields/whatsapp-button-list/index.js.map +1 -1
  216. package/lib/esm/filters/index.d.ts +2 -2
  217. package/lib/esm/filters/index.js +8 -9
  218. package/lib/esm/filters/index.js.map +1 -1
  219. package/lib/esm/flow-factory.d.ts +3 -3
  220. package/lib/esm/flow-factory.js +57 -49
  221. package/lib/esm/flow-factory.js.map +1 -1
  222. package/lib/esm/functions/index.d.ts +1 -1
  223. package/lib/esm/functions/index.js +25 -19
  224. package/lib/esm/functions/index.js.map +1 -1
  225. package/lib/esm/index.d.ts +12 -12
  226. package/lib/esm/index.js +94 -77
  227. package/lib/esm/index.js.map +1 -1
  228. package/lib/esm/package.json +3 -0
  229. package/lib/esm/services/hubtype-queues-api.js +14 -14
  230. package/lib/esm/services/hubtype-queues-api.js.map +1 -1
  231. package/lib/esm/structured-output/flow-builder-content.js +14 -13
  232. package/lib/esm/structured-output/flow-builder-content.js.map +1 -1
  233. package/lib/esm/tracking.d.ts +2 -2
  234. package/lib/esm/tracking.js +27 -21
  235. package/lib/esm/tracking.js.map +1 -1
  236. package/lib/esm/types.d.ts +5 -5
  237. package/lib/esm/types.js +9 -9
  238. package/lib/esm/types.js.map +1 -1
  239. package/lib/esm/user-input/capture-user-input-api.d.ts +2 -2
  240. package/lib/esm/user-input/capture-user-input-api.js +44 -33
  241. package/lib/esm/user-input/capture-user-input-api.js.map +1 -1
  242. package/lib/esm/user-input/index.d.ts +2 -2
  243. package/lib/esm/user-input/index.js +23 -14
  244. package/lib/esm/user-input/index.js.map +1 -1
  245. package/lib/esm/user-input/keyword.d.ts +2 -2
  246. package/lib/esm/user-input/keyword.js +31 -26
  247. package/lib/esm/user-input/keyword.js.map +1 -1
  248. package/lib/esm/user-input/smart-intent.d.ts +2 -2
  249. package/lib/esm/user-input/smart-intent.js +36 -32
  250. package/lib/esm/user-input/smart-intent.js.map +1 -1
  251. package/lib/esm/utils/ai-agent.d.ts +3 -3
  252. package/lib/esm/utils/ai-agent.js +17 -12
  253. package/lib/esm/utils/ai-agent.js.map +1 -1
  254. package/lib/esm/utils/authentication.js +10 -7
  255. package/lib/esm/utils/authentication.js.map +1 -1
  256. package/lib/esm/utils/flow-locale.js +14 -18
  257. package/lib/esm/utils/flow-locale.js.map +1 -1
  258. package/lib/esm/utils/get-flow-builder-plugin.d.ts +1 -1
  259. package/lib/esm/utils/get-flow-builder-plugin.js +4 -4
  260. package/lib/esm/utils/get-flow-builder-plugin.js.map +1 -1
  261. package/lib/esm/utils/hubtype-assistant-content.d.ts +1 -1
  262. package/lib/esm/utils/hubtype-assistant-content.js +57 -43
  263. package/lib/esm/utils/hubtype-assistant-content.js.map +1 -1
  264. package/lib/esm/utils/input.js +16 -14
  265. package/lib/esm/utils/input.js.map +1 -1
  266. package/lib/esm/webview/contents-context.d.ts +1 -1
  267. package/lib/esm/webview/contents-context.js +13 -11
  268. package/lib/esm/webview/contents-context.js.map +1 -1
  269. package/lib/esm/webview/index.d.ts +3 -3
  270. package/lib/esm/webview/index.js +10 -9
  271. package/lib/esm/webview/index.js.map +1 -1
  272. package/lib/esm/webview/types.d.ts +1 -1
  273. package/lib/esm/webview/types.js +6 -6
  274. package/lib/esm/webview/types.js.map +1 -1
  275. package/lib/esm/webview/use-webview-contents.d.ts +1 -1
  276. package/lib/esm/webview/use-webview-contents.js +46 -39
  277. package/lib/esm/webview/use-webview-contents.js.map +1 -1
  278. package/package.json +8 -7
  279. package/src/content-fields/flow-whatsapp-request-contact-info.tsx +48 -0
  280. package/src/content-fields/flow-whatsapp-template.tsx +16 -0
  281. package/src/content-fields/hubtype-fields/index.ts +1 -0
  282. package/src/content-fields/hubtype-fields/node-types.ts +1 -0
  283. package/src/content-fields/hubtype-fields/nodes.ts +2 -0
  284. package/src/content-fields/hubtype-fields/whatsapp-request-contact-info.ts +9 -0
  285. package/src/content-fields/hubtype-fields/whatsapp-template.ts +5 -0
  286. package/src/content-fields/index.ts +3 -0
  287. package/src/flow-factory.ts +6 -0
  288. package/src/index.ts +5 -5
  289. package/src/types.ts +6 -6
  290. package/lib/cjs/action/ai-agent-from-user-input.d.ts +0 -3
  291. package/lib/cjs/action/ai-agent-from-user-input.js +0 -32
  292. package/lib/cjs/action/ai-agent-from-user-input.js.map +0 -1
  293. package/lib/cjs/action/context.d.ts +0 -11
  294. package/lib/cjs/action/context.js +0 -17
  295. package/lib/cjs/action/context.js.map +0 -1
  296. package/lib/cjs/action/fallback.d.ts +0 -3
  297. package/lib/cjs/action/fallback.js +0 -36
  298. package/lib/cjs/action/fallback.js.map +0 -1
  299. package/lib/cjs/action/first-interaction.d.ts +0 -3
  300. package/lib/cjs/action/first-interaction.js +0 -88
  301. package/lib/cjs/action/first-interaction.js.map +0 -1
  302. package/lib/cjs/action/get-contents.d.ts +0 -3
  303. package/lib/cjs/action/get-contents.js +0 -39
  304. package/lib/cjs/action/get-contents.js.map +0 -1
  305. package/lib/cjs/action/index.d.ts +0 -25
  306. package/lib/cjs/action/index.js +0 -90
  307. package/lib/cjs/action/index.js.map +0 -1
  308. package/lib/cjs/action/payload.d.ts +0 -3
  309. package/lib/cjs/action/payload.js +0 -74
  310. package/lib/cjs/action/payload.js.map +0 -1
  311. package/lib/cjs/api.d.ts +0 -40
  312. package/lib/cjs/api.js +0 -205
  313. package/lib/cjs/api.js.map +0 -1
  314. package/lib/cjs/constants.d.ts +0 -13
  315. package/lib/cjs/constants.js +0 -19
  316. package/lib/cjs/constants.js.map +0 -1
  317. package/lib/cjs/content-fields/content-fields-base.d.ts +0 -20
  318. package/lib/cjs/content-fields/content-fields-base.js +0 -74
  319. package/lib/cjs/content-fields/content-fields-base.js.map +0 -1
  320. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -15
  321. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
  322. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  323. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -9
  324. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js +0 -58
  325. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  326. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +0 -17
  327. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
  328. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  329. package/lib/cjs/content-fields/flow-ai-agent-base.d.ts +0 -25
  330. package/lib/cjs/content-fields/flow-ai-agent-base.js +0 -93
  331. package/lib/cjs/content-fields/flow-ai-agent-base.js.map +0 -1
  332. package/lib/cjs/content-fields/flow-ai-agent-router.d.ts +0 -21
  333. package/lib/cjs/content-fields/flow-ai-agent-router.js +0 -125
  334. package/lib/cjs/content-fields/flow-ai-agent-router.js.map +0 -1
  335. package/lib/cjs/content-fields/flow-ai-agent.d.ts +0 -17
  336. package/lib/cjs/content-fields/flow-ai-agent.js +0 -64
  337. package/lib/cjs/content-fields/flow-ai-agent.js.map +0 -1
  338. package/lib/cjs/content-fields/flow-bot-action.d.ts +0 -14
  339. package/lib/cjs/content-fields/flow-bot-action.js +0 -45
  340. package/lib/cjs/content-fields/flow-bot-action.js.map +0 -1
  341. package/lib/cjs/content-fields/flow-button.d.ts +0 -31
  342. package/lib/cjs/content-fields/flow-button.js +0 -86
  343. package/lib/cjs/content-fields/flow-button.js.map +0 -1
  344. package/lib/cjs/content-fields/flow-capture-user-input.d.ts +0 -14
  345. package/lib/cjs/content-fields/flow-capture-user-input.js +0 -45
  346. package/lib/cjs/content-fields/flow-capture-user-input.js.map +0 -1
  347. package/lib/cjs/content-fields/flow-carousel.d.ts +0 -22
  348. package/lib/cjs/content-fields/flow-carousel.js +0 -152
  349. package/lib/cjs/content-fields/flow-carousel.js.map +0 -1
  350. package/lib/cjs/content-fields/flow-channel-conditional.d.ts +0 -14
  351. package/lib/cjs/content-fields/flow-channel-conditional.js +0 -57
  352. package/lib/cjs/content-fields/flow-channel-conditional.js.map +0 -1
  353. package/lib/cjs/content-fields/flow-country-conditional.d.ts +0 -13
  354. package/lib/cjs/content-fields/flow-country-conditional.js +0 -59
  355. package/lib/cjs/content-fields/flow-country-conditional.js.map +0 -1
  356. package/lib/cjs/content-fields/flow-custom-conditional.d.ts +0 -17
  357. package/lib/cjs/content-fields/flow-custom-conditional.js +0 -89
  358. package/lib/cjs/content-fields/flow-custom-conditional.js.map +0 -1
  359. package/lib/cjs/content-fields/flow-element.d.ts +0 -22
  360. package/lib/cjs/content-fields/flow-element.js +0 -50
  361. package/lib/cjs/content-fields/flow-element.js.map +0 -1
  362. package/lib/cjs/content-fields/flow-go-to-flow.d.ts +0 -13
  363. package/lib/cjs/content-fields/flow-go-to-flow.js +0 -51
  364. package/lib/cjs/content-fields/flow-go-to-flow.js.map +0 -1
  365. package/lib/cjs/content-fields/flow-handoff.d.ts +0 -17
  366. package/lib/cjs/content-fields/flow-handoff.js +0 -68
  367. package/lib/cjs/content-fields/flow-handoff.js.map +0 -1
  368. package/lib/cjs/content-fields/flow-image.d.ts +0 -10
  369. package/lib/cjs/content-fields/flow-image.js +0 -33
  370. package/lib/cjs/content-fields/flow-image.js.map +0 -1
  371. package/lib/cjs/content-fields/flow-queue-status-conditional.d.ts +0 -30
  372. package/lib/cjs/content-fields/flow-queue-status-conditional.js +0 -95
  373. package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +0 -1
  374. package/lib/cjs/content-fields/flow-rating.d.ts +0 -15
  375. package/lib/cjs/content-fields/flow-rating.js +0 -66
  376. package/lib/cjs/content-fields/flow-rating.js.map +0 -1
  377. package/lib/cjs/content-fields/flow-text.d.ts +0 -15
  378. package/lib/cjs/content-fields/flow-text.js +0 -60
  379. package/lib/cjs/content-fields/flow-text.js.map +0 -1
  380. package/lib/cjs/content-fields/flow-video.d.ts +0 -10
  381. package/lib/cjs/content-fields/flow-video.js +0 -33
  382. package/lib/cjs/content-fields/flow-video.js.map +0 -1
  383. package/lib/cjs/content-fields/flow-webview.d.ts +0 -16
  384. package/lib/cjs/content-fields/flow-webview.js +0 -78
  385. package/lib/cjs/content-fields/flow-webview.js.map +0 -1
  386. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +0 -21
  387. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +0 -92
  388. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  389. package/lib/cjs/content-fields/flow-whatsapp-template.d.ts +0 -36
  390. package/lib/cjs/content-fields/flow-whatsapp-template.js +0 -253
  391. package/lib/cjs/content-fields/flow-whatsapp-template.js.map +0 -1
  392. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.d.ts +0 -21
  393. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js +0 -3
  394. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  395. package/lib/cjs/content-fields/hubtype-fields/ai-agent.d.ts +0 -25
  396. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +0 -3
  397. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  398. package/lib/cjs/content-fields/hubtype-fields/bot-action.d.ts +0 -10
  399. package/lib/cjs/content-fields/hubtype-fields/bot-action.js +0 -3
  400. package/lib/cjs/content-fields/hubtype-fields/bot-action.js.map +0 -1
  401. package/lib/cjs/content-fields/hubtype-fields/button.d.ts +0 -8
  402. package/lib/cjs/content-fields/hubtype-fields/button.js +0 -3
  403. package/lib/cjs/content-fields/hubtype-fields/button.js.map +0 -1
  404. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.d.ts +0 -19
  405. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js +0 -12
  406. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  407. package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +0 -17
  408. package/lib/cjs/content-fields/hubtype-fields/carousel.js +0 -3
  409. package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +0 -1
  410. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.d.ts +0 -10
  411. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +0 -3
  412. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  413. package/lib/cjs/content-fields/hubtype-fields/common.d.ts +0 -83
  414. package/lib/cjs/content-fields/hubtype-fields/common.js +0 -3
  415. package/lib/cjs/content-fields/hubtype-fields/common.js.map +0 -1
  416. package/lib/cjs/content-fields/hubtype-fields/country-conditional.d.ts +0 -10
  417. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +0 -3
  418. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  419. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.d.ts +0 -56
  420. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js +0 -36
  421. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  422. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +0 -11
  423. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +0 -3
  424. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  425. package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +0 -9
  426. package/lib/cjs/content-fields/hubtype-fields/fallback.js +0 -3
  427. package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +0 -1
  428. package/lib/cjs/content-fields/hubtype-fields/function.d.ts +0 -30
  429. package/lib/cjs/content-fields/hubtype-fields/function.js +0 -11
  430. package/lib/cjs/content-fields/hubtype-fields/function.js.map +0 -1
  431. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.d.ts +0 -9
  432. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js +0 -3
  433. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  434. package/lib/cjs/content-fields/hubtype-fields/handoff.d.ts +0 -11
  435. package/lib/cjs/content-fields/hubtype-fields/handoff.js +0 -3
  436. package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +0 -1
  437. package/lib/cjs/content-fields/hubtype-fields/image.d.ts +0 -8
  438. package/lib/cjs/content-fields/hubtype-fields/image.js +0 -3
  439. package/lib/cjs/content-fields/hubtype-fields/image.js.map +0 -1
  440. package/lib/cjs/content-fields/hubtype-fields/index.d.ts +0 -26
  441. package/lib/cjs/content-fields/hubtype-fields/index.js +0 -30
  442. package/lib/cjs/content-fields/hubtype-fields/index.js.map +0 -1
  443. package/lib/cjs/content-fields/hubtype-fields/keyword.d.ts +0 -9
  444. package/lib/cjs/content-fields/hubtype-fields/keyword.js +0 -3
  445. package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +0 -1
  446. package/lib/cjs/content-fields/hubtype-fields/node-types.d.ts +0 -30
  447. package/lib/cjs/content-fields/hubtype-fields/node-types.js +0 -37
  448. package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +0 -1
  449. package/lib/cjs/content-fields/hubtype-fields/nodes.d.ts +0 -25
  450. package/lib/cjs/content-fields/hubtype-fields/nodes.js +0 -3
  451. package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +0 -1
  452. package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +0 -8
  453. package/lib/cjs/content-fields/hubtype-fields/payload.js +0 -3
  454. package/lib/cjs/content-fields/hubtype-fields/payload.js.map +0 -1
  455. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +0 -25
  456. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
  457. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  458. package/lib/cjs/content-fields/hubtype-fields/rating.d.ts +0 -23
  459. package/lib/cjs/content-fields/hubtype-fields/rating.js +0 -9
  460. package/lib/cjs/content-fields/hubtype-fields/rating.js.map +0 -1
  461. package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +0 -12
  462. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +0 -3
  463. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  464. package/lib/cjs/content-fields/hubtype-fields/text.d.ts +0 -11
  465. package/lib/cjs/content-fields/hubtype-fields/text.js +0 -3
  466. package/lib/cjs/content-fields/hubtype-fields/text.js.map +0 -1
  467. package/lib/cjs/content-fields/hubtype-fields/url.d.ts +0 -8
  468. package/lib/cjs/content-fields/hubtype-fields/url.js +0 -3
  469. package/lib/cjs/content-fields/hubtype-fields/url.js.map +0 -1
  470. package/lib/cjs/content-fields/hubtype-fields/video.d.ts +0 -8
  471. package/lib/cjs/content-fields/hubtype-fields/video.js +0 -3
  472. package/lib/cjs/content-fields/hubtype-fields/video.js.map +0 -1
  473. package/lib/cjs/content-fields/hubtype-fields/webview.d.ts +0 -17
  474. package/lib/cjs/content-fields/hubtype-fields/webview.js +0 -3
  475. package/lib/cjs/content-fields/hubtype-fields/webview.js.map +0 -1
  476. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +0 -21
  477. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
  478. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  479. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -17
  480. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
  481. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  482. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.d.ts +0 -92
  483. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js +0 -9
  484. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  485. package/lib/cjs/content-fields/index.d.ts +0 -24
  486. package/lib/cjs/content-fields/index.js +0 -50
  487. package/lib/cjs/content-fields/index.js.map +0 -1
  488. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -14
  489. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -41
  490. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  491. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -13
  492. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
  493. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  494. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -14
  495. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
  496. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  497. package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +0 -3
  498. package/lib/cjs/content-fields/whatsapp-button-list/index.js +0 -10
  499. package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +0 -1
  500. package/lib/cjs/filters/index.d.ts +0 -12
  501. package/lib/cjs/filters/index.js +0 -17
  502. package/lib/cjs/filters/index.js.map +0 -1
  503. package/lib/cjs/flow-factory.d.ts +0 -12
  504. package/lib/cjs/flow-factory.js +0 -67
  505. package/lib/cjs/flow-factory.js.map +0 -1
  506. package/lib/cjs/functions/index.d.ts +0 -11
  507. package/lib/cjs/functions/index.js +0 -49
  508. package/lib/cjs/functions/index.js.map +0 -1
  509. package/lib/cjs/index.d.ts +0 -45
  510. package/lib/cjs/index.js +0 -178
  511. package/lib/cjs/index.js.map +0 -1
  512. package/lib/cjs/services/hubtype-queues-api.d.ts +0 -14
  513. package/lib/cjs/services/hubtype-queues-api.js +0 -26
  514. package/lib/cjs/services/hubtype-queues-api.js.map +0 -1
  515. package/lib/cjs/structured-output/flow-builder-content.d.ts +0 -13
  516. package/lib/cjs/structured-output/flow-builder-content.js +0 -15
  517. package/lib/cjs/structured-output/flow-builder-content.js.map +0 -1
  518. package/lib/cjs/tracking.d.ts +0 -16
  519. package/lib/cjs/tracking.js +0 -71
  520. package/lib/cjs/tracking.js.map +0 -1
  521. package/lib/cjs/types.d.ts +0 -62
  522. package/lib/cjs/types.js +0 -14
  523. package/lib/cjs/types.js.map +0 -1
  524. package/lib/cjs/user-input/capture-user-input-api.d.ts +0 -21
  525. package/lib/cjs/user-input/capture-user-input-api.js +0 -88
  526. package/lib/cjs/user-input/capture-user-input-api.js.map +0 -1
  527. package/lib/cjs/user-input/index.d.ts +0 -4
  528. package/lib/cjs/user-input/index.js +0 -37
  529. package/lib/cjs/user-input/index.js.map +0 -1
  530. package/lib/cjs/user-input/keyword.d.ts +0 -27
  531. package/lib/cjs/user-input/keyword.js +0 -84
  532. package/lib/cjs/user-input/keyword.js.map +0 -1
  533. package/lib/cjs/user-input/smart-intent.d.ts +0 -24
  534. package/lib/cjs/user-input/smart-intent.js +0 -89
  535. package/lib/cjs/user-input/smart-intent.js.map +0 -1
  536. package/lib/cjs/utils/ai-agent.d.ts +0 -11
  537. package/lib/cjs/utils/ai-agent.js +0 -28
  538. package/lib/cjs/utils/ai-agent.js.map +0 -1
  539. package/lib/cjs/utils/authentication.d.ts +0 -2
  540. package/lib/cjs/utils/authentication.js +0 -21
  541. package/lib/cjs/utils/authentication.js.map +0 -1
  542. package/lib/cjs/utils/flow-locale.d.ts +0 -22
  543. package/lib/cjs/utils/flow-locale.js +0 -79
  544. package/lib/cjs/utils/flow-locale.js.map +0 -1
  545. package/lib/cjs/utils/get-flow-builder-plugin.d.ts +0 -3
  546. package/lib/cjs/utils/get-flow-builder-plugin.js +0 -16
  547. package/lib/cjs/utils/get-flow-builder-plugin.js.map +0 -1
  548. package/lib/cjs/utils/hubtype-assistant-content.d.ts +0 -12
  549. package/lib/cjs/utils/hubtype-assistant-content.js +0 -173
  550. package/lib/cjs/utils/hubtype-assistant-content.js.map +0 -1
  551. package/lib/cjs/utils/input.d.ts +0 -6
  552. package/lib/cjs/utils/input.js +0 -35
  553. package/lib/cjs/utils/input.js.map +0 -1
  554. package/lib/cjs/webview/contents-context.d.ts +0 -2
  555. package/lib/cjs/webview/contents-context.js +0 -12
  556. package/lib/cjs/webview/contents-context.js.map +0 -1
  557. package/lib/cjs/webview/index.d.ts +0 -3
  558. package/lib/cjs/webview/index.js +0 -10
  559. package/lib/cjs/webview/index.js.map +0 -1
  560. package/lib/cjs/webview/types.d.ts +0 -47
  561. package/lib/cjs/webview/types.js +0 -9
  562. package/lib/cjs/webview/types.js.map +0 -1
  563. package/lib/cjs/webview/use-webview-contents.d.ts +0 -2
  564. package/lib/cjs/webview/use-webview-contents.js +0 -83
  565. package/lib/cjs/webview/use-webview-contents.js.map +0 -1
@@ -1,18 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SmartIntentsApi = void 0;
4
- const tslib_1 = require("tslib");
5
- const core_1 = require("@botonic/core");
6
- const axios_1 = tslib_1.__importDefault(require("axios"));
7
- const tracking_1 = require("../tracking");
8
- const get_flow_builder_plugin_1 = require("../utils/get-flow-builder-plugin");
1
+ import { EventAction, NluType } from "@botonic/core";
2
+ import axios from "axios";
3
+ import { getCommonFlowContentEventArgsForContentId, trackEvent } from "../tracking.js";
4
+ import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
9
14
  class SmartIntentsApi {
10
- constructor(cmsApi, currentRequest, smartIntentsConfig, userTextOrTranscript) {
11
- this.cmsApi = cmsApi;
12
- this.currentRequest = currentRequest;
13
- this.smartIntentsConfig = smartIntentsConfig;
14
- this.userTextOrTranscript = userTextOrTranscript;
15
- }
16
15
  async getNodeByInput() {
17
16
  if (!this.userTextOrTranscript) {
18
17
  return undefined;
@@ -21,29 +20,27 @@ class SmartIntentsApi {
21
20
  if (!smartIntentNodes.length) {
22
21
  return undefined;
23
22
  }
24
- const disabledSmartIntentTitles = smartIntentNodes
25
- .filter(smartIntentNode => smartIntentNode.content.is_active === false)
26
- .map(smartIntentNode => smartIntentNode.content.title);
23
+ const disabledSmartIntentTitles = smartIntentNodes.filter((smartIntentNode)=>smartIntentNode.content.is_active === false).map((smartIntentNode)=>smartIntentNode.content.title);
27
24
  const params = {
28
25
  bot_id: this.currentRequest.session.bot.id,
29
26
  text: this.userTextOrTranscript,
30
27
  num_smart_intents_to_use: this.smartIntentsConfig.numSmartIntentsToUse,
31
28
  use_latest: this.resolveUseLatest(),
32
- disabled_smart_intent_titles: disabledSmartIntentTitles,
29
+ disabled_smart_intent_titles: disabledSmartIntentTitles
33
30
  };
34
31
  try {
35
32
  const response = await this.getInference(params);
36
- const smartIntentNode = smartIntentNodes.find(smartIntentNode => smartIntentNode.content.title === response.data.smart_intent_title);
33
+ const smartIntentNode = smartIntentNodes.find((smartIntentNode)=>smartIntentNode.content.title === response.data.smart_intent_title);
37
34
  if (smartIntentNode) {
38
35
  const targetPayload = this.cmsApi.getPayload(smartIntentNode.target);
39
36
  this.currentRequest.input.nluResolution = {
40
- type: core_1.NluType.SmartIntent,
37
+ type: NluType.SmartIntent,
41
38
  matchedValue: smartIntentNode.content.title,
42
- payload: targetPayload,
39
+ payload: targetPayload
43
40
  };
44
- const { flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(this.currentRequest, smartIntentNode.id);
41
+ const { flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(this.currentRequest, smartIntentNode.id);
45
42
  const event = {
46
- action: core_1.EventAction.IntentSmart,
43
+ action: EventAction.IntentSmart,
47
44
  nluIntentSmartTitle: response.data.smart_intent_title,
48
45
  nluIntentSmartNumUsed: response.data.smart_intents_used.length,
49
46
  nluIntentSmartMessageId: this.currentRequest.input.message_id,
@@ -52,14 +49,13 @@ class SmartIntentsApi {
52
49
  flowId,
53
50
  flowName,
54
51
  flowNodeContentId,
55
- flowNodeId,
52
+ flowNodeId
56
53
  };
57
54
  const { action, ...eventArgs } = event;
58
- await (0, tracking_1.trackEvent)(this.currentRequest, action, eventArgs);
55
+ await trackEvent(this.currentRequest, action, eventArgs);
59
56
  return smartIntentNode;
60
57
  }
61
- }
62
- catch (e) {
58
+ } catch (e) {
63
59
  console.error(e);
64
60
  }
65
61
  return undefined;
@@ -71,19 +67,27 @@ class SmartIntentsApi {
71
67
  return this.smartIntentsConfig.useLatest;
72
68
  }
73
69
  async getInference(inferenceParams) {
74
- const pluginFlowBuilder = (0, get_flow_builder_plugin_1.getFlowBuilderPlugin)(this.currentRequest.plugins);
70
+ const pluginFlowBuilder = getFlowBuilderPlugin(this.currentRequest.plugins);
75
71
  const token = pluginFlowBuilder.getAccessToken(this.currentRequest.session);
76
- return await (0, axios_1.default)({
72
+ return await axios({
77
73
  method: 'POST',
78
74
  url: `${process.env.HUBTYPE_API_URL}/external/v2/ai/smart_intents/inference/`,
79
75
  headers: {
80
76
  Authorization: `Bearer ${token}`,
81
- 'Content-Type': 'application/json',
77
+ 'Content-Type': 'application/json'
82
78
  },
83
79
  data: inferenceParams,
84
- timeout: 10000,
80
+ timeout: 10000
85
81
  });
86
82
  }
83
+ constructor(cmsApi, currentRequest, smartIntentsConfig, userTextOrTranscript){
84
+ this.cmsApi = cmsApi;
85
+ this.currentRequest = currentRequest;
86
+ this.smartIntentsConfig = smartIntentsConfig;
87
+ this.userTextOrTranscript = userTextOrTranscript;
88
+ }
87
89
  }
88
- exports.SmartIntentsApi = SmartIntentsApi;
90
+
91
+ export { SmartIntentsApi };
92
+
89
93
  //# sourceMappingURL=smart-intent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"smart-intent.js","sourceRoot":"","sources":["../../../src/user-input/smart-intent.ts"],"names":[],"mappings":";;;;AAAA,wCAA2E;AAE3E,0DAAyB;AAIzB,0CAGoB;AAEpB,8EAAuE;AAevE,MAAa,eAAe;IAC1B,YACS,MAAsB,EACtB,cAA6B,EAC7B,kBAA+C,EAC/C,oBAA4B;QAH5B,WAAM,GAAN,MAAM,CAAgB;QACtB,mBAAc,GAAd,cAAc,CAAe;QAC7B,uBAAkB,GAAlB,kBAAkB,CAA6B;QAC/C,yBAAoB,GAApB,oBAAoB,CAAQ;IAClC,CAAC;IAEJ,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/B,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAA;QAC1D,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,MAAM,yBAAyB,GAAG,gBAAgB;aAC/C,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,SAAS,KAAK,KAAK,CAAC;aACtE,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC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-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;YAC9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AC,cAAc,CAAC,KAAK,CAAC,UAAU;oBAC7D,WAAW,IAAI,CAAC,oBAAoB;oBACpC,cAAc,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc;oBACxDE;oBACAC;oBACAE;oBACAD;gBACF;gBACA,MAAM,EAAEG,MAAM,EAAE,GAAGC,WAAW,GAAGF;gBAEjC,MAAMd,UAAUA,CAAC,IAAI,CAAC,cAAc,EAAEe,QAAQC;gBAE9C,OAAOV;YACT;QACF,EAAE,OAAOW,GAAG;YACVC,QAAQ,KAAK,CAACD;QAChB;QACA,OAAOd;IACT;IAEQ,mBAA4B;QAClC,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACnD,OAAO;QACT;QACA,OAAO,IAAI,CAAC,kBAAkB,CAAC,SAAS;IAC1C;IAEA,MAAc,aACZgB,eAA4C,EACd;QAC9B,MAAMC,oBAAoBnB,oBAAoBA,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO;QAC1E,MAAMoB,QAAQD,kBAAkB,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO;QAE1E,OAAO,MAAMtB,KAAKA,CAAC;YACjB,QAAQ;YACR,KAAK,GAAGwB,QAAQ,GAAG,CAAC,eAAe,CAAC,wCAAwC,CAAC;YAC7E,SAAS;gBACP,eAAe,CAAC,OAAO,EAAED,OAAO;gBAChC,gBAAgB;YAClB;YACA,MAAMF;YACN,SAAS;QACX;IACF;IAhGA,YACSI,MAAsB,EACtBC,cAA6B,EAC7BC,kBAA+C,EAC/CC,oBAA4B,CACnC;aAJOH,SAAAA;aACAC,iBAAAA;aACAC,qBAAAA;aACAC,uBAAAA;IACN;AA4FL"}
@@ -1,6 +1,6 @@
1
- import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router';
2
- import { FlowAiAgent, type FlowContent } from '../content-fields/index';
3
- export { HubtypeAssistantContent } from './hubtype-assistant-content';
1
+ import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router.js';
2
+ import { FlowAiAgent, type FlowContent } from '../content-fields/index.js';
3
+ export { HubtypeAssistantContent } from './hubtype-assistant-content.js';
4
4
  type AiAgentContentAndContentsBeforeAiAgent = {
5
5
  aiAgentWorkerContent: FlowAiAgent;
6
6
  contentsBeforeAiAgentWorker: FlowContent[];
@@ -1,20 +1,21 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubtypeAssistantContent = void 0;
4
- exports.splitAiAgentContents = splitAiAgentContents;
5
- const flow_ai_agent_router_1 = require("../content-fields/flow-ai-agent-router");
6
- const index_1 = require("../content-fields/index");
7
- var hubtype_assistant_content_1 = require("./hubtype-assistant-content");
8
- Object.defineProperty(exports, "HubtypeAssistantContent", { enumerable: true, get: function () { return hubtype_assistant_content_1.HubtypeAssistantContent; } });
1
+ import { FlowAiAgentRouter } from "../content-fields/flow-ai-agent-router.js";
2
+ import { FlowAiAgent } from "../content-fields/index.js";
3
+
4
+
5
+
6
+
7
+
8
+
9
+
9
10
  function splitAiAgentContents(contents) {
10
- const aiAgentRouterIndex = contents.findIndex(content => content instanceof flow_ai_agent_router_1.FlowAiAgentRouter);
11
+ const aiAgentRouterIndex = contents.findIndex((content)=>content instanceof FlowAiAgentRouter);
11
12
  if (aiAgentRouterIndex >= 0) {
12
13
  return {
13
14
  aiAgentRouterContent: contents[aiAgentRouterIndex],
14
- contentsBeforeAiAgentRouter: contents.slice(0, aiAgentRouterIndex),
15
+ contentsBeforeAiAgentRouter: contents.slice(0, aiAgentRouterIndex)
15
16
  };
16
17
  }
17
- const aiAgentIndex = contents.findIndex(content => content instanceof index_1.FlowAiAgent);
18
+ const aiAgentIndex = contents.findIndex((content)=>content instanceof FlowAiAgent);
18
19
  if (aiAgentIndex < 0) {
19
20
  return undefined;
20
21
  }
@@ -22,7 +23,11 @@ function splitAiAgentContents(contents) {
22
23
  const contentsBeforeAiAgentWorker = contents.slice(0, aiAgentIndex);
23
24
  return {
24
25
  aiAgentWorkerContent,
25
- contentsBeforeAiAgentWorker,
26
+ contentsBeforeAiAgentWorker
26
27
  };
27
28
  }
29
+
30
+ export { splitAiAgentContents };
31
+ export { HubtypeAssistantContent } from "./hubtype-assistant-content.js";
32
+
28
33
  //# sourceMappingURL=ai-agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-agent.js","sourceRoot":"","sources":["../../../src/utils/ai-agent.ts"],"names":[],"mappings":";;;AAeA,oDA2BC;AA1CD,iFAA0E;AAC1E,mDAAuE;AAEvE,yEAAqE;AAA5D,oIAAA,uBAAuB,OAAA;AAYhC,SAAgB,oBAAoB,CAClC,QAAuB;IAEvB,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,CAC3C,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,wCAAiB,CAChD,CAAA;IACD,IAAI,kBAAkB,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,oBAAoB,EAAE,QAAQ,CAAC,kBAAkB,CAAsB;YACvE,2BAA2B,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC;SACnE,CAAA;IACH,CAAC;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,SAAS,CACrC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,mBAAW,CAC1C,CAAA;IACD,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,oBAAoB,GAAG,QAAQ,CAAC,YAAY,CAAgB,CAAA;IAClE,MAAM,2BAA2B,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;IAEnE,OAAO;QACL,oBAAoB;QACpB,2BAA2B;KAC5B,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"utils/ai-agent.js","sources":["../../../src/utils/ai-agent.ts"],"sourcesContent":["import { FlowAiAgentRouter } from '../content-fields/flow-ai-agent-router'\nimport { FlowAiAgent, type FlowContent } from '../content-fields/index'\n\nexport { HubtypeAssistantContent } from './hubtype-assistant-content'\n\ntype AiAgentContentAndContentsBeforeAiAgent =\n | {\n aiAgentWorkerContent: FlowAiAgent\n contentsBeforeAiAgentWorker: FlowContent[]\n }\n | {\n aiAgentRouterContent: FlowAiAgentRouter\n contentsBeforeAiAgentRouter: FlowContent[]\n }\n\nexport function splitAiAgentContents(\n contents: FlowContent[]\n): AiAgentContentAndContentsBeforeAiAgent | undefined {\n const aiAgentRouterIndex = contents.findIndex(\n content => content instanceof FlowAiAgentRouter\n )\n if (aiAgentRouterIndex >= 0) {\n return {\n aiAgentRouterContent: contents[aiAgentRouterIndex] as FlowAiAgentRouter,\n contentsBeforeAiAgentRouter: contents.slice(0, aiAgentRouterIndex),\n }\n }\n\n const aiAgentIndex = contents.findIndex(\n content => content instanceof FlowAiAgent\n )\n if (aiAgentIndex < 0) {\n return undefined\n }\n\n const aiAgentWorkerContent = contents[aiAgentIndex] as FlowAiAgent\n const contentsBeforeAiAgentWorker = contents.slice(0, aiAgentIndex)\n\n return {\n aiAgentWorkerContent,\n contentsBeforeAiAgentWorker,\n }\n}\n"],"names":["FlowAiAgentRouter","FlowAiAgent","HubtypeAssistantContent","splitAiAgentContents","contents","aiAgentRouterIndex","content","aiAgentIndex","undefined","aiAgentWorkerContent","contentsBeforeAiAgentWorker"],"mappings":";;;;;;AAA0E;AACH;AAEF;AAY9D,SAASG,oBAAoBA,CAClCC,QAAuB;IAEvB,MAAMC,qBAAqBD,SAAS,SAAS,CAC3CE,CAAAA,UAAWA,mBAAmBN,iBAAiBA;IAEjD,IAAIK,sBAAsB,GAAG;QAC3B,OAAO;YACL,sBAAsBD,QAAQ,CAACC,mBAAmB;YAClD,6BAA6BD,SAAS,KAAK,CAAC,GAAGC;QACjD;IACF;IAEA,MAAME,eAAeH,SAAS,SAAS,CACrCE,CAAAA,UAAWA,mBAAmBL,WAAWA;IAE3C,IAAIM,eAAe,GAAG;QACpB,OAAOC;IACT;IAEA,MAAMC,uBAAuBL,QAAQ,CAACG,aAAa;IACnD,MAAMG,8BAA8BN,SAAS,KAAK,CAAC,GAAGG;IAEtD,OAAO;QACLE;QACAC;IACF;AACF"}
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveGetAccessToken = resolveGetAccessToken;
4
- const types_1 = require("../types");
1
+ import { ProcessEnvNodeEnvs } from "../types.js";
2
+
3
+
4
+
5
5
  function getAccessTokenFromSession(session) {
6
6
  if (!session._access_token) {
7
7
  throw new Error('No access token found in session');
@@ -9,13 +9,16 @@ function getAccessTokenFromSession(session) {
9
9
  return session._access_token;
10
10
  }
11
11
  function resolveGetAccessToken(getAccessToken) {
12
- switch (process.env.NODE_ENV) {
13
- case types_1.ProcessEnvNodeEnvs.PRODUCTION:
12
+ switch(process.env.NODE_ENV){
13
+ case ProcessEnvNodeEnvs.PRODUCTION:
14
14
  return getAccessTokenFromSession;
15
- case types_1.ProcessEnvNodeEnvs.DEVELOPMENT:
15
+ case ProcessEnvNodeEnvs.DEVELOPMENT:
16
16
  return getAccessToken;
17
17
  default:
18
18
  throw new Error('No method defined for getting access token');
19
19
  }
20
20
  }
21
+
22
+ export { resolveGetAccessToken };
23
+
21
24
  //# sourceMappingURL=authentication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../../src/utils/authentication.ts"],"names":[],"mappings":";;AAWA,sDAWC;AApBD,oCAA6C;AAE7C,SAAS,yBAAyB,CAAC,OAAgB;IACjD,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;IACrD,CAAC;IACD,OAAO,OAAO,CAAC,aAAa,CAAA;AAC9B,CAAC;AAED,SAAgB,qBAAqB,CACnC,cAA4C;IAE5C,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7B,KAAK,0BAAkB,CAAC,UAAU;YAChC,OAAO,yBAAyB,CAAA;QAClC,KAAK,0BAAkB,CAAC,WAAW;YACjC,OAAO,cAAc,CAAA;QACvB;YACE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;IACjE,CAAC;AACH,CAAC"}
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"}
@@ -1,16 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowLocale = void 0;
4
1
  class FlowLocale {
5
- constructor(botContext, flowLocales, defaultLocaleCode) {
6
- this.botContext = botContext;
7
- this.flowLocales = flowLocales;
8
- this.defaultLocaleCode = defaultLocaleCode;
9
- }
10
2
  resolve() {
11
- const priorityLocale = this.isLanguageDetectionEnabled()
12
- ? this.getPriorityLocale()
13
- : this.botContext.getSystemLocale();
3
+ const priorityLocale = this.isLanguageDetectionEnabled() ? this.getPriorityLocale() : this.botContext.getSystemLocale();
14
4
  if (priorityLocale) {
15
5
  const exactMatch = this.matchExactLocale(priorityLocale);
16
6
  if (exactMatch) {
@@ -27,12 +17,11 @@ class FlowLocale {
27
17
  return !!this.botContext.settings?.LANGUAGE_DETECTION_ENABLED;
28
18
  }
29
19
  /**
30
- * Rules:
31
- * - If user and system languages differ, user locale takes priority.
32
- * - If both share the same language, the more specific locale wins.
33
- * - If both have the same specificity, user locale wins.
34
- */
35
- getPriorityLocale() {
20
+ * Rules:
21
+ * - If user and system languages differ, user locale takes priority.
22
+ * - If both share the same language, the more specific locale wins.
23
+ * - If both have the same specificity, user locale wins.
24
+ */ getPriorityLocale() {
36
25
  const userLocale = this.botContext.getUserLocale();
37
26
  const systemLocale = this.botContext.getSystemLocale();
38
27
  if (!userLocale || !systemLocale) {
@@ -74,6 +63,13 @@ class FlowLocale {
74
63
  isSpecificLocale(locale) {
75
64
  return locale.includes('-');
76
65
  }
66
+ constructor(botContext, flowLocales, defaultLocaleCode){
67
+ this.botContext = botContext;
68
+ this.flowLocales = flowLocales;
69
+ this.defaultLocaleCode = defaultLocaleCode;
70
+ }
77
71
  }
78
- exports.FlowLocale = FlowLocale;
72
+
73
+ export { FlowLocale };
74
+
79
75
  //# sourceMappingURL=flow-locale.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flow-locale.js","sourceRoot":"","sources":["../../../src/utils/flow-locale.ts"],"names":[],"mappings":";;;AAEA,MAAa,UAAU;IACrB,YACmB,UAAsB,EACtB,WAAqB,EACrB,iBAAyB;QAFzB,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAU;QACrB,sBAAiB,GAAjB,iBAAiB,CAAQ;IACzC,CAAC;IAEJ,OAAO;QACL,MAAM,cAAc,GAAG,IAAI,CAAC,0BAA0B,EAAE;YACtD,CAAC,CAAC,IAAI,CAAC,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;QAE5D,IAAI,cAAc,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxC,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,IAAI,CAAC,cAAc,IAAI,gBAAgB,EAAE,CAAC;YACxC,OAAO,YAAY,CAAA;QACrB,CAAC;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;IAEO,gBAAgB,CAAC,MAAc;QACrC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/D,CAAC;IAEO,aAAa,CAAC,MAAc;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAA;IACnE,CAAC;IAEO,gBAAgB;QACtB,OAAO,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAA;IACvC,CAAC;IAEO,WAAW,CAAC,MAAc;QAChC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAA;QACzD,OAAO,MAAM,CAAA;IACf,CAAC;IAEO,WAAW,CAAC,MAAc;QAChC,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC;IAEO,gBAAgB,CAAC,MAAc;QACrC,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;CACF;AA1FD,gCA0FC"}
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"}
@@ -1,3 +1,3 @@
1
1
  import type { ResolvedPlugins } from '@botonic/core';
2
- import type BotonicPluginFlowBuilder from '../index';
2
+ import type BotonicPluginFlowBuilder from '../index.js';
3
3
  export declare function getFlowBuilderPlugin(plugins: ResolvedPlugins): BotonicPluginFlowBuilder;
@@ -1,16 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFlowBuilderPlugin = getFlowBuilderPlugin;
4
1
  const FLOW_BUILDER_PLUGIN_NAME = 'BotonicPluginFlowBuilder';
5
2
  function getFlowBuilderPlugin(plugins) {
6
3
  const ERROR_MESSAGE = `You must include '@botonic/plugin-flow-builder' in your plugins file.`;
7
4
  if (Object.values(plugins).length === 0) {
8
5
  throw new Error(ERROR_MESSAGE);
9
6
  }
10
- const flowBuilderPlugin = Object.values(plugins).find(plugin => plugin.constructor.name === FLOW_BUILDER_PLUGIN_NAME);
7
+ const flowBuilderPlugin = Object.values(plugins).find((plugin)=>plugin.constructor.name === FLOW_BUILDER_PLUGIN_NAME);
11
8
  if (!flowBuilderPlugin) {
12
9
  throw new Error(ERROR_MESSAGE);
13
10
  }
14
11
  return flowBuilderPlugin;
15
12
  }
13
+
14
+ export { getFlowBuilderPlugin };
15
+
16
16
  //# sourceMappingURL=get-flow-builder-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-flow-builder-plugin.js","sourceRoot":"","sources":["../../../src/utils/get-flow-builder-plugin.ts"],"names":[],"mappings":";;AAMA,oDAkBC;AApBD,MAAM,wBAAwB,GAAG,0BAA0B,CAAA;AAE3D,SAAgB,oBAAoB,CAClC,OAAwB;IAExB,MAAM,aAAa,GAAG,uEAAuE,CAAA;IAE7F,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CACnD,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,KAAK,wBAAwB,CACxB,CAAA;IAExC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
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"}
@@ -1,4 +1,4 @@
1
- import type { FlowContent } from '../content-fields';
1
+ import type { FlowContent } from '../content-fields/index.js';
2
2
  export declare class HubtypeAssistantContent {
3
3
  static adapt(content: FlowContent): string;
4
4
  private static quickReplyLabel;
@@ -1,37 +1,53 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubtypeAssistantContent = void 0;
4
- const react_1 = require("@botonic/react");
5
- const flow_carousel_1 = require("../content-fields/flow-carousel");
6
- const flow_image_1 = require("../content-fields/flow-image");
7
- const flow_text_1 = require("../content-fields/flow-text");
8
- const flow_video_1 = require("../content-fields/flow-video");
9
- const flow_whatsapp_cta_url_button_1 = require("../content-fields/flow-whatsapp-cta-url-button");
10
- const flow_whatsapp_template_1 = require("../content-fields/flow-whatsapp-template");
11
- const hubtype_fields_1 = require("../content-fields/hubtype-fields");
12
- const flow_whatsapp_button_list_1 = require("../content-fields/whatsapp-button-list/flow-whatsapp-button-list");
1
+ import { WhatsappCTAUrlHeaderType } from "@botonic/react";
2
+ import { FlowCarousel } from "../content-fields/flow-carousel.js";
3
+ import { FlowImage } from "../content-fields/flow-image.js";
4
+ import { FlowText } from "../content-fields/flow-text.js";
5
+ import { FlowVideo } from "../content-fields/flow-video.js";
6
+ import { FlowWhatsappCtaUrlButtonNode } from "../content-fields/flow-whatsapp-cta-url-button.js";
7
+ import { FlowWhatsappTemplate } from "../content-fields/flow-whatsapp-template.js";
8
+ import { HtButtonStyle } from "../content-fields/hubtype-fields/index.js";
9
+ import { FlowWhatsappButtonList } from "../content-fields/whatsapp-button-list/flow-whatsapp-button-list.js";
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
13
29
  // biome-ignore lint/complexity/noStaticOnlyClass: namespace-like adapter with private static helpers
14
30
  class HubtypeAssistantContent {
15
31
  static adapt(content) {
16
- if (content instanceof flow_text_1.FlowText) {
32
+ if (content instanceof FlowText) {
17
33
  return HubtypeAssistantContent.formatFlowTextContent(content);
18
34
  }
19
- if (content instanceof flow_carousel_1.FlowCarousel) {
35
+ if (content instanceof FlowCarousel) {
20
36
  return HubtypeAssistantContent.formatCarouselContent(content);
21
37
  }
22
- if (content instanceof flow_image_1.FlowImage) {
38
+ if (content instanceof FlowImage) {
23
39
  return content.src ? `[Image]\n${content.src}` : '[Image]';
24
40
  }
25
- if (content instanceof flow_video_1.FlowVideo) {
41
+ if (content instanceof FlowVideo) {
26
42
  return content.src ? `[Video]\n${content.src}` : '[Video]';
27
43
  }
28
- if (content instanceof flow_whatsapp_button_list_1.FlowWhatsappButtonList) {
44
+ if (content instanceof FlowWhatsappButtonList) {
29
45
  return HubtypeAssistantContent.formatWhatsappButtonListContent(content);
30
46
  }
31
- if (content instanceof flow_whatsapp_cta_url_button_1.FlowWhatsappCtaUrlButtonNode) {
47
+ if (content instanceof FlowWhatsappCtaUrlButtonNode) {
32
48
  return HubtypeAssistantContent.formatWhatsappCtaContent(content);
33
49
  }
34
- if (content instanceof flow_whatsapp_template_1.FlowWhatsappTemplate) {
50
+ if (content instanceof FlowWhatsappTemplate) {
35
51
  return HubtypeAssistantContent.formatWhatsappTemplateContent(content);
36
52
  }
37
53
  return '';
@@ -58,15 +74,16 @@ class HubtypeAssistantContent {
58
74
  if (buttons.length === 0) {
59
75
  return text.text;
60
76
  }
61
- const isQuickReply = text.buttonStyle === hubtype_fields_1.HtButtonStyle.QUICK_REPLY;
77
+ const isQuickReply = text.buttonStyle === HtButtonStyle.QUICK_REPLY;
62
78
  const blockTitle = isQuickReply ? 'Quick replies:' : 'Buttons:';
63
- const lines = buttons.map((button, i) => {
64
- const label = isQuickReply
65
- ? HubtypeAssistantContent.quickReplyLabel(button)
66
- : HubtypeAssistantContent.persistentButtonLabel(button);
79
+ const lines = buttons.map((button, i)=>{
80
+ const label = isQuickReply ? HubtypeAssistantContent.quickReplyLabel(button) : HubtypeAssistantContent.persistentButtonLabel(button);
67
81
  return ` [${i + 1}] ${label}`;
68
82
  });
69
- const block = [blockTitle, ...lines].join('\n');
83
+ const block = [
84
+ blockTitle,
85
+ ...lines
86
+ ].join('\n');
70
87
  if (!body) {
71
88
  return block;
72
89
  }
@@ -82,14 +99,12 @@ class HubtypeAssistantContent {
82
99
  let header;
83
100
  if (!mainText) {
84
101
  header = `Carousel displayed with ${n} items:`;
85
- }
86
- else if (mainText.endsWith(':')) {
102
+ } else if (mainText.endsWith(':')) {
87
103
  header = mainText;
88
- }
89
- else {
104
+ } else {
90
105
  header = `${mainText}\nCarousel with ${n} items:`;
91
106
  }
92
- const itemLines = elements.map((element, index) => {
107
+ const itemLines = elements.map((element, index)=>{
93
108
  const title = element.title?.trim() || 'Item';
94
109
  const subtitle = element.subtitle?.trim();
95
110
  const subtitlePart = subtitle ? ` - ${subtitle}` : '';
@@ -100,11 +115,14 @@ class HubtypeAssistantContent {
100
115
  const btnPart = btnLabels.length > 0 ? ` [${btnLabels.join(', ')}]` : '';
101
116
  return ` ${index + 1}. "${title}"${subtitlePart}${btnPart}`;
102
117
  });
103
- return [header, ...itemLines].join('\n');
118
+ return [
119
+ header,
120
+ ...itemLines
121
+ ].join('\n');
104
122
  }
105
123
  static formatWhatsappButtonListContent(list) {
106
124
  const body = list.text?.trim() ?? '';
107
- const hasSections = list.sections.some(s => s.rows.length > 0);
125
+ const hasSections = list.sections.some((s)=>s.rows.length > 0);
108
126
  if (!body && !hasSections) {
109
127
  return '[WhatsApp Button List]';
110
128
  }
@@ -113,8 +131,8 @@ class HubtypeAssistantContent {
113
131
  parts.push(body);
114
132
  }
115
133
  if (hasSections) {
116
- const sectionBlocks = list.sections.map(section => {
117
- const rowLines = section.rows.map(row => {
134
+ const sectionBlocks = list.sections.map((section)=>{
135
+ const rowLines = section.rows.map((row)=>{
118
136
  const rowTitle = row.title?.trim() ?? '';
119
137
  const rowDescription = row.description?.trim() ?? '';
120
138
  if (!rowTitle && !rowDescription) {
@@ -140,18 +158,12 @@ class HubtypeAssistantContent {
140
158
  return parts.join('\n\n');
141
159
  }
142
160
  static formatWhatsappCtaContent(cta) {
143
- const hasStructuredData = (cta.headerType === react_1.WhatsappCTAUrlHeaderType.Text &&
144
- !!cta.header?.trim()) ||
145
- cta.text?.trim() ||
146
- cta.footer?.trim() ||
147
- cta.displayText?.trim() ||
148
- cta.url;
161
+ const hasStructuredData = cta.headerType === WhatsappCTAUrlHeaderType.Text && !!cta.header?.trim() || cta.text?.trim() || cta.footer?.trim() || cta.displayText?.trim() || cta.url;
149
162
  if (!hasStructuredData) {
150
163
  return cta.text?.trim() || '[WhatsApp CTA Button]';
151
164
  }
152
165
  const lines = [];
153
- if (cta.headerType === react_1.WhatsappCTAUrlHeaderType.Text &&
154
- cta.header?.trim()) {
166
+ if (cta.headerType === WhatsappCTAUrlHeaderType.Text && cta.header?.trim()) {
155
167
  lines.push(cta.header.trim());
156
168
  }
157
169
  if (cta.text?.trim()) {
@@ -169,5 +181,7 @@ class HubtypeAssistantContent {
169
181
  return `WhatsApp Template: ${name} (${language})`;
170
182
  }
171
183
  }
172
- exports.HubtypeAssistantContent = HubtypeAssistantContent;
184
+
185
+ export { HubtypeAssistantContent };
186
+
173
187
  //# sourceMappingURL=hubtype-assistant-content.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hubtype-assistant-content.js","sourceRoot":"","sources":["../../../src/utils/hubtype-assistant-content.ts"],"names":[],"mappings":";;;AAAA,0CAAyD;AAGzD,mEAA8D;AAC9D,6DAAwD;AACxD,2DAAsD;AACtD,6DAAwD;AACxD,iGAA6F;AAC7F,qFAA+E;AAC/E,qEAAgE;AAChE,gHAAyG;AAEzG,qGAAqG;AACrG,MAAa,uBAAuB;IAClC,MAAM,CAAC,KAAK,CAAC,OAAoB;QAC/B,IAAI,OAAO,YAAY,oBAAQ,EAAE,CAAC;YAChC,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAA;QAC/D,CAAC;QACD,IAAI,OAAO,YAAY,4BAAY,EAAE,CAAC;YACpC,OAAO,uBAAuB,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAA;QAC/D,CAAC;QACD,IAAI,OAAO,YAAY,sBAAS,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC5D,CAAC;QACD,IAAI,OAAO,YAAY,sBAAS,EAAE,CAAC;YACjC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC5D,CAAC;QACD,IAAI,OAAO,YAAY,kDAAsB,EAAE,CAAC;YAC9C,OAAO,uBAAuB,CAAC,+BAA+B,CAAC,OAAO,C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KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAEO,MAAM,CAAC,6BAA6B,CAC1C,QAA8B;QAE9B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,kBAAkB,CAAA;QACtD,OAAO,sBAAsB,IAAI,KAAK,QAAQ,GAAG,CAAA;IACnD,CAAC;CACF;AAlMD,0DAkMC"}
1
+ {"version":3,"file":"utils/hubtype-assistant-content.js","sources":["../../../src/utils/hubtype-assistant-content.ts"],"sourcesContent":["import { WhatsappCTAUrlHeaderType } from '@botonic/react'\nimport type { FlowContent } from '../content-fields'\nimport type { FlowButton } from '../content-fields/flow-button'\nimport { FlowCarousel } from '../content-fields/flow-carousel'\nimport { FlowImage } from '../content-fields/flow-image'\nimport { FlowText } from '../content-fields/flow-text'\nimport { FlowVideo } from '../content-fields/flow-video'\nimport { FlowWhatsappCtaUrlButtonNode } from '../content-fields/flow-whatsapp-cta-url-button'\nimport { FlowWhatsappTemplate } from '../content-fields/flow-whatsapp-template'\nimport { HtButtonStyle } from '../content-fields/hubtype-fields'\nimport { FlowWhatsappButtonList } from '../content-fields/whatsapp-button-list/flow-whatsapp-button-list'\n\n// biome-ignore lint/complexity/noStaticOnlyClass: namespace-like adapter with private static helpers\nexport class HubtypeAssistantContent {\n static adapt(content: FlowContent): string {\n if (content instanceof FlowText) {\n return HubtypeAssistantContent.formatFlowTextContent(content)\n }\n if (content instanceof FlowCarousel) {\n return HubtypeAssistantContent.formatCarouselContent(content)\n }\n if (content instanceof FlowImage) {\n return content.src ? `[Image]\\n${content.src}` : '[Image]'\n }\n if (content instanceof FlowVideo) {\n return content.src ? `[Video]\\n${content.src}` : '[Video]'\n }\n if (content instanceof FlowWhatsappButtonList) {\n return HubtypeAssistantContent.formatWhatsappButtonListContent(content)\n }\n if (content instanceof FlowWhatsappCtaUrlButtonNode) {\n return HubtypeAssistantContent.formatWhatsappCtaContent(content)\n }\n if (content instanceof FlowWhatsappTemplate) {\n return HubtypeAssistantContent.formatWhatsappTemplateContent(content)\n }\n return ''\n }\n\n private static quickReplyLabel(button: FlowButton): string {\n const buttonText = button.text?.trim()\n if (buttonText) {\n return buttonText\n }\n\n return button.payload || 'Option'\n }\n\n private static persistentButtonLabel(button: FlowButton): string {\n return button.text?.trim() || 'Button'\n }\n\n private static carouselButtonLabel(button: FlowButton): string {\n return button.text?.trim() || 'Action'\n }\n\n private static formatFlowTextContent(text: FlowText): string {\n const body = text.text?.trim() ?? ''\n const buttons = text.buttons\n\n if (!body && buttons.length === 0) {\n return ''\n }\n\n if (buttons.length === 0) {\n return text.text\n }\n\n const isQuickReply = text.buttonStyle === HtButtonStyle.QUICK_REPLY\n const blockTitle = isQuickReply ? 'Quick replies:' : 'Buttons:'\n const lines = buttons.map((button, i) => {\n const label = isQuickReply\n ? HubtypeAssistantContent.quickReplyLabel(button)\n : HubtypeAssistantContent.persistentButtonLabel(button)\n return ` [${i + 1}] ${label}`\n })\n\n const block = [blockTitle, ...lines].join('\\n')\n if (!body) {\n return block\n }\n\n return `${body}\\n\\n${block}`\n }\n\n private static formatCarouselContent(carousel: FlowCarousel): string {\n const elements = carousel.elements\n const n = elements.length\n const mainText = (carousel.whatsappText ?? '').trim()\n\n if (n === 0) {\n return mainText\n }\n\n let header: string\n if (!mainText) {\n header = `Carousel displayed with ${n} items:`\n } else if (mainText.endsWith(':')) {\n header = mainText\n } else {\n header = `${mainText}\\nCarousel with ${n} items:`\n }\n\n const itemLines = elements.map((element, index) => {\n const title = element.title?.trim() || 'Item'\n const subtitle = element.subtitle?.trim()\n const subtitlePart = subtitle ? ` - ${subtitle}` : ''\n const btnLabels: string[] = []\n if (element.button) {\n btnLabels.push(\n HubtypeAssistantContent.carouselButtonLabel(element.button)\n )\n }\n const btnPart = btnLabels.length > 0 ? ` [${btnLabels.join(', ')}]` : ''\n\n return ` ${index + 1}. \"${title}\"${subtitlePart}${btnPart}`\n })\n\n return [header, ...itemLines].join('\\n')\n }\n\n private static formatWhatsappButtonListContent(\n list: FlowWhatsappButtonList\n ): string {\n const body = list.text?.trim() ?? ''\n const hasSections = list.sections.some(s => s.rows.length > 0)\n\n if (!body && !hasSections) {\n return '[WhatsApp Button List]'\n }\n\n const parts: string[] = []\n if (body) {\n parts.push(body)\n }\n\n if (hasSections) {\n const sectionBlocks = list.sections.map(section => {\n const rowLines = section.rows.map(row => {\n const rowTitle = row.title?.trim() ?? ''\n const rowDescription = row.description?.trim() ?? ''\n if (!rowTitle && !rowDescription) {\n return ' - '\n }\n if (!rowTitle) {\n return ` - ${rowDescription}`\n }\n if (!rowDescription) {\n return ` - ${rowTitle}`\n }\n return ` - ${rowTitle}: ${rowDescription}`\n })\n const rowsText = rowLines.join('\\n')\n\n const sectionTitle = section.title?.trim()\n if (sectionTitle) {\n return `${sectionTitle}:\\n${rowsText}`\n }\n\n return rowsText\n })\n parts.push(sectionBlocks.join('\\n'))\n }\n\n return parts.join('\\n\\n')\n }\n\n private static formatWhatsappCtaContent(\n cta: FlowWhatsappCtaUrlButtonNode\n ): string {\n const hasStructuredData =\n (cta.headerType === WhatsappCTAUrlHeaderType.Text &&\n !!cta.header?.trim()) ||\n cta.text?.trim() ||\n cta.footer?.trim() ||\n cta.displayText?.trim() ||\n cta.url\n\n if (!hasStructuredData) {\n return cta.text?.trim() || '[WhatsApp CTA Button]'\n }\n\n const lines: string[] = []\n if (\n cta.headerType === WhatsappCTAUrlHeaderType.Text &&\n cta.header?.trim()\n ) {\n lines.push(cta.header.trim())\n }\n if (cta.text?.trim()) {\n lines.push(cta.text.trim())\n }\n if (cta.footer?.trim()) {\n lines.push(cta.footer.trim())\n }\n const ctaLine = `[${cta.displayText || ''}]${cta.url ? ` (${cta.url})` : ''}`\n lines.push(ctaLine)\n\n return lines.join('\\n')\n }\n\n private static formatWhatsappTemplateContent(\n template: FlowWhatsappTemplate\n ): string {\n const { name, language } = template.htWhatsappTemplate\n return `WhatsApp Template: ${name} (${language})`\n }\n}\n"],"names":["WhatsappCTAUrlHeaderType","FlowCarousel","FlowImage","FlowText","FlowVideo","FlowWhatsappCtaUrlButtonNode","FlowWhatsappTemplate","HtButtonStyle","FlowWhatsappButtonList","HubtypeAssistantContent","content","button","buttonText","text","body","buttons","isQuickReply","blockTitle","lines","i","label","block","carousel","elements","n","mainText","header","itemLines","element","index","title","subtitle","subtitlePart","btnLabels","btnPart","list","hasSections","s","parts","sectionBlocks","section","rowLines","row","rowTitle","rowDescription","rowsText","sectionTitle","cta","hasStructuredData","ctaLine","template","name","language"],"mappings":";;;;;;;;;;;;;;;;;;;AAAyD;AAGK;AACN;AACF;AACE;AACqC;AACd;AACf;AACyC;AAEzG,qGAAqG;AAC9F,MAAMS,uBAAuBA;IAClC,OAAO,MAAMC,OAAoB,EAAU;QACzC,IAAIA,mBAAmBP,QAAQA,EAAE;YAC/B,OAAOM,uBAAuBA,CAAC,qBAAqB,CAACC;QACvD;QACA,IAAIA,mBAAmBT,YAAYA,EAAE;YACnC,OAAOQ,uBAAuBA,CAAC,qBAAqB,CAACC;QACvD;QACA,IAAIA,mBAAmBR,SAASA,EAAE;YAChC,OAAOQ,QAAQ,GAAG,GAAG,CAAC,SAAS,EAAEA,QAAQ,GAAG,EAAE,GAAG;QACnD;QACA,IAAIA,mBAAmBN,SAASA,EAAE;YAChC,OAAOM,QAAQ,GAAG,GAAG,CAAC,SAAS,EAAEA,QAAQ,GAAG,EAAE,GAAG;QACnD;QACA,IAAIA,mBAAmBF,sBAAsBA,EAAE;YAC7C,OAAOC,uBAAuBA,CAAC,+BAA+B,CAACC;QACjE;QACA,IAAIA,mBAAmBL,4BAA4BA,EAAE;YACnD,OAAOI,uBAAuBA,CAAC,wBAAwB,CAACC;QAC1D;QACA,IAAIA,mBAAmBJ,oBAAoBA,EAAE;YAC3C,OAAOG,uBAAuBA,CAAC,6BAA6B,CAACC;QAC/D;QACA,OAAO;IACT;IAEA,OAAe,gBAAgBC,MAAkB,EAAU;QACzD,MAAMC,aAAaD,OAAO,IAAI,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