@repzo/widget-react-native 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/README.md +482 -0
  2. package/lib/commonjs/agent-ui-blocks.js +159 -0
  3. package/lib/commonjs/agent-ui-blocks.js.map +1 -0
  4. package/lib/commonjs/api/client.js +267 -0
  5. package/lib/commonjs/api/client.js.map +1 -0
  6. package/lib/commonjs/api/realtime.js +193 -0
  7. package/lib/commonjs/api/realtime.js.map +1 -0
  8. package/lib/commonjs/api/sse-parser.js +58 -0
  9. package/lib/commonjs/api/sse-parser.js.map +1 -0
  10. package/lib/commonjs/controller.js +23 -0
  11. package/lib/commonjs/controller.js.map +1 -0
  12. package/lib/commonjs/device-id.js +75 -0
  13. package/lib/commonjs/device-id.js.map +1 -0
  14. package/lib/commonjs/events.js +49 -0
  15. package/lib/commonjs/events.js.map +1 -0
  16. package/lib/commonjs/i18n.js +106 -0
  17. package/lib/commonjs/i18n.js.map +1 -0
  18. package/lib/commonjs/index.js +98 -0
  19. package/lib/commonjs/index.js.map +1 -0
  20. package/lib/commonjs/locales.js +85 -0
  21. package/lib/commonjs/locales.js.map +1 -0
  22. package/lib/commonjs/package.json +1 -0
  23. package/lib/commonjs/push/push-notifications.js +208 -0
  24. package/lib/commonjs/push/push-notifications.js.map +1 -0
  25. package/lib/commonjs/state/use-widget-state.js +23 -0
  26. package/lib/commonjs/state/use-widget-state.js.map +1 -0
  27. package/lib/commonjs/state/widget-store.js +1682 -0
  28. package/lib/commonjs/state/widget-store.js.map +1 -0
  29. package/lib/commonjs/storage.js +147 -0
  30. package/lib/commonjs/storage.js.map +1 -0
  31. package/lib/commonjs/types.js +44 -0
  32. package/lib/commonjs/types.js.map +1 -0
  33. package/lib/commonjs/ui/WidgetProvider.js +404 -0
  34. package/lib/commonjs/ui/WidgetProvider.js.map +1 -0
  35. package/lib/commonjs/ui/components/AgentUiBlocks.js +864 -0
  36. package/lib/commonjs/ui/components/AgentUiBlocks.js.map +1 -0
  37. package/lib/commonjs/ui/components/Avatar.js +76 -0
  38. package/lib/commonjs/ui/components/Avatar.js.map +1 -0
  39. package/lib/commonjs/ui/components/ConversationRow.js +155 -0
  40. package/lib/commonjs/ui/components/ConversationRow.js.map +1 -0
  41. package/lib/commonjs/ui/components/ErrorBoundary.js +44 -0
  42. package/lib/commonjs/ui/components/ErrorBoundary.js.map +1 -0
  43. package/lib/commonjs/ui/components/Gradient.js +168 -0
  44. package/lib/commonjs/ui/components/Gradient.js.map +1 -0
  45. package/lib/commonjs/ui/components/Launcher.js +125 -0
  46. package/lib/commonjs/ui/components/Launcher.js.map +1 -0
  47. package/lib/commonjs/ui/components/Markdown.js +257 -0
  48. package/lib/commonjs/ui/components/Markdown.js.map +1 -0
  49. package/lib/commonjs/ui/components/OutboundMessageCard.js +157 -0
  50. package/lib/commonjs/ui/components/OutboundMessageCard.js.map +1 -0
  51. package/lib/commonjs/ui/components/WidgetPanel.js +131 -0
  52. package/lib/commonjs/ui/components/WidgetPanel.js.map +1 -0
  53. package/lib/commonjs/ui/components/icons.js +383 -0
  54. package/lib/commonjs/ui/components/icons.js.map +1 -0
  55. package/lib/commonjs/ui/hooks/use-keyboard-overlap.js +113 -0
  56. package/lib/commonjs/ui/hooks/use-keyboard-overlap.js.map +1 -0
  57. package/lib/commonjs/ui/hooks/use-reduce-motion.js +38 -0
  58. package/lib/commonjs/ui/hooks/use-reduce-motion.js.map +1 -0
  59. package/lib/commonjs/ui/hooks/use-widget-insets.js +41 -0
  60. package/lib/commonjs/ui/hooks/use-widget-insets.js.map +1 -0
  61. package/lib/commonjs/ui/screens/chat/ChatView.js +590 -0
  62. package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -0
  63. package/lib/commonjs/ui/screens/chat/ChatView.styles.js +362 -0
  64. package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -0
  65. package/lib/commonjs/ui/screens/chat/ChatView.types.js +6 -0
  66. package/lib/commonjs/ui/screens/chat/ChatView.types.js.map +1 -0
  67. package/lib/commonjs/ui/screens/conversations/ConversationsList.js +150 -0
  68. package/lib/commonjs/ui/screens/conversations/ConversationsList.js.map +1 -0
  69. package/lib/commonjs/ui/screens/conversations/ConversationsList.styles.js +118 -0
  70. package/lib/commonjs/ui/screens/conversations/ConversationsList.styles.js.map +1 -0
  71. package/lib/commonjs/ui/screens/conversations/ConversationsList.types.js +6 -0
  72. package/lib/commonjs/ui/screens/conversations/ConversationsList.types.js.map +1 -0
  73. package/lib/commonjs/ui/screens/home/HomeView.js +336 -0
  74. package/lib/commonjs/ui/screens/home/HomeView.js.map +1 -0
  75. package/lib/commonjs/ui/screens/home/HomeView.styles.js +245 -0
  76. package/lib/commonjs/ui/screens/home/HomeView.styles.js.map +1 -0
  77. package/lib/commonjs/ui/screens/home/HomeView.types.js +6 -0
  78. package/lib/commonjs/ui/screens/home/HomeView.types.js.map +1 -0
  79. package/lib/commonjs/ui/screens/home/greeting.js +49 -0
  80. package/lib/commonjs/ui/screens/home/greeting.js.map +1 -0
  81. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.js +229 -0
  82. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.js.map +1 -0
  83. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.styles.js +125 -0
  84. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.styles.js.map +1 -0
  85. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.types.js +6 -0
  86. package/lib/commonjs/ui/screens/pre-chat/PreChatForm.types.js.map +1 -0
  87. package/lib/commonjs/ui/styles/global.js +55 -0
  88. package/lib/commonjs/ui/styles/global.js.map +1 -0
  89. package/lib/commonjs/ui/styles/theme.js +148 -0
  90. package/lib/commonjs/ui/styles/theme.js.map +1 -0
  91. package/lib/commonjs/ui/utils/conversations.js +125 -0
  92. package/lib/commonjs/ui/utils/conversations.js.map +1 -0
  93. package/lib/commonjs/ui/utils/html.js +44 -0
  94. package/lib/commonjs/ui/utils/html.js.map +1 -0
  95. package/lib/commonjs/ui/utils/native-gradient.js +65 -0
  96. package/lib/commonjs/ui/utils/native-gradient.js.map +1 -0
  97. package/lib/commonjs/ui/utils/rtl.js +56 -0
  98. package/lib/commonjs/ui/utils/rtl.js.map +1 -0
  99. package/lib/commonjs/ui/utils/safe-url.js +67 -0
  100. package/lib/commonjs/ui/utils/safe-url.js.map +1 -0
  101. package/lib/module/agent-ui-blocks.js +152 -0
  102. package/lib/module/agent-ui-blocks.js.map +1 -0
  103. package/lib/module/api/client.js +261 -0
  104. package/lib/module/api/client.js.map +1 -0
  105. package/lib/module/api/realtime.js +189 -0
  106. package/lib/module/api/realtime.js.map +1 -0
  107. package/lib/module/api/sse-parser.js +53 -0
  108. package/lib/module/api/sse-parser.js.map +1 -0
  109. package/lib/module/controller.js +19 -0
  110. package/lib/module/controller.js.map +1 -0
  111. package/lib/module/device-id.js +69 -0
  112. package/lib/module/device-id.js.map +1 -0
  113. package/lib/module/events.js +44 -0
  114. package/lib/module/events.js.map +1 -0
  115. package/lib/module/i18n.js +99 -0
  116. package/lib/module/i18n.js.map +1 -0
  117. package/lib/module/index.js +55 -0
  118. package/lib/module/index.js.map +1 -0
  119. package/lib/module/locales.js +80 -0
  120. package/lib/module/locales.js.map +1 -0
  121. package/lib/module/package.json +1 -0
  122. package/lib/module/push/push-notifications.js +204 -0
  123. package/lib/module/push/push-notifications.js.map +1 -0
  124. package/lib/module/state/use-widget-state.js +18 -0
  125. package/lib/module/state/use-widget-state.js.map +1 -0
  126. package/lib/module/state/widget-store.js +1677 -0
  127. package/lib/module/state/widget-store.js.map +1 -0
  128. package/lib/module/storage.js +141 -0
  129. package/lib/module/storage.js.map +1 -0
  130. package/lib/module/types.js +40 -0
  131. package/lib/module/types.js.map +1 -0
  132. package/lib/module/ui/WidgetProvider.js +400 -0
  133. package/lib/module/ui/WidgetProvider.js.map +1 -0
  134. package/lib/module/ui/components/AgentUiBlocks.js +857 -0
  135. package/lib/module/ui/components/AgentUiBlocks.js.map +1 -0
  136. package/lib/module/ui/components/Avatar.js +71 -0
  137. package/lib/module/ui/components/Avatar.js.map +1 -0
  138. package/lib/module/ui/components/ConversationRow.js +150 -0
  139. package/lib/module/ui/components/ConversationRow.js.map +1 -0
  140. package/lib/module/ui/components/ErrorBoundary.js +39 -0
  141. package/lib/module/ui/components/ErrorBoundary.js.map +1 -0
  142. package/lib/module/ui/components/Gradient.js +165 -0
  143. package/lib/module/ui/components/Gradient.js.map +1 -0
  144. package/lib/module/ui/components/Launcher.js +121 -0
  145. package/lib/module/ui/components/Launcher.js.map +1 -0
  146. package/lib/module/ui/components/Markdown.js +253 -0
  147. package/lib/module/ui/components/Markdown.js.map +1 -0
  148. package/lib/module/ui/components/OutboundMessageCard.js +153 -0
  149. package/lib/module/ui/components/OutboundMessageCard.js.map +1 -0
  150. package/lib/module/ui/components/WidgetPanel.js +127 -0
  151. package/lib/module/ui/components/WidgetPanel.js.map +1 -0
  152. package/lib/module/ui/components/icons.js +370 -0
  153. package/lib/module/ui/components/icons.js.map +1 -0
  154. package/lib/module/ui/hooks/use-keyboard-overlap.js +109 -0
  155. package/lib/module/ui/hooks/use-keyboard-overlap.js.map +1 -0
  156. package/lib/module/ui/hooks/use-reduce-motion.js +34 -0
  157. package/lib/module/ui/hooks/use-reduce-motion.js.map +1 -0
  158. package/lib/module/ui/hooks/use-widget-insets.js +37 -0
  159. package/lib/module/ui/hooks/use-widget-insets.js.map +1 -0
  160. package/lib/module/ui/screens/chat/ChatView.js +586 -0
  161. package/lib/module/ui/screens/chat/ChatView.js.map +1 -0
  162. package/lib/module/ui/screens/chat/ChatView.styles.js +358 -0
  163. package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -0
  164. package/lib/module/ui/screens/chat/ChatView.types.js +4 -0
  165. package/lib/module/ui/screens/chat/ChatView.types.js.map +1 -0
  166. package/lib/module/ui/screens/conversations/ConversationsList.js +146 -0
  167. package/lib/module/ui/screens/conversations/ConversationsList.js.map +1 -0
  168. package/lib/module/ui/screens/conversations/ConversationsList.styles.js +114 -0
  169. package/lib/module/ui/screens/conversations/ConversationsList.styles.js.map +1 -0
  170. package/lib/module/ui/screens/conversations/ConversationsList.types.js +4 -0
  171. package/lib/module/ui/screens/conversations/ConversationsList.types.js.map +1 -0
  172. package/lib/module/ui/screens/home/HomeView.js +332 -0
  173. package/lib/module/ui/screens/home/HomeView.js.map +1 -0
  174. package/lib/module/ui/screens/home/HomeView.styles.js +242 -0
  175. package/lib/module/ui/screens/home/HomeView.styles.js.map +1 -0
  176. package/lib/module/ui/screens/home/HomeView.types.js +4 -0
  177. package/lib/module/ui/screens/home/HomeView.types.js.map +1 -0
  178. package/lib/module/ui/screens/home/greeting.js +44 -0
  179. package/lib/module/ui/screens/home/greeting.js.map +1 -0
  180. package/lib/module/ui/screens/pre-chat/PreChatForm.js +225 -0
  181. package/lib/module/ui/screens/pre-chat/PreChatForm.js.map +1 -0
  182. package/lib/module/ui/screens/pre-chat/PreChatForm.styles.js +121 -0
  183. package/lib/module/ui/screens/pre-chat/PreChatForm.styles.js.map +1 -0
  184. package/lib/module/ui/screens/pre-chat/PreChatForm.types.js +4 -0
  185. package/lib/module/ui/screens/pre-chat/PreChatForm.types.js.map +1 -0
  186. package/lib/module/ui/styles/global.js +51 -0
  187. package/lib/module/ui/styles/global.js.map +1 -0
  188. package/lib/module/ui/styles/theme.js +137 -0
  189. package/lib/module/ui/styles/theme.js.map +1 -0
  190. package/lib/module/ui/utils/conversations.js +115 -0
  191. package/lib/module/ui/utils/conversations.js.map +1 -0
  192. package/lib/module/ui/utils/html.js +39 -0
  193. package/lib/module/ui/utils/html.js.map +1 -0
  194. package/lib/module/ui/utils/native-gradient.js +60 -0
  195. package/lib/module/ui/utils/native-gradient.js.map +1 -0
  196. package/lib/module/ui/utils/rtl.js +49 -0
  197. package/lib/module/ui/utils/rtl.js.map +1 -0
  198. package/lib/module/ui/utils/safe-url.js +59 -0
  199. package/lib/module/ui/utils/safe-url.js.map +1 -0
  200. package/lib/typescript/commonjs/agent-ui-blocks.d.ts +20 -0
  201. package/lib/typescript/commonjs/agent-ui-blocks.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/api/client.d.ts +115 -0
  203. package/lib/typescript/commonjs/api/client.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/api/realtime.d.ts +39 -0
  205. package/lib/typescript/commonjs/api/realtime.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/api/sse-parser.d.ts +13 -0
  207. package/lib/typescript/commonjs/api/sse-parser.d.ts.map +1 -0
  208. package/lib/typescript/commonjs/controller.d.ts +15 -0
  209. package/lib/typescript/commonjs/controller.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/device-id.d.ts +15 -0
  211. package/lib/typescript/commonjs/device-id.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/events.d.ts +41 -0
  213. package/lib/typescript/commonjs/events.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/i18n.d.ts +78 -0
  215. package/lib/typescript/commonjs/i18n.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/index.d.ts +103 -0
  217. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/locales.d.ts +18 -0
  219. package/lib/typescript/commonjs/locales.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/package.json +1 -0
  221. package/lib/typescript/commonjs/push/push-notifications.d.ts +71 -0
  222. package/lib/typescript/commonjs/push/push-notifications.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/state/use-widget-state.d.ts +10 -0
  224. package/lib/typescript/commonjs/state/use-widget-state.d.ts.map +1 -0
  225. package/lib/typescript/commonjs/state/widget-store.d.ts +227 -0
  226. package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -0
  227. package/lib/typescript/commonjs/storage.d.ts +42 -0
  228. package/lib/typescript/commonjs/storage.d.ts.map +1 -0
  229. package/lib/typescript/commonjs/types.d.ts +391 -0
  230. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts +15 -0
  232. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -0
  233. package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts +27 -0
  234. package/lib/typescript/commonjs/ui/components/AgentUiBlocks.d.ts.map +1 -0
  235. package/lib/typescript/commonjs/ui/components/Avatar.d.ts +19 -0
  236. package/lib/typescript/commonjs/ui/components/Avatar.d.ts.map +1 -0
  237. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts +26 -0
  238. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts.map +1 -0
  239. package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts +27 -0
  240. package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts.map +1 -0
  241. package/lib/typescript/commonjs/ui/components/Gradient.d.ts +33 -0
  242. package/lib/typescript/commonjs/ui/components/Gradient.d.ts.map +1 -0
  243. package/lib/typescript/commonjs/ui/components/Launcher.d.ts +18 -0
  244. package/lib/typescript/commonjs/ui/components/Launcher.d.ts.map +1 -0
  245. package/lib/typescript/commonjs/ui/components/Markdown.d.ts +19 -0
  246. package/lib/typescript/commonjs/ui/components/Markdown.d.ts.map +1 -0
  247. package/lib/typescript/commonjs/ui/components/OutboundMessageCard.d.ts +20 -0
  248. package/lib/typescript/commonjs/ui/components/OutboundMessageCard.d.ts.map +1 -0
  249. package/lib/typescript/commonjs/ui/components/WidgetPanel.d.ts +26 -0
  250. package/lib/typescript/commonjs/ui/components/WidgetPanel.d.ts.map +1 -0
  251. package/lib/typescript/commonjs/ui/components/icons.d.ts +38 -0
  252. package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -0
  253. package/lib/typescript/commonjs/ui/hooks/use-keyboard-overlap.d.ts +33 -0
  254. package/lib/typescript/commonjs/ui/hooks/use-keyboard-overlap.d.ts.map +1 -0
  255. package/lib/typescript/commonjs/ui/hooks/use-reduce-motion.d.ts +11 -0
  256. package/lib/typescript/commonjs/ui/hooks/use-reduce-motion.d.ts.map +1 -0
  257. package/lib/typescript/commonjs/ui/hooks/use-widget-insets.d.ts +16 -0
  258. package/lib/typescript/commonjs/ui/hooks/use-widget-insets.d.ts.map +1 -0
  259. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +11 -0
  260. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -0
  261. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +349 -0
  262. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -0
  263. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +48 -0
  264. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -0
  265. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts +10 -0
  266. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts.map +1 -0
  267. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.styles.d.ts +113 -0
  268. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.styles.d.ts.map +1 -0
  269. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts +31 -0
  270. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -0
  271. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts +17 -0
  272. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts.map +1 -0
  273. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts +227 -0
  274. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts.map +1 -0
  275. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts +40 -0
  276. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts.map +1 -0
  277. package/lib/typescript/commonjs/ui/screens/home/greeting.d.ts +19 -0
  278. package/lib/typescript/commonjs/ui/screens/home/greeting.d.ts.map +1 -0
  279. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.d.ts +7 -0
  280. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.d.ts.map +1 -0
  281. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.styles.d.ts +115 -0
  282. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.styles.d.ts.map +1 -0
  283. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.types.d.ts +20 -0
  284. package/lib/typescript/commonjs/ui/screens/pre-chat/PreChatForm.types.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/ui/styles/global.d.ts +46 -0
  286. package/lib/typescript/commonjs/ui/styles/global.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/ui/styles/theme.d.ts +103 -0
  288. package/lib/typescript/commonjs/ui/styles/theme.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/ui/utils/conversations.d.ts +41 -0
  290. package/lib/typescript/commonjs/ui/utils/conversations.d.ts.map +1 -0
  291. package/lib/typescript/commonjs/ui/utils/html.d.ts +10 -0
  292. package/lib/typescript/commonjs/ui/utils/html.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/ui/utils/native-gradient.d.ts +61 -0
  294. package/lib/typescript/commonjs/ui/utils/native-gradient.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/ui/utils/rtl.d.ts +33 -0
  296. package/lib/typescript/commonjs/ui/utils/rtl.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/ui/utils/safe-url.d.ts +21 -0
  298. package/lib/typescript/commonjs/ui/utils/safe-url.d.ts.map +1 -0
  299. package/lib/typescript/module/agent-ui-blocks.d.ts +20 -0
  300. package/lib/typescript/module/agent-ui-blocks.d.ts.map +1 -0
  301. package/lib/typescript/module/api/client.d.ts +115 -0
  302. package/lib/typescript/module/api/client.d.ts.map +1 -0
  303. package/lib/typescript/module/api/realtime.d.ts +39 -0
  304. package/lib/typescript/module/api/realtime.d.ts.map +1 -0
  305. package/lib/typescript/module/api/sse-parser.d.ts +13 -0
  306. package/lib/typescript/module/api/sse-parser.d.ts.map +1 -0
  307. package/lib/typescript/module/controller.d.ts +15 -0
  308. package/lib/typescript/module/controller.d.ts.map +1 -0
  309. package/lib/typescript/module/device-id.d.ts +15 -0
  310. package/lib/typescript/module/device-id.d.ts.map +1 -0
  311. package/lib/typescript/module/events.d.ts +41 -0
  312. package/lib/typescript/module/events.d.ts.map +1 -0
  313. package/lib/typescript/module/i18n.d.ts +78 -0
  314. package/lib/typescript/module/i18n.d.ts.map +1 -0
  315. package/lib/typescript/module/index.d.ts +103 -0
  316. package/lib/typescript/module/index.d.ts.map +1 -0
  317. package/lib/typescript/module/locales.d.ts +18 -0
  318. package/lib/typescript/module/locales.d.ts.map +1 -0
  319. package/lib/typescript/module/package.json +1 -0
  320. package/lib/typescript/module/push/push-notifications.d.ts +71 -0
  321. package/lib/typescript/module/push/push-notifications.d.ts.map +1 -0
  322. package/lib/typescript/module/state/use-widget-state.d.ts +10 -0
  323. package/lib/typescript/module/state/use-widget-state.d.ts.map +1 -0
  324. package/lib/typescript/module/state/widget-store.d.ts +227 -0
  325. package/lib/typescript/module/state/widget-store.d.ts.map +1 -0
  326. package/lib/typescript/module/storage.d.ts +42 -0
  327. package/lib/typescript/module/storage.d.ts.map +1 -0
  328. package/lib/typescript/module/types.d.ts +391 -0
  329. package/lib/typescript/module/types.d.ts.map +1 -0
  330. package/lib/typescript/module/ui/WidgetProvider.d.ts +15 -0
  331. package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -0
  332. package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts +27 -0
  333. package/lib/typescript/module/ui/components/AgentUiBlocks.d.ts.map +1 -0
  334. package/lib/typescript/module/ui/components/Avatar.d.ts +19 -0
  335. package/lib/typescript/module/ui/components/Avatar.d.ts.map +1 -0
  336. package/lib/typescript/module/ui/components/ConversationRow.d.ts +26 -0
  337. package/lib/typescript/module/ui/components/ConversationRow.d.ts.map +1 -0
  338. package/lib/typescript/module/ui/components/ErrorBoundary.d.ts +27 -0
  339. package/lib/typescript/module/ui/components/ErrorBoundary.d.ts.map +1 -0
  340. package/lib/typescript/module/ui/components/Gradient.d.ts +33 -0
  341. package/lib/typescript/module/ui/components/Gradient.d.ts.map +1 -0
  342. package/lib/typescript/module/ui/components/Launcher.d.ts +18 -0
  343. package/lib/typescript/module/ui/components/Launcher.d.ts.map +1 -0
  344. package/lib/typescript/module/ui/components/Markdown.d.ts +19 -0
  345. package/lib/typescript/module/ui/components/Markdown.d.ts.map +1 -0
  346. package/lib/typescript/module/ui/components/OutboundMessageCard.d.ts +20 -0
  347. package/lib/typescript/module/ui/components/OutboundMessageCard.d.ts.map +1 -0
  348. package/lib/typescript/module/ui/components/WidgetPanel.d.ts +26 -0
  349. package/lib/typescript/module/ui/components/WidgetPanel.d.ts.map +1 -0
  350. package/lib/typescript/module/ui/components/icons.d.ts +38 -0
  351. package/lib/typescript/module/ui/components/icons.d.ts.map +1 -0
  352. package/lib/typescript/module/ui/hooks/use-keyboard-overlap.d.ts +33 -0
  353. package/lib/typescript/module/ui/hooks/use-keyboard-overlap.d.ts.map +1 -0
  354. package/lib/typescript/module/ui/hooks/use-reduce-motion.d.ts +11 -0
  355. package/lib/typescript/module/ui/hooks/use-reduce-motion.d.ts.map +1 -0
  356. package/lib/typescript/module/ui/hooks/use-widget-insets.d.ts +16 -0
  357. package/lib/typescript/module/ui/hooks/use-widget-insets.d.ts.map +1 -0
  358. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +11 -0
  359. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -0
  360. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +349 -0
  361. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -0
  362. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +48 -0
  363. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -0
  364. package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts +10 -0
  365. package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts.map +1 -0
  366. package/lib/typescript/module/ui/screens/conversations/ConversationsList.styles.d.ts +113 -0
  367. package/lib/typescript/module/ui/screens/conversations/ConversationsList.styles.d.ts.map +1 -0
  368. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts +31 -0
  369. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -0
  370. package/lib/typescript/module/ui/screens/home/HomeView.d.ts +17 -0
  371. package/lib/typescript/module/ui/screens/home/HomeView.d.ts.map +1 -0
  372. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts +227 -0
  373. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts.map +1 -0
  374. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts +40 -0
  375. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts.map +1 -0
  376. package/lib/typescript/module/ui/screens/home/greeting.d.ts +19 -0
  377. package/lib/typescript/module/ui/screens/home/greeting.d.ts.map +1 -0
  378. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.d.ts +7 -0
  379. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.d.ts.map +1 -0
  380. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.styles.d.ts +115 -0
  381. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.styles.d.ts.map +1 -0
  382. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.types.d.ts +20 -0
  383. package/lib/typescript/module/ui/screens/pre-chat/PreChatForm.types.d.ts.map +1 -0
  384. package/lib/typescript/module/ui/styles/global.d.ts +46 -0
  385. package/lib/typescript/module/ui/styles/global.d.ts.map +1 -0
  386. package/lib/typescript/module/ui/styles/theme.d.ts +103 -0
  387. package/lib/typescript/module/ui/styles/theme.d.ts.map +1 -0
  388. package/lib/typescript/module/ui/utils/conversations.d.ts +41 -0
  389. package/lib/typescript/module/ui/utils/conversations.d.ts.map +1 -0
  390. package/lib/typescript/module/ui/utils/html.d.ts +10 -0
  391. package/lib/typescript/module/ui/utils/html.d.ts.map +1 -0
  392. package/lib/typescript/module/ui/utils/native-gradient.d.ts +61 -0
  393. package/lib/typescript/module/ui/utils/native-gradient.d.ts.map +1 -0
  394. package/lib/typescript/module/ui/utils/rtl.d.ts +33 -0
  395. package/lib/typescript/module/ui/utils/rtl.d.ts.map +1 -0
  396. package/lib/typescript/module/ui/utils/safe-url.d.ts +21 -0
  397. package/lib/typescript/module/ui/utils/safe-url.d.ts.map +1 -0
  398. package/metro.js +40 -0
  399. package/package.json +116 -0
  400. package/src/agent-ui-blocks.ts +302 -0
  401. package/src/api/client.ts +332 -0
  402. package/src/api/realtime.ts +225 -0
  403. package/src/api/sse-parser.ts +51 -0
  404. package/src/controller.ts +20 -0
  405. package/src/device-id.ts +71 -0
  406. package/src/events.ts +74 -0
  407. package/src/i18n.ts +114 -0
  408. package/src/index.tsx +199 -0
  409. package/src/locales.ts +80 -0
  410. package/src/push/push-notifications.ts +254 -0
  411. package/src/state/use-widget-state.ts +20 -0
  412. package/src/state/widget-store.ts +1815 -0
  413. package/src/storage.ts +153 -0
  414. package/src/types.ts +445 -0
  415. package/src/ui/WidgetProvider.tsx +434 -0
  416. package/src/ui/components/AgentUiBlocks.tsx +912 -0
  417. package/src/ui/components/Avatar.tsx +86 -0
  418. package/src/ui/components/ConversationRow.tsx +163 -0
  419. package/src/ui/components/ErrorBoundary.tsx +49 -0
  420. package/src/ui/components/Gradient.tsx +165 -0
  421. package/src/ui/components/Launcher.tsx +128 -0
  422. package/src/ui/components/Markdown.tsx +291 -0
  423. package/src/ui/components/OutboundMessageCard.tsx +154 -0
  424. package/src/ui/components/WidgetPanel.tsx +133 -0
  425. package/src/ui/components/icons.tsx +315 -0
  426. package/src/ui/hooks/use-keyboard-overlap.ts +134 -0
  427. package/src/ui/hooks/use-reduce-motion.ts +39 -0
  428. package/src/ui/hooks/use-widget-insets.ts +44 -0
  429. package/src/ui/screens/chat/ChatView.styles.ts +357 -0
  430. package/src/ui/screens/chat/ChatView.tsx +690 -0
  431. package/src/ui/screens/chat/ChatView.types.ts +46 -0
  432. package/src/ui/screens/conversations/ConversationsList.styles.ts +111 -0
  433. package/src/ui/screens/conversations/ConversationsList.tsx +144 -0
  434. package/src/ui/screens/conversations/ConversationsList.types.ts +33 -0
  435. package/src/ui/screens/home/HomeView.styles.ts +246 -0
  436. package/src/ui/screens/home/HomeView.tsx +336 -0
  437. package/src/ui/screens/home/HomeView.types.ts +42 -0
  438. package/src/ui/screens/home/greeting.ts +50 -0
  439. package/src/ui/screens/pre-chat/PreChatForm.styles.ts +120 -0
  440. package/src/ui/screens/pre-chat/PreChatForm.tsx +221 -0
  441. package/src/ui/screens/pre-chat/PreChatForm.types.ts +22 -0
  442. package/src/ui/styles/global.ts +50 -0
  443. package/src/ui/styles/theme.ts +155 -0
  444. package/src/ui/utils/conversations.ts +122 -0
  445. package/src/ui/utils/html.ts +58 -0
  446. package/src/ui/utils/native-gradient.ts +60 -0
  447. package/src/ui/utils/rtl.ts +43 -0
  448. package/src/ui/utils/safe-url.ts +63 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Maps the widget's `GET /config` theming fields onto React Native styles.
