@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,857 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Renders agent-authored rich blocks (product cards, slot pickers, lead forms,
5
+ * quotes, receipts) and posts the visitor's choice back through
6
+ * `POST /api/widget/messages` as an `agentUiAction`.
7
+ * Port of `client/src/widget/components/AgentUiBlocks.tsx`.
8
+ */
9
+
10
+ import { createContext, useContext, useState } from 'react';
11
+ import { Image, Pressable, StyleSheet, Text, TextInput, View } from 'react-native';
12
+ import { fontSize, palette, radius, shadows, spacing, withAlpha } from "../styles/theme.js";
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ const DEFAULT_BLOCK_LABELS = {
15
+ service: 'Service',
16
+ product: 'Product',
17
+ chooseTime: 'Choose a time',
18
+ professional: 'Professional',
19
+ priceOffer: 'Price offer',
20
+ working: 'Working...'
21
+ };
22
+ const BlockLabelContext = /*#__PURE__*/createContext(DEFAULT_BLOCK_LABELS);
23
+ export function AgentUiBlocks({
24
+ blocks,
25
+ color,
26
+ labels = DEFAULT_BLOCK_LABELS,
27
+ onAction
28
+ }) {
29
+ const [selectedVariants, setSelectedVariants] = useState({});
30
+ const [consents, setConsents] = useState({});
31
+ const [values, setValues] = useState({});
32
+ const [selectedSlots, setSelectedSlots] = useState({});
33
+ const [pending, setPending] = useState(null);
34
+ const requiredConsent = blocks.filter(block => block.type === 'consent' && block.required);
35
+ const consentGranted = requiredConsent.every(block => consents[block.id]);
36
+ const act = async action => {
37
+ if (pending) return;
38
+ const productId = typeof action.payload.productId === 'string' ? action.payload.productId : undefined;
39
+ const nextAction = productId && selectedVariants[productId] ? {
40
+ ...action,
41
+ payload: {
42
+ ...action.payload,
43
+ variantId: selectedVariants[productId]
44
+ }
45
+ } : action;
46
+ setPending(action.id);
47
+ try {
48
+ await onAction(nextAction);
49
+ } finally {
50
+ setPending(null);
51
+ }
52
+ };
53
+ return /*#__PURE__*/_jsx(BlockLabelContext.Provider, {
54
+ value: labels,
55
+ children: /*#__PURE__*/_jsx(View, {
56
+ style: styles.stack,
57
+ children: blocks.map(block => {
58
+ if (block.type === 'product_service_card') {
59
+ return /*#__PURE__*/_jsxs(View, {
60
+ style: styles.card,
61
+ children: [block.product.imageUrl ? /*#__PURE__*/_jsx(Image, {
62
+ source: {
63
+ uri: block.product.imageUrl
64
+ },
65
+ style: styles.cardImage,
66
+ resizeMode: "cover",
67
+ accessibilityIgnoresInvertColors: true
68
+ }) : null, /*#__PURE__*/_jsxs(View, {
69
+ style: styles.cardBody,
70
+ children: [/*#__PURE__*/_jsxs(View, {
71
+ style: styles.rowStart,
72
+ children: [/*#__PURE__*/_jsxs(View, {
73
+ style: styles.flexMin,
74
+ children: [/*#__PURE__*/_jsx(Text, {
75
+ style: styles.title,
76
+ children: block.product.name
77
+ }), /*#__PURE__*/_jsx(Text, {
78
+ style: styles.description,
79
+ children: block.product.shortDescription || block.product.description || ''
80
+ })]
81
+ }), /*#__PURE__*/_jsx(Badge, {
82
+ label: block.product.type === 'service' ? labels.service : labels.product
83
+ })]
84
+ }), /*#__PURE__*/_jsxs(View, {
85
+ style: styles.row,
86
+ children: [/*#__PURE__*/_jsx(Text, {
87
+ style: styles.muted,
88
+ children: block.product.durationMinutes ? `${block.product.durationMinutes} min` : block.product.unit || ''
89
+ }), /*#__PURE__*/_jsx(Text, {
90
+ style: styles.price,
91
+ children: formatMoney(block.product.price, block.product.currency)
92
+ })]
93
+ })]
94
+ })]
95
+ }, block.id);
96
+ }
97
+ if (block.type === 'product_choices') {
98
+ const selected = selectedVariants[block.productId] || block.variants.find(variant => variant.available)?.id || '';
99
+ return /*#__PURE__*/_jsxs(View, {
100
+ style: [styles.card, styles.cardPadded],
101
+ children: [/*#__PURE__*/_jsx(Text, {
102
+ style: styles.title,
103
+ children: block.title
104
+ }), /*#__PURE__*/_jsx(View, {
105
+ style: styles.chipRow,
106
+ children: block.variants.map(variant => /*#__PURE__*/_jsx(Chip, {
107
+ selected: selected === variant.id,
108
+ disabled: !variant.available,
109
+ color: color,
110
+ onPress: () => setSelectedVariants(current => ({
111
+ ...current,
112
+ [block.productId]: variant.id
113
+ })),
114
+ label: variant.title,
115
+ sublabel: formatMoney(variant.price, variant.currency)
116
+ }, variant.id))
117
+ })]
118
+ }, block.id);
119
+ }
120
+ if (block.type === 'commerce_actions') {
121
+ return /*#__PURE__*/_jsx(View, {
122
+ style: styles.actionRow,
123
+ children: block.actions.map((action, index) => /*#__PURE__*/_jsx(View, {
124
+ style: styles.actionCell,
125
+ children: /*#__PURE__*/_jsx(ActionButton, {
126
+ color: color,
127
+ secondary: index === 0 && block.actions.length > 1,
128
+ pending: pending === action.id,
129
+ onPress: () => act(action),
130
+ children: action.label
131
+ })
132
+ }, action.id))
133
+ }, block.id);
134
+ }
135
+ if (block.type === 'cart_order_summary') {
136
+ return /*#__PURE__*/_jsxs(View, {
137
+ style: [styles.card, styles.cardPadded],
138
+ children: [/*#__PURE__*/_jsxs(View, {
139
+ style: styles.rowStart,
140
+ children: [/*#__PURE__*/_jsx(Text, {
141
+ style: styles.title,
142
+ children: block.title
143
+ }), block.status ? /*#__PURE__*/_jsx(Badge, {
144
+ label: block.status
145
+ }) : null]
146
+ }), /*#__PURE__*/_jsx(View, {
147
+ style: styles.itemList,
148
+ children: block.items.map((item, index) => /*#__PURE__*/_jsxs(View, {
149
+ style: styles.row,
150
+ children: [/*#__PURE__*/_jsxs(View, {
151
+ style: styles.flexMin,
152
+ children: [/*#__PURE__*/_jsx(Text, {
153
+ style: styles.itemName,
154
+ children: item.name
155
+ }), /*#__PURE__*/_jsxs(Text, {
156
+ style: styles.muted,
157
+ children: [item.quantity, " \xD7 ", formatMoney(item.unitPrice, block.currency)]
158
+ })]
159
+ }), /*#__PURE__*/_jsx(Text, {
160
+ style: styles.itemTotal,
161
+ children: formatMoney(item.lineTotal, block.currency)
162
+ })]
163
+ }, `${item.name}:${index}`))
164
+ }), /*#__PURE__*/_jsxs(View, {
165
+ style: styles.totals,
166
+ children: [/*#__PURE__*/_jsx(MoneyRow, {
167
+ label: "Subtotal",
168
+ value: formatMoney(block.subtotal, block.currency)
169
+ }), block.discount ? /*#__PURE__*/_jsx(MoneyRow, {
170
+ label: "Discount",
171
+ value: `−${formatMoney(block.discount, block.currency)}`
172
+ }) : null, block.tax ? /*#__PURE__*/_jsx(MoneyRow, {
173
+ label: "Tax",
174
+ value: formatMoney(block.tax, block.currency)
175
+ }) : null, block.shipping ? /*#__PURE__*/_jsx(MoneyRow, {
176
+ label: "Shipping",
177
+ value: formatMoney(block.shipping, block.currency)
178
+ }) : null, /*#__PURE__*/_jsx(MoneyRow, {
179
+ label: "Total",
180
+ value: formatMoney(block.total, block.currency),
181
+ strong: true
182
+ })]
183
+ }), block.action ? /*#__PURE__*/_jsx(View, {
184
+ style: styles.blockAction,
185
+ children: /*#__PURE__*/_jsx(ActionButton, {
186
+ color: color,
187
+ pending: pending === block.action.id,
188
+ onPress: () => block.action && act(block.action),
189
+ children: block.action.label
190
+ })
191
+ }) : null]
192
+ }, block.id);
193
+ }
194
+ if (block.type === 'contact_lead_form') {
195
+ const complete = block.fields.every(field => !field.required || (values[`${block.id}:${field.name}`] ?? field.value ?? '').trim());
196
+ return /*#__PURE__*/_jsxs(View, {
197
+ style: [styles.card, styles.cardPadded],
198
+ children: [/*#__PURE__*/_jsx(Text, {
199
+ style: styles.title,
200
+ children: block.title
201
+ }), block.description ? /*#__PURE__*/_jsx(Text, {
202
+ style: styles.description,
203
+ children: block.description
204
+ }) : null, /*#__PURE__*/_jsx(View, {
205
+ style: styles.fieldStack,
206
+ children: block.fields.map(field => {
207
+ const id = `${block.id}:${field.name}`;
208
+ return /*#__PURE__*/_jsx(TextInput, {
209
+ value: values[id] ?? field.value ?? '',
210
+ onChangeText: text => setValues(current => ({
211
+ ...current,
212
+ [id]: text
213
+ })),
214
+ placeholder: field.placeholder || field.label,
215
+ placeholderTextColor: palette.textSubtle,
216
+ accessibilityLabel: field.label,
217
+ keyboardType: keyboardTypeFor(field.type),
218
+ autoCapitalize: field.type === 'email' ? 'none' : 'sentences',
219
+ multiline: field.type === 'textarea',
220
+ style: [styles.input, field.type === 'textarea' && styles.textarea]
221
+ }, id);
222
+ })
223
+ }), /*#__PURE__*/_jsx(View, {
224
+ style: styles.blockAction,
225
+ children: /*#__PURE__*/_jsx(ActionButton, {
226
+ color: color,
227
+ disabled: !complete || !consentGranted,
228
+ pending: pending === `submit:${block.id}`,
229
+ onPress: () => act({
230
+ id: `submit:${block.id}`,
231
+ type: 'submit_contact',
232
+ label: block.submitLabel,
233
+ module: block.module,
234
+ payload: Object.fromEntries(block.fields.map(field => [field.name, values[`${block.id}:${field.name}`] || field.value || '']))
235
+ }),
236
+ children: block.submitLabel
237
+ })
238
+ })]
239
+ }, block.id);
240
+ }
241
+ if (block.type === 'consent') {
242
+ const checked = consents[block.id] || false;
243
+ return /*#__PURE__*/_jsxs(View, {
244
+ style: [styles.card, styles.cardPadded],
245
+ children: [/*#__PURE__*/_jsxs(Pressable, {
246
+ onPress: () => setConsents(current => ({
247
+ ...current,
248
+ [block.id]: !checked
249
+ })),
250
+ accessibilityRole: "checkbox",
251
+ accessibilityState: {
252
+ checked
253
+ },
254
+ style: styles.consentRow,
255
+ children: [/*#__PURE__*/_jsx(View, {
256
+ style: [styles.checkbox, checked && {
257
+ backgroundColor: color,
258
+ borderColor: color
259
+ }],
260
+ children: checked ? /*#__PURE__*/_jsx(Text, {
261
+ style: styles.checkmark,
262
+ children: "\u2713"
263
+ }) : null
264
+ }), /*#__PURE__*/_jsx(Text, {
265
+ style: styles.consentText,
266
+ children: block.statement
267
+ })]
268
+ }), /*#__PURE__*/_jsxs(View, {
269
+ style: [styles.row, styles.blockAction],
270
+ children: [/*#__PURE__*/_jsx(View, {
271
+ style: styles.chipRow,
272
+ children: block.channels.map(channel => /*#__PURE__*/_jsx(Badge, {
273
+ label: channel
274
+ }, channel))
275
+ }), /*#__PURE__*/_jsx(Pressable, {
276
+ disabled: !checked || pending !== null,
277
+ onPress: () => act({
278
+ id: `consent:${block.id}`,
279
+ type: 'record_consent',
280
+ label: 'Save consent',
281
+ module: 'contacts',
282
+ payload: {
283
+ channels: block.channels,
284
+ consent: true,
285
+ statement: block.statement
286
+ }
287
+ }),
288
+ hitSlop: 8,
289
+ children: /*#__PURE__*/_jsx(Text, {
290
+ style: [styles.linkButton, {
291
+ color: checked ? color : palette.textSubtle
292
+ }],
293
+ children: "Save"
294
+ })
295
+ })]
296
+ })]
297
+ }, block.id);
298
+ }
299
+ if (block.type === 'appointment_slot_picker') {
300
+ const selected = selectedSlots[block.id] || '';
301
+ const selectedSlot = block.days.flatMap(day => day.slots.map(slot => ({
302
+ ...slot,
303
+ date: day.date
304
+ }))).find(slot => `${slot.date}:${slot.startTime}` === selected);
305
+ const providerById = new Map(block.providers.map(provider => [provider.id, provider]));
306
+ const selectedProvider = selectedSlot?.staffUserId ? providerById.get(selectedSlot.staffUserId) : undefined;
307
+ const activeProviderId = block.selectedProviderId || 'any';
308
+ return /*#__PURE__*/_jsxs(View, {
309
+ style: [styles.card, styles.cardPadded],
310
+ children: [/*#__PURE__*/_jsx(Text, {
311
+ style: styles.title,
312
+ children: labels.chooseTime
313
+ }), /*#__PURE__*/_jsxs(Text, {
314
+ style: styles.description,
315
+ children: [block.serviceName, " \xB7 ", block.durationMinutes, " min", block.timezone ? ` · ${block.timezone}` : '']
316
+ }), block.providers.length > 0 ? /*#__PURE__*/_jsxs(View, {
317
+ style: styles.section,
318
+ children: [/*#__PURE__*/_jsx(Text, {
319
+ style: styles.sectionLabel,
320
+ children: labels.professional
321
+ }), /*#__PURE__*/_jsxs(View, {
322
+ style: styles.chipRow,
323
+ children: [/*#__PURE__*/_jsx(Chip, {
324
+ selected: activeProviderId === 'any',
325
+ color: color,
326
+ disabled: pending !== null,
327
+ label: "Any available",
328
+ onPress: () => activeProviderId !== 'any' && act({
329
+ id: `provider:${block.serviceId}:any`,
330
+ type: 'select_appointment_provider',
331
+ label: 'Choose any professional',
332
+ module: 'appointments',
333
+ payload: {
334
+ serviceId: block.serviceId,
335
+ serviceName: block.serviceName,
336
+ durationMinutes: block.durationMinutes,
337
+ locationId: block.locationId,
338
+ providerName: 'any available professional'
339
+ }
340
+ })
341
+ }), block.providers.map(provider => /*#__PURE__*/_jsx(Chip, {
342
+ selected: activeProviderId === provider.id,
343
+ color: color,
344
+ disabled: pending !== null,
345
+ label: provider.name,
346
+ onPress: () => activeProviderId !== provider.id && act({
347
+ id: `provider:${block.serviceId}:${provider.id}`,
348
+ type: 'select_appointment_provider',
349
+ label: `Choose ${provider.name}`,
350
+ module: 'appointments',
351
+ payload: {
352
+ serviceId: block.serviceId,
353
+ serviceName: block.serviceName,
354
+ durationMinutes: block.durationMinutes,
355
+ locationId: block.locationId,
356
+ providerId: provider.id,
357
+ providerName: provider.name
358
+ }
359
+ })
360
+ }, provider.id))]
361
+ })]
362
+ }) : null, /*#__PURE__*/_jsx(View, {
363
+ style: styles.section,
364
+ children: block.days.map(day => /*#__PURE__*/_jsxs(View, {
365
+ style: styles.day,
366
+ children: [/*#__PURE__*/_jsx(Text, {
367
+ style: styles.sectionLabel,
368
+ children: formatDate(day.date)
369
+ }), /*#__PURE__*/_jsx(View, {
370
+ style: styles.chipRow,
371
+ children: day.slots.map(slot => {
372
+ const value = `${day.date}:${slot.startTime}`;
373
+ return /*#__PURE__*/_jsx(Chip, {
374
+ selected: selected === value,
375
+ color: color,
376
+ label: formatTime(slot.startTime),
377
+ onPress: () => setSelectedSlots(current => ({
378
+ ...current,
379
+ [block.id]: value
380
+ }))
381
+ }, value);
382
+ })
383
+ })]
384
+ }, day.date))
385
+ }), selectedProvider ? /*#__PURE__*/_jsxs(Text, {
386
+ style: [styles.muted, styles.blockAction],
387
+ children: ["With ", selectedProvider.name]
388
+ }) : null, /*#__PURE__*/_jsx(View, {
389
+ style: styles.blockAction,
390
+ children: /*#__PURE__*/_jsx(ActionButton, {
391
+ color: color,
392
+ disabled: !selectedSlot,
393
+ pending: pending?.startsWith(`book:${block.serviceId}`) || false,
394
+ onPress: () => selectedSlot && act({
395
+ id: `book:${block.serviceId}:${selected}`,
396
+ type: 'select_appointment_slot',
397
+ label: 'Book this time',
398
+ module: 'appointments',
399
+ payload: {
400
+ serviceId: block.serviceId,
401
+ serviceName: block.serviceName,
402
+ durationMinutes: block.durationMinutes,
403
+ date: selectedSlot.date,
404
+ startTime: selectedSlot.startTime,
405
+ endTime: selectedSlot.endTime,
406
+ userId: selectedSlot.staffUserId,
407
+ slotToken: selectedSlot.slotToken,
408
+ providerName: selectedProvider?.name
409
+ }
410
+ }),
411
+ children: "Book this time"
412
+ })
413
+ })]
414
+ }, block.id);
415
+ }
416
+ if (block.type === 'quote_preview') {
417
+ const publicActions = block.actions.filter(action => action.type !== 'open_record');
418
+ return /*#__PURE__*/_jsxs(View, {
419
+ style: [styles.card, styles.cardPadded],
420
+ children: [/*#__PURE__*/_jsxs(View, {
421
+ style: styles.rowStart,
422
+ children: [/*#__PURE__*/_jsxs(View, {
423
+ style: styles.flexMin,
424
+ children: [/*#__PURE__*/_jsx(Text, {
425
+ style: styles.title,
426
+ children: block.name
427
+ }), /*#__PURE__*/_jsxs(Text, {
428
+ style: styles.description,
429
+ children: [block.serialNumber || labels.priceOffer, block.contactName ? ` · ${block.contactName}` : '']
430
+ })]
431
+ }), /*#__PURE__*/_jsx(Badge, {
432
+ label: block.status
433
+ })]
434
+ }), /*#__PURE__*/_jsx(Text, {
435
+ style: styles.amount,
436
+ children: formatMoney(block.amount, block.currency)
437
+ }), block.validUntil ? /*#__PURE__*/_jsxs(Text, {
438
+ style: styles.muted,
439
+ children: ["Valid until ", formatDate(block.validUntil.slice(0, 10))]
440
+ }) : null, publicActions.map(action => /*#__PURE__*/_jsx(View, {
441
+ style: styles.blockAction,
442
+ children: /*#__PURE__*/_jsx(ActionButton, {
443
+ color: color,
444
+ pending: pending === action.id,
445
+ onPress: () => act(action),
446
+ children: action.label
447
+ })
448
+ }, action.id))]
449
+ }, block.id);
450
+ }
451
+
452
+ // success_receipt
453
+ return /*#__PURE__*/_jsxs(View, {
454
+ style: [styles.card, styles.cardPadded],
455
+ children: [/*#__PURE__*/_jsxs(View, {
456
+ style: styles.rowStart,
457
+ children: [/*#__PURE__*/_jsx(Text, {
458
+ style: [styles.checkGlyph, {
459
+ color
460
+ }],
461
+ children: "\u2713"
462
+ }), /*#__PURE__*/_jsxs(View, {
463
+ style: styles.flexMin,
464
+ children: [/*#__PURE__*/_jsx(Text, {
465
+ style: styles.title,
466
+ children: block.title
467
+ }), block.description ? /*#__PURE__*/_jsx(Text, {
468
+ style: styles.description,
469
+ children: block.description
470
+ }) : null]
471
+ })]
472
+ }), /*#__PURE__*/_jsxs(View, {
473
+ style: [styles.row, styles.blockAction],
474
+ children: [block.reference ? /*#__PURE__*/_jsx(Badge, {
475
+ label: block.reference
476
+ }) : /*#__PURE__*/_jsx(View, {}), block.amount != null && block.currency ? /*#__PURE__*/_jsx(Text, {
477
+ style: styles.itemTotal,
478
+ children: formatMoney(block.amount, block.currency)
479
+ }) : null]
480
+ }), block.nextActions.filter(action => action.type !== 'open_record').map(action => /*#__PURE__*/_jsx(View, {
481
+ style: styles.blockAction,
482
+ children: /*#__PURE__*/_jsx(ActionButton, {
483
+ color: color,
484
+ pending: pending === action.id,
485
+ onPress: () => act(action),
486
+ children: action.label
487
+ })
488
+ }, action.id))]
489
+ }, block.id);
490
+ })
491
+ })
492
+ });
493
+ }
494
+ function ActionButton({
495
+ children,
496
+ color,
497
+ secondary = false,
498
+ pending = false,
499
+ disabled = false,
500
+ onPress
501
+ }) {
502
+ const labels = useContext(BlockLabelContext);
503
+ const inactive = disabled || pending;
504
+ return /*#__PURE__*/_jsx(Pressable, {
505
+ disabled: inactive,
506
+ onPress: onPress,
507
+ accessibilityRole: "button",
508
+ style: ({
509
+ pressed
510
+ }) => [styles.actionButton, secondary ? {
511
+ borderColor: color,
512
+ backgroundColor: palette.white
513
+ } : {
514
+ backgroundColor: color
515
+ }, inactive && styles.actionButtonDisabled, pressed && styles.pressed],
516
+ children: /*#__PURE__*/_jsx(Text, {
517
+ style: [styles.actionButtonLabel, {
518
+ color: inactive ? palette.white : secondary ? color : palette.white
519
+ }],
520
+ children: pending ? labels.working : children
521
+ })
522
+ });
523
+ }
524
+ function Chip({
525
+ label,
526
+ sublabel,
527
+ selected,
528
+ disabled = false,
529
+ color,
530
+ onPress
531
+ }) {
532
+ return /*#__PURE__*/_jsxs(Pressable, {
533
+ disabled: disabled,
534
+ onPress: onPress,
535
+ accessibilityRole: "button",
536
+ accessibilityState: {
537
+ selected,
538
+ disabled
539
+ },
540
+ style: [styles.chip, {
541
+ borderColor: selected ? color : palette.disabled,
542
+ backgroundColor: selected ? withAlpha(color, 0.07) : palette.white
543
+ }, disabled && styles.chipDisabled],
544
+ children: [/*#__PURE__*/_jsx(Text, {
545
+ style: [styles.chipLabel, {
546
+ color: selected ? color : '#374151'
547
+ }],
548
+ children: label
549
+ }), sublabel ? /*#__PURE__*/_jsx(Text, {
550
+ style: styles.chipSublabel,
551
+ children: sublabel
552
+ }) : null]
553
+ });
554
+ }
555
+ function Badge({
556
+ label
557
+ }) {
558
+ return /*#__PURE__*/_jsx(View, {
559
+ style: styles.badge,
560
+ children: /*#__PURE__*/_jsx(Text, {
561
+ style: styles.badgeLabel,
562
+ numberOfLines: 1,
563
+ children: label
564
+ })
565
+ });
566
+ }
567
+ function MoneyRow({
568
+ label,
569
+ value,
570
+ strong = false
571
+ }) {
572
+ return /*#__PURE__*/_jsxs(View, {
573
+ style: styles.row,
574
+ children: [/*#__PURE__*/_jsx(Text, {
575
+ style: [styles.moneyLabel, strong && styles.moneyStrong],
576
+ children: label
577
+ }), /*#__PURE__*/_jsx(Text, {
578
+ style: [styles.moneyLabel, strong && styles.moneyStrong],
579
+ children: value
580
+ })]
581
+ });
582
+ }
583
+ function keyboardTypeFor(type) {
584
+ if (type === 'email') return 'email-address';
585
+ if (type === 'phone') return 'phone-pad';
586
+ return 'default';
587
+ }
588
+ export function formatMoney(amount, currency) {
589
+ // Blocks are validated upstream; this is the last line against a bad value.
590
+ const value = typeof amount === 'number' && Number.isFinite(amount) ? amount : 0;
591
+ try {
592
+ return new Intl.NumberFormat(undefined, {
593
+ style: 'currency',
594
+ currency
595
+ }).format(value);
596
+ } catch {
597
+ return `${value.toFixed(2)} ${currency ?? ''}`.trim();
598
+ }
599
+ }
600
+ export function formatDate(date) {
601
+ const parsed = new Date(`${date}T12:00:00`);
602
+ if (Number.isNaN(parsed.getTime())) return date;
603
+ try {
604
+ return new Intl.DateTimeFormat(undefined, {
605
+ weekday: 'short',
606
+ month: 'short',
607
+ day: 'numeric'
608
+ }).format(parsed);
609
+ } catch {
610
+ return date;
611
+ }
612
+ }
613
+ export function formatTime(time) {
614
+ const [hour, minute] = time.split(':').map(Number);
615
+ try {
616
+ return new Intl.DateTimeFormat(undefined, {
617
+ hour: 'numeric',
618
+ minute: '2-digit'
619
+ }).format(new Date(2000, 0, 1, hour ?? 0, minute ?? 0));
620
+ } catch {
621
+ return time;
622
+ }
623
+ }
624
+ const cardStyle = {
625
+ overflow: 'hidden',
626
+ borderWidth: StyleSheet.hairlineWidth,
627
+ borderColor: palette.border,
628
+ borderRadius: radius.xl,
629
+ backgroundColor: palette.white,
630
+ ...shadows.card
631
+ };
632
+ const styles = StyleSheet.create({
633
+ stack: {
634
+ width: '100%',
635
+ maxWidth: 350,
636
+ gap: spacing.sm,
637
+ marginTop: spacing.sm
638
+ },
639
+ card: cardStyle,
640
+ cardPadded: {
641
+ padding: spacing.md
642
+ },
643
+ cardBody: {
644
+ gap: spacing.sm + 2,
645
+ padding: spacing.md
646
+ },
647
+ cardImage: {
648
+ width: '100%',
649
+ aspectRatio: 16 / 7
650
+ },
651
+ row: {
652
+ flexDirection: 'row',
653
+ alignItems: 'center',
654
+ justifyContent: 'space-between',
655
+ gap: spacing.sm + 2
656
+ },
657
+ rowStart: {
658
+ flexDirection: 'row',
659
+ alignItems: 'flex-start',
660
+ justifyContent: 'space-between',
661
+ gap: spacing.sm + 2
662
+ },
663
+ flexMin: {
664
+ flex: 1,
665
+ minWidth: 0
666
+ },
667
+ title: {
668
+ fontSize: fontSize.body,
669
+ lineHeight: fontSize.body * 1.3,
670
+ fontWeight: '600',
671
+ color: palette.text
672
+ },
673
+ description: {
674
+ fontSize: fontSize.meta,
675
+ lineHeight: fontSize.meta * 1.45,
676
+ color: palette.textMuted,
677
+ marginTop: 3
678
+ },
679
+ muted: {
680
+ fontSize: fontSize.caption,
681
+ color: palette.textMuted
682
+ },
683
+ price: {
684
+ fontSize: fontSize.title,
685
+ fontWeight: '600',
686
+ color: palette.text
687
+ },
688
+ amount: {
689
+ fontSize: fontSize.heading,
690
+ fontWeight: '700',
691
+ color: palette.text,
692
+ marginTop: spacing.sm + 2
693
+ },
694
+ badge: {
695
+ borderWidth: StyleSheet.hairlineWidth,
696
+ borderColor: palette.border,
697
+ borderRadius: radius.pill,
698
+ paddingHorizontal: 7,
699
+ paddingVertical: 3,
700
+ backgroundColor: palette.surface
701
+ },
702
+ badgeLabel: {
703
+ fontSize: fontSize.caption - 1,
704
+ color: '#4b5563'
705
+ },
706
+ chipRow: {
707
+ flexDirection: 'row',
708
+ flexWrap: 'wrap',
709
+ gap: spacing.xs + 2,
710
+ marginTop: spacing.sm
711
+ },
712
+ chip: {
713
+ borderWidth: 1,
714
+ borderRadius: radius.md,
715
+ paddingHorizontal: spacing.md,
716
+ paddingVertical: spacing.sm,
717
+ minHeight: 40,
718
+ justifyContent: 'center'
719
+ },
720
+ chipDisabled: {
721
+ opacity: 0.45
722
+ },
723
+ chipLabel: {
724
+ fontSize: fontSize.meta,
725
+ fontWeight: '600'
726
+ },
727
+ chipSublabel: {
728
+ fontSize: fontSize.caption - 1,
729
+ opacity: 0.75,
730
+ marginTop: 2
731
+ },
732
+ actionRow: {
733
+ flexDirection: 'row',
734
+ gap: spacing.sm
735
+ },
736
+ actionCell: {
737
+ flex: 1
738
+ },
739
+ actionButton: {
740
+ width: '100%',
741
+ borderWidth: 1,
742
+ borderColor: 'transparent',
743
+ borderRadius: radius.md,
744
+ paddingVertical: spacing.md,
745
+ paddingHorizontal: spacing.md,
746
+ alignItems: 'center',
747
+ justifyContent: 'center',
748
+ minHeight: 44
749
+ },
750
+ actionButtonDisabled: {
751
+ backgroundColor: palette.disabled,
752
+ borderColor: palette.disabled
753
+ },
754
+ actionButtonLabel: {
755
+ fontSize: fontSize.meta,
756
+ fontWeight: '600'
757
+ },
758
+ pressed: {
759
+ opacity: 0.85
760
+ },
761
+ blockAction: {
762
+ marginTop: spacing.sm + 2
763
+ },
764
+ itemList: {
765
+ gap: spacing.sm,
766
+ marginTop: spacing.sm + 2
767
+ },
768
+ itemName: {
769
+ fontSize: fontSize.meta,
770
+ fontWeight: '600',
771
+ color: palette.text
772
+ },
773
+ itemTotal: {
774
+ fontSize: fontSize.meta,
775
+ fontWeight: '600',
776
+ color: palette.text
777
+ },
778
+ totals: {
779
+ borderTopWidth: StyleSheet.hairlineWidth,
780
+ borderTopColor: palette.border,
781
+ marginTop: spacing.sm + 2,
782
+ paddingTop: spacing.sm + 2,
783
+ gap: 5
784
+ },
785
+ moneyLabel: {
786
+ fontSize: fontSize.meta,
787
+ color: palette.text
788
+ },
789
+ moneyStrong: {
790
+ fontWeight: '700'
791
+ },
792
+ fieldStack: {
793
+ gap: spacing.sm,
794
+ marginTop: spacing.sm + 2
795
+ },
796
+ input: {
797
+ borderWidth: StyleSheet.hairlineWidth,
798
+ borderColor: palette.disabled,
799
+ borderRadius: radius.md,
800
+ paddingHorizontal: spacing.md,
801
+ paddingVertical: spacing.sm + 2,
802
+ fontSize: fontSize.input,
803
+ color: palette.text,
804
+ backgroundColor: palette.white,
805
+ minHeight: 44
806
+ },
807
+ textarea: {
808
+ minHeight: 84,
809
+ textAlignVertical: 'top'
810
+ },
811
+ consentRow: {
812
+ flexDirection: 'row',
813
+ alignItems: 'flex-start',
814
+ gap: spacing.sm
815
+ },
816
+ checkbox: {
817
+ width: 22,
818
+ height: 22,
819
+ borderRadius: 6,
820
+ borderWidth: 1.5,
821
+ borderColor: palette.disabled,
822
+ alignItems: 'center',
823
+ justifyContent: 'center'
824
+ },
825
+ checkmark: {
826
+ color: palette.white,
827
+ fontSize: fontSize.meta,
828
+ fontWeight: '700'
829
+ },
830
+ consentText: {
831
+ flex: 1,
832
+ fontSize: fontSize.meta,
833
+ lineHeight: fontSize.meta * 1.45,
834
+ color: palette.text
835
+ },
836
+ linkButton: {
837
+ fontSize: fontSize.meta,
838
+ fontWeight: '600',
839
+ padding: spacing.xs
840
+ },
841
+ section: {
842
+ marginTop: spacing.sm + 2
843
+ },
844
+ sectionLabel: {
845
+ fontSize: fontSize.caption,
846
+ fontWeight: '600',
847
+ color: palette.text
848
+ },
849
+ day: {
850
+ marginTop: spacing.sm + 2
851
+ },
852
+ checkGlyph: {
853
+ fontSize: fontSize.title,
854
+ fontWeight: '700'
855
+ }
856
+ });
857
+ //# sourceMappingURL=AgentUiBlocks.js.map