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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (733) hide show
  1. package/README.md +1 -1
  2. package/lib/{cjs/action → action}/ai-agent-from-user-input.d.ts +2 -2
  3. package/lib/{cjs/action → action}/ai-agent-from-user-input.js +9 -6
  4. package/lib/action/ai-agent-from-user-input.js.map +1 -0
  5. package/lib/{esm/action → action}/context.d.ts +2 -2
  6. package/lib/action/context.js +20 -0
  7. package/lib/action/context.js.map +1 -0
  8. package/lib/{cjs/action → action}/fallback.d.ts +2 -2
  9. package/lib/{cjs/action → action}/fallback.js +16 -11
  10. package/lib/action/fallback.js.map +1 -0
  11. package/lib/action/first-interaction.d.ts +3 -0
  12. package/lib/{cjs/action → action}/first-interaction.js +39 -27
  13. package/lib/action/first-interaction.js.map +1 -0
  14. package/lib/{cjs/action → action}/get-contents.d.ts +1 -1
  15. package/lib/action/get-contents.js +56 -0
  16. package/lib/action/get-contents.js.map +1 -0
  17. package/lib/{esm/action → action}/index.d.ts +1 -1
  18. package/lib/{esm/action → action}/index.js +68 -32
  19. package/lib/action/index.js.map +1 -0
  20. package/lib/action/payload.d.ts +3 -0
  21. package/lib/{cjs/action → action}/payload.js +27 -23
  22. package/lib/action/payload.js.map +1 -0
  23. package/lib/{cjs/api.d.ts → api.d.ts} +2 -2
  24. package/lib/{esm/api.js → api.js} +55 -44
  25. package/lib/api.js.map +1 -0
  26. package/lib/constants.js +17 -0
  27. package/lib/constants.js.map +1 -0
  28. package/lib/{esm/content-fields → content-fields}/content-fields-base.d.ts +2 -2
  29. package/lib/content-fields/content-fields-base.js +78 -0
  30. package/lib/content-fields/content-fields-base.js.map +1 -0
  31. package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-evaluators.d.ts +1 -1
  32. package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +73 -0
  33. package/lib/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +1 -0
  34. package/lib/{esm/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.d.ts +1 -1
  35. package/lib/{cjs/content-fields → content-fields}/custom-conditional/custom-conditional-v2-resolver.js +15 -15
  36. package/lib/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +1 -0
  37. package/lib/{cjs/content-fields → content-fields}/custom-conditional/flow-custom-condition-v2.d.ts +3 -3
  38. package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js +94 -0
  39. package/lib/content-fields/custom-conditional/flow-custom-condition-v2.js.map +1 -0
  40. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-base.d.ts +4 -4
  41. package/lib/content-fields/flow-ai-agent-base.js +100 -0
  42. package/lib/content-fields/flow-ai-agent-base.js.map +1 -0
  43. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.d.ts +5 -5
  44. package/lib/{esm/content-fields → content-fields}/flow-ai-agent-router.js +57 -46
  45. package/lib/content-fields/flow-ai-agent-router.js.map +1 -0
  46. package/lib/{cjs/content-fields → content-fields}/flow-ai-agent.d.ts +4 -4
  47. package/lib/{cjs/content-fields → content-fields}/flow-ai-agent.js +33 -22
  48. package/lib/content-fields/flow-ai-agent.js.map +1 -0
  49. package/lib/{esm/content-fields → content-fields}/flow-bot-action.d.ts +3 -3
  50. package/lib/{esm/content-fields → content-fields}/flow-bot-action.js +23 -15
  51. package/lib/content-fields/flow-bot-action.js.map +1 -0
  52. package/lib/{esm/content-fields → content-fields}/flow-button.d.ts +5 -5
  53. package/lib/{esm/content-fields → content-fields}/flow-button.js +48 -29
  54. package/lib/content-fields/flow-button.js.map +1 -0
  55. package/lib/{cjs/content-fields → content-fields}/flow-capture-user-input.d.ts +2 -2
  56. package/lib/content-fields/flow-capture-user-input.js +46 -0
  57. package/lib/content-fields/flow-capture-user-input.js.map +1 -0
  58. package/lib/{esm/content-fields → content-fields}/flow-carousel.d.ts +4 -4
  59. package/lib/content-fields/flow-carousel.js +193 -0
  60. package/lib/content-fields/flow-carousel.js.map +1 -0
  61. package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.d.ts +3 -3
  62. package/lib/{esm/content-fields → content-fields}/flow-channel-conditional.js +26 -22
  63. package/lib/content-fields/flow-channel-conditional.js.map +1 -0
  64. package/lib/{cjs/content-fields → content-fields}/flow-country-conditional.d.ts +3 -3
  65. package/lib/{esm/content-fields → content-fields}/flow-country-conditional.js +26 -21
  66. package/lib/content-fields/flow-country-conditional.js.map +1 -0
  67. package/lib/{cjs/content-fields → content-fields}/flow-custom-conditional.d.ts +4 -4
  68. package/lib/{esm/content-fields → content-fields}/flow-custom-conditional.js +31 -33
  69. package/lib/content-fields/flow-custom-conditional.js.map +1 -0
  70. package/lib/{cjs/content-fields → content-fields}/flow-element.d.ts +4 -4
  71. package/lib/content-fields/flow-element.js +67 -0
  72. package/lib/content-fields/flow-element.js.map +1 -0
  73. package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.d.ts +3 -3
  74. package/lib/{esm/content-fields → content-fields}/flow-go-to-flow.js +25 -20
  75. package/lib/content-fields/flow-go-to-flow.js.map +1 -0
  76. package/lib/{cjs/content-fields → content-fields}/flow-handoff.d.ts +3 -3
  77. package/lib/{cjs/content-fields → content-fields}/flow-handoff.js +30 -19
  78. package/lib/content-fields/flow-handoff.js.map +1 -0
  79. package/lib/{cjs/content-fields → content-fields}/flow-image.d.ts +2 -2
  80. package/lib/content-fields/flow-image.js +42 -0
  81. package/lib/content-fields/flow-image.js.map +1 -0
  82. package/lib/{cjs/content-fields → content-fields}/flow-queue-status-conditional.d.ts +3 -3
  83. package/lib/{cjs/content-fields → content-fields}/flow-queue-status-conditional.js +45 -40
  84. package/lib/content-fields/flow-queue-status-conditional.js.map +1 -0
  85. package/lib/{esm/content-fields → content-fields}/flow-rating.d.ts +3 -3
  86. package/lib/content-fields/flow-rating.js +88 -0
  87. package/lib/content-fields/flow-rating.js.map +1 -0
  88. package/lib/{cjs/content-fields → content-fields}/flow-text.d.ts +4 -4
  89. package/lib/content-fields/flow-text.js +82 -0
  90. package/lib/content-fields/flow-text.js.map +1 -0
  91. package/lib/{esm/content-fields → content-fields}/flow-video.d.ts +2 -2
  92. package/lib/content-fields/flow-video.js +42 -0
  93. package/lib/content-fields/flow-video.js.map +1 -0
  94. package/lib/{esm/content-fields → content-fields}/flow-webview.d.ts +2 -2
  95. package/lib/{cjs/content-fields → content-fields}/flow-webview.js +31 -28
  96. package/lib/content-fields/flow-webview.js.map +1 -0
  97. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-cta-url-button.d.ts +3 -3
  98. package/lib/content-fields/flow-whatsapp-cta-url-button.js +131 -0
  99. package/lib/content-fields/flow-whatsapp-cta-url-button.js.map +1 -0
  100. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-request-contact-info.d.ts +3 -4
  101. package/lib/content-fields/flow-whatsapp-request-contact-info.js +51 -0
  102. package/lib/content-fields/flow-whatsapp-request-contact-info.js.map +1 -0
  103. package/lib/{cjs/content-fields → content-fields}/flow-whatsapp-template.d.ts +2 -2
  104. package/lib/{esm/content-fields → content-fields}/flow-whatsapp-template.js +119 -102
  105. package/lib/content-fields/flow-whatsapp-template.js.map +1 -0
  106. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/ai-agent-router.d.ts +3 -3
  107. package/lib/content-fields/hubtype-fields/ai-agent-router.js +4 -0
  108. package/lib/content-fields/hubtype-fields/ai-agent-router.js.map +1 -0
  109. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/ai-agent.d.ts +2 -2
  110. package/lib/content-fields/hubtype-fields/ai-agent.js +4 -0
  111. package/lib/content-fields/hubtype-fields/ai-agent.js.map +1 -0
  112. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/bot-action.d.ts +2 -2
  113. package/lib/content-fields/hubtype-fields/bot-action.js +4 -0
  114. package/lib/content-fields/hubtype-fields/bot-action.js.map +1 -0
  115. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/button.d.ts +1 -1
  116. package/lib/content-fields/hubtype-fields/button.js +4 -0
  117. package/lib/content-fields/hubtype-fields/button.js.map +1 -0
  118. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/capture-user-input.d.ts +2 -2
  119. package/lib/content-fields/hubtype-fields/capture-user-input.js +12 -0
  120. package/lib/content-fields/hubtype-fields/capture-user-input.js.map +1 -0
  121. package/lib/{esm/content-fields → content-fields}/hubtype-fields/carousel.d.ts +3 -3
  122. package/lib/content-fields/hubtype-fields/carousel.js +4 -0
  123. package/lib/content-fields/hubtype-fields/carousel.js.map +1 -0
  124. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/channel-conditional.d.ts +3 -3
  125. package/lib/content-fields/hubtype-fields/channel-conditional.js +4 -0
  126. package/lib/content-fields/hubtype-fields/channel-conditional.js.map +1 -0
  127. package/lib/{esm/content-fields → content-fields}/hubtype-fields/common.d.ts +2 -2
  128. package/lib/content-fields/hubtype-fields/common.js +4 -0
  129. package/lib/content-fields/hubtype-fields/common.js.map +1 -0
  130. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/country-conditional.d.ts +3 -3
  131. package/lib/content-fields/hubtype-fields/country-conditional.js +4 -0
  132. package/lib/content-fields/hubtype-fields/country-conditional.js.map +1 -0
  133. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.d.ts +2 -2
  134. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional-v2.js +15 -15
  135. package/lib/content-fields/hubtype-fields/custom-conditional-v2.js.map +1 -0
  136. package/lib/{esm/content-fields → content-fields}/hubtype-fields/custom-conditional.d.ts +3 -3
  137. package/lib/content-fields/hubtype-fields/custom-conditional.js +4 -0
  138. package/lib/content-fields/hubtype-fields/custom-conditional.js.map +1 -0
  139. package/lib/{esm/content-fields → content-fields}/hubtype-fields/fallback.d.ts +2 -2
  140. package/lib/content-fields/hubtype-fields/fallback.js +4 -0
  141. package/lib/content-fields/hubtype-fields/fallback.js.map +1 -0
  142. package/lib/{esm/content-fields → content-fields}/hubtype-fields/function.d.ts +2 -2
  143. package/lib/content-fields/hubtype-fields/function.js +11 -0
  144. package/lib/content-fields/hubtype-fields/function.js.map +1 -0
  145. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/go-to-flow.d.ts +2 -2
  146. package/lib/content-fields/hubtype-fields/go-to-flow.js +4 -0
  147. package/lib/content-fields/hubtype-fields/go-to-flow.js.map +1 -0
  148. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/handoff.d.ts +2 -2
  149. package/lib/content-fields/hubtype-fields/handoff.js +4 -0
  150. package/lib/content-fields/hubtype-fields/handoff.js.map +1 -0
  151. package/lib/{esm/content-fields → content-fields}/hubtype-fields/image.d.ts +2 -2
  152. package/lib/content-fields/hubtype-fields/image.js +4 -0
  153. package/lib/content-fields/hubtype-fields/image.js.map +1 -0
  154. package/lib/content-fields/hubtype-fields/index.d.ts +27 -0
  155. package/lib/content-fields/hubtype-fields/index.js +57 -0
  156. package/lib/content-fields/hubtype-fields/index.js.map +1 -0
  157. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/keyword.d.ts +2 -2
  158. package/lib/content-fields/hubtype-fields/keyword.js +4 -0
  159. package/lib/content-fields/hubtype-fields/keyword.js.map +1 -0
  160. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/node-types.js +12 -12
  161. package/lib/content-fields/hubtype-fields/node-types.js.map +1 -0
  162. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/nodes.d.ts +23 -23
  163. package/lib/content-fields/hubtype-fields/nodes.js +4 -0
  164. package/lib/content-fields/hubtype-fields/nodes.js.map +1 -0
  165. package/lib/{esm/content-fields → content-fields}/hubtype-fields/payload.d.ts +1 -1
  166. package/lib/content-fields/hubtype-fields/payload.js +4 -0
  167. package/lib/content-fields/hubtype-fields/payload.js.map +1 -0
  168. package/lib/{esm/content-fields → content-fields}/hubtype-fields/queue-status-conditional.d.ts +3 -3
  169. package/lib/content-fields/hubtype-fields/queue-status-conditional.js +4 -0
  170. package/lib/content-fields/hubtype-fields/queue-status-conditional.js.map +1 -0
  171. package/lib/{esm/content-fields → content-fields}/hubtype-fields/rating.d.ts +2 -2
  172. package/lib/content-fields/hubtype-fields/rating.js +9 -0
  173. package/lib/content-fields/hubtype-fields/rating.js.map +1 -0
  174. package/lib/{esm/content-fields → content-fields}/hubtype-fields/smart-intent.d.ts +2 -2
  175. package/lib/content-fields/hubtype-fields/smart-intent.js +4 -0
  176. package/lib/content-fields/hubtype-fields/smart-intent.js.map +1 -0
  177. package/lib/{esm/content-fields → content-fields}/hubtype-fields/text.d.ts +3 -3
  178. package/lib/content-fields/hubtype-fields/text.js +4 -0
  179. package/lib/content-fields/hubtype-fields/text.js.map +1 -0
  180. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/url.d.ts +1 -1
  181. package/lib/content-fields/hubtype-fields/url.js +4 -0
  182. package/lib/content-fields/hubtype-fields/url.js.map +1 -0
  183. package/lib/{esm/content-fields → content-fields}/hubtype-fields/video.d.ts +2 -2
  184. package/lib/content-fields/hubtype-fields/video.js +4 -0
  185. package/lib/content-fields/hubtype-fields/video.js.map +1 -0
  186. package/lib/{esm/content-fields → content-fields}/hubtype-fields/webview.d.ts +2 -2
  187. package/lib/content-fields/hubtype-fields/webview.js +4 -0
  188. package/lib/content-fields/hubtype-fields/webview.js.map +1 -0
  189. package/lib/{esm/content-fields → content-fields}/hubtype-fields/whatsapp-button-list.d.ts +2 -2
  190. package/lib/content-fields/hubtype-fields/whatsapp-button-list.js +4 -0
  191. package/lib/content-fields/hubtype-fields/whatsapp-button-list.js.map +1 -0
  192. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-cta-url-button.d.ts +3 -3
  193. package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js +4 -0
  194. package/lib/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +1 -0
  195. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-request-contact-info.d.ts +2 -2
  196. package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js +4 -0
  197. package/lib/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +1 -0
  198. package/lib/{cjs/content-fields → content-fields}/hubtype-fields/whatsapp-template.d.ts +3 -3
  199. package/lib/content-fields/hubtype-fields/whatsapp-template.js +9 -0
  200. package/lib/content-fields/hubtype-fields/whatsapp-template.js.map +1 -0
  201. package/lib/content-fields/index.d.ts +25 -0
  202. package/lib/content-fields/index.js +73 -0
  203. package/lib/content-fields/index.js.map +1 -0
  204. package/lib/{cjs/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +3 -3
  205. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-row.js +16 -14
  206. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +1 -0
  207. package/lib/{cjs/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +4 -4
  208. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +41 -0
  209. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +1 -0
  210. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/flow-whatsapp-button-list.d.ts +4 -4
  211. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +66 -0
  212. package/lib/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +1 -0
  213. package/lib/{esm/content-fields → content-fields}/whatsapp-button-list/index.d.ts +3 -3
  214. package/lib/content-fields/whatsapp-button-list/index.js +12 -0
  215. package/lib/content-fields/whatsapp-button-list/index.js.map +1 -0
  216. package/lib/{cjs/filters → filters}/index.d.ts +2 -2
  217. package/lib/filters/index.js +16 -0
  218. package/lib/filters/index.js.map +1 -0
  219. package/lib/{cjs/flow-factory.d.ts → flow-factory.d.ts} +3 -3
  220. package/lib/flow-factory.js +75 -0
  221. package/lib/flow-factory.js.map +1 -0
  222. package/lib/{esm/functions → functions}/index.d.ts +1 -1
  223. package/lib/{cjs/functions → functions}/index.js +25 -19
  224. package/lib/functions/index.js.map +1 -0
  225. package/lib/{cjs/index.d.ts → index.d.ts} +12 -12
  226. package/lib/{esm/index.js → index.js} +94 -77
  227. package/lib/index.js.map +1 -0
  228. package/lib/services/hubtype-queues-api.js +26 -0
  229. package/lib/services/hubtype-queues-api.js.map +1 -0
  230. package/lib/structured-output/flow-builder-content.js +16 -0
  231. package/lib/structured-output/flow-builder-content.js.map +1 -0
  232. package/lib/{cjs/tracking.d.ts → tracking.d.ts} +2 -2
  233. package/lib/{cjs/tracking.js → tracking.js} +27 -21
  234. package/lib/tracking.js.map +1 -0
  235. package/lib/{esm/types.d.ts → types.d.ts} +5 -5
  236. package/lib/types.js +14 -0
  237. package/lib/types.js.map +1 -0
  238. package/lib/{esm/user-input → user-input}/capture-user-input-api.d.ts +2 -2
  239. package/lib/{cjs/user-input → user-input}/capture-user-input-api.js +44 -33
  240. package/lib/user-input/capture-user-input-api.js.map +1 -0
  241. package/lib/{esm/user-input → user-input}/index.d.ts +2 -2
  242. package/lib/user-input/index.js +46 -0
  243. package/lib/user-input/index.js.map +1 -0
  244. package/lib/{esm/user-input → user-input}/keyword.d.ts +2 -2
  245. package/lib/{esm/user-input → user-input}/keyword.js +31 -26
  246. package/lib/user-input/keyword.js.map +1 -0
  247. package/lib/{cjs/user-input → user-input}/smart-intent.d.ts +2 -2
  248. package/lib/{cjs/user-input → user-input}/smart-intent.js +36 -32
  249. package/lib/user-input/smart-intent.js.map +1 -0
  250. package/lib/{cjs/utils → utils}/ai-agent.d.ts +3 -3
  251. package/lib/utils/ai-agent.js +33 -0
  252. package/lib/utils/ai-agent.js.map +1 -0
  253. package/lib/{cjs/utils → utils}/authentication.js +10 -7
  254. package/lib/utils/authentication.js.map +1 -0
  255. package/lib/{cjs/utils → utils}/flow-locale.js +14 -18
  256. package/lib/utils/flow-locale.js.map +1 -0
  257. package/lib/{cjs/utils → utils}/get-flow-builder-plugin.d.ts +1 -1
  258. package/lib/{cjs/utils → utils}/get-flow-builder-plugin.js +4 -4
  259. package/lib/utils/get-flow-builder-plugin.js.map +1 -0
  260. package/lib/{cjs/utils → utils}/hubtype-assistant-content.d.ts +1 -2
  261. package/lib/{cjs/utils → utils}/hubtype-assistant-content.js +57 -54
  262. package/lib/utils/hubtype-assistant-content.js.map +1 -0
  263. package/lib/utils/input.js +37 -0
  264. package/lib/utils/input.js.map +1 -0
  265. package/lib/{cjs/webview → webview}/contents-context.d.ts +1 -1
  266. package/lib/webview/contents-context.js +14 -0
  267. package/lib/webview/contents-context.js.map +1 -0
  268. package/lib/webview/index.d.ts +3 -0
  269. package/lib/webview/index.js +11 -0
  270. package/lib/webview/index.js.map +1 -0
  271. package/lib/{esm/webview → webview}/types.d.ts +1 -1
  272. package/lib/webview/types.js +9 -0
  273. package/lib/webview/types.js.map +1 -0
  274. package/lib/{cjs/webview → webview}/use-webview-contents.d.ts +1 -1
  275. package/lib/webview/use-webview-contents.js +90 -0
  276. package/lib/webview/use-webview-contents.js.map +1 -0
  277. package/package.json +10 -8
  278. package/src/content-fields/flow-ai-agent-base.tsx +0 -11
  279. package/src/content-fields/flow-whatsapp-request-contact-info.tsx +1 -17
  280. package/src/content-fields/index.ts +2 -2
  281. package/src/index.ts +5 -5
  282. package/src/types.ts +6 -6
  283. package/src/utils/hubtype-assistant-content.ts +0 -14
  284. package/lib/cjs/action/ai-agent-from-user-input.js.map +0 -1
  285. package/lib/cjs/action/context.d.ts +0 -11
  286. package/lib/cjs/action/context.js +0 -17
  287. package/lib/cjs/action/context.js.map +0 -1
  288. package/lib/cjs/action/fallback.js.map +0 -1
  289. package/lib/cjs/action/first-interaction.d.ts +0 -3
  290. package/lib/cjs/action/first-interaction.js.map +0 -1
  291. package/lib/cjs/action/get-contents.js +0 -39
  292. package/lib/cjs/action/get-contents.js.map +0 -1
  293. package/lib/cjs/action/index.d.ts +0 -25
  294. package/lib/cjs/action/index.js +0 -90
  295. package/lib/cjs/action/index.js.map +0 -1
  296. package/lib/cjs/action/payload.d.ts +0 -3
  297. package/lib/cjs/action/payload.js.map +0 -1
  298. package/lib/cjs/api.js +0 -205
  299. package/lib/cjs/api.js.map +0 -1
  300. package/lib/cjs/constants.js +0 -19
  301. package/lib/cjs/constants.js.map +0 -1
  302. package/lib/cjs/content-fields/content-fields-base.d.ts +0 -20
  303. package/lib/cjs/content-fields/content-fields-base.js +0 -74
  304. package/lib/cjs/content-fields/content-fields-base.js.map +0 -1
  305. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.d.ts +0 -15
  306. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
  307. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  308. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.d.ts +0 -9
  309. package/lib/cjs/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  310. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
  311. package/lib/cjs/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  312. package/lib/cjs/content-fields/flow-ai-agent-base.d.ts +0 -25
  313. package/lib/cjs/content-fields/flow-ai-agent-base.js +0 -97
  314. package/lib/cjs/content-fields/flow-ai-agent-base.js.map +0 -1
  315. package/lib/cjs/content-fields/flow-ai-agent-router.d.ts +0 -21
  316. package/lib/cjs/content-fields/flow-ai-agent-router.js +0 -125
  317. package/lib/cjs/content-fields/flow-ai-agent-router.js.map +0 -1
  318. package/lib/cjs/content-fields/flow-ai-agent.js.map +0 -1
  319. package/lib/cjs/content-fields/flow-bot-action.d.ts +0 -14
  320. package/lib/cjs/content-fields/flow-bot-action.js +0 -45
  321. package/lib/cjs/content-fields/flow-bot-action.js.map +0 -1
  322. package/lib/cjs/content-fields/flow-button.d.ts +0 -31
  323. package/lib/cjs/content-fields/flow-button.js +0 -86
  324. package/lib/cjs/content-fields/flow-button.js.map +0 -1
  325. package/lib/cjs/content-fields/flow-capture-user-input.js +0 -45
  326. package/lib/cjs/content-fields/flow-capture-user-input.js.map +0 -1
  327. package/lib/cjs/content-fields/flow-carousel.d.ts +0 -22
  328. package/lib/cjs/content-fields/flow-carousel.js +0 -152
  329. package/lib/cjs/content-fields/flow-carousel.js.map +0 -1
  330. package/lib/cjs/content-fields/flow-channel-conditional.d.ts +0 -14
  331. package/lib/cjs/content-fields/flow-channel-conditional.js +0 -57
  332. package/lib/cjs/content-fields/flow-channel-conditional.js.map +0 -1
  333. package/lib/cjs/content-fields/flow-country-conditional.js +0 -59
  334. package/lib/cjs/content-fields/flow-country-conditional.js.map +0 -1
  335. package/lib/cjs/content-fields/flow-custom-conditional.js +0 -89
  336. package/lib/cjs/content-fields/flow-custom-conditional.js.map +0 -1
  337. package/lib/cjs/content-fields/flow-element.js +0 -50
  338. package/lib/cjs/content-fields/flow-element.js.map +0 -1
  339. package/lib/cjs/content-fields/flow-go-to-flow.d.ts +0 -13
  340. package/lib/cjs/content-fields/flow-go-to-flow.js +0 -51
  341. package/lib/cjs/content-fields/flow-go-to-flow.js.map +0 -1
  342. package/lib/cjs/content-fields/flow-handoff.js.map +0 -1
  343. package/lib/cjs/content-fields/flow-image.js +0 -33
  344. package/lib/cjs/content-fields/flow-image.js.map +0 -1
  345. package/lib/cjs/content-fields/flow-queue-status-conditional.js.map +0 -1
  346. package/lib/cjs/content-fields/flow-rating.d.ts +0 -15
  347. package/lib/cjs/content-fields/flow-rating.js +0 -66
  348. package/lib/cjs/content-fields/flow-rating.js.map +0 -1
  349. package/lib/cjs/content-fields/flow-text.js +0 -60
  350. package/lib/cjs/content-fields/flow-text.js.map +0 -1
  351. package/lib/cjs/content-fields/flow-video.d.ts +0 -10
  352. package/lib/cjs/content-fields/flow-video.js +0 -33
  353. package/lib/cjs/content-fields/flow-video.js.map +0 -1
  354. package/lib/cjs/content-fields/flow-webview.d.ts +0 -16
  355. package/lib/cjs/content-fields/flow-webview.js.map +0 -1
  356. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.d.ts +0 -21
  357. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js +0 -92
  358. package/lib/cjs/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  359. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.d.ts +0 -11
  360. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js +0 -45
  361. package/lib/cjs/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
  362. package/lib/cjs/content-fields/flow-whatsapp-template.js +0 -264
  363. package/lib/cjs/content-fields/flow-whatsapp-template.js.map +0 -1
  364. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js +0 -3
  365. package/lib/cjs/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  366. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js +0 -3
  367. package/lib/cjs/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  368. package/lib/cjs/content-fields/hubtype-fields/bot-action.js +0 -3
  369. package/lib/cjs/content-fields/hubtype-fields/bot-action.js.map +0 -1
  370. package/lib/cjs/content-fields/hubtype-fields/button.js +0 -3
  371. package/lib/cjs/content-fields/hubtype-fields/button.js.map +0 -1
  372. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js +0 -12
  373. package/lib/cjs/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  374. package/lib/cjs/content-fields/hubtype-fields/carousel.d.ts +0 -17
  375. package/lib/cjs/content-fields/hubtype-fields/carousel.js +0 -3
  376. package/lib/cjs/content-fields/hubtype-fields/carousel.js.map +0 -1
  377. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js +0 -3
  378. package/lib/cjs/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  379. package/lib/cjs/content-fields/hubtype-fields/common.d.ts +0 -83
  380. package/lib/cjs/content-fields/hubtype-fields/common.js +0 -3
  381. package/lib/cjs/content-fields/hubtype-fields/common.js.map +0 -1
  382. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js +0 -3
  383. package/lib/cjs/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  384. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.d.ts +0 -56
  385. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js +0 -36
  386. package/lib/cjs/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  387. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.d.ts +0 -11
  388. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js +0 -3
  389. package/lib/cjs/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  390. package/lib/cjs/content-fields/hubtype-fields/fallback.d.ts +0 -9
  391. package/lib/cjs/content-fields/hubtype-fields/fallback.js +0 -3
  392. package/lib/cjs/content-fields/hubtype-fields/fallback.js.map +0 -1
  393. package/lib/cjs/content-fields/hubtype-fields/function.d.ts +0 -30
  394. package/lib/cjs/content-fields/hubtype-fields/function.js +0 -11
  395. package/lib/cjs/content-fields/hubtype-fields/function.js.map +0 -1
  396. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js +0 -3
  397. package/lib/cjs/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  398. package/lib/cjs/content-fields/hubtype-fields/handoff.js +0 -3
  399. package/lib/cjs/content-fields/hubtype-fields/handoff.js.map +0 -1
  400. package/lib/cjs/content-fields/hubtype-fields/image.d.ts +0 -8
  401. package/lib/cjs/content-fields/hubtype-fields/image.js +0 -3
  402. package/lib/cjs/content-fields/hubtype-fields/image.js.map +0 -1
  403. package/lib/cjs/content-fields/hubtype-fields/index.d.ts +0 -27
  404. package/lib/cjs/content-fields/hubtype-fields/index.js +0 -31
  405. package/lib/cjs/content-fields/hubtype-fields/index.js.map +0 -1
  406. package/lib/cjs/content-fields/hubtype-fields/keyword.js +0 -3
  407. package/lib/cjs/content-fields/hubtype-fields/keyword.js.map +0 -1
  408. package/lib/cjs/content-fields/hubtype-fields/node-types.js.map +0 -1
  409. package/lib/cjs/content-fields/hubtype-fields/nodes.js +0 -3
  410. package/lib/cjs/content-fields/hubtype-fields/nodes.js.map +0 -1
  411. package/lib/cjs/content-fields/hubtype-fields/payload.d.ts +0 -8
  412. package/lib/cjs/content-fields/hubtype-fields/payload.js +0 -3
  413. package/lib/cjs/content-fields/hubtype-fields/payload.js.map +0 -1
  414. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.d.ts +0 -25
  415. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
  416. package/lib/cjs/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  417. package/lib/cjs/content-fields/hubtype-fields/rating.d.ts +0 -23
  418. package/lib/cjs/content-fields/hubtype-fields/rating.js +0 -9
  419. package/lib/cjs/content-fields/hubtype-fields/rating.js.map +0 -1
  420. package/lib/cjs/content-fields/hubtype-fields/smart-intent.d.ts +0 -12
  421. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js +0 -3
  422. package/lib/cjs/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  423. package/lib/cjs/content-fields/hubtype-fields/text.d.ts +0 -11
  424. package/lib/cjs/content-fields/hubtype-fields/text.js +0 -3
  425. package/lib/cjs/content-fields/hubtype-fields/text.js.map +0 -1
  426. package/lib/cjs/content-fields/hubtype-fields/url.js +0 -3
  427. package/lib/cjs/content-fields/hubtype-fields/url.js.map +0 -1
  428. package/lib/cjs/content-fields/hubtype-fields/video.d.ts +0 -8
  429. package/lib/cjs/content-fields/hubtype-fields/video.js +0 -3
  430. package/lib/cjs/content-fields/hubtype-fields/video.js.map +0 -1
  431. package/lib/cjs/content-fields/hubtype-fields/webview.d.ts +0 -17
  432. package/lib/cjs/content-fields/hubtype-fields/webview.js +0 -3
  433. package/lib/cjs/content-fields/hubtype-fields/webview.js.map +0 -1
  434. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.d.ts +0 -21
  435. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
  436. package/lib/cjs/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  437. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
  438. package/lib/cjs/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  439. package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js +0 -3
  440. package/lib/cjs/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
  441. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js +0 -9
  442. package/lib/cjs/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  443. package/lib/cjs/content-fields/index.d.ts +0 -25
  444. package/lib/cjs/content-fields/index.js +0 -52
  445. package/lib/cjs/content-fields/index.js.map +0 -1
  446. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js +0 -41
  447. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  448. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
  449. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  450. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.d.ts +0 -14
  451. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
  452. package/lib/cjs/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  453. package/lib/cjs/content-fields/whatsapp-button-list/index.d.ts +0 -3
  454. package/lib/cjs/content-fields/whatsapp-button-list/index.js +0 -10
  455. package/lib/cjs/content-fields/whatsapp-button-list/index.js.map +0 -1
  456. package/lib/cjs/filters/index.js +0 -17
  457. package/lib/cjs/filters/index.js.map +0 -1
  458. package/lib/cjs/flow-factory.js +0 -69
  459. package/lib/cjs/flow-factory.js.map +0 -1
  460. package/lib/cjs/functions/index.d.ts +0 -11
  461. package/lib/cjs/functions/index.js.map +0 -1
  462. package/lib/cjs/index.js +0 -178
  463. package/lib/cjs/index.js.map +0 -1
  464. package/lib/cjs/services/hubtype-queues-api.js +0 -26
  465. package/lib/cjs/services/hubtype-queues-api.js.map +0 -1
  466. package/lib/cjs/structured-output/flow-builder-content.js +0 -15
  467. package/lib/cjs/structured-output/flow-builder-content.js.map +0 -1
  468. package/lib/cjs/tracking.js.map +0 -1
  469. package/lib/cjs/types.d.ts +0 -62
  470. package/lib/cjs/types.js +0 -14
  471. package/lib/cjs/types.js.map +0 -1
  472. package/lib/cjs/user-input/capture-user-input-api.d.ts +0 -21
  473. package/lib/cjs/user-input/capture-user-input-api.js.map +0 -1
  474. package/lib/cjs/user-input/index.d.ts +0 -4
  475. package/lib/cjs/user-input/index.js +0 -37
  476. package/lib/cjs/user-input/index.js.map +0 -1
  477. package/lib/cjs/user-input/keyword.d.ts +0 -27
  478. package/lib/cjs/user-input/keyword.js +0 -84
  479. package/lib/cjs/user-input/keyword.js.map +0 -1
  480. package/lib/cjs/user-input/smart-intent.js.map +0 -1
  481. package/lib/cjs/utils/ai-agent.js +0 -28
  482. package/lib/cjs/utils/ai-agent.js.map +0 -1
  483. package/lib/cjs/utils/authentication.js.map +0 -1
  484. package/lib/cjs/utils/flow-locale.js.map +0 -1
  485. package/lib/cjs/utils/get-flow-builder-plugin.js.map +0 -1
  486. package/lib/cjs/utils/hubtype-assistant-content.js.map +0 -1
  487. package/lib/cjs/utils/input.js +0 -35
  488. package/lib/cjs/utils/input.js.map +0 -1
  489. package/lib/cjs/webview/contents-context.js +0 -12
  490. package/lib/cjs/webview/contents-context.js.map +0 -1
  491. package/lib/cjs/webview/index.d.ts +0 -3
  492. package/lib/cjs/webview/index.js +0 -10
  493. package/lib/cjs/webview/index.js.map +0 -1
  494. package/lib/cjs/webview/types.d.ts +0 -47
  495. package/lib/cjs/webview/types.js +0 -9
  496. package/lib/cjs/webview/types.js.map +0 -1
  497. package/lib/cjs/webview/use-webview-contents.js +0 -83
  498. package/lib/cjs/webview/use-webview-contents.js.map +0 -1
  499. package/lib/esm/action/ai-agent-from-user-input.d.ts +0 -3
  500. package/lib/esm/action/ai-agent-from-user-input.js +0 -32
  501. package/lib/esm/action/ai-agent-from-user-input.js.map +0 -1
  502. package/lib/esm/action/context.js +0 -17
  503. package/lib/esm/action/context.js.map +0 -1
  504. package/lib/esm/action/fallback.d.ts +0 -3
  505. package/lib/esm/action/fallback.js +0 -36
  506. package/lib/esm/action/fallback.js.map +0 -1
  507. package/lib/esm/action/first-interaction.d.ts +0 -3
  508. package/lib/esm/action/first-interaction.js +0 -88
  509. package/lib/esm/action/first-interaction.js.map +0 -1
  510. package/lib/esm/action/get-contents.d.ts +0 -3
  511. package/lib/esm/action/get-contents.js +0 -39
  512. package/lib/esm/action/get-contents.js.map +0 -1
  513. package/lib/esm/action/index.js.map +0 -1
  514. package/lib/esm/action/payload.d.ts +0 -3
  515. package/lib/esm/action/payload.js +0 -74
  516. package/lib/esm/action/payload.js.map +0 -1
  517. package/lib/esm/api.d.ts +0 -40
  518. package/lib/esm/api.js.map +0 -1
  519. package/lib/esm/constants.d.ts +0 -13
  520. package/lib/esm/constants.js +0 -19
  521. package/lib/esm/constants.js.map +0 -1
  522. package/lib/esm/content-fields/content-fields-base.js +0 -74
  523. package/lib/esm/content-fields/content-fields-base.js.map +0 -1
  524. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js +0 -71
  525. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-evaluators.js.map +0 -1
  526. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js +0 -58
  527. package/lib/esm/content-fields/custom-conditional/custom-conditional-v2-resolver.js.map +0 -1
  528. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.d.ts +0 -17
  529. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js +0 -79
  530. package/lib/esm/content-fields/custom-conditional/flow-custom-condition-v2.js.map +0 -1
  531. package/lib/esm/content-fields/flow-ai-agent-base.js +0 -97
  532. package/lib/esm/content-fields/flow-ai-agent-base.js.map +0 -1
  533. package/lib/esm/content-fields/flow-ai-agent-router.js.map +0 -1
  534. package/lib/esm/content-fields/flow-ai-agent.d.ts +0 -17
  535. package/lib/esm/content-fields/flow-ai-agent.js +0 -64
  536. package/lib/esm/content-fields/flow-ai-agent.js.map +0 -1
  537. package/lib/esm/content-fields/flow-bot-action.js.map +0 -1
  538. package/lib/esm/content-fields/flow-button.js.map +0 -1
  539. package/lib/esm/content-fields/flow-capture-user-input.d.ts +0 -14
  540. package/lib/esm/content-fields/flow-capture-user-input.js +0 -45
  541. package/lib/esm/content-fields/flow-capture-user-input.js.map +0 -1
  542. package/lib/esm/content-fields/flow-carousel.js +0 -152
  543. package/lib/esm/content-fields/flow-carousel.js.map +0 -1
  544. package/lib/esm/content-fields/flow-channel-conditional.js.map +0 -1
  545. package/lib/esm/content-fields/flow-country-conditional.d.ts +0 -13
  546. package/lib/esm/content-fields/flow-country-conditional.js.map +0 -1
  547. package/lib/esm/content-fields/flow-custom-conditional.d.ts +0 -17
  548. package/lib/esm/content-fields/flow-custom-conditional.js.map +0 -1
  549. package/lib/esm/content-fields/flow-element.d.ts +0 -22
  550. package/lib/esm/content-fields/flow-element.js +0 -50
  551. package/lib/esm/content-fields/flow-element.js.map +0 -1
  552. package/lib/esm/content-fields/flow-go-to-flow.js.map +0 -1
  553. package/lib/esm/content-fields/flow-handoff.d.ts +0 -17
  554. package/lib/esm/content-fields/flow-handoff.js +0 -68
  555. package/lib/esm/content-fields/flow-handoff.js.map +0 -1
  556. package/lib/esm/content-fields/flow-image.d.ts +0 -10
  557. package/lib/esm/content-fields/flow-image.js +0 -33
  558. package/lib/esm/content-fields/flow-image.js.map +0 -1
  559. package/lib/esm/content-fields/flow-queue-status-conditional.d.ts +0 -30
  560. package/lib/esm/content-fields/flow-queue-status-conditional.js +0 -95
  561. package/lib/esm/content-fields/flow-queue-status-conditional.js.map +0 -1
  562. package/lib/esm/content-fields/flow-rating.js +0 -66
  563. package/lib/esm/content-fields/flow-rating.js.map +0 -1
  564. package/lib/esm/content-fields/flow-text.d.ts +0 -15
  565. package/lib/esm/content-fields/flow-text.js +0 -60
  566. package/lib/esm/content-fields/flow-text.js.map +0 -1
  567. package/lib/esm/content-fields/flow-video.js +0 -33
  568. package/lib/esm/content-fields/flow-video.js.map +0 -1
  569. package/lib/esm/content-fields/flow-webview.js +0 -78
  570. package/lib/esm/content-fields/flow-webview.js.map +0 -1
  571. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js +0 -92
  572. package/lib/esm/content-fields/flow-whatsapp-cta-url-button.js.map +0 -1
  573. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js +0 -45
  574. package/lib/esm/content-fields/flow-whatsapp-request-contact-info.js.map +0 -1
  575. package/lib/esm/content-fields/flow-whatsapp-template.d.ts +0 -37
  576. package/lib/esm/content-fields/flow-whatsapp-template.js.map +0 -1
  577. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.d.ts +0 -21
  578. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js +0 -3
  579. package/lib/esm/content-fields/hubtype-fields/ai-agent-router.js.map +0 -1
  580. package/lib/esm/content-fields/hubtype-fields/ai-agent.d.ts +0 -25
  581. package/lib/esm/content-fields/hubtype-fields/ai-agent.js +0 -3
  582. package/lib/esm/content-fields/hubtype-fields/ai-agent.js.map +0 -1
  583. package/lib/esm/content-fields/hubtype-fields/bot-action.d.ts +0 -10
  584. package/lib/esm/content-fields/hubtype-fields/bot-action.js +0 -3
  585. package/lib/esm/content-fields/hubtype-fields/bot-action.js.map +0 -1
  586. package/lib/esm/content-fields/hubtype-fields/button.d.ts +0 -8
  587. package/lib/esm/content-fields/hubtype-fields/button.js +0 -3
  588. package/lib/esm/content-fields/hubtype-fields/button.js.map +0 -1
  589. package/lib/esm/content-fields/hubtype-fields/capture-user-input.d.ts +0 -19
  590. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js +0 -12
  591. package/lib/esm/content-fields/hubtype-fields/capture-user-input.js.map +0 -1
  592. package/lib/esm/content-fields/hubtype-fields/carousel.js +0 -3
  593. package/lib/esm/content-fields/hubtype-fields/carousel.js.map +0 -1
  594. package/lib/esm/content-fields/hubtype-fields/channel-conditional.d.ts +0 -10
  595. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js +0 -3
  596. package/lib/esm/content-fields/hubtype-fields/channel-conditional.js.map +0 -1
  597. package/lib/esm/content-fields/hubtype-fields/common.js +0 -3
  598. package/lib/esm/content-fields/hubtype-fields/common.js.map +0 -1
  599. package/lib/esm/content-fields/hubtype-fields/country-conditional.d.ts +0 -10
  600. package/lib/esm/content-fields/hubtype-fields/country-conditional.js +0 -3
  601. package/lib/esm/content-fields/hubtype-fields/country-conditional.js.map +0 -1
  602. package/lib/esm/content-fields/hubtype-fields/custom-conditional-v2.js.map +0 -1
  603. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js +0 -3
  604. package/lib/esm/content-fields/hubtype-fields/custom-conditional.js.map +0 -1
  605. package/lib/esm/content-fields/hubtype-fields/fallback.js +0 -3
  606. package/lib/esm/content-fields/hubtype-fields/fallback.js.map +0 -1
  607. package/lib/esm/content-fields/hubtype-fields/function.js +0 -11
  608. package/lib/esm/content-fields/hubtype-fields/function.js.map +0 -1
  609. package/lib/esm/content-fields/hubtype-fields/go-to-flow.d.ts +0 -9
  610. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js +0 -3
  611. package/lib/esm/content-fields/hubtype-fields/go-to-flow.js.map +0 -1
  612. package/lib/esm/content-fields/hubtype-fields/handoff.d.ts +0 -11
  613. package/lib/esm/content-fields/hubtype-fields/handoff.js +0 -3
  614. package/lib/esm/content-fields/hubtype-fields/handoff.js.map +0 -1
  615. package/lib/esm/content-fields/hubtype-fields/image.js +0 -3
  616. package/lib/esm/content-fields/hubtype-fields/image.js.map +0 -1
  617. package/lib/esm/content-fields/hubtype-fields/index.d.ts +0 -27
  618. package/lib/esm/content-fields/hubtype-fields/index.js +0 -31
  619. package/lib/esm/content-fields/hubtype-fields/index.js.map +0 -1
  620. package/lib/esm/content-fields/hubtype-fields/keyword.d.ts +0 -9
  621. package/lib/esm/content-fields/hubtype-fields/keyword.js +0 -3
  622. package/lib/esm/content-fields/hubtype-fields/keyword.js.map +0 -1
  623. package/lib/esm/content-fields/hubtype-fields/node-types.d.ts +0 -31
  624. package/lib/esm/content-fields/hubtype-fields/node-types.js +0 -38
  625. package/lib/esm/content-fields/hubtype-fields/node-types.js.map +0 -1
  626. package/lib/esm/content-fields/hubtype-fields/nodes.d.ts +0 -26
  627. package/lib/esm/content-fields/hubtype-fields/nodes.js +0 -3
  628. package/lib/esm/content-fields/hubtype-fields/nodes.js.map +0 -1
  629. package/lib/esm/content-fields/hubtype-fields/payload.js +0 -3
  630. package/lib/esm/content-fields/hubtype-fields/payload.js.map +0 -1
  631. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js +0 -3
  632. package/lib/esm/content-fields/hubtype-fields/queue-status-conditional.js.map +0 -1
  633. package/lib/esm/content-fields/hubtype-fields/rating.js +0 -9
  634. package/lib/esm/content-fields/hubtype-fields/rating.js.map +0 -1
  635. package/lib/esm/content-fields/hubtype-fields/smart-intent.js +0 -3
  636. package/lib/esm/content-fields/hubtype-fields/smart-intent.js.map +0 -1
  637. package/lib/esm/content-fields/hubtype-fields/text.js +0 -3
  638. package/lib/esm/content-fields/hubtype-fields/text.js.map +0 -1
  639. package/lib/esm/content-fields/hubtype-fields/url.d.ts +0 -8
  640. package/lib/esm/content-fields/hubtype-fields/url.js +0 -3
  641. package/lib/esm/content-fields/hubtype-fields/url.js.map +0 -1
  642. package/lib/esm/content-fields/hubtype-fields/video.js +0 -3
  643. package/lib/esm/content-fields/hubtype-fields/video.js.map +0 -1
  644. package/lib/esm/content-fields/hubtype-fields/webview.js +0 -3
  645. package/lib/esm/content-fields/hubtype-fields/webview.js.map +0 -1
  646. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js +0 -3
  647. package/lib/esm/content-fields/hubtype-fields/whatsapp-button-list.js.map +0 -1
  648. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.d.ts +0 -17
  649. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js +0 -3
  650. package/lib/esm/content-fields/hubtype-fields/whatsapp-cta-url-button.js.map +0 -1
  651. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.d.ts +0 -8
  652. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js +0 -3
  653. package/lib/esm/content-fields/hubtype-fields/whatsapp-request-contact-info.js.map +0 -1
  654. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.d.ts +0 -96
  655. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js +0 -9
  656. package/lib/esm/content-fields/hubtype-fields/whatsapp-template.js.map +0 -1
  657. package/lib/esm/content-fields/index.d.ts +0 -25
  658. package/lib/esm/content-fields/index.js +0 -52
  659. package/lib/esm/content-fields/index.js.map +0 -1
  660. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.d.ts +0 -14
  661. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-row.js.map +0 -1
  662. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.d.ts +0 -13
  663. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js +0 -36
  664. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list-section.js.map +0 -1
  665. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js +0 -46
  666. package/lib/esm/content-fields/whatsapp-button-list/flow-whatsapp-button-list.js.map +0 -1
  667. package/lib/esm/content-fields/whatsapp-button-list/index.js +0 -10
  668. package/lib/esm/content-fields/whatsapp-button-list/index.js.map +0 -1
  669. package/lib/esm/filters/index.d.ts +0 -12
  670. package/lib/esm/filters/index.js +0 -17
  671. package/lib/esm/filters/index.js.map +0 -1
  672. package/lib/esm/flow-factory.d.ts +0 -12
  673. package/lib/esm/flow-factory.js +0 -69
  674. package/lib/esm/flow-factory.js.map +0 -1
  675. package/lib/esm/functions/index.js +0 -49
  676. package/lib/esm/functions/index.js.map +0 -1
  677. package/lib/esm/index.d.ts +0 -45
  678. package/lib/esm/index.js.map +0 -1
  679. package/lib/esm/services/hubtype-queues-api.d.ts +0 -14
  680. package/lib/esm/services/hubtype-queues-api.js +0 -26
  681. package/lib/esm/services/hubtype-queues-api.js.map +0 -1
  682. package/lib/esm/structured-output/flow-builder-content.d.ts +0 -13
  683. package/lib/esm/structured-output/flow-builder-content.js +0 -15
  684. package/lib/esm/structured-output/flow-builder-content.js.map +0 -1
  685. package/lib/esm/tracking.d.ts +0 -16
  686. package/lib/esm/tracking.js +0 -71
  687. package/lib/esm/tracking.js.map +0 -1
  688. package/lib/esm/types.js +0 -14
  689. package/lib/esm/types.js.map +0 -1
  690. package/lib/esm/user-input/capture-user-input-api.js +0 -88
  691. package/lib/esm/user-input/capture-user-input-api.js.map +0 -1
  692. package/lib/esm/user-input/index.js +0 -37
  693. package/lib/esm/user-input/index.js.map +0 -1
  694. package/lib/esm/user-input/keyword.js.map +0 -1
  695. package/lib/esm/user-input/smart-intent.d.ts +0 -24
  696. package/lib/esm/user-input/smart-intent.js +0 -89
  697. package/lib/esm/user-input/smart-intent.js.map +0 -1
  698. package/lib/esm/utils/ai-agent.d.ts +0 -11
  699. package/lib/esm/utils/ai-agent.js +0 -28
  700. package/lib/esm/utils/ai-agent.js.map +0 -1
  701. package/lib/esm/utils/authentication.d.ts +0 -2
  702. package/lib/esm/utils/authentication.js +0 -21
  703. package/lib/esm/utils/authentication.js.map +0 -1
  704. package/lib/esm/utils/flow-locale.d.ts +0 -22
  705. package/lib/esm/utils/flow-locale.js +0 -79
  706. package/lib/esm/utils/flow-locale.js.map +0 -1
  707. package/lib/esm/utils/get-flow-builder-plugin.d.ts +0 -3
  708. package/lib/esm/utils/get-flow-builder-plugin.js +0 -16
  709. package/lib/esm/utils/get-flow-builder-plugin.js.map +0 -1
  710. package/lib/esm/utils/hubtype-assistant-content.d.ts +0 -13
  711. package/lib/esm/utils/hubtype-assistant-content.js +0 -184
  712. package/lib/esm/utils/hubtype-assistant-content.js.map +0 -1
  713. package/lib/esm/utils/input.d.ts +0 -6
  714. package/lib/esm/utils/input.js +0 -35
  715. package/lib/esm/utils/input.js.map +0 -1
  716. package/lib/esm/webview/contents-context.d.ts +0 -2
  717. package/lib/esm/webview/contents-context.js +0 -12
  718. package/lib/esm/webview/contents-context.js.map +0 -1
  719. package/lib/esm/webview/index.d.ts +0 -3
  720. package/lib/esm/webview/index.js +0 -10
  721. package/lib/esm/webview/index.js.map +0 -1
  722. package/lib/esm/webview/types.js +0 -9
  723. package/lib/esm/webview/types.js.map +0 -1
  724. package/lib/esm/webview/use-webview-contents.d.ts +0 -2
  725. package/lib/esm/webview/use-webview-contents.js +0 -83
  726. package/lib/esm/webview/use-webview-contents.js.map +0 -1
  727. /package/lib/{cjs/constants.d.ts → constants.d.ts} +0 -0
  728. /package/lib/{cjs/content-fields → content-fields}/hubtype-fields/node-types.d.ts +0 -0
  729. /package/lib/{cjs/services → services}/hubtype-queues-api.d.ts +0 -0
  730. /package/lib/{cjs/structured-output → structured-output}/flow-builder-content.d.ts +0 -0
  731. /package/lib/{cjs/utils → utils}/authentication.d.ts +0 -0
  732. /package/lib/{cjs/utils → utils}/flow-locale.d.ts +0 -0
  733. /package/lib/{cjs/utils → utils}/input.d.ts +0 -0
@@ -1,21 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getContentsByPayload = getContentsByPayload;
4
- const core_1 = require("@botonic/core");
5
- const uuid_1 = require("uuid");
6
- const constants_1 = require("../constants");
7
- const tracking_1 = require("../tracking");
1
+ import { EventAction, storeCaseRating } from "@botonic/core";
2
+ import { v7 } from "uuid";
3
+ import { AGENT_RATING_PAYLOAD, PUSH_FLOW_PAYLOAD, SEPARATOR } from "../constants.js";
4
+ import { trackEvent } from "../tracking.js";
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
8
14
  async function getContentsByPayload(context) {
9
15
  const { cmsApi, flowBuilderPlugin, request, contentID } = context;
10
- if (request.input.payload?.startsWith(constants_1.AGENT_RATING_PAYLOAD)) {
16
+ if (request.input.payload?.startsWith(AGENT_RATING_PAYLOAD)) {
11
17
  return await resolveRatingPayload(context);
12
18
  }
13
- if (request.input.payload?.startsWith(constants_1.PUSH_FLOW_PAYLOAD)) {
19
+ if (request.input.payload?.startsWith(PUSH_FLOW_PAYLOAD)) {
14
20
  return await resolvePushFlowPayload(context);
15
21
  }
16
- const id = contentID
17
- ? cmsApi.getNodeByContentID(contentID)?.id
18
- : request.input.payload;
22
+ const id = contentID ? cmsApi.getNodeByContentID(contentID)?.id : request.input.payload;
19
23
  const targetNode = id ? cmsApi.getNodeById(id) : undefined;
20
24
  if (targetNode) {
21
25
  return await flowBuilderPlugin.getContentsByNode(targetNode);
@@ -30,20 +34,18 @@ async function resolveRatingPayload(context) {
30
34
  const { target, text, value, possibleOptions, possibleValues } = flowBuilderPlugin.getRatingSubmittedInfo(request.input.payload);
31
35
  if (request.session._hubtype_case_id) {
32
36
  const event = {
33
- action: core_1.EventAction.FeedbackCase,
37
+ action: EventAction.FeedbackCase,
34
38
  feedbackTargetId: request.session._hubtype_case_id,
35
- feedbackGroupId: (0, uuid_1.v7)().toString(),
39
+ feedbackGroupId: v7().toString(),
36
40
  possibleOptions,
37
41
  possibleValues,
38
42
  option: text,
39
- value,
43
+ value
40
44
  };
41
- await (0, core_1.storeCaseRating)(request.session, value);
42
- await (0, tracking_1.trackEvent)(request, core_1.EventAction.FeedbackCase, event);
45
+ await storeCaseRating(request.session, value);
46
+ await trackEvent(request, EventAction.FeedbackCase, event);
43
47
  }
44
- const targetNode = target
45
- ? cmsApi.getNodeById(target.id)
46
- : undefined;
48
+ const targetNode = target ? cmsApi.getNodeById(target.id) : undefined;
47
49
  if (targetNode) {
48
50
  return await flowBuilderPlugin.getContentsByNode(targetNode);
49
51
  }
@@ -54,7 +56,7 @@ async function resolvePushFlowPayload(context) {
54
56
  if (!request.input.payload) {
55
57
  return [];
56
58
  }
57
- const parts = request.input.payload.split(constants_1.SEPARATOR);
59
+ const parts = request.input.payload.split(SEPARATOR);
58
60
  const pushFlowId = parts.length > 1 ? parts[1] : '';
59
61
  if (!pushFlowId) {
60
62
  return [];
@@ -65,10 +67,12 @@ async function resolvePushFlowPayload(context) {
65
67
  return [];
66
68
  }
67
69
  return await flowBuilderPlugin.getContentsByNode(pushFlowNode);
68
- }
69
- catch {
70
+ } catch {
70
71
  // Campaign not found - return empty to trigger fallback
71
72
  return [];
72
73
  }
73
74
  }
75
+
76
+ export { getContentsByPayload };
77
+
74
78
  //# sourceMappingURL=payload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action/payload.js","sources":["../../src/action/payload.ts"],"sourcesContent":["import { EventAction, type EventFeedback, storeCaseRating } from '@botonic/core'\nimport { v7 as uuid } from 'uuid'\n\nimport {\n AGENT_RATING_PAYLOAD,\n PUSH_FLOW_PAYLOAD,\n SEPARATOR,\n} from '../constants'\nimport type { FlowContent } from '../content-fields'\nimport type { HtNodeWithContent } from '../content-fields/hubtype-fields'\nimport { trackEvent } from '../tracking'\nimport type { FlowBuilderContext } from './context'\n\nexport async function getContentsByPayload(\n context: FlowBuilderContext\n): Promise<FlowContent[]> {\n const { cmsApi, flowBuilderPlugin, request, contentID } = context\n if (request.input.payload?.startsWith(AGENT_RATING_PAYLOAD)) {\n return await resolveRatingPayload(context)\n }\n if (request.input.payload?.startsWith(PUSH_FLOW_PAYLOAD)) {\n return await resolvePushFlowPayload(context)\n }\n\n const id = contentID\n ? cmsApi.getNodeByContentID(contentID)?.id\n : request.input.payload\n const targetNode = id ? cmsApi.getNodeById<HtNodeWithContent>(id) : undefined\n\n if (targetNode) {\n return await flowBuilderPlugin.getContentsByNode(targetNode)\n }\n\n return []\n}\n\nasync function resolveRatingPayload(\n context: FlowBuilderContext\n): Promise<FlowContent[]> {\n const { cmsApi, flowBuilderPlugin, request } = context\n\n if (!request.input.payload) {\n return []\n }\n\n const { target, text, value, possibleOptions, possibleValues } =\n flowBuilderPlugin.getRatingSubmittedInfo(request.input.payload)\n\n if (request.session._hubtype_case_id) {\n const event: EventFeedback = {\n action: EventAction.FeedbackCase,\n feedbackTargetId: request.session._hubtype_case_id,\n feedbackGroupId: uuid().toString(),\n possibleOptions,\n possibleValues,\n option: text,\n value,\n }\n\n await storeCaseRating(request.session, value)\n await trackEvent(request, EventAction.FeedbackCase, event)\n }\n\n const targetNode = target\n ? cmsApi.getNodeById<HtNodeWithContent>(target.id)\n : undefined\n\n if (targetNode) {\n return await flowBuilderPlugin.getContentsByNode(targetNode)\n }\n\n return []\n}\n\nasync function resolvePushFlowPayload(\n context: FlowBuilderContext\n): Promise<FlowContent[]> {\n const { cmsApi, flowBuilderPlugin, request } = context\n\n if (!request.input.payload) {\n return []\n }\n\n const parts = request.input.payload.split(SEPARATOR)\n const pushFlowId = parts.length > 1 ? parts[1] : ''\n\n if (!pushFlowId) {\n return []\n }\n\n try {\n const pushFlowNode =\n cmsApi.getNodeByCampaignId<HtNodeWithContent>(pushFlowId)\n\n if (!pushFlowNode) {\n return []\n }\n\n return await flowBuilderPlugin.getContentsByNode(pushFlowNode)\n } catch {\n // Campaign not found - return empty to trigger fallback\n return []\n }\n}\n"],"names":["EventAction","storeCaseRating","v7","uuid","AGENT_RATING_PAYLOAD","PUSH_FLOW_PAYLOAD","SEPARATOR","trackEvent","getContentsByPayload","context","cmsApi","flowBuilderPlugin","request","contentID","resolveRatingPayload","resolvePushFlowPayload","id","targetNode","undefined","target","text","value","possibleOptions","possibleValues","event","parts","pushFlowId","pushFlowNode"],"mappings":";;;;;;;;;AAAgF;AAC/C;AAMZ;AAGmB;AAGjC,eAAeQ,oBAAoBA,CACxCC,OAA2B;IAE3B,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGJ;IAC1D,IAAIG,QAAQ,KA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sBA,CACnCN,OAA2B;IAE3B,MAAM,EAAEC,MAAM,EAAEC,iBAAiB,EAAEC,OAAO,EAAE,GAAGH;IAE/C,IAAI,CAACG,QAAQ,KAAK,CAAC,OAAO,EAAE;QAC1B,OAAO,EAAE;IACX;IAEA,MAAMa,QAAQb,QAAQ,KAAK,CAAC,OAAO,CAAC,KAAK,CAACN,SAASA;IACnD,MAAMoB,aAAaD,MAAM,MAAM,GAAG,IAAIA,KAAK,CAAC,EAAE,GAAG;IAEjD,IAAI,CAACC,YAAY;QACf,OAAO,EAAE;IACX;IAEA,IAAI;QACF,MAAMC,eACJjB,OAAO,mBAAmB,CAAoBgB;QAEhD,IAAI,CAACC,cAAc;YACjB,OAAO,EAAE;QACX;QAEA,OAAO,MAAMhB,kBAAkB,iBAAiB,CAACgB;IACnD,EAAE,OAAM;QACN,wDAAwD;QACxD,OAAO,EAAE;IACX;AACF"}
@@ -1,6 +1,6 @@
1
1
  import type { PluginPreRequest } from '@botonic/core';
2
- import { type HtBotActionNode, type HtCaptureUserInputNode, type HtFlowBuilderData, type HtFlowWebview, type HtKeywordNode, type HtNodeComponent, type HtNodeLink, type HtNodeWithContent, type HtRatingButton, type HtRatingNode, type HtSmartIntentNode } from './content-fields/hubtype-fields';
3
- import { type FlowBuilderApiOptions } from './types';
2
+ import { type HtBotActionNode, type HtCaptureUserInputNode, type HtFlowBuilderData, type HtFlowWebview, type HtKeywordNode, type HtNodeComponent, type HtNodeLink, type HtNodeWithContent, type HtRatingButton, type HtRatingNode, type HtSmartIntentNode } from './content-fields/hubtype-fields/index.js';
3
+ import { type FlowBuilderApiOptions } from './types.js';
4
4
  export declare class FlowBuilderApi {
5
5
  url: string;
6
6
  flowUrl: string;
@@ -1,79 +1,89 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FlowBuilderApi = void 0;
4
- const tslib_1 = require("tslib");
5
- const axios_1 = tslib_1.__importDefault(require("axios"));
6
- const constants_1 = require("./constants");
7
- const hubtype_fields_1 = require("./content-fields/hubtype-fields");
8
- const types_1 = require("./types");
9
- const flow_locale_1 = require("./utils/flow-locale");
1
+ import axios from "axios";
2
+ import { AI_AGENTS_FLOW_NAME, SEPARATOR, UUID_REGEXP } from "./constants.js";
3
+ import { HtNodeWithContentType } from "./content-fields/hubtype-fields/index.js";
4
+ import { ProcessEnvNodeEnvs } from "./types.js";
5
+ import { FlowLocale } from "./utils/flow-locale.js";
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
10
17
  class FlowBuilderApi {
11
- constructor() { }
12
18
  static async create(options) {
13
19
  const newApi = new FlowBuilderApi();
14
20
  newApi.url = options.url;
15
21
  newApi.request = options.request;
16
22
  // TODO: Refactor later to combine logic from `FlowBuilderApi.create`, `resolveFlowUrl` and `getAccessToken` to be in one place
17
- if (process.env.NODE_ENV === types_1.ProcessEnvNodeEnvs.DEVELOPMENT) {
23
+ if (process.env.NODE_ENV === ProcessEnvNodeEnvs.DEVELOPMENT) {
18
24
  await newApi.updateSessionWithUserInfo(options.accessToken);
19
25
  }
20
26
  const updatedRequest = newApi.request;
21
27
  newApi.flowUrl = options.flowUrl.replace('{bot_id}', updatedRequest.session.bot.id);
22
- newApi.flow = options.flow ?? (await newApi.getFlow(options.accessToken));
28
+ newApi.flow = options.flow ?? await newApi.getFlow(options.accessToken);
23
29
  return newApi;
24
30
  }
25
31
  async getFlow(token) {
26
- const { data } = await axios_1.default.get(this.flowUrl, {
27
- headers: { Authorization: `Bearer ${token}` },
32
+ const { data } = await axios.get(this.flowUrl, {
33
+ headers: {
34
+ Authorization: `Bearer ${token}`
35
+ }
28
36
  });
29
37
  return data;
30
38
  }
31
39
  async updateSessionWithUserInfo(token) {
32
40
  const url = `${this.url}/v1/flow_builder/user_info/`;
33
- const response = await axios_1.default.get(url, {
34
- headers: { Authorization: `Bearer ${token}` },
41
+ const response = await axios.get(url, {
42
+ headers: {
43
+ Authorization: `Bearer ${token}`
44
+ }
35
45
  });
36
46
  this.request.session.organization_id = response.data.organization_id;
37
47
  this.request.session.bot.id = response.data.bot_id;
38
48
  }
39
49
  getNodeByFlowId(id) {
40
- const subFlow = this.flow.flows.find(subFlow => subFlow.id === id);
50
+ const subFlow = this.flow.flows.find((subFlow)=>subFlow.id === id);
41
51
  if (!subFlow) {
42
52
  throw Error(`SubFlow with id: '${id}' not found`);
43
53
  }
44
54
  return this.getNodeById(subFlow.start_node_id);
45
55
  }
46
56
  getNodeByCampaignId(id) {
47
- const campaign = this.flow.campaigns.find(campaign => campaign.id === id);
57
+ const campaign = this.flow.campaigns.find((campaign)=>campaign.id === id);
48
58
  if (!campaign) {
49
59
  throw Error(`Campaign with id: '${id}' not found`);
50
60
  }
51
61
  return this.getNodeById(campaign.start_node_id);
52
62
  }
53
63
  getNodeById(id) {
54
- const node = this.flow.nodes.find(node => node.id === id);
64
+ const node = this.flow.nodes.find((node)=>node.id === id);
55
65
  if (!node) {
56
66
  console.error(`Node with id: '${id}' not found`);
57
67
  }
58
68
  return node;
59
69
  }
60
70
  getRatingNodeByButtonId(id) {
61
- const ratingNodes = this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.RATING);
62
- const ratingNode = ratingNodes.find(node => node.content.buttons.some(button => button.id === id));
71
+ const ratingNodes = this.flow.nodes.filter((node)=>node.type === HtNodeWithContentType.RATING);
72
+ const ratingNode = ratingNodes.find((node)=>node.content.buttons.some((button)=>button.id === id));
63
73
  if (!ratingNode) {
64
74
  throw Error(`Rating node with button id: '${id}' not found`);
65
75
  }
66
76
  return ratingNode;
67
77
  }
68
78
  getRatingButtonById(ratingNode, id) {
69
- const ratingButton = ratingNode.content.buttons.find(button => button.id === id);
79
+ const ratingButton = ratingNode.content.buttons.find((button)=>button.id === id);
70
80
  if (!ratingButton) {
71
81
  throw Error(`Rating button with id: '${id}' not found`);
72
82
  }
73
83
  return ratingButton;
74
84
  }
75
85
  getNodeByContentID(contentID) {
76
- const content = this.flow.nodes.find(node => 'code' in node ? node.code === contentID : false);
86
+ const content = this.flow.nodes.find((node)=>'code' in node ? node.code === contentID : false);
77
87
  if (!content) {
78
88
  throw Error(`Node with contentID: '${contentID}' not found`);
79
89
  }
@@ -87,7 +97,7 @@ class FlowBuilderApi {
87
97
  return this.getNodeById(startNodeId);
88
98
  }
89
99
  getFallbackNode(alternate) {
90
- const fallbackNode = this.flow.nodes.find(node => node.type === hubtype_fields_1.HtNodeWithContentType.FALLBACK);
100
+ const fallbackNode = this.flow.nodes.find((node)=>node.type === HtNodeWithContentType.FALLBACK);
91
101
  if (!fallbackNode) {
92
102
  throw new Error('Fallback node must be defined');
93
103
  }
@@ -99,15 +109,13 @@ class FlowBuilderApi {
99
109
  if (!fallbackSecondMessage) {
100
110
  return this.getNodeById(fallbackFirstMessage.id);
101
111
  }
102
- return alternate
103
- ? this.getNodeById(fallbackFirstMessage.id)
104
- : this.getNodeById(fallbackSecondMessage.id);
112
+ return alternate ? this.getNodeById(fallbackFirstMessage.id) : this.getNodeById(fallbackSecondMessage.id);
105
113
  }
106
114
  getSmartIntentNodes() {
107
- return this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.SMART_INTENT);
115
+ return this.flow.nodes.filter((node)=>node.type === HtNodeWithContentType.SMART_INTENT);
108
116
  }
109
117
  getKeywordNodes() {
110
- return this.flow.nodes.filter(node => node.type === hubtype_fields_1.HtNodeWithContentType.KEYWORD);
118
+ return this.flow.nodes.filter((node)=>node.type === HtNodeWithContentType.KEYWORD);
111
119
  }
112
120
  getPayload(target) {
113
121
  if (!target) {
@@ -120,10 +128,10 @@ class FlowBuilderApi {
120
128
  return false;
121
129
  }
122
130
  const node = this.getNodeById(id);
123
- return node?.type === hubtype_fields_1.HtNodeWithContentType.BOT_ACTION;
131
+ return node?.type === HtNodeWithContentType.BOT_ACTION;
124
132
  }
125
133
  isUUID(str) {
126
- return constants_1.UUID_REGEXP.test(str);
134
+ return UUID_REGEXP.test(str);
127
135
  }
128
136
  createPayloadWithParams(botActionNode) {
129
137
  const payloadId = botActionNode.content.payload_id;
@@ -133,30 +141,28 @@ class FlowBuilderApi {
133
141
  const followUpContentID = this.getFollowUpContentID(botActionNode.follow_up?.id);
134
142
  const payloadParams = {
135
143
  contentID,
136
- followUpContentID,
144
+ followUpContentID
137
145
  };
138
146
  const payloadJson = JSON.stringify({
139
147
  ...customParams,
140
- ...payloadParams,
148
+ ...payloadParams
141
149
  });
142
- return `${payloadNode.content.payload}${constants_1.SEPARATOR}${payloadJson}`;
150
+ return `${payloadNode.content.payload}${SEPARATOR}${payloadJson}`;
143
151
  }
144
152
  getFollowUpContentID(id) {
145
- const followUpNode = id
146
- ? this.getNodeById(id)
147
- : undefined;
153
+ const followUpNode = id ? this.getNodeById(id) : undefined;
148
154
  return followUpNode?.code;
149
155
  }
150
156
  getFlowName(flowId) {
151
- const flow = this.flow.flows.find(flow => flow.id === flowId);
157
+ const flow = this.flow.flows.find((flow)=>flow.id === flowId);
152
158
  return flow ? flow.name : this.getCampaignFlowName(flowId);
153
159
  }
154
160
  getCampaignFlowName(campaignId) {
155
- const campaign = this.flow.campaigns.find(campaign => campaign.id === campaignId);
161
+ const campaign = this.flow.campaigns.find((campaign)=>campaign.id === campaignId);
156
162
  return campaign ? campaign.name : '';
157
163
  }
158
164
  getStartNodeAiAgentFlow() {
159
- const aiAgentFlow = this.flow.flows.find(flow => flow.name === constants_1.AI_AGENTS_FLOW_NAME);
165
+ const aiAgentFlow = this.flow.flows.find((flow)=>flow.name === AI_AGENTS_FLOW_NAME);
160
166
  if (!aiAgentFlow) {
161
167
  return undefined;
162
168
  }
@@ -166,7 +172,7 @@ class FlowBuilderApi {
166
172
  return this.flow.is_ai_agent_active || false;
167
173
  }
168
174
  getWebviewById(id) {
169
- return this.flow.webviews.find(webview => webview.id === id);
175
+ return this.flow.webviews.find((webview)=>webview.id === id);
170
176
  }
171
177
  shouldCaptureUserInput() {
172
178
  return !!this.getCaptureUserInputId();
@@ -178,7 +184,9 @@ class FlowBuilderApi {
178
184
  if (this.request.session.capture_user_input) {
179
185
  this.request.session.capture_user_input.node_id = id;
180
186
  }
181
- this.request.session.capture_user_input = { node_id: id };
187
+ this.request.session.capture_user_input = {
188
+ node_id: id
189
+ };
182
190
  }
183
191
  removeCaptureUserInputId() {
184
192
  this.request.session.capture_user_input = undefined;
@@ -198,8 +206,11 @@ class FlowBuilderApi {
198
206
  getResolvedLocale() {
199
207
  const flowLocales = this.flow.locales;
200
208
  const defaultLocaleCode = this.flow.default_locale_code;
201
- return new flow_locale_1.FlowLocale(this.request, flowLocales, defaultLocaleCode).resolve();
209
+ return new FlowLocale(this.request, flowLocales, defaultLocaleCode).resolve();
202
210
  }
211
+ constructor(){}
203
212
  }
204
- exports.FlowBuilderApi = FlowBuilderApi;
213
+
214
+ export { FlowBuilderApi };
215
+
205
216
  //# sourceMappingURL=api.js.map
package/lib/api.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sources":["../src/api.ts"],"sourcesContent":["import type { PluginPreRequest } from '@botonic/core'\nimport axios from 'axios'\n\nimport { AI_AGENTS_FLOW_NAME, SEPARATOR, UUID_REGEXP } from './constants'\nimport {\n type HtBotActionNode,\n type HtCaptureUserInputNode,\n type HtFallbackNode,\n type HtFlowBuilderData,\n type HtFlowWebview,\n type HtGoToFlow,\n type HtKeywordNode,\n type HtNodeComponent,\n type HtNodeLink,\n type HtNodeWithContent,\n HtNodeWithContentType,\n type HtPayloadNode,\n type HtRatingButton,\n type HtRatingNode,\n type HtSmartIntentNode,\n} from './content-fields/hubtype-fields'\nimport {\n type FlowBuilderApiOptions,\n type PayloadParamsBase,\n ProcessEnvNodeEnvs,\n} from './types'\nimport { FlowLocale } from './utils/flow-locale'\n\nexport class FlowBuilderApi {\n url: string\n flowUrl: string\n flow: HtFlowBuilderData\n request: PluginPreRequest\n\n private constructor() {}\n\n static async create(options: FlowBuilderApiOptions): Promise<FlowBuilderApi> {\n const newApi = new FlowBuilderApi()\n\n newApi.url = options.url\n newApi.request = options.request\n // TODO: Refactor later to combine logic from `FlowBuilderApi.create`, `resolveFlowUrl` and `getAccessToken` to be in one place\n if (process.env.NODE_ENV === ProcessEnvNodeEnvs.DEVELOPMENT) {\n await newApi.updateSessionWithUserInfo(options.accessToken)\n }\n const updatedRequest = newApi.request\n newApi.flowUrl = options.flowUrl.replace(\n '{bot_id}',\n updatedRequest.session.bot.id\n )\n newApi.flow = options.flow ?? (await newApi.getFlow(options.accessToken))\n return newApi\n }\n\n private async getFlow(token: string): Promise<HtFlowBuilderData> {\n const { data } = await axios.get(this.flowUrl, {\n headers: { Authorization: `Bearer ${token}` },\n })\n return data as HtFlowBuilderData\n }\n\n private async updateSessionWithUserInfo(token: string) {\n const url = `${this.url}/v1/flow_builder/user_info/`\n const response = await axios.get(url, {\n headers: { Authorization: `Bearer ${token}` },\n })\n this.request.session.organization_id = response.data.organization_id\n this.request.session.bot.id = response.data.bot_id\n }\n\n getNodeByFlowId(id: string): HtNodeWithContent {\n const subFlow = this.flow.flows.find(subFlow => subFlow.id === id)\n if (!subFlow) {\n throw Error(`SubFlow with id: '${id}' not found`)\n }\n return this.getNodeById<HtNodeWithContent>(subFlow.start_node_id)\n }\n\n getNodeByCampaignId<T extends HtNodeComponent>(id: string): T {\n const campaign = this.flow.campaigns.find(campaign => campaign.id === id)\n if (!campaign) {\n throw Error(`Campaign with id: '${id}' not found`)\n }\n return this.getNodeById<T>(campaign.start_node_id)\n }\n\n getNodeById<T extends HtNodeComponent>(id: string): T {\n const node = this.flow.nodes.find(node => node.id === id)\n if (!node) {\n console.error(`Node with id: '${id}' not found`)\n }\n\n return node as T\n }\n\n getRatingNodeByButtonId(id: string): HtRatingNode {\n const ratingNodes = this.flow.nodes.filter(\n node => node.type === HtNodeWithContentType.RATING\n ) as HtRatingNode[]\n const ratingNode = ratingNodes.find(node =>\n node.content.buttons.some(button => button.id === id)\n ) as HtRatingNode | undefined\n\n if (!ratingNode) {\n throw Error(`Rating node with button id: '${id}' not found`)\n }\n\n return ratingNode\n }\n\n getRatingButtonById(ratingNode: HtRatingNode, id: string): HtRatingButton {\n const ratingButton = ratingNode.content.buttons.find(\n button => button.id === id\n ) as HtRatingButton | undefined\n if (!ratingButton) {\n throw Error(`Rating button with id: '${id}' not found`)\n }\n\n return ratingButton\n }\n\n getNodeByContentID(contentID: string): HtNodeComponent {\n const content = this.flow.nodes.find(node =>\n 'code' in node ? node.code === contentID : false\n )\n if (!content) {\n throw Error(`Node with contentID: '${contentID}' not found`)\n }\n return content\n }\n\n getStartNode(): HtNodeWithContent {\n const startNodeId = this.flow.start_node_id\n if (!startNodeId) {\n throw new Error('Start node id must be defined')\n }\n return this.getNodeById(startNodeId)\n }\n\n getFallbackNode(alternate: boolean): HtNodeWithContent {\n const fallbackNode = this.flow.nodes.find(\n node => node.type === HtNodeWithContentType.FALLBACK\n ) as HtFallbackNode | undefined\n if (!fallbackNode) {\n throw new Error('Fallback node must be defined')\n }\n const fallbackFirstMessage = fallbackNode.content.first_message\n if (!fallbackFirstMessage) {\n throw new Error('Fallback 1st message must be defined')\n }\n const fallbackSecondMessage = fallbackNode.content.second_message\n if (!fallbackSecondMessage) {\n return this.getNodeById(fallbackFirstMessage.id)\n }\n return alternate\n ? this.getNodeById(fallbackFirstMessage.id)\n : this.getNodeById(fallbackSecondMessage.id)\n }\n\n getSmartIntentNodes(): HtSmartIntentNode[] {\n return this.flow.nodes.filter(\n node => node.type === HtNodeWithContentType.SMART_INTENT\n ) as HtSmartIntentNode[]\n }\n\n getKeywordNodes(): HtKeywordNode[] {\n return this.flow.nodes.filter(\n node => node.type === HtNodeWithContentType.KEYWORD\n ) as HtKeywordNode[]\n }\n\n getPayload(target?: HtNodeLink): string | undefined {\n if (!target) {\n return undefined\n }\n\n return target.id\n }\n\n isBotAction(id: string): boolean {\n if (!this.isUUID(id)) {\n return false\n }\n const node = this.getNodeById(id)\n return node?.type === HtNodeWithContentType.BOT_ACTION\n }\n\n private isUUID(str: string): boolean {\n return UUID_REGEXP.test(str)\n }\n\n createPayloadWithParams(botActionNode: HtBotActionNode): string {\n const payloadId = botActionNode.content.payload_id\n const payloadNode = this.getNodeById<HtPayloadNode>(payloadId)\n const customParams = JSON.parse(\n botActionNode.content.payload_params || '{}'\n )\n\n const contentID = botActionNode.code\n\n const followUpContentID = this.getFollowUpContentID(\n botActionNode.follow_up?.id\n )\n\n const payloadParams: PayloadParamsBase = {\n contentID,\n followUpContentID,\n }\n\n const payloadJson = JSON.stringify({\n ...customParams,\n ...payloadParams,\n })\n return `${payloadNode.content.payload}${SEPARATOR}${payloadJson}`\n }\n\n private getFollowUpContentID(id?: string): string | undefined {\n const followUpNode = id\n ? this.getNodeById<HtNodeWithContent | HtGoToFlow>(id)\n : undefined\n\n return followUpNode?.code\n }\n\n getFlowName(flowId: string): string {\n const flow = this.flow.flows.find(flow => flow.id === flowId)\n return flow ? flow.name : this.getCampaignFlowName(flowId)\n }\n\n getCampaignFlowName(campaignId: string): string {\n const campaign = this.flow.campaigns.find(\n campaign => campaign.id === campaignId\n )\n return campaign ? campaign.name : ''\n }\n\n getStartNodeAiAgentFlow(): HtNodeWithContent | undefined {\n const aiAgentFlow = this.flow.flows.find(\n flow => flow.name === AI_AGENTS_FLOW_NAME\n )\n\n if (!aiAgentFlow) {\n return undefined\n }\n\n return this.getNodeById<HtNodeWithContent>(aiAgentFlow.start_node_id)\n }\n\n isAiAgentEnabled(): boolean {\n return this.flow.is_ai_agent_active || false\n }\n\n getWebviewById(id: string): HtFlowWebview | undefined {\n return this.flow.webviews.find(webview => webview.id === id)\n }\n\n shouldCaptureUserInput(): boolean {\n return !!this.getCaptureUserInputId()\n }\n\n getCaptureUserInputId(): string | undefined {\n return this.request.session.capture_user_input?.node_id\n }\n\n setCaptureUserInputId(id: string): void {\n if (this.request.session.capture_user_input) {\n this.request.session.capture_user_input.node_id = id\n }\n this.request.session.capture_user_input = { node_id: id }\n }\n\n removeCaptureUserInputId(): void {\n this.request.session.capture_user_input = undefined\n }\n\n setUserExtraDataVariable(key: string, value: string): void {\n if (this.request.session.user.extra_data) {\n this.request.session.user.extra_data[key] = value\n }\n }\n\n getCaptureUserInputNode(): HtCaptureUserInputNode | undefined {\n const captureUserInputId = this.getCaptureUserInputId()\n if (!captureUserInputId) {\n return undefined\n }\n return this.getNodeById<HtCaptureUserInputNode>(captureUserInputId)\n }\n\n getResolvedLocale(): string {\n const flowLocales = this.flow.locales\n const defaultLocaleCode = this.flow.default_locale_code\n\n return new FlowLocale(\n this.request,\n flowLocales,\n defaultLocaleCode\n ).resolve()\n }\n}\n"],"names":["axios","AI_AGENTS_FLOW_NAME","SEPARATOR","UUID_REGEXP","HtNodeWithContentType","ProcessEnvNodeEnvs","FlowLocale","FlowBuilderApi","options","newApi","process","updatedRequest","token","data","url","response","id","subFlow","Error","campaign","node","console","ratingNodes","ratingNode","button","ratingButton","contentID","content","startNodeId","alternate","fallbackNode","fallbackFirstMessage","fallbackSecondMessage","target","undefined","str","botActionNode","payloadId","payloadNode","customParams","JSON","followUpContentID","payloadParams","payloadJson","followUpNode","flowId","flow","campaignId","aiAgentFlow","webview","key","value","captureUserInputId","flowLocales","defaultLocaleCode"],"mappings":";;;;;;;;;;;AACyB;AAEgD;AAiBjC;AAKxB;AACgC;AAEzC,MAAMO,cAAcA;IAQzB,aAAa,OAAOC,OAA8B,EAA2B;QAC3E,MAAMC,SAAS,IAAIF,cAAcA;QAEjCE,OAAO,GAAG,GAAGD,QAAQ,GAAG;QACxBC,OAAO,OAAO,GAAGD,QAAQ,OAAO;QAChC,+HAA+H;QAC/H,IAAIE,oBAAoB,KAAKL,8BAA8B,EAAE;YAC3D,MAAMI,OAAO,yBAAyB,CAACD,QAAQ,WAAW;QAC5D;QACA,MAAMG,iBAAiBF,OAAO,OAAO;QACrCA,OAAO,OAAO,GAAGD,QAAQ,OAAO,CAAC,OAAO,CACtC,YACAG,eAAe,OAAO,CAAC,GAAG,CAAC,EAAE;QAE/BF,OAAO,IAAI,GAAGD,QAAQ,IAAI,IAAK,MA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_PROD = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
2
+ const SEPARATOR = '|';
3
+ const SOURCE_INFO_SEPARATOR = `${SEPARATOR}source_`;
4
+ const EMPTY_PAYLOAD = 'fb-empty-payload';
5
+ const VARIABLE_PATTERN_GLOBAL = /{([^{}]+)}/g;
6
+ const ACCESS_TOKEN_VARIABLE_KEY = '_access_token';
7
+ const REG_EXP_PATTERN = /^\/(.*)\/([gimyus]*)$/;
8
+ const UUID_REGEXP = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
9
+ /* ********** PAYLOADS ********** */ const AGENT_RATING_PAYLOAD = 'agent-rating';
10
+ const PUSH_FLOW_PAYLOAD = 'push-flow';
11
+ /* ********** FLOW NAMES ********** */ const MAIN_FLOW_NAME = 'Main';
12
+ const AI_AGENTS_FLOW_NAME = 'AI Agents';
13
+ const FALLBACK_FLOW_NAME = 'Fallback';
14
+
15
+ export { ACCESS_TOKEN_VARIABLE_KEY, AGENT_RATING_PAYLOAD, AI_AGENTS_FLOW_NAME, EMPTY_PAYLOAD, FALLBACK_FLOW_NAME, FLOW_BUILDER_API_URL_PROD, MAIN_FLOW_NAME, PUSH_FLOW_PAYLOAD, REG_EXP_PATTERN, SEPARATOR, SOURCE_INFO_SEPARATOR, UUID_REGEXP, VARIABLE_PATTERN_GLOBAL };
16
+
17
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const FLOW_BUILDER_API_URL_PROD =\n process.env.HUBTYPE_API_URL || 'https://api.hubtype.com'\nexport const SEPARATOR = '|'\nexport const SOURCE_INFO_SEPARATOR = `${SEPARATOR}source_`\nexport const EMPTY_PAYLOAD = 'fb-empty-payload'\nexport const VARIABLE_PATTERN_GLOBAL = /{([^{}]+)}/g\nexport const ACCESS_TOKEN_VARIABLE_KEY = '_access_token'\nexport const REG_EXP_PATTERN = /^\\/(.*)\\/([gimyus]*)$/\nexport const UUID_REGEXP =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i\n\n/* ********** PAYLOADS ********** */\nexport const AGENT_RATING_PAYLOAD = 'agent-rating'\nexport const PUSH_FLOW_PAYLOAD = 'push-flow'\n\n/* ********** FLOW NAMES ********** */\nexport const MAIN_FLOW_NAME = 'Main'\nexport const AI_AGENTS_FLOW_NAME = 'AI Agents'\nexport const FALLBACK_FLOW_NAME = 'Fallback'\n"],"names":["FLOW_BUILDER_API_URL_PROD","process","SEPARATOR","SOURCE_INFO_SEPARATOR","EMPTY_PAYLOAD","VARIABLE_PATTERN_GLOBAL","ACCESS_TOKEN_VARIABLE_KEY","REG_EXP_PATTERN","UUID_REGEXP","AGENT_RATING_PAYLOAD","PUSH_FLOW_PAYLOAD","MAIN_FLOW_NAME","AI_AGENTS_FLOW_NAME","FALLBACK_FLOW_NAME"],"mappings":"AAAO,MAAMA,yBAAyBA,GACpCC,QAAQ,GAAG,CAAC,eAAe,IAAI,0BAAyB;AACnD,MAAMC,SAASA,GAAG,IAAG;AACrB,MAAMC,qBAAqBA,GAAG,GAAGD,SAASA,CAAC,OAAO,CAAC;AACnD,MAAME,aAAaA,GAAG,mBAAkB;AACxC,MAAMC,uBAAuBA,GAAG,cAAa;AAC7C,MAAMC,yBAAyBA,GAAG,gBAAe;AACjD,MAAMC,eAAeA,GAAG,wBAAuB;AAC/C,MAAMC,WAAWA,GACtB,kEAAiE;AAEnE,kCAAkC,GAC3B,MAAMC,oBAAoBA,GAAG,eAAc;AAC3C,MAAMC,iBAAiBA,GAAG,YAAW;AAE5C,oCAAoC,GAC7B,MAAMC,cAAcA,GAAG,OAAM;AAC7B,MAAMC,mBAAmBA,GAAG,YAAW;AACvC,MAAMC,kBAAkBA,GAAG,WAAU"}
@@ -1,6 +1,6 @@
1
1
  import type { BotContext } from '@botonic/core';
2
- import type { HtMediaFileLocale, HtNodeLink, HtQueueLocale, HtTextLocale, HtVideoLocale } from './hubtype-fields';
3
- import type { FlowContent } from './index';
2
+ import type { HtMediaFileLocale, HtNodeLink, HtQueueLocale, HtTextLocale, HtVideoLocale } from './hubtype-fields/index.js';
3
+ import type { FlowContent } from './index.js';
4
4
  export declare abstract class ContentFieldsBase {
5
5
  readonly id: string;
6
6
  code: string;
@@ -0,0 +1,78 @@
1
+ import { ACCESS_TOKEN_VARIABLE_KEY, VARIABLE_PATTERN_GLOBAL } from "../constants.js";
2
+ import { ContentFilterExecutor } from "../filters/index.js";
3
+ import { getFlowBuilderPlugin } from "../utils/get-flow-builder-plugin.js";
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ class ContentFieldsBase {
12
+ async filterContent(botContext, content) {
13
+ const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins);
14
+ const contentFilters = flowBuilderPlugin.contentFilters;
15
+ const contentFilterExecutor = new ContentFilterExecutor({
16
+ filters: contentFilters
17
+ });
18
+ const filteredContent = await contentFilterExecutor.filter(botContext, content);
19
+ return filteredContent;
20
+ }
21
+ static getTextByLocale(locale, text) {
22
+ const result = text.find((t)=>t.locale === locale);
23
+ return result?.message ?? '';
24
+ }
25
+ static getAssetByLocale(locale, asset) {
26
+ const result = asset.find((i)=>i.locale === locale);
27
+ return result?.file ?? '';
28
+ }
29
+ static getVideoByLocale(locale, video) {
30
+ const result = video.find((v)=>v.locale === locale);
31
+ return result?.url ?? '';
32
+ }
33
+ static getQueueByLocale(locale, queues) {
34
+ return queues.find((queue)=>queue.locale === locale);
35
+ }
36
+ replaceVariables(text, botContext) {
37
+ if (!botContext) {
38
+ return text;
39
+ }
40
+ return text.replace(VARIABLE_PATTERN_GLOBAL, (match)=>{
41
+ // remove \\ ( escape for _ ) added by text node with markdown
42
+ const keyPath = match.slice(1, -1).replaceAll('\\', '');
43
+ const botVariable = keyPath.endsWith(ACCESS_TOKEN_VARIABLE_KEY) ? match : this.getValueFromKeyPath(botContext, keyPath);
44
+ return this.isValidType(botVariable) ? String(botVariable) : match;
45
+ });
46
+ }
47
+ getValueFromKeyPath(botContext, keyPath) {
48
+ if (keyPath.startsWith('session.user.contact_info.')) {
49
+ const name = keyPath.split('.').at(-1);
50
+ return botContext.session.user.contact_info?.find((contact)=>contact.name === name)?.value;
51
+ }
52
+ if (keyPath.startsWith('input.') || keyPath.startsWith('session.')) {
53
+ return keyPath.split('.').reduce((object, key)=>this.resolveObjectKey(object, key), botContext);
54
+ }
55
+ return keyPath.split('.').reduce((object, key)=>this.resolveObjectKey(object, key), botContext.session.user.extra_data);
56
+ }
57
+ resolveObjectKey(object, key) {
58
+ if (object && object[key] !== undefined) {
59
+ return object[key];
60
+ }
61
+ return undefined;
62
+ }
63
+ isValidType(botVariable) {
64
+ const validTypes = [
65
+ 'boolean',
66
+ 'string',
67
+ 'number'
68
+ ];
69
+ return validTypes.includes(typeof botVariable);
70
+ }
71
+ constructor(id){
72
+ this.id = id;
73
+ }
74
+ }
75
+
76
+ export { ContentFieldsBase };
77
+
78
+ //# sourceMappingURL=content-fields-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/content-fields-base.js","sources":["../../src/content-fields/content-fields-base.ts"],"sourcesContent":["import type { BotContext } from '@botonic/core'\nimport {\n ACCESS_TOKEN_VARIABLE_KEY,\n VARIABLE_PATTERN_GLOBAL,\n} from '../constants'\nimport { ContentFilterExecutor } from '../filters'\nimport { getFlowBuilderPlugin } from '../utils/get-flow-builder-plugin'\nimport type {\n HtMediaFileLocale,\n HtNodeLink,\n HtQueueLocale,\n HtTextLocale,\n HtVideoLocale,\n} from './hubtype-fields'\nimport type { FlowContent } from './index'\n\nexport abstract class ContentFieldsBase {\n public code: string\n public followUp?: HtNodeLink\n\n constructor(public readonly id: string) {}\n\n abstract trackFlow(botContext: BotContext): Promise<void>\n\n abstract processContent(botContext: BotContext): Promise<void>\n\n async filterContent(\n botContext: BotContext,\n content: FlowContent\n ): Promise<FlowContent> {\n const flowBuilderPlugin = getFlowBuilderPlugin(botContext.plugins)\n const contentFilters = flowBuilderPlugin.contentFilters\n const contentFilterExecutor = new ContentFilterExecutor({\n filters: contentFilters,\n })\n const filteredContent = await contentFilterExecutor.filter(\n botContext,\n content\n )\n return filteredContent\n }\n\n static getTextByLocale(locale: string, text: HtTextLocale[]): string {\n const result = text.find(t => t.locale === locale)\n return result?.message ?? ''\n }\n\n static getAssetByLocale(locale: string, asset: HtMediaFileLocale[]): string {\n const result = asset.find(i => i.locale === locale)\n return result?.file ?? ''\n }\n\n static getVideoByLocale(locale: string, video: HtVideoLocale[]): string {\n const result = video.find(v => v.locale === locale)\n return result?.url ?? ''\n }\n\n static getQueueByLocale(\n locale: string,\n queues: HtQueueLocale[]\n ): HtQueueLocale | undefined {\n return queues.find(queue => queue.locale === locale)\n }\n\n replaceVariables(text: string, botContext: BotContext): string {\n if (!botContext) {\n return text\n }\n\n return text.replace(VARIABLE_PATTERN_GLOBAL, match => {\n // remove \\\\ ( escape for _ ) added by text node with markdown\n const keyPath = match.slice(1, -1).replaceAll('\\\\', '')\n\n const botVariable = keyPath.endsWith(ACCESS_TOKEN_VARIABLE_KEY)\n ? match\n : this.getValueFromKeyPath(botContext, keyPath)\n\n return this.isValidType(botVariable) ? String(botVariable) : match\n })\n }\n\n getValueFromKeyPath(botContext: BotContext, keyPath: string): any {\n if (keyPath.startsWith('session.user.contact_info.')) {\n const name = keyPath.split('.').at(-1)\n return botContext.session.user.contact_info?.find(\n contact => contact.name === name\n )?.value\n }\n\n if (keyPath.startsWith('input.') || keyPath.startsWith('session.')) {\n return keyPath\n .split('.')\n .reduce((object, key) => this.resolveObjectKey(object, key), botContext)\n }\n\n return keyPath\n .split('.')\n .reduce(\n (object, key) => this.resolveObjectKey(object, key),\n botContext.session.user.extra_data\n )\n }\n\n private resolveObjectKey(object: any, key: string): any {\n if (object && object[key] !== undefined) {\n return object[key]\n }\n return undefined\n }\n\n private isValidType(botVariable: any): boolean {\n const validTypes = ['boolean', 'string', 'number']\n return validTypes.includes(typeof botVariable)\n }\n}\n"],"names":["ACCESS_TOKEN_VARIABLE_KEY","VARIABLE_PATTERN_GLOBAL","ContentFilterExecutor","getFlowBuilderPlugin","ContentFieldsBase","botContext","content","flowBuilderPlugin","contentFilters","contentFilterExecutor","filteredContent","locale","text","result","t","asset","i","video","v","queues","queue","match","keyPath","botVariable","String","name","contact","object","key","undefined","validTypes","id"],"mappings":";;;;;;;AAIqB;AAC6B;AACqB;AAUhE,MAAeI,iBAAiBA;IAUrC,MAAM,cACJC,UAAsB,EACtBC,OAAoB,EACE;QACtB,MAAMC,oBAAoBJ,oBAAoBA,CAACE,WAAW,OAAO;QACjE,MAAMG,iBAAiBD,kBAAkB,cAAc;QACvD,MAAME,wBAAwB,IAAIP,qBAAqBA,CAAC;YACtD,SAASM;QACX;QACA,MAAME,kBAAkB,MAAMD,sBAAsB,MAAM,CACxDJ,YACAC;QAEF,OAAOI;IACT;IAEA,OAAO,gBAAgBC,MAAc,EAAEC,IAAoB,EAAU;QACnE,MAAMC,SAASD,KAAK,IAAI,CAACE,CAAAA,IAAKA,EAAE,MAAM,KAAKH;QAC3C,OAAOE,QAAQ,WAAW;IAC5B;IAEA,OAAO,iBAAiBF,MAAc,EAAEI,KAA0B,EAAU;QAC1E,MAAMF,SAASE,MAAM,IAAI,CAACC,CAAAA,IAAKA,EAAE,MAAM,KAAKL;QAC5C,OAAOE,QAAQ,QAAQ;IACzB;IAEA,OAAO,iBAAiBF,MAAc,EAAEM,KAAsB,EAAU;QACtE,MAAMJ,SAASI,MAAM,IAAI,CAACC,CAAAA,IAAKA,EAAE,MAAM,KAAKP;QAC5C,OAAOE,QAAQ,OAAO;IACxB;IAEA,OAAO,iBACLF,MAAc,EACdQ,MAAuB,EACI;QAC3B,OAAOA,OAAO,IAAI,CAACC,CAAAA,QAASA,MAAM,MAAM,KAAKT;IAC/C;IAEA,iBAAiBC,IAAY,EAAEP,UAAsB,EAAU;QAC7D,IAAI,CAACA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CAAE;aAAZA,KAAAA;IAAa;AA8F3C"}
@@ -1,4 +1,4 @@
1
- import { BooleanConditionOperator, type HtBooleanCondition, type HtNumberCondition, type HtStringCondition, NumberConditionOperator, StringConditionOperator } from '../hubtype-fields';
1
+ import { BooleanConditionOperator, type HtBooleanCondition, type HtNumberCondition, type HtStringCondition, NumberConditionOperator, StringConditionOperator } from '../hubtype-fields/index.js';
2
2
  type StringEvaluator = (variable: string, value: string) => boolean;
3
3
  type NumberEvaluator = (variable: number, value: number, condition: HtNumberCondition) => boolean;
4
4
  type BooleanEvaluator = (variable: boolean) => boolean;
@@ -0,0 +1,73 @@
1
+ import { BooleanConditionOperator, NumberConditionOperator, StringConditionOperator } from "../hubtype-fields/index.js";
2
+
3
+
4
+
5
+ function getMinAndMax(condition) {
6
+ if (condition.min !== undefined && condition.max !== undefined) {
7
+ return {
8
+ min: condition.min,
9
+ max: condition.max
10
+ };
11
+ }
12
+ throw new Error(`Min or max not found for number condition ${condition.operator}`);
13
+ }
14
+ const STRING_CONDITION_EVALUATORS = {
15
+ [StringConditionOperator.Contains]: (variable, value)=>variable.includes(value),
16
+ [StringConditionOperator.NotContains]: (variable, value)=>!variable.includes(value),
17
+ [StringConditionOperator.EqualsTo]: (variable, value)=>variable === value,
18
+ [StringConditionOperator.NotEqualsTo]: (variable, value)=>variable !== value,
19
+ [StringConditionOperator.StartsWith]: (variable, value)=>variable.startsWith(value),
20
+ [StringConditionOperator.NotStartsWith]: (variable, value)=>!variable.startsWith(value),
21
+ [StringConditionOperator.EndsWith]: (variable, value)=>variable.endsWith(value),
22
+ [StringConditionOperator.NotEndsWith]: (variable, value)=>!variable.endsWith(value)
23
+ };
24
+ const NUMBER_CONDITION_EVALUATORS = {
25
+ [NumberConditionOperator.EqualsTo]: (variable, value)=>variable === value,
26
+ [NumberConditionOperator.NotEqualsTo]: (variable, value)=>variable !== value,
27
+ [NumberConditionOperator.GreaterThan]: (variable, value)=>variable > value,
28
+ [NumberConditionOperator.LessThan]: (variable, value)=>variable < value,
29
+ [NumberConditionOperator.GreaterThanOrEqualTo]: (variable, value)=>variable >= value,
30
+ [NumberConditionOperator.LessThanOrEqualTo]: (variable, value)=>variable <= value,
31
+ [NumberConditionOperator.Between]: (variable, _value, condition)=>{
32
+ const { min, max } = getMinAndMax(condition);
33
+ return variable >= min && variable <= max;
34
+ },
35
+ [NumberConditionOperator.NotBetween]: (variable, _value, condition)=>{
36
+ const { min, max } = getMinAndMax(condition);
37
+ return variable < min || variable > max;
38
+ }
39
+ };
40
+ const BOOLEAN_CONDITION_EVALUATORS = {
41
+ [BooleanConditionOperator.IsTruthy]: (variable)=>!!variable
42
+ };
43
+ function evaluateStringCondition(variable, condition) {
44
+ if (condition.value === undefined) {
45
+ throw new Error(`Value not found for string condition ${condition.operator}`);
46
+ }
47
+ const evaluator = STRING_CONDITION_EVALUATORS[condition.operator];
48
+ if (!evaluator) {
49
+ throw new Error(`Invalid string condition operator ${condition.operator}`);
50
+ }
51
+ return evaluator(variable, condition.value);
52
+ }
53
+ function evaluateNumberCondition(variable, condition) {
54
+ if (condition.value === undefined) {
55
+ throw new Error(`Value not found for number condition ${condition.operator}`);
56
+ }
57
+ const evaluator = NUMBER_CONDITION_EVALUATORS[condition.operator];
58
+ if (!evaluator) {
59
+ throw new Error(`Invalid number condition operator ${condition.operator}`);
60
+ }
61
+ return evaluator(variable, condition.value, condition);
62
+ }
63
+ function evaluateBooleanCondition(variable, condition) {
64
+ const evaluator = BOOLEAN_CONDITION_EVALUATORS[condition.operator];
65
+ if (!evaluator) {
66
+ throw new Error(`Invalid boolean condition operator ${condition.operator}`);
67
+ }
68
+ return evaluator(variable);
69
+ }
70
+
71
+ export { BOOLEAN_CONDITION_EVALUATORS, NUMBER_CONDITION_EVALUATORS, STRING_CONDITION_EVALUATORS, evaluateBooleanCondition, evaluateNumberCondition, evaluateStringCondition, getMinAndMax };
72
+
73
+ //# sourceMappingURL=custom-conditional-v2-evaluators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-fields/custom-conditional/custom-conditional-v2-evaluators.js","sources":["../../../src/content-fields/custom-conditional/custom-conditional-v2-evaluators.ts"],"sourcesContent":["import {\n BooleanConditionOperator,\n type HtBooleanCondition,\n type HtNumberCondition,\n type HtStringCondition,\n NumberConditionOperator,\n StringConditionOperator,\n} from '../hubtype-fields'\n\ntype StringEvaluator = (variable: string, value: string) => boolean\n\ntype NumberEvaluator = (\n variable: number,\n value: number,\n condition: HtNumberCondition\n) => boolean\n\ntype BooleanEvaluator = (variable: boolean) => boolean\n\nexport function getMinAndMax(condition: HtNumberCondition): {\n min: number\n max: number\n} {\n if (condition.min !== undefined && condition.max !== undefined) {\n return { min: condition.min, max: condition.max }\n }\n throw new Error(\n `Min or max not found for number condition ${condition.operator}`\n )\n}\n\nexport const STRING_CONDITION_EVALUATORS: Record<\n StringConditionOperator,\n StringEvaluator\n> = {\n [StringConditionOperator.Contains]: (variable, value) =>\n variable.includes(value),\n [StringConditionOperator.NotContains]: (variable, value) =>\n !variable.includes(value),\n [StringConditionOperator.EqualsTo]: (variable, value) => variable === value,\n [StringConditionOperator.NotEqualsTo]: (variable, value) =>\n variable !== value,\n [StringConditionOperator.StartsWith]: (variable, value) =>\n variable.startsWith(value),\n [StringConditionOperator.NotStartsWith]: (variable, value) =>\n !variable.startsWith(value),\n [StringConditionOperator.EndsWith]: (variable, value) =>\n variable.endsWith(value),\n [StringConditionOperator.NotEndsWith]: (variable, value) =>\n !variable.endsWith(value),\n}\n\nexport const NUMBER_CONDITION_EVALUATORS: Record<\n NumberConditionOperator,\n NumberEvaluator\n> = {\n [NumberConditionOperator.EqualsTo]: (variable, value) => variable === value,\n [NumberConditionOperator.NotEqualsTo]: (variable, value) =>\n variable !== value,\n [NumberConditionOperator.GreaterThan]: (variable, value) => variable > value,\n [NumberConditionOperator.LessThan]: (variable, value) => variable < value,\n [NumberConditionOperator.GreaterThanOrEqualTo]: (variable, value) =>\n variable >= value,\n [NumberConditionOperator.LessThanOrEqualTo]: (variable, value) =>\n variable <= value,\n [NumberConditionOperator.Between]: (variable, _value, condition) => {\n const { min, max } = getMinAndMax(condition)\n return variable >= min && variable <= max\n },\n [NumberConditionOperator.NotBetween]: (variable, _value, condition) => {\n const { min, max } = getMinAndMax(condition)\n return variable < min || variable > max\n },\n}\n\nexport const BOOLEAN_CONDITION_EVALUATORS: Record<\n BooleanConditionOperator,\n BooleanEvaluator\n> = {\n [BooleanConditionOperator.IsTruthy]: variable => !!variable,\n}\n\nexport function evaluateStringCondition(\n variable: string,\n condition: HtStringCondition\n): boolean {\n if (condition.value === undefined) {\n throw new Error(\n `Value not found for string condition ${condition.operator}`\n )\n }\n const evaluator = STRING_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid string condition operator ${condition.operator}`)\n }\n return evaluator(variable, condition.value)\n}\n\nexport function evaluateNumberCondition(\n variable: number,\n condition: HtNumberCondition\n): boolean {\n if (condition.value === undefined) {\n throw new Error(\n `Value not found for number condition ${condition.operator}`\n )\n }\n const evaluator = NUMBER_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid number condition operator ${condition.operator}`)\n }\n return evaluator(variable, condition.value, condition)\n}\n\nexport function evaluateBooleanCondition(\n variable: boolean,\n condition: HtBooleanCondition\n): boolean {\n const evaluator = BOOLEAN_CONDITION_EVALUATORS[condition.operator]\n if (!evaluator) {\n throw new Error(`Invalid boolean condition operator ${condition.operator}`)\n }\n return evaluator(variable)\n}\n"],"names":["BooleanConditionOperator","NumberConditionOperator","StringConditionOperator","getMinAndMax","condition","undefined","Error","STRING_CONDITION_EVALUATORS","variable","value","NUMBER_CONDITION_EVALUATORS","_value","min","max","BOOLEAN_CONDITION_EVALUATORS","evaluateStringCondition","evaluator","evaluateNumberCondition","evaluateBooleanCondition"],"mappings":";;;AAO0B;AAYnB,SAASG,YAAYA,CAACC,SAA4B;IAIvD,IAAIA,UAAU,GAAG,KAAKC,aAAaD,UAAU,GAAG,KAAK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,CAAC,mCAAmC,EAAEF,UAAU,QAAQ,EAAE;IAC5E;IACA,OAAOY,UAAUR;AACnB"}
@@ -1,4 +1,4 @@
1
- import { type HtCondition, type HtNodeLink, VariableFormat } from '../hubtype-fields';
1
+ import { type HtCondition, type HtNodeLink, VariableFormat } from '../hubtype-fields/index.js';
2
2
  export type ConditionMatch = {
3
3
  customResult: string;
4
4
  target: HtNodeLink;