@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,245 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.styles = exports.START_CARD_MIN_HEIGHT = exports.START_CARD_LIFT = exports.HEADER_MIN_HEIGHT = exports.HEADER_FADE_HEIGHT = exports.HEADER_BOTTOM_PADDING = exports.CLOSE_ICON_SIZE = exports.CLOSE_BUTTON_SIZE = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _ConversationRow = require("../../components/ConversationRow.js");
9
+ var _theme = require("../../styles/theme.js");
10
+ var _rtl = require("../../utils/rtl.js");
11
+ /**
12
+ * Styles and layout constants for the Home space. The constants live next to
13
+ * the sheet so the component and the styles can never disagree about them.
14
+ */
15
+
16
+ /**
17
+ * Header geometry in dp, measured off the web widget so the two surfaces line
18
+ * up: a tall header with the greeting pinned low, a start card that overhangs
19
+ * the seam by a fixed amount rather than half its height, and a fade that is a
20
+ * straight white ramp over the bottom of the header, starting just under the
21
+ * heading.
22
+ */
23
+ const HEADER_MIN_HEIGHT = exports.HEADER_MIN_HEIGHT = 228;
24
+ /** Between the greeting and whatever comes next: the seam, or the start card. */
25
+ const HEADER_BOTTOM_PADDING = exports.HEADER_BOTTOM_PADDING = 36;
26
+ const START_CARD_LIFT = exports.START_CARD_LIFT = 28;
27
+ const START_CARD_MIN_HEIGHT = exports.START_CARD_MIN_HEIGHT = 76;
28
+ const HEADER_FADE_HEIGHT = exports.HEADER_FADE_HEIGHT = 90;
29
+ const CLOSE_BUTTON_SIZE = exports.CLOSE_BUTTON_SIZE = 28;
30
+ const CLOSE_ICON_SIZE = exports.CLOSE_ICON_SIZE = 14;
31
+ const styles = exports.styles = _reactNative.StyleSheet.create({
32
+ contentContainer: {
33
+ flexGrow: 1
34
+ },
35
+ // Tall on purpose, with the greeting pinned to the bottom by `headerSpacer`:
36
+ // the close row stays at the top and the heading sits just above the seam.
37
+ header: {
38
+ minHeight: HEADER_MIN_HEIGHT,
39
+ paddingHorizontal: _theme.spacing.xl,
40
+ paddingTop: _theme.spacing.xl,
41
+ // When the start card is shown the component grows this to clear the card.
42
+ paddingBottom: HEADER_BOTTOM_PADDING,
43
+ overflow: 'hidden'
44
+ },
45
+ imageScrim: {
46
+ ..._reactNative.StyleSheet.absoluteFillObject,
47
+ backgroundColor: 'rgba(0,0,0,0.16)'
48
+ },
49
+ // Always as tall as the logo slot, so the greeting lands in the same place
50
+ // whether or not the workspace uploaded a logo.
51
+ headerTop: {
52
+ flexDirection: 'row',
53
+ alignItems: 'flex-start',
54
+ justifyContent: 'space-between',
55
+ minHeight: 40
56
+ },
57
+ // Soaks up the header's spare height so the greeting hugs the seam, and
58
+ // never shrinks below the gap the web widget keeps under the close row.
59
+ headerSpacer: {
60
+ flex: 1,
61
+ minHeight: 40
62
+ },
63
+ logo: {
64
+ width: 132,
65
+ height: 40
66
+ },
67
+ closeButton: {
68
+ marginStart: 'auto',
69
+ padding: (CLOSE_BUTTON_SIZE - CLOSE_ICON_SIZE) / 2,
70
+ borderRadius: _theme.radius.pill,
71
+ backgroundColor: 'rgba(255,255,255,0.18)'
72
+ },
73
+ heading: {
74
+ textAlign: _rtl.START_ALIGN,
75
+ fontSize: _theme.fontSize.display,
76
+ lineHeight: _theme.fontSize.display * 1.15,
77
+ fontWeight: '600',
78
+ marginBottom: _theme.spacing.md
79
+ },
80
+ subheading: {
81
+ textAlign: _rtl.START_ALIGN,
82
+ fontSize: _theme.fontSize.body,
83
+ lineHeight: _theme.fontSize.body * 1.4
84
+ },
85
+ // Meets the header on a straight seam. No top padding here: the start card
86
+ // is pulled up past this edge, and the rest of the content takes its spacing
87
+ // from `bodyContent`.
88
+ body: {
89
+ flex: 1,
90
+ backgroundColor: _theme.palette.white,
91
+ paddingHorizontal: _theme.spacing.xl,
92
+ paddingBottom: _theme.spacing.xxl
93
+ },
94
+ bodyContent: {
95
+ flex: 1,
96
+ paddingTop: _theme.spacing.xl
97
+ },
98
+ offlineNotice: {
99
+ flexDirection: 'row',
100
+ alignItems: 'flex-start',
101
+ gap: _theme.spacing.sm + 2,
102
+ padding: _theme.spacing.md,
103
+ borderRadius: _theme.radius.md,
104
+ backgroundColor: _theme.palette.warningBg,
105
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
106
+ borderColor: _theme.palette.warningBorder,
107
+ marginBottom: _theme.spacing.lg
108
+ },
109
+ offlineText: {
110
+ textAlign: _rtl.START_ALIGN,
111
+ flex: 1,
112
+ fontSize: _theme.fontSize.meta,
113
+ lineHeight: _theme.fontSize.meta * 1.4,
114
+ color: _theme.palette.warningText
115
+ },
116
+ startCardSlot: {
117
+ marginTop: -START_CARD_LIFT
118
+ },
119
+ // Neutral and opaque, like the web card: it spans two backgrounds, and a
120
+ // translucent or brand-tinted fill would let the header bleed through its
121
+ // top or stain the seam. Shadowed because without it the half over the
122
+ // header reads as a flat cut-out.
123
+ startCard: {
124
+ flexDirection: 'row',
125
+ alignItems: 'center',
126
+ gap: _theme.spacing.md,
127
+ minHeight: START_CARD_MIN_HEIGHT,
128
+ paddingHorizontal: _theme.spacing.xl,
129
+ paddingVertical: _theme.spacing.lg + 2,
130
+ borderRadius: _theme.radius.lg,
131
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
132
+ borderColor: _theme.palette.border,
133
+ backgroundColor: _theme.palette.surface,
134
+ ..._theme.shadows.card
135
+ },
136
+ startCardPressed: {
137
+ opacity: 0.85
138
+ },
139
+ startIcon: {
140
+ width: 40,
141
+ height: 40,
142
+ borderRadius: 20,
143
+ alignItems: 'center',
144
+ justifyContent: 'center'
145
+ },
146
+ startCopy: {
147
+ flex: 1,
148
+ minWidth: 0
149
+ },
150
+ startTitle: {
151
+ textAlign: _rtl.START_ALIGN,
152
+ fontSize: _theme.fontSize.title,
153
+ fontWeight: '600',
154
+ color: _theme.palette.ink
155
+ },
156
+ startSubtitle: {
157
+ textAlign: _rtl.START_ALIGN,
158
+ fontSize: _theme.fontSize.meta,
159
+ color: _theme.palette.textSubtle,
160
+ marginTop: 2
161
+ },
162
+ recentHeader: {
163
+ flexDirection: 'row',
164
+ alignItems: 'center',
165
+ justifyContent: 'space-between',
166
+ minHeight: 28,
167
+ marginBottom: _theme.spacing.sm
168
+ },
169
+ recentTitle: {
170
+ textAlign: _rtl.START_ALIGN,
171
+ fontSize: _theme.fontSize.caption,
172
+ fontWeight: '700',
173
+ color: _theme.palette.textMuted,
174
+ letterSpacing: _reactNative.I18nManager.isRTL ? 0 : 0.6,
175
+ textTransform: 'uppercase'
176
+ },
177
+ viewAllButton: {
178
+ minHeight: 32,
179
+ paddingHorizontal: _theme.spacing.xs,
180
+ justifyContent: 'center'
181
+ },
182
+ viewAllLabel: {
183
+ textAlign: _rtl.START_ALIGN,
184
+ fontSize: _theme.fontSize.meta,
185
+ fontWeight: '600'
186
+ },
187
+ // Border rather than a shadow: `overflow: hidden` keeps the rows' ripple
188
+ // inside the rounded corners, and would clip a shadow on iOS anyway.
189
+ recentCard: {
190
+ overflow: 'hidden'
191
+ },
192
+ recentDivider: {
193
+ marginStart: (0, _ConversationRow.rowDividerInset)(_theme.spacing.lg)
194
+ },
195
+ // Absorbs the slack so the status strip stays pinned to the bottom, and
196
+ // centers the empty hint when there is nothing else to show.
197
+ spacer: {
198
+ flex: 1,
199
+ minHeight: _theme.spacing.lg,
200
+ justifyContent: 'center'
201
+ },
202
+ emptyHint: {
203
+ alignItems: 'center',
204
+ gap: _theme.spacing.sm,
205
+ paddingVertical: _theme.spacing.xl
206
+ },
207
+ emptyHintText: {
208
+ fontSize: _theme.fontSize.meta,
209
+ color: _theme.palette.textSubtle,
210
+ textAlign: 'center'
211
+ },
212
+ statusStrip: {
213
+ flexDirection: 'row',
214
+ alignItems: 'center',
215
+ gap: _theme.spacing.sm + 2,
216
+ minHeight: 56,
217
+ paddingTop: _theme.spacing.lg,
218
+ marginTop: _theme.spacing.lg,
219
+ borderTopWidth: _reactNative.StyleSheet.hairlineWidth,
220
+ borderTopColor: _theme.palette.borderSoft
221
+ },
222
+ avatarStack: {
223
+ flexDirection: 'row',
224
+ alignItems: 'center'
225
+ },
226
+ avatarStackItem: {
227
+ borderWidth: 2,
228
+ borderColor: _theme.palette.white
229
+ },
230
+ avatarStackOverlap: {
231
+ marginStart: -10
232
+ },
233
+ statusDot: {
234
+ width: 8,
235
+ height: 8,
236
+ borderRadius: 4
237
+ },
238
+ statusText: {
239
+ textAlign: _rtl.START_ALIGN,
240
+ flex: 1,
241
+ fontSize: _theme.fontSize.meta,
242
+ color: _theme.palette.textMuted
243
+ }
244
+ });
245
+ //# sourceMappingURL=HomeView.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_ConversationRow","_theme","_rtl","HEADER_MIN_HEIGHT","exports","HEADER_BOTTOM_PADDING","START_CARD_LIFT","START_CARD_MIN_HEIGHT","HEADER_FADE_HEIGHT","CLOSE_BUTTON_SIZE","CLOSE_ICON_SIZE","styles","StyleSheet","create","contentContainer","flexGrow","header","minHeight","paddingHorizontal","spacing","xl","paddingTop","paddingBottom","overflow","imageScrim","absoluteFillObject","backgroundColor","headerTop","flexDirection","alignItems","justifyContent","headerSpacer","flex","logo","width","height","closeButton","marginStart","padding","borderRadius","radius","pill","heading","textAlign","START_ALIGN","fontSize","display","lineHeight","fontWeight","marginBottom","md","subheading","body","palette","white","xxl","bodyContent","offlineNotice","gap","sm","warningBg","borderWidth","hairlineWidth","borderColor","warningBorder","lg","offlineText","meta","color","warningText","startCardSlot","marginTop","startCard","paddingVertical","border","surface","shadows","card","startCardPressed","opacity","startIcon","startCopy","minWidth","startTitle","title","ink","startSubtitle","textSubtle","recentHeader","recentTitle","caption","textMuted","letterSpacing","I18nManager","isRTL","textTransform","viewAllButton","xs","viewAllLabel","recentCard","recentDivider","rowDividerInset","spacer","emptyHint","emptyHintText","statusStrip","borderTopWidth","borderTopColor","borderSoft","avatarStack","avatarStackItem","avatarStackOverlap","statusDot","statusText"],"sourceRoot":"../../../../../src","sources":["ui/screens/home/HomeView.styles.ts"],"mappings":";;;;;;AAKA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AATA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,GAAG;AACpC;AACO,MAAME,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAAG,EAAE;AAChC,MAAMC,eAAe,GAAAF,OAAA,CAAAE,eAAA,GAAG,EAAE;AAC1B,MAAMC,qBAAqB,GAAAH,OAAA,CAAAG,qBAAA,GAAG,EAAE;AAChC,MAAMC,kBAAkB,GAAAJ,OAAA,CAAAI,kBAAA,GAAG,EAAE;AAC7B,MAAMC,iBAAiB,GAAAL,OAAA,CAAAK,iBAAA,GAAG,EAAE;AAC5B,MAAMC,eAAe,GAAAN,OAAA,CAAAM,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C;EACvB,CAAC;EACDyD,kBAAkB,EAAE;IAClB1E,WAAW,EAAE,CAAC;EAChB,CAAC;EACD2E,SAAS,EAAE;IACT9E,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTI,YAAY,EAAE;EAChB,CAAC;EACD0E,UAAU,EAAE;IACVtE,SAAS,EAAEC,gBAAW;IACtBZ,IAAI,EAAE,CAAC;IACPa,QAAQ,EAAEA,eAAQ,CAACsB,IAAI;IACvBC,KAAK,EAAEf,cAAO,CAACsC;EACjB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=HomeView.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["ui/screens/home/HomeView.types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.firstName = firstName;
7
+ exports.personalizeGreeting = personalizeGreeting;
8
+ /**
9
+ * Greeting helpers for the Home space. The admin's heading renders exactly as
10
+ * the dashboard sent it, with one exception: an explicit name token, which is
11
+ * the admin asking for the visitor's first name to be filled in.
12
+ * Deliberately free of React and React Native so they stay trivial to test.
13
+ */
14
+
15
+ /** `{{name}}`, `{name}`, `{{first_name}}` all stand in for the visitor's first name. */
16
+ const NAME_TOKEN = /\{\{?\s*(?:name|first_?name)\s*\}?\}/gi;
17
+ const EMAIL_LIKE = /@/;
18
+ const PHONE_LIKE = /^[\d\s+()\-.]+$/;
19
+
20
+ /**
21
+ * First name suitable for greeting someone by. Hosts sometimes put an email or
22
+ * a phone number in the name field, and greeting "Hi rep@acme.com" is worse
23
+ * than not personalizing at all.
24
+ */
25
+ function firstName(fullName) {
26
+ const trimmed = (fullName ?? '').trim();
27
+ if (!trimmed || EMAIL_LIKE.test(trimmed) || PHONE_LIKE.test(trimmed)) return null;
28
+ const candidate = (trimmed.split(/\s+/)[0] ?? '').replace(/[,;:.]+$/, '');
29
+ // Under 2 rejects a bare initial; over 24 means a sentence landed in the field.
30
+ if (candidate.length < 2 || candidate.length > 24) return null;
31
+ return candidate;
32
+ }
33
+
34
+ /** Repair the spacing and punctuation left behind when a token resolves to nothing. */
35
+ function tidy(value) {
36
+ return value.replace(/\s+/g, ' ').replace(/\s+([,!?.:;])/g, '$1').replace(/^[\s,]+/, '').trim();
37
+ }
38
+
39
+ /**
40
+ * Resolve the admin's heading against the visitor's name. Only an explicit
41
+ * token is substituted: a generic "Hi there" stays "Hi there", because that is
42
+ * what the dashboard preview shows the admin and the phone has to match it.
43
+ */
44
+ function personalizeGreeting(template, visitorName, fallback) {
45
+ const base = (template ?? '').trim() || fallback;
46
+ const tokenized = base.replace(NAME_TOKEN, firstName(visitorName) ?? '');
47
+ return tokenized === base ? base : tidy(tokenized);
48
+ }
49
+ //# sourceMappingURL=greeting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NAME_TOKEN","EMAIL_LIKE","PHONE_LIKE","firstName","fullName","trimmed","trim","test","candidate","split","replace","length","tidy","value","personalizeGreeting","template","visitorName","fallback","base","tokenized"],"sourceRoot":"../../../../../src","sources":["ui/screens/home/greeting.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,UAAU,GAAG,wCAAwC;AAE3D,MAAMC,UAAU,GAAG,GAAG;AACtB,MAAMC,UAAU,GAAG,iBAAiB;;AAEpC;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAACC,QAAwB,EAAiB;EACjE,MAAMC,OAAO,GAAG,CAACD,QAAQ,IAAI,EAAE,EAAEE,IAAI,CAAC,CAAC;EACvC,IAAI,CAACD,OAAO,IAAIJ,UAAU,CAACM,IAAI,CAACF,OAAO,CAAC,IAAIH,UAAU,CAACK,IAAI,CAACF,OAAO,CAAC,EAAE,OAAO,IAAI;EACjF,MAAMG,SAAS,GAAG,CAACH,OAAO,CAACI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAEC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;EACzE;EACA,IAAIF,SAAS,CAACG,MAAM,GAAG,CAAC,IAAIH,SAAS,CAACG,MAAM,GAAG,EAAE,EAAE,OAAO,IAAI;EAC9D,OAAOH,SAAS;AAClB;;AAEA;AACA,SAASI,IAAIA,CAACC,KAAa,EAAU;EACnC,OAAOA,KAAK,CACTH,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CACpBA,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAC/BA,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CACtBJ,IAAI,CAAC,CAAC;AACX;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASQ,mBAAmBA,CACjCC,QAAmC,EACnCC,WAAsC,EACtCC,QAAgB,EACR;EACR,MAAMC,IAAI,GAAG,CAACH,QAAQ,IAAI,EAAE,EAAET,IAAI,CAAC,CAAC,IAAIW,QAAQ;EAChD,MAAME,SAAS,GAAGD,IAAI,CAACR,OAAO,CAACV,UAAU,EAAEG,SAAS,CAACa,WAAW,CAAC,IAAI,EAAE,CAAC;EACxE,OAAOG,SAAS,KAAKD,IAAI,GAAGA,IAAI,GAAGN,IAAI,CAACO,SAAS,CAAC;AACpD","ignoreList":[]}
@@ -0,0 +1,229 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PreChatForm = PreChatForm;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _i18n = require("../../../i18n.js");
10
+ var _Gradient = require("../../components/Gradient.js");
11
+ var _icons = require("../../components/icons.js");
12
+ var _global = require("../../styles/global.js");
13
+ var _theme = require("../../styles/theme.js");
14
+ var _rtl = require("../../utils/rtl.js");
15
+ var _PreChatFormStyles = require("./PreChatForm.styles.js");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ /**
18
+ * Pre-chat form — collects visitor info before the first message.
19
+ * Port of `client/src/widget/components/PreChatForm.tsx`.
20
+ */
21
+
22
+ /** Breathing room kept under a focused field when it is scrolled into view. */
23
+ const FIELD_GUTTER = 16;
24
+ function PreChatForm({
25
+ fields,
26
+ color,
27
+ labels,
28
+ onSubmit,
29
+ onSkip,
30
+ onClose
31
+ }) {
32
+ const [values, setValues] = (0, _react.useState)({});
33
+ const [errors, setErrors] = (0, _react.useState)({});
34
+ const scrollRef = (0, _react.useRef)(null);
35
+ const scrollOffset = (0, _react.useRef)(0);
36
+ const viewportHeight = (0, _react.useRef)(0);
37
+ const fieldRefs = (0, _react.useRef)({});
38
+ const focusedField = (0, _react.useRef)(null);
39
+
40
+ // The keyboard shortens the form instead of scrolling it, so a field low in
41
+ // the list ends up behind it. Once the viewport has shrunk, lift the focused
42
+ // field back above the fold. Both edges are measured the same way, so the
43
+ // offset a modal adds to either cancels out, and RN folds the scroll position
44
+ // into the field's own measurement.
45
+ const revealFocusedField = (0, _react.useCallback)(() => {
46
+ const name = focusedField.current;
47
+ const field = name ? fieldRefs.current[name] : null;
48
+ const viewport = scrollRef.current?.getNativeScrollRef();
49
+ if (!field || !viewport) return;
50
+ viewport.measureInWindow((_vx, viewportY, _vw, height) => {
51
+ field.measureInWindow((_fx, fieldY, _fw, fieldHeight) => {
52
+ const hidden = fieldY + fieldHeight + FIELD_GUTTER - (viewportY + height);
53
+ if (hidden <= 0) return;
54
+ scrollRef.current?.scrollTo({
55
+ y: scrollOffset.current + hidden,
56
+ animated: false
57
+ });
58
+ });
59
+ });
60
+ }, []);
61
+ const handleViewportLayout = (0, _react.useCallback)(event => {
62
+ const {
63
+ height
64
+ } = event.nativeEvent.layout;
65
+ const shrank = viewportHeight.current - height > 1;
66
+ viewportHeight.current = height;
67
+ if (shrank) revealFocusedField();
68
+ }, [revealFocusedField]);
69
+ const handleScroll = (0, _react.useCallback)(event => {
70
+ scrollOffset.current = event.nativeEvent.contentOffset.y;
71
+ }, []);
72
+ const hasRequired = fields.some(field => field.required);
73
+ const handleSubmit = () => {
74
+ const nextErrors = {};
75
+ for (const field of fields) {
76
+ const value = values[field.name]?.trim() || '';
77
+ if (field.required && !value) {
78
+ nextErrors[field.name] = (0, _i18n.formatLabel)(labels.fieldRequired, {
79
+ field: field.label
80
+ });
81
+ }
82
+ if (field.type === 'email' && value && !value.includes('@')) {
83
+ nextErrors[field.name] = labels.invalidEmail;
84
+ }
85
+ }
86
+ if (Object.keys(nextErrors).length > 0) {
87
+ setErrors(nextErrors);
88
+ return;
89
+ }
90
+ onSubmit(values);
91
+ };
92
+ const headerTextColor = (0, _theme.contrastingTextColor)(color);
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
94
+ style: _global.globalStyles.screen,
95
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Gradient.GradientBackground, {
96
+ colors: [color, (0, _theme.mixHex)(color, '#000000', 0.16)],
97
+ style: _PreChatFormStyles.styles.header,
98
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
99
+ style: _PreChatFormStyles.styles.headerCopy,
100
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
101
+ style: [_PreChatFormStyles.styles.headerTitle, {
102
+ color: headerTextColor
103
+ }],
104
+ children: labels.title
105
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
106
+ style: [_PreChatFormStyles.styles.headerSubtitle, {
107
+ color: (0, _theme.withAlpha)(headerTextColor, 0.75)
108
+ }],
109
+ numberOfLines: 2,
110
+ children: labels.subtitle
111
+ })]
112
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
113
+ onPress: onClose,
114
+ accessibilityRole: "button",
115
+ accessibilityLabel: labels.close,
116
+ hitSlop: 12,
117
+ style: ({
118
+ pressed
119
+ }) => [_global.globalStyles.iconButton, {
120
+ backgroundColor: (0, _theme.withAlpha)(headerTextColor, 0.16)
121
+ }, pressed && _global.globalStyles.pressed],
122
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChevronIcon, {
123
+ size: 20,
124
+ direction: "down",
125
+ color: headerTextColor
126
+ })
127
+ })]
128
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
129
+ ref: scrollRef,
130
+ style: _global.globalStyles.fill,
131
+ contentContainerStyle: _PreChatFormStyles.styles.content,
132
+ keyboardShouldPersistTaps: "handled",
133
+ keyboardDismissMode: "on-drag",
134
+ onLayout: handleViewportLayout,
135
+ onScroll: handleScroll,
136
+ scrollEventThrottle: 16,
137
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
138
+ style: _global.globalStyles.fill,
139
+ children: fields.map(field => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
140
+ ref: node => {
141
+ fieldRefs.current[field.name] = node;
142
+ },
143
+ collapsable: false,
144
+ style: _PreChatFormStyles.styles.field,
145
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
146
+ style: _PreChatFormStyles.styles.label,
147
+ children: [field.label, field.required ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
148
+ style: _PreChatFormStyles.styles.required,
149
+ children: " *"
150
+ }) : null]
151
+ }), field.type === 'select' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
152
+ style: _PreChatFormStyles.styles.options,
153
+ children: (field.options ?? []).map(option => {
154
+ const selected = values[field.name] === option;
155
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
156
+ onPress: () => setValues(current => ({
157
+ ...current,
158
+ [field.name]: option
159
+ })),
160
+ accessibilityRole: "button",
161
+ accessibilityState: {
162
+ selected
163
+ },
164
+ style: [_PreChatFormStyles.styles.option, selected && {
165
+ borderColor: color,
166
+ backgroundColor: _theme.palette.surface
167
+ }],
168
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
169
+ style: [_PreChatFormStyles.styles.optionLabel, selected && {
170
+ color
171
+ }],
172
+ children: option
173
+ }), selected ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChevronIcon, {
174
+ size: 14,
175
+ direction: (0, _rtl.forwardDirection)(),
176
+ color: color
177
+ }) : null]
178
+ }, option);
179
+ })
180
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
181
+ value: values[field.name] || '',
182
+ onChangeText: text => setValues(current => ({
183
+ ...current,
184
+ [field.name]: text
185
+ })),
186
+ placeholder: field.label,
187
+ placeholderTextColor: _theme.palette.textSubtle,
188
+ keyboardType: field.type === 'email' ? 'email-address' : field.type === 'phone' ? 'phone-pad' : 'default',
189
+ autoCapitalize: field.type === 'email' ? 'none' : 'sentences',
190
+ autoCorrect: field.type !== 'email',
191
+ onFocus: () => {
192
+ focusedField.current = field.name;
193
+ revealFocusedField();
194
+ },
195
+ onBlur: () => {
196
+ if (focusedField.current === field.name) focusedField.current = null;
197
+ },
198
+ style: [_PreChatFormStyles.styles.input, errors[field.name] ? _PreChatFormStyles.styles.inputError : null]
199
+ }), errors[field.name] ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
200
+ style: _PreChatFormStyles.styles.errorText,
201
+ children: errors[field.name]
202
+ }) : null]
203
+ }, field.name))
204
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
205
+ style: _PreChatFormStyles.styles.actions,
206
+ children: [!hasRequired ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
207
+ onPress: onSkip,
208
+ accessibilityRole: "button",
209
+ style: _PreChatFormStyles.styles.skipButton,
210
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
211
+ style: _PreChatFormStyles.styles.skipLabel,
212
+ children: labels.skip
213
+ })
214
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
215
+ onPress: handleSubmit,
216
+ accessibilityRole: "button",
217
+ style: [_PreChatFormStyles.styles.submitButton, {
218
+ backgroundColor: color
219
+ }],
220
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
221
+ style: _PreChatFormStyles.styles.submitLabel,
222
+ children: labels.submit
223
+ })
224
+ })]
225
+ })]
226
+ })]
227
+ });
228
+ }
229
+ //# sourceMappingURL=PreChatForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_i18n","_Gradient","_icons","_global","_theme","_rtl","_PreChatFormStyles","_jsxRuntime","FIELD_GUTTER","PreChatForm","fields","color","labels","onSubmit","onSkip","onClose","values","setValues","useState","errors","setErrors","scrollRef","useRef","scrollOffset","viewportHeight","fieldRefs","focusedField","revealFocusedField","useCallback","name","current","field","viewport","getNativeScrollRef","measureInWindow","_vx","viewportY","_vw","height","_fx","fieldY","_fw","fieldHeight","hidden","scrollTo","y","animated","handleViewportLayout","event","nativeEvent","layout","shrank","handleScroll","contentOffset","hasRequired","some","required","handleSubmit","nextErrors","value","trim","formatLabel","fieldRequired","label","type","includes","invalidEmail","Object","keys","length","headerTextColor","contrastingTextColor","jsxs","View","style","globalStyles","screen","children","GradientBackground","colors","mixHex","styles","header","headerCopy","jsx","Text","headerTitle","title","headerSubtitle","withAlpha","numberOfLines","subtitle","Pressable","onPress","accessibilityRole","accessibilityLabel","close","hitSlop","pressed","iconButton","backgroundColor","ChevronIcon","size","direction","ScrollView","ref","fill","contentContainerStyle","content","keyboardShouldPersistTaps","keyboardDismissMode","onLayout","onScroll","scrollEventThrottle","map","node","collapsable","options","option","selected","accessibilityState","borderColor","palette","surface","optionLabel","forwardDirection","TextInput","onChangeText","text","placeholder","placeholderTextColor","textSubtle","keyboardType","autoCapitalize","autoCorrect","onFocus","onBlur","input","inputError","errorText","actions","skipButton","skipLabel","skip","submitButton","submitLabel","subm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