3
+ *
4
+ * The palette mirrors the web widget so a workspace looks the same on both
5
+ * surfaces; type scales are nudged up because 13px body copy is unreadable on
6
+ * a phone (minimum readable body size is 15–16px).
7
+ */
8
+ import type { WidgetConfig } from '../../types';
9
+ export declare const palette: {
10
+ readonly white: "#ffffff";
11
+ readonly ink: "#1a1a1a";
12
+ readonly text: "#111827";
13
+ readonly textMuted: "#6b7280";
14
+ readonly textSubtle: "#9ca3af";
15
+ readonly textFaint: "#b0b0b0";
16
+ readonly border: "#e5e7eb";
17
+ readonly borderSoft: "#f3f4f6";
18
+ readonly surface: "#f9fafb";
19
+ readonly surfaceAlt: "#f3f4f6";
20
+ readonly danger: "#ef4444";
21
+ readonly warningBg: "#fef3c7";
22
+ readonly warningBorder: "#fde68a";
23
+ readonly warningText: "#92400e";
24
+ readonly warningIcon: "#d97706";
25
+ readonly online: "#22c55e";
26
+ readonly disabled: "#d1d5db";
27
+ };
28
+ export declare const radius: {
29
+ readonly sm: 8;
30
+ readonly md: 10;
31
+ readonly lg: 12;
32
+ readonly xl: 14;
33
+ readonly pill: 999;
34
+ };
35
+ export declare const spacing: {
36
+ readonly xs: 4;
37
+ readonly sm: 8;
38
+ readonly md: 12;
39
+ readonly lg: 16;
40
+ readonly xl: 20;
41
+ readonly xxl: 24;
42
+ };
43
+ /** Mobile type scale — one step larger than the web widget's. */
44
+ export declare const fontSize: {
45
+ readonly micro: 10;
46
+ readonly caption: 12;
47
+ readonly meta: 13;
48
+ readonly body: 15;
49
+ readonly input: 16;
50
+ readonly title: 17;
51
+ readonly heading: 22;
52
+ readonly display: 28;
53
+ };
54
+ export interface WidgetTheme {
55
+ primaryColor: string;
56
+ position: 'left' | 'right';
57
+ isOnline: boolean;
58
+ /** Only set when the widget is outside business hours and has a message. */
59
+ offlineMessage?: string;
60
+ startConversationLabel: string;
61
+ replyTimeLabel: string;
62
+ allowNewConversations: boolean;
63
+ showPreviousConversations: boolean;
64
+ attachmentsEnabled: boolean;
65
+ preChatEnabled: boolean;
66
+ }
67
+ export declare const DEFAULT_PRIMARY_COLOR = "#0d9488";
68
+ /**
69
+ * `override` supplies a translation for the active locale when one exists.
70
+ * Without it the workspace's single-language config fields are used, which is
71
+ * correct for the default locale and wrong for every other one.
72
+ */
73
+ export declare function buildTheme(config: WidgetConfig | null): WidgetTheme;
74
+ /** `#rrggbb` → `rgba(r, g, b, alpha)`; passes non-hex colors straight through. */
75
+ export declare function withAlpha(color: string, alpha: number): string;
76
+ export declare function hexToRgb(color: string): [number, number, number] | null;
77
+ /** Linear blend between two hex colors, used to fake gradients without a native lib. */
78
+ export declare function mixHex(from: string, to: string, ratio: number): string;
79
+ /** Pick readable foreground text for an arbitrary brand color. */
80
+ export declare function contrastingTextColor(background: string): string;
81
+ export declare const shadows: {
82
+ readonly card: {
83
+ readonly shadowColor: "#0f172a";
84
+ readonly shadowOffset: {
85
+ readonly width: 0;
86
+ readonly height: 4;
87
+ };
88
+ readonly shadowOpacity: 0.08;
89
+ readonly shadowRadius: 14;
90
+ readonly elevation: 3;
91
+ };
92
+ readonly floating: {
93
+ readonly shadowColor: "#000000";
94
+ readonly shadowOffset: {
95
+ readonly width: 0;
96
+ readonly height: 4;
97
+ };
98
+ readonly shadowOpacity: 0.15;
99
+ readonly shadowRadius: 12;
100
+ readonly elevation: 6;
101
+ };
102
+ };
103
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/ui/styles/theme.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBV,CAAC;AAEX,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;;CAOV,CAAC;AAEX,iEAAiE;AACjE,eAAO,MAAM,QAAQ;;;;;;;;;CASX,CAAC;AAEX,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,yBAAyB,EAAE,OAAO,CAAC;IACnC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;GAIG;AAGH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,WAAW,CAgBnE;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAYvE;AAED,wFAAwF;AACxF,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;CAeV,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Conversation selectors and formatting shared by the Home and Messages
3
+ * spaces, so the two can never disagree about ordering or wording.
4
+ * Pure and free of React so they stay trivial to test.
5
+ */
6
+ import type { Conversation } from '../../types';
7
+ export interface TeamAgent {
8
+ name: string | null;
9
+ avatar: string | null;
10
+ }
11
+ /**
12
+ * Newest first. The store patches a conversation in place when a message
13
+ * arrives and never reorders the array, so position is not recency — every
14
+ * surface that lists conversations has to sort for itself.
15
+ */
16
+ export declare function sortByRecency(conversations: Conversation[]): Conversation[];
17
+ export declare function pickRecentConversations(conversations: Conversation[], limit?: number): Conversation[];
18
+ /** Distinct agents the visitor has spoken to, most recent conversation first. */
19
+ export declare function pickTeamAgents(conversations: Conversation[], limit?: number): TeamAgent[];
20
+ /** Every unit is a translated template, so `2h` can become `منذ ساعتين`. */
21
+ export interface RelativeTimeLabels {
22
+ justNow: string;
23
+ minutes: string;
24
+ hours: string;
25
+ days: string;
26
+ months: string;
27
+ years: string;
28
+ }
29
+ export declare function formatRelativeTime(dateStr: string, labels: RelativeTimeLabels): string;
30
+ export declare function isSameDay(a: string, b: string): boolean;
31
+ /**
32
+ * Clock time beside a message. Intl ships with Hermes but is guarded anyway —
33
+ * a missing implementation should not blank out every timestamp in the thread.
34
+ */
35
+ export declare function formatClockTime(dateStr: string, locale: string): string;
36
+ /** "Today", "Yesterday", then a real date once it is older than that. */
37
+ export declare function formatDayLabel(dateStr: string, locale: string, labels: {
38
+ today: string;
39
+ yesterday: string;
40
+ }): string;
41
+ //# sourceMappingURL=conversations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/conversations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAOD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAE3E;AAED,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,KAAK,SAAI,GAAG,YAAY,EAAE,CAEhG;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,aAAa,EAAE,YAAY,EAAE,EAAE,KAAK,SAAI,GAAG,SAAS,EAAE,CAepF;AAED,4EAA4E;AAC5E,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,CActF;AAKD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQvE;AAED,yEAAyE;AACzE,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC3C,MAAM,CAmBR"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * HTML → text helpers. The CRM stores message bodies as HTML and campaign
3
+ * payloads as rich text; React Native has no DOMParser, so these are the
4
+ * regex equivalents of the web widget's `stripHtml` / `htmlToText`.
5
+ */
6
+ /** Block-level tags become newlines so paragraphs survive the strip. */
7
+ export declare function stripHtml(html: string): string;
8
+ /** Single-line flattening used for campaign cards and list snippets. */
9
+ export declare function htmlToText(html: string): string;
10
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/html.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW9C;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU/C"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * A real gradient when the host app happens to ship one, stacked bands when it
3
+ * does not.
4
+ *
5
+ * Stacked bands can only ever approximate a ramp: each strip is a solid fill,
6
+ * and once the strips are thin enough to hide the colour steps their heights
7
+ * start landing on fractional pixels, which shows up as faint seams. A native
8
+ * gradient has neither problem, so we use one where it exists — the same
9
+ * "borrow it from the host" approach as `safe-area.ts` and `storage.ts`.
10
+ *
11
+ * Resolution happens once at module load so component identity stays stable
12
+ * across renders.
13
+ */
14
+ import type { ComponentType, ReactNode } from 'react';
15
+ import type { StyleProp, ViewStyle } from 'react-native';
16
+ export interface NativeGradientProps {
17
+ colors: string[];
18
+ /** Stop positions in 0..1, matching `colors` one for one. */
19
+ locations?: number[];
20
+ start?: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ end?: {
25
+ x: number;
26
+ y: number;
27
+ };
28
+ style?: StyleProp<ViewStyle>;
29
+ pointerEvents?: 'none' | 'auto' | 'box-none' | 'box-only';
30
+ children?: ReactNode;
31
+ }
32
+ /** Null when the host installed no gradient library; callers fall back to bands. */
33
+ export declare function getNativeGradient(): ComponentType<NativeGradientProps> | null;
34
+ /** Top-to-bottom. The only direction the band fallback can draw. */
35
+ export declare const VERTICAL: {
36
+ readonly start: {
37
+ readonly x: 0.5;
38
+ readonly y: 0;
39
+ };
40
+ readonly end: {
41
+ readonly x: 0.5;
42
+ readonly y: 1;
43
+ };
44
+ };
45
+ /**
46
+ * Top-left to bottom-right, the same way round in every language. A brand
47
+ * ramp is a visual, not a sentence, so it does not mirror with the reading
48
+ * direction. Needs a native gradient: stacked bands are horizontal strips and
49
+ * can only ever run top to bottom.
50
+ */
51
+ export declare const DIAGONAL: {
52
+ readonly start: {
53
+ readonly x: 0;
54
+ readonly y: 0;
55
+ };
56
+ readonly end: {
57
+ readonly x: 1;
58
+ readonly y: 1;
59
+ };
60
+ };
61
+ //# sourceMappingURL=native-gradient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-gradient.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/native-gradient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,GAAG,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;IAC1D,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAaD,oFAAoF;AACpF,wBAAgB,iBAAiB,IAAI,aAAa,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAE7E;AAED,oEAAoE;AACpE,eAAO,MAAM,QAAQ;;;;;;;;;CAGX,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;CAGX,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Right-to-left helpers.
3
+ *
4
+ * Yoga mirrors `flexDirection: 'row'`, `flex-start`/`flex-end` and the
5
+ * `start`/`end` style props on its own once the host app has turned RTL on.
6
+ * What it cannot mirror is meaning: an arrow that points "forward" is drawn
7
+ * rightwards in English and leftwards in Arabic, and a bubble's tail corner
8
+ * swaps sides with it. Those decisions live here.
9
+ */
10
+ /**
11
+ * Text alignment follows the LAYOUT's direction, not the script's. Left to
12
+ * itself, a Latin string inside an Arabic screen renders hard against the
13
+ * left edge while everything around it is anchored right, which reads as a
14
+ * broken row rather than as mixed content.
15
+ *
16
+ * Read once at module load: switching direction requires an app restart.
17
+ */
18
+ export declare const START_ALIGN: 'left' | 'right';
19
+ export declare function isRTL(): boolean;
20
+ /** Deeper into the app: a disclosure chevron, a "continue" arrow. */
21
+ export declare function forwardDirection(): 'left' | 'right';
22
+ /** Back out of the current screen. */
23
+ export declare function backDirection(): 'left' | 'right';
24
+ /**
25
+ * Mirrors a glyph that is drawn pointing right. Cheaper and less error-prone
26
+ * than maintaining a second set of geometry for every directional icon.
27
+ */
28
+ export declare function flipForRTL(): {
29
+ transform: [{
30
+ scaleX: number;
31
+ }];
32
+ } | undefined;
33
+ //# sourceMappingURL=rtl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rtl.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/rtl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,GAAG,OAA8C,CAAC;AAElF,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED,qEAAqE;AACrE,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,OAAO,CAEnD;AAED,sCAAsC;AACtC,wBAAgB,aAAa,IAAI,MAAM,GAAG,OAAO,CAEhD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI;IAAE,SAAS,EAAE,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,SAAS,CAE5E"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The one gate every widget link goes through before `Linking.openURL`.
3
+ *
4
+ * Agent and AI replies, campaign CTAs and attachment URLs are remote content.
5
+ * Opened blindly they could fire the host app's own deep links
6
+ * (`myapp://transfer?…`), Android `intent:` URLs, `sms:` or `file:` URIs. Only
7
+ * web, mail and phone links open by default; the host can route anything else
8
+ * itself through `boot({ onOpenUrl })`.
9
+ */
10
+ type OpenUrlHandler = (url: string) => boolean | Promise<boolean>;
11
+ /** Set from `boot({ onOpenUrl })`; `null` restores the default policy. */
12
+ export declare function setOpenUrlHandler(handler: OpenUrlHandler | null): void;
13
+ /** Lower-cased scheme including the colon (`'https:'`), or null when relative. */
14
+ export declare function urlScheme(url: string): string | null;
15
+ /** Absolute `http(s)://host…` — the only shape media URLs may take. */
16
+ export declare function isHttpUrl(url: string): boolean;
17
+ export declare function isSafeExternalUrl(url: string): boolean;
18
+ /** Host handler first, then the allow-list. Never throws. */
19
+ export declare function openExternalUrl(url: string | null | undefined): Promise<void>;
20
+ export {};
21
+ //# sourceMappingURL=safe-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safe-url.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/safe-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AASlE,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAEtE;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGpD;AAED,uEAAuE;AACvE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKtD;AAED,6DAA6D;AAC7D,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBnF"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Structural parsing for agent-authored UI blocks.
3
+ *
4
+ * The CRM validates these with zod (`shared/agent-ui-blocks.ts`) before
5
+ * broadcasting, so this side only needs to reject malformed payloads rather
6
+ * than re-implement the schema — which keeps the SDK dependency-free. Action
7
+ * message formatting is copied verbatim so the transcript reads the same on
8
+ * web and mobile.
9
+ */
10
+ import type { AgentUiAction, AgentUiBlock, AgentProcedureForm } from './types';
11
+ /**
12
+ * Drops blocks this SDK version does not know how to render, or whose fields
13
+ * don't match what the renderer reads. Optional lists the server may omit
14
+ * come back as empty arrays.
15
+ */
16
+ export declare function parseAgentUiBlocks(value: unknown): AgentUiBlock[];
17
+ export declare function getAgentUiBlocks(metadata: Record<string, unknown> | null | undefined): AgentUiBlock[];
18
+ export declare function getProcedureForm(metadata: Record<string, unknown> | null | undefined): AgentProcedureForm | null;
19
+ export declare function formatAgentUiActionMessage(action: AgentUiAction): string;
20
+ //# sourceMappingURL=agent-ui-blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-ui-blocks.d.ts","sourceRoot":"","sources":["../../../src/agent-ui-blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAgM/E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,EAAE,CAmBjE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,kBAGpF;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACnD,kBAAkB,GAAG,IAAI,CAiB3B;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA+CxE"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Fetch client for `/api/widget/*`.
3
+ *
4
+ * Ported from the web widget's `client/src/widget/lib/api.ts`, with
5
+ * localStorage swapped for the storage adapter and EventSource moved to
6
+ * `api/realtime.ts`. Visitor tokens live up to 14 days with no refresh, so a
7
+ * 401 triggers one silent re-init + retry (single-flight, owned by the store).
8
+ * The token itself lives in `SecureStorage`.
9
+ */
10
+ import type { AgentUiAction, Conversation, InitResponse, Message, OutboundMessage, RepzoWidgetErrorCode, WidgetAttachment, WidgetConfig, WidgetUser } from '../types';
11
+ export declare function isTerminalErrorCode(code: string | null | undefined): boolean;
12
+ export declare class RepzoWidgetError extends Error {
13
+ readonly status: number;
14
+ readonly code: RepzoWidgetErrorCode;
15
+ constructor(message: string, status: number, code?: RepzoWidgetErrorCode);
16
+ /** Builds the error for a non-2xx `{ message, code }` body. */
17
+ static fromResponse(status: number, body: unknown): RepzoWidgetError;
18
+ }
19
+ export declare class WidgetApiClient {
20
+ private baseUrl;
21
+ private channelAccountId;
22
+ private token;
23
+ private tokenLoaded;
24
+ /**
25
+ * Set by the store: given the token that just got a 401, returns a valid
26
+ * token (fresh, or one another caller already minted), or null.
27
+ */
28
+ reauthorize: ((failedToken: string | null) => Promise<string | null>) | null;
29
+ /** Set by the store: a 403 with a terminal `code` came back from any endpoint. */
30
+ onTerminalError: ((error: RepzoWidgetError) => void) | null;
31
+ configure(baseUrl: string, channelAccountId: string): void;
32
+ getBaseUrl(): string;
33
+ getChannelAccountId(): string;
34
+ getToken(): Promise<string | null>;
35
+ setToken(token: string): Promise<void>;
36
+ clearToken(): Promise<void>;
37
+ /**
38
+ * Absolute URL for a server media path (avatars, attachments). Only ever
39
+ * returns `http(s)` — relative paths resolve against `baseUrl`; any other
40
+ * scheme (`file:`, `data:`, `intent:`, host deep links…) yields null.
41
+ */
42
+ resolveUrl(url: string | null | undefined): string | null;
43
+ private request;
44
+ /** Public config. `platform` makes the server apply the Mobile SDKs overrides. */
45
+ getConfig(platform?: 'ios' | 'android' | 'web'): Promise<WidgetConfig>;
46
+ getOutboundMessage(): Promise<{
47
+ message: OutboundMessage | null;
48
+ }>;
49
+ /**
50
+ * Does NOT store the returned token — the store persists it only once it
51
+ * knows the identity op that asked for it is still current.
52
+ */
53
+ init(params: {
54
+ user?: WidgetUser;
55
+ trackingVisitorId?: string;
56
+ platform?: string;
57
+ sdkVersion?: string;
58
+ /** False for fresh sessions — never resume another identity's token. */
59
+ resumeToken?: boolean;
60
+ }): Promise<InitResponse>;
61
+ /** Revokes `token` server-side. A 401 means it was already dead — fine. */
62
+ logout(token: string): Promise<void>;
63
+ sendMessage(data: {
64
+ conversationId?: string;
65
+ forceNewConversation?: boolean;
66
+ body: string;
67
+ attachments?: WidgetAttachment[];
68
+ visitorName?: string;
69
+ visitorEmail?: string;
70
+ agentUiAction?: AgentUiAction;
71
+ }): Promise<{
72
+ messageId: string;
73
+ conversationId: string;
74
+ isNewConversation: boolean;
75
+ }>;
76
+ listConversations(): Promise<{
77
+ data: Conversation[];
78
+ }>;
79
+ listMessages(conversationId: string, cursor?: string | null): Promise<{
80
+ data: Message[];
81
+ meta: {
82
+ hasMore: boolean;
83
+ nextCursor: string | null;
84
+ };
85
+ }>;
86
+ /**
87
+ * Advances the visitor's read cursor for a thread they're watching live.
88
+ * Best effort and `skipReauth`: a burst of live replies must never turn an
89
+ * expired token into a burst of re-inits.
90
+ */
91
+ markConversationRead(conversationId: string): Promise<void>;
92
+ identify(data: {
93
+ email?: string;
94
+ name?: string;
95
+ phone?: string;
96
+ customAttributes?: Record<string, string | number | boolean>;
97
+ }): Promise<void>;
98
+ sendTyping(conversationId: string, isTyping: boolean): Promise<void>;
99
+ trackEvent(data: {
100
+ event: string;
101
+ visitorId?: string | null;
102
+ metadata?: Record<string, unknown>;
103
+ }): Promise<void>;
104
+ registerPushToken(data: {
105
+ token: string;
106
+ platform: string;
107
+ bundleId?: string;
108
+ }): Promise<void>;
109
+ /** Logout passes the session's token explicitly and `skipReauth`. */
110
+ removePushToken(token: string, auth?: {
111
+ authToken?: string | null;
112
+ skipReauth?: boolean;
113
+ }): Promise<void>;
114
+ }
115
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/api/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * SSE transport over `GET /api/widget/sse`, authenticated with an
3
+ * `Authorization: Bearer` header (never the query string, which ends up in
4
+ * proxy and server access logs).
5
+ *
6
+ * Uses React Native's streaming XMLHttpRequest and handles both network
7
+ * failures and successful stream EOF with exponential reconnect backoff.
8
+ * Auth failures never retry here: 401 hands over to the store's re-init,
9
+ * while 403 is terminal.
10
+ */
11
+ import type { WidgetRealtimeEvent } from '../types';
12
+ import { RepzoWidgetError } from './client';
13
+ export type RealtimeHandler = (event: WidgetRealtimeEvent, data: any) => void;
14
+ export interface RealtimeAuthHooks {
15
+ /** 401: the token expired or was revoked. The stream stays closed. */
16
+ onUnauthorized(token: string): void;
17
+ /** 403 (e.g. `messenger_api_disabled`): terminal, the stream stays closed. */
18
+ onForbidden(error: RepzoWidgetError): void;
19
+ }
20
+ export declare class WidgetRealtime {
21
+ private source;
22
+ private connected;
23
+ private reconnectTimer;
24
+ private attempt;
25
+ private closedByUs;
26
+ private url;
27
+ private token;
28
+ private handler;
29
+ private authHooks;
30
+ private authErrorTimer;
31
+ connect(baseUrl: string, token: string, handler: RealtimeHandler, authHooks?: RealtimeAuthHooks): void;
32
+ private open;
33
+ private handleAuthError;
34
+ private scheduleReconnect;
35
+ private teardownSource;
36
+ get isConnected(): boolean;
37
+ close(): void;
38
+ }
39
+ //# sourceMappingURL=realtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.d.ts","sourceRoot":"","sources":["../../../../src/api/realtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAsB5C,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,mBAAmB,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;AAE9E,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,8EAA8E;IAC9E,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC5C;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAA+B;IAE7C,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,cAAc,CAA8C;IAEpE,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,GAAG,CAAuB;IAElC,OAAO,CAAC,KAAK,CAAuB;IAEpC,OAAO,CAAC,OAAO,CAAgC;IAE/C,OAAO,CAAC,SAAS,CAAkC;IAEnD,OAAO,CAAC,cAAc,CAA8C;IAEpE,OAAO,CACL,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,EACxB,SAAS,CAAC,EAAE,iBAAiB,GAC5B,IAAI;IAUP,OAAO,CAAC,IAAI;IAyEZ,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,cAAc;IAiBtB,IAAI,WAAW,IAAI,OAAO,CAIzB;IAED,KAAK,IAAI,IAAI;CAad"}
@@ -0,0 +1,13 @@
1
+ /** Incremental SSE framing. A blank line dispatches an event; EOF alone does not. */
2
+ export declare class SseParser {
3
+ private readonly dispatch;
4
+ private line;
5
+ private event;
6
+ private data;
7
+ private afterCR;
8
+ private atStart;
9
+ constructor(dispatch: (event: string, data: string) => void);
10
+ push(chunk: string): void;
11
+ private readLine;
12
+ }
13
+ //# sourceMappingURL=sse-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sse-parser.d.ts","sourceRoot":"","sources":["../../../../src/api/sse-parser.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,qBAAa,SAAS;IAOR,OAAO,CAAC,QAAQ,CAAC,QAAQ;IANrC,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,KAAK,CAAM;IACnB,OAAO,CAAC,IAAI,CAAgB;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAQ;gBAEM,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI;IAE5E,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAqBzB,OAAO,CAAC,QAAQ;CAmBjB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Process-wide singleton that owns the store (and therefore the session, the
3
+ * SSE stream and the unread count). Imperative API calls land here whether or
4
+ * not `<RepzoWidgetProvider>` is mounted; the provider is a pure subscriber, so
5
+ * commands issued before boot finishes simply land in state and render once the
6
+ * provider mounts.
7
+ */
8
+ import { WidgetStore } from './state/widget-store';
9
+ declare class RepzoWidgetController {
10
+ readonly store: WidgetStore;
11
+ get events(): import("./events").EventEmitter;
12
+ }
13
+ export declare const controller: RepzoWidgetController;
14
+ export type { RepzoWidgetController };
15
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/controller.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,cAAM,qBAAqB;IACzB,QAAQ,CAAC,KAAK,cAAqB;IAEnC,IAAI,MAAM,oCAET;CACF;AAED,eAAO,MAAM,UAAU,uBAA8B,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Per-install id sent as `trackingVisitorId`. This is the mobile equivalent of
3
+ * the web widget's `repzo_vid` cookie: it lets the CRM stitch an anonymous
4
+ * visitor back together if the session token is ever lost. Stable until
5
+ * `logout()`, which rotates it.
6
+ */
7
+ export declare function getDeviceId(): Promise<string>;
8
+ /** Only used by tests and `rotateDeviceId()`. */
9
+ export declare function resetDeviceIdCache(): void;
10
+ /**
11
+ * Called by `logout()`: the id stitches anonymous sessions together, so on a
12
+ * shared device the next visitor must not inherit the previous user's.
13
+ */
14
+ export declare function rotateDeviceId(): Promise<void>;
15
+ //# sourceMappingURL=device-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-id.d.ts","sourceRoot":"","sources":["../../../src/device-id.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsCH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAanD;AAED,iDAAiD;AACjD,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAGpD"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Tiny typed event emitter. Pure JS — no NativeEventEmitter, so listeners work
3
+ * identically on iOS, Android and in tests.
4
+ */
5
+ import type { Conversation, Message } from './types';
6
+ export declare const RepzoWidgetEvents: {
7
+ readonly UnreadCountDidChange: "repzoWidget.unreadCountDidChange";
8
+ readonly MessageDidArrive: "repzoWidget.messageDidArrive";
9
+ /** The visitor opened a thread — hosts use it to dismiss that conversation's push notification. */
10
+ readonly ConversationDidRead: "repzoWidget.conversationDidRead";
11
+ readonly WindowDidShow: "repzoWidget.windowDidShow";
12
+ readonly WindowDidHide: "repzoWidget.windowDidHide";
13
+ };
14
+ export type RepzoWidgetEvent = (typeof RepzoWidgetEvents)[keyof typeof RepzoWidgetEvents];
15
+ export interface MessageDidArrivePayload {
16
+ conversationId: string;
17
+ message: Message;
18
+ /** Null when the reply lands before this device has listed the thread. */
19
+ conversation: Conversation | null;
20
+ }
21
+ export interface RepzoWidgetEventPayloads {
22
+ [RepzoWidgetEvents.UnreadCountDidChange]: {
23
+ count: number;
24
+ };
25
+ [RepzoWidgetEvents.MessageDidArrive]: MessageDidArrivePayload;
26
+ [RepzoWidgetEvents.ConversationDidRead]: {
27
+ conversationId: string;
28
+ };
29
+ [RepzoWidgetEvents.WindowDidShow]: undefined;
30
+ [RepzoWidgetEvents.WindowDidHide]: undefined;
31
+ }
32
+ export interface EventSubscription {
33
+ remove(): void;
34
+ }
35
+ export declare class EventEmitter {
36
+ private listeners;
37
+ addListener<E extends RepzoWidgetEvent>(event: E, listener: (payload: RepzoWidgetEventPayloads[E]) => void): EventSubscription;
38
+ emit<E extends RepzoWidgetEvent>(event: E, payload: RepzoWidgetEventPayloads[E]): void;
39
+ removeAllListeners(): void;
40
+ }
41
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,iBAAiB;;;IAG5B,mGAAmG;;;;CAI3F,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAE1F,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,EAAE,uBAAuB,CAAC;IAC9D,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;IAC7C,CAAC,iBAAiB,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC;CAC9C;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,IAAI,CAAC;CAChB;AAID,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAoC;IAErD,WAAW,CAAC,CAAC,SAAS,gBAAgB,EACpC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAAK,IAAI,GACvD,iBAAiB;IAYpB,IAAI,CAAC,CAAC,SAAS,gBAAgB,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI;IAatF,kBAAkB,IAAI,IAAI;CAG3B"}