@repzo/widget-react-native 1.3.0 → 1.4.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 (251) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/README.md +72 -16
  3. package/lib/commonjs/api/client.js +113 -0
  4. package/lib/commonjs/api/client.js.map +1 -1
  5. package/lib/commonjs/attachments/file-size.js +52 -0
  6. package/lib/commonjs/attachments/file-size.js.map +1 -0
  7. package/lib/commonjs/attachments/local-previews.js +40 -0
  8. package/lib/commonjs/attachments/local-previews.js.map +1 -0
  9. package/lib/commonjs/attachments/pickers.js +76 -28
  10. package/lib/commonjs/attachments/pickers.js.map +1 -1
  11. package/lib/commonjs/i18n.js +24 -3
  12. package/lib/commonjs/i18n.js.map +1 -1
  13. package/lib/commonjs/locales.js +13 -3
  14. package/lib/commonjs/locales.js.map +1 -1
  15. package/lib/commonjs/state/widget-store.js +486 -63
  16. package/lib/commonjs/state/widget-store.js.map +1 -1
  17. package/lib/commonjs/storage.js +3 -1
  18. package/lib/commonjs/storage.js.map +1 -1
  19. package/lib/commonjs/types.js.map +1 -1
  20. package/lib/commonjs/ui/WidgetProvider.js +40 -16
  21. package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
  22. package/lib/commonjs/ui/components/AttachmentChips.js +109 -40
  23. package/lib/commonjs/ui/components/AttachmentChips.js.map +1 -1
  24. package/lib/commonjs/ui/components/ConversationRow.js +65 -10
  25. package/lib/commonjs/ui/components/ConversationRow.js.map +1 -1
  26. package/lib/commonjs/ui/components/ImageViewer.js +231 -25
  27. package/lib/commonjs/ui/components/ImageViewer.js.map +1 -1
  28. package/lib/commonjs/ui/components/RatingCard.js +5 -2
  29. package/lib/commonjs/ui/components/RatingCard.js.map +1 -1
  30. package/lib/commonjs/ui/components/ZoomableImage.js +58 -10
  31. package/lib/commonjs/ui/components/ZoomableImage.js.map +1 -1
  32. package/lib/commonjs/ui/components/icons.js +22 -16
  33. package/lib/commonjs/ui/components/icons.js.map +1 -1
  34. package/lib/commonjs/ui/hooks/use-retained-state.js +39 -0
  35. package/lib/commonjs/ui/hooks/use-retained-state.js.map +1 -0
  36. package/lib/commonjs/ui/screens/chat/ChatView.js +666 -171
  37. package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
  38. package/lib/commonjs/ui/screens/chat/ChatView.styles.js +150 -3
  39. package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -1
  40. package/lib/commonjs/ui/screens/conversations/ConversationsList.js +1 -0
  41. package/lib/commonjs/ui/screens/conversations/ConversationsList.js.map +1 -1
  42. package/lib/commonjs/ui/screens/home/HomeView.js +38 -55
  43. package/lib/commonjs/ui/screens/home/HomeView.js.map +1 -1
  44. package/lib/commonjs/ui/screens/home/HomeView.styles.js +36 -45
  45. package/lib/commonjs/ui/screens/home/HomeView.styles.js.map +1 -1
  46. package/lib/commonjs/ui/styles/theme.js +1 -0
  47. package/lib/commonjs/ui/styles/theme.js.map +1 -1
  48. package/lib/commonjs/ui/utils/conversations.js +17 -1
  49. package/lib/commonjs/ui/utils/conversations.js.map +1 -1
  50. package/lib/commonjs/ui/utils/html.js +13 -0
  51. package/lib/commonjs/ui/utils/html.js.map +1 -1
  52. package/lib/commonjs/ui/utils/image-load-queue.js +114 -0
  53. package/lib/commonjs/ui/utils/image-load-queue.js.map +1 -0
  54. package/lib/commonjs/ui/utils/inline-attachments.js +88 -0
  55. package/lib/commonjs/ui/utils/inline-attachments.js.map +1 -0
  56. package/lib/module/api/client.js +113 -0
  57. package/lib/module/api/client.js.map +1 -1
  58. package/lib/module/attachments/file-size.js +47 -0
  59. package/lib/module/attachments/file-size.js.map +1 -0
  60. package/lib/module/attachments/local-previews.js +33 -0
  61. package/lib/module/attachments/local-previews.js.map +1 -0
  62. package/lib/module/attachments/pickers.js +74 -27
  63. package/lib/module/attachments/pickers.js.map +1 -1
  64. package/lib/module/i18n.js +24 -3
  65. package/lib/module/i18n.js.map +1 -1
  66. package/lib/module/locales.js +13 -3
  67. package/lib/module/locales.js.map +1 -1
  68. package/lib/module/state/widget-store.js +488 -65
  69. package/lib/module/state/widget-store.js.map +1 -1
  70. package/lib/module/storage.js +2 -0
  71. package/lib/module/storage.js.map +1 -1
  72. package/lib/module/types.js.map +1 -1
  73. package/lib/module/ui/WidgetProvider.js +40 -16
  74. package/lib/module/ui/WidgetProvider.js.map +1 -1
  75. package/lib/module/ui/components/AttachmentChips.js +111 -42
  76. package/lib/module/ui/components/AttachmentChips.js.map +1 -1
  77. package/lib/module/ui/components/ConversationRow.js +65 -10
  78. package/lib/module/ui/components/ConversationRow.js.map +1 -1
  79. package/lib/module/ui/components/ImageViewer.js +233 -27
  80. package/lib/module/ui/components/ImageViewer.js.map +1 -1
  81. package/lib/module/ui/components/RatingCard.js +5 -2
  82. package/lib/module/ui/components/RatingCard.js.map +1 -1
  83. package/lib/module/ui/components/ZoomableImage.js +58 -10
  84. package/lib/module/ui/components/ZoomableImage.js.map +1 -1
  85. package/lib/module/ui/components/icons.js +21 -15
  86. package/lib/module/ui/components/icons.js.map +1 -1
  87. package/lib/module/ui/hooks/use-retained-state.js +34 -0
  88. package/lib/module/ui/hooks/use-retained-state.js.map +1 -0
  89. package/lib/module/ui/screens/chat/ChatView.js +672 -177
  90. package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
  91. package/lib/module/ui/screens/chat/ChatView.styles.js +152 -4
  92. package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -1
  93. package/lib/module/ui/screens/conversations/ConversationsList.js +1 -0
  94. package/lib/module/ui/screens/conversations/ConversationsList.js.map +1 -1
  95. package/lib/module/ui/screens/home/HomeView.js +40 -57
  96. package/lib/module/ui/screens/home/HomeView.js.map +1 -1
  97. package/lib/module/ui/screens/home/HomeView.styles.js +36 -45
  98. package/lib/module/ui/screens/home/HomeView.styles.js.map +1 -1
  99. package/lib/module/ui/styles/theme.js +1 -0
  100. package/lib/module/ui/styles/theme.js.map +1 -1
  101. package/lib/module/ui/utils/conversations.js +15 -1
  102. package/lib/module/ui/utils/conversations.js.map +1 -1
  103. package/lib/module/ui/utils/html.js +12 -0
  104. package/lib/module/ui/utils/html.js.map +1 -1
  105. package/lib/module/ui/utils/image-load-queue.js +109 -0
  106. package/lib/module/ui/utils/image-load-queue.js.map +1 -0
  107. package/lib/module/ui/utils/inline-attachments.js +85 -0
  108. package/lib/module/ui/utils/inline-attachments.js.map +1 -0
  109. package/lib/typescript/commonjs/api/client.d.ts +35 -1
  110. package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
  111. package/lib/typescript/commonjs/attachments/file-size.d.ts +15 -0
  112. package/lib/typescript/commonjs/attachments/file-size.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/attachments/local-previews.d.ts +14 -0
  114. package/lib/typescript/commonjs/attachments/local-previews.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/attachments/pickers.d.ts +35 -10
  116. package/lib/typescript/commonjs/attachments/pickers.d.ts.map +1 -1
  117. package/lib/typescript/commonjs/i18n.d.ts +13 -3
  118. package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
  119. package/lib/typescript/commonjs/locales.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/state/widget-store.d.ts +67 -4
  121. package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/storage.d.ts +2 -0
  123. package/lib/typescript/commonjs/storage.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/types.d.ts +58 -0
  125. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts +13 -3
  128. package/lib/typescript/commonjs/ui/components/AttachmentChips.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts +15 -1
  130. package/lib/typescript/commonjs/ui/components/ConversationRow.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts +26 -6
  132. package/lib/typescript/commonjs/ui/components/ImageViewer.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/ui/components/RatingCard.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/ui/components/ZoomableImage.d.ts +10 -1
  135. package/lib/typescript/commonjs/ui/components/ZoomableImage.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/ui/components/icons.d.ts +2 -1
  137. package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/ui/hooks/use-retained-state.d.ts +11 -0
  139. package/lib/typescript/commonjs/ui/hooks/use-retained-state.d.ts.map +1 -0
  140. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts +4 -4
  141. package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +154 -2
  143. package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +30 -1
  145. package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts +2 -0
  148. package/lib/typescript/commonjs/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts +7 -5
  150. package/lib/typescript/commonjs/ui/screens/home/HomeView.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts +30 -35
  152. package/lib/typescript/commonjs/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  153. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts +5 -6
  154. package/lib/typescript/commonjs/ui/screens/home/HomeView.types.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/ui/styles/theme.d.ts +2 -0
  156. package/lib/typescript/commonjs/ui/styles/theme.d.ts.map +1 -1
  157. package/lib/typescript/commonjs/ui/utils/conversations.d.ts +10 -2
  158. package/lib/typescript/commonjs/ui/utils/conversations.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/ui/utils/html.d.ts +5 -0
  160. package/lib/typescript/commonjs/ui/utils/html.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/ui/utils/image-load-queue.d.ts +44 -0
  162. package/lib/typescript/commonjs/ui/utils/image-load-queue.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/ui/utils/inline-attachments.d.ts +29 -0
  164. package/lib/typescript/commonjs/ui/utils/inline-attachments.d.ts.map +1 -0
  165. package/lib/typescript/module/api/client.d.ts +35 -1
  166. package/lib/typescript/module/api/client.d.ts.map +1 -1
  167. package/lib/typescript/module/attachments/file-size.d.ts +15 -0
  168. package/lib/typescript/module/attachments/file-size.d.ts.map +1 -0
  169. package/lib/typescript/module/attachments/local-previews.d.ts +14 -0
  170. package/lib/typescript/module/attachments/local-previews.d.ts.map +1 -0
  171. package/lib/typescript/module/attachments/pickers.d.ts +35 -10
  172. package/lib/typescript/module/attachments/pickers.d.ts.map +1 -1
  173. package/lib/typescript/module/i18n.d.ts +13 -3
  174. package/lib/typescript/module/i18n.d.ts.map +1 -1
  175. package/lib/typescript/module/locales.d.ts.map +1 -1
  176. package/lib/typescript/module/state/widget-store.d.ts +67 -4
  177. package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
  178. package/lib/typescript/module/storage.d.ts +2 -0
  179. package/lib/typescript/module/storage.d.ts.map +1 -1
  180. package/lib/typescript/module/types.d.ts +58 -0
  181. package/lib/typescript/module/types.d.ts.map +1 -1
  182. package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
  183. package/lib/typescript/module/ui/components/AttachmentChips.d.ts +13 -3
  184. package/lib/typescript/module/ui/components/AttachmentChips.d.ts.map +1 -1
  185. package/lib/typescript/module/ui/components/ConversationRow.d.ts +15 -1
  186. package/lib/typescript/module/ui/components/ConversationRow.d.ts.map +1 -1
  187. package/lib/typescript/module/ui/components/ImageViewer.d.ts +26 -6
  188. package/lib/typescript/module/ui/components/ImageViewer.d.ts.map +1 -1
  189. package/lib/typescript/module/ui/components/RatingCard.d.ts.map +1 -1
  190. package/lib/typescript/module/ui/components/ZoomableImage.d.ts +10 -1
  191. package/lib/typescript/module/ui/components/ZoomableImage.d.ts.map +1 -1
  192. package/lib/typescript/module/ui/components/icons.d.ts +2 -1
  193. package/lib/typescript/module/ui/components/icons.d.ts.map +1 -1
  194. package/lib/typescript/module/ui/hooks/use-retained-state.d.ts +11 -0
  195. package/lib/typescript/module/ui/hooks/use-retained-state.d.ts.map +1 -0
  196. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts +4 -4
  197. package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
  198. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +154 -2
  199. package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
  200. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +30 -1
  201. package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
  202. package/lib/typescript/module/ui/screens/conversations/ConversationsList.d.ts.map +1 -1
  203. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts +2 -0
  204. package/lib/typescript/module/ui/screens/conversations/ConversationsList.types.d.ts.map +1 -1
  205. package/lib/typescript/module/ui/screens/home/HomeView.d.ts +7 -5
  206. package/lib/typescript/module/ui/screens/home/HomeView.d.ts.map +1 -1
  207. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts +30 -35
  208. package/lib/typescript/module/ui/screens/home/HomeView.styles.d.ts.map +1 -1
  209. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts +5 -6
  210. package/lib/typescript/module/ui/screens/home/HomeView.types.d.ts.map +1 -1
  211. package/lib/typescript/module/ui/styles/theme.d.ts +2 -0
  212. package/lib/typescript/module/ui/styles/theme.d.ts.map +1 -1
  213. package/lib/typescript/module/ui/utils/conversations.d.ts +10 -2
  214. package/lib/typescript/module/ui/utils/conversations.d.ts.map +1 -1
  215. package/lib/typescript/module/ui/utils/html.d.ts +5 -0
  216. package/lib/typescript/module/ui/utils/html.d.ts.map +1 -1
  217. package/lib/typescript/module/ui/utils/image-load-queue.d.ts +44 -0
  218. package/lib/typescript/module/ui/utils/image-load-queue.d.ts.map +1 -0
  219. package/lib/typescript/module/ui/utils/inline-attachments.d.ts +29 -0
  220. package/lib/typescript/module/ui/utils/inline-attachments.d.ts.map +1 -0
  221. package/package.json +1 -1
  222. package/src/api/client.ts +148 -2
  223. package/src/attachments/file-size.ts +42 -0
  224. package/src/attachments/local-previews.ts +32 -0
  225. package/src/attachments/pickers.ts +90 -30
  226. package/src/i18n.ts +24 -3
  227. package/src/locales.ts +13 -3
  228. package/src/state/widget-store.ts +519 -70
  229. package/src/storage.ts +2 -0
  230. package/src/types.ts +58 -0
  231. package/src/ui/WidgetProvider.tsx +50 -12
  232. package/src/ui/components/AttachmentChips.tsx +100 -29
  233. package/src/ui/components/ConversationRow.tsx +90 -9
  234. package/src/ui/components/ImageViewer.tsx +250 -28
  235. package/src/ui/components/RatingCard.tsx +5 -2
  236. package/src/ui/components/ZoomableImage.tsx +58 -5
  237. package/src/ui/components/icons.tsx +10 -12
  238. package/src/ui/hooks/use-retained-state.ts +35 -0
  239. package/src/ui/screens/chat/ChatView.styles.ts +151 -3
  240. package/src/ui/screens/chat/ChatView.tsx +760 -213
  241. package/src/ui/screens/chat/ChatView.types.ts +30 -1
  242. package/src/ui/screens/conversations/ConversationsList.tsx +1 -0
  243. package/src/ui/screens/conversations/ConversationsList.types.ts +2 -0
  244. package/src/ui/screens/home/HomeView.styles.ts +36 -45
  245. package/src/ui/screens/home/HomeView.tsx +54 -70
  246. package/src/ui/screens/home/HomeView.types.ts +5 -6
  247. package/src/ui/styles/theme.ts +6 -0
  248. package/src/ui/utils/conversations.ts +16 -2
  249. package/src/ui/utils/html.ts +26 -0
  250. package/src/ui/utils/image-load-queue.ts +108 -0
  251. package/src/ui/utils/inline-attachments.ts +71 -0
package/CHANGELOG.md CHANGED
@@ -12,6 +12,185 @@ All notable changes to `@repzo/widget-react-native`, newest first.
12
12
 
13
13
  ## Unreleased
14
14
 
15
+ ## 1.4.0 — 2026-11-02
16
+
17
+ ### Added
18
+
19
+ - **Several photos in one message show as an album,** like WhatsApp: one
20
+ square holding them all. Two sit side by side, three as one tall beside two
21
+ stacked, four in a grid, and with more than four the last tile shows how
22
+ many more there are ("+3"). Tapping any tile opens the photos at that one.
23
+ Other files in the message still show below. New `boot({ photoAlbums })`
24
+ option (default `true`): `false` shows each photo on its own, as before.
25
+ See **Upgrading**.
26
+ - **Swipe between a message's photos.** When a message has several photos,
27
+ sent or received, tapping one opens them all in the full-screen viewer.
28
+ Swipe left or right to move between them (mirrored in Arabic); the header
29
+ shows which one is open, like "2 / 4", and screen readers move between them
30
+ with the adjust gesture. The next photo is already drawn as it slides in
31
+ and stays on screen while its full-size copy loads, so a swipe never shows
32
+ a black frame. Pinch and double-tap zoom work as before. Nothing to set up.
33
+ - **Photos in the chat show a loader until they've loaded.** A small spinner
34
+ sits over each photo, and each album tile, while it downloads or waits its
35
+ turn, instead of an empty box. A photo that loads straight away (from the
36
+ cache) never shows it. Nothing to set up.
37
+ - **Choose when picked files upload.** New
38
+ `boot({ attachments: { uploadOnPick } })` option (default `true`). Set it to
39
+ `false` to upload files only when the visitor taps Send, so nothing leaves
40
+ the phone for a file they pick and then remove.
41
+ - **"You:" before the visitor's own last message.** On Home and in Messages,
42
+ a conversation whose newest message is the visitor's shows "You: " before
43
+ it ("You: Photo" for a photo), so it's clear who spoke last. Arabic:
44
+ "أنت: ". Workspaces can change it with the `lastMessageYou` translation key,
45
+ which keeps `{message}`. Workstation's list doesn't say who sent the newest
46
+ message, so the SDK remembers it from what this device sent, received or
47
+ loaded, including across launches; a conversation last written in
48
+ elsewhere shows no "You:". `Conversation` has a new optional
49
+ `lastMessageFromVisitor` field; a Workstation list that sends it is used
50
+ as is. New `boot({ youPrefix })` option (default `true`): `false` shows the
51
+ message without "You:", as before. See **Upgrading**.
52
+
53
+ ### Changed
54
+
55
+ - **A conversation opens on its newest message.** The thread starts at the
56
+ bottom, with the latest messages drawn first, instead of rendering from the
57
+ top and then jumping down. Older messages load on their own as the visitor
58
+ scrolls up, without moving what they're reading, so there's no need to tap
59
+ **Load earlier messages**. That row stays at the top while a page loads, or
60
+ to try again if one didn't. A reply that arrives while they read further up
61
+ doesn't move the text either. Once the visitor has scrolled up, a button in
62
+ the corner takes them back to the newest message and shows how many
63
+ teammate replies arrived in the meantime. Nothing to set up.
64
+ - **Visitors can attach files up to 50 MB.** With a Workstation server that
65
+ takes uploads, a picked file is uploaded on its own instead of being sent
66
+ inside the message, so the 1.5 MB cap per file (6 MB per message) is gone;
67
+ the server sets the cap (50 MB a file, up to five files). With
68
+ `expo-file-system` installed, a file is sent straight from the phone's
69
+ storage as it uploads, so even a 50 MB file doesn't fill the app's memory.
70
+ Without it the file is read into memory first, which can fail on Android
71
+ for files over about 30 MB. The "File is too large" notice shows the
72
+ server's cap. Nothing else to set up.
73
+ - **Files upload as soon as they're picked.** A spinner shows on each file
74
+ in the message field while it uploads, and the send button turns on once
75
+ every file is up, so the message goes out at once. The upload happens while
76
+ the visitor writes. A file that fails to upload shows **Tap to retry**, and
77
+ removing a file cancels its upload. If the visitor waits so long to send
78
+ that Workstation no longer keeps the upload (about an hour), the file
79
+ uploads again as the message goes out. With an older Workstation that
80
+ doesn't take uploads, nothing changes. To keep uploading on Send, see
81
+ **Upgrading**.
82
+ - **Home shows the latest conversation in a "Recent message" card.** The
83
+ newest conversation now sits in its own card above **Send us a message**:
84
+ who replied, how long ago and the last thing said, with the unread count
85
+ when there is one. Tapping it opens the conversation. It replaces the
86
+ "Recent" list of two conversations and its **View all** link that sat under
87
+ the start card; every conversation is still one tap away in the Messages
88
+ tab. The card follows the workspace's "show previous conversations" setting
89
+ like the list did. Arabic: "أحدث رسالة". Workspaces can change the title
90
+ with the `homeRecentMessageTitle` translation key. Nothing to set up.
91
+
92
+ ### Fixed
93
+
94
+ - **Images in a team reply show where the teammate put them.** A reply with
95
+ text, an image, more text and another image now shows them in that order,
96
+ like the web Messenger, instead of all the text first and every image after
97
+ it. Links and formatting in the text between images are kept.
98
+ - **A photo the visitor sends stays a photo.** Right after sending, a photo
99
+ could turn into a file row until the conversation was opened again. It now
100
+ keeps showing from the phone until the next time the conversation loads.
101
+ An attachment that arrives without a file type shows as what its name says,
102
+ so a photo shows as a photo.
103
+ - **Photos keep showing in long conversations on Android.** A conversation
104
+ with a few large photos could use up the memory Android sets aside for
105
+ images. Later photos, in the chat and elsewhere in your app, then showed as
106
+ file rows or didn't load. Photos in the chat are now decoded at the size
107
+ they're shown, and photos over 10 MB download two at a time, newest first,
108
+ so several of them on screen at once all show instead of all failing.
109
+ Ordinary photos still load straight away. iOS wasn't affected.
110
+ - **Screen readers name the send button.** VoiceOver and TalkBack read
111
+ "Send message" (Arabic: "إرسال الرسالة") for the button beside the message
112
+ field, instead of just "button". Workspaces can change the text with the
113
+ `sendMessage` translation key.
114
+ - **The conversation list shows the reply that just arrived.** On Home and
115
+ in Messages, a reply that came in while the visitor was on those screens
116
+ could leave the row showing the visitor's own last message, beside the
117
+ unread badge. This happened when the reply was only a photo or file, or
118
+ came from Workstation as formatted text only. The row now shows the
119
+ reply's words, or "Photo" or "File" (Arabic: "صورة", "ملف") when it had
120
+ none. Workspaces can change these with the `lastMessagePhoto` and
121
+ `lastMessageFile` translation keys. A conversation the visitor starts with
122
+ only attachments shows the same instead of "1 attachment". For apps that
123
+ read conversations from `MessageDidArrive`, `snippet` stays text: after a
124
+ reply with only photos or files it now says "2 attachments", the way
125
+ Workstation's list words it, instead of keeping the previous message's
126
+ words. A new optional `lastMessageAttachment` field (`'photo'`, `'file'`
127
+ or `null`) says which it was.
128
+ - **The conversation list shows what the visitor just sent.** After replying
129
+ in a conversation and going back to Home or Messages, the row still showed
130
+ the team's last message until the list was pulled to refresh. It now shows
131
+ the visitor's message, and its time, as soon as it's sent.
132
+
133
+ ### Older versions
134
+
135
+ - Apps on earlier versions keep the 1.5 MB cap. With an older server, this
136
+ version keeps it too.
137
+
138
+ ### Upgrading
139
+
140
+ - **Picked files now upload before Send.** Nothing to do. To upload them only
141
+ when the visitor taps Send, as before:
142
+
143
+ ```ts
144
+ await RepzoWidget.boot({ channelAccountId: '<widget id>', attachments: { uploadOnPick: false } });
145
+ ```
146
+
147
+ - **Several photos in one message show as an album.** Nothing to do. To keep
148
+ showing each photo on its own, full width:
149
+
150
+ ```ts
151
+ await RepzoWidget.boot({ channelAccountId: '<widget id>', photoAlbums: false });
152
+ ```
153
+
154
+ - **"You:" before the visitor's own last message** on Home and in Messages.
155
+ Nothing to do. To show the message alone, as before:
156
+
157
+ ```ts
158
+ await RepzoWidget.boot({ channelAccountId: '<widget id>', youPrefix: false });
159
+ ```
160
+
161
+ ## 1.3.1 — 2026-10-29
162
+
163
+ ### Added
164
+
165
+ - **Tap to retry a message that didn't send.** A text message that fails to
166
+ send (no connection, say) shows **Failed to send · Tap to retry** under it,
167
+ where Sent and Seen usually are. Tapping the line sends it again, and it
168
+ moves to the end of the conversation, after anything sent in the meantime. A
169
+ tap on an agent card button (add to cart, book a time and so on) is sent
170
+ again with its text. Tapping the card button again also works and replaces
171
+ the failed message, so the action runs only once. Nothing to set up.
172
+ - **No double messages after a dropped connection,** with a Workstation
173
+ update. If the connection drops after Workstation has already stored a
174
+ message, the message shows as sent instead of failed, and a retry doesn't
175
+ post it a second time. With older Workstation deployments, a retry in that
176
+ case can still post the message twice. New optional field
177
+ `Message.clientMessageId`.
178
+
179
+ ### Changed
180
+
181
+ - **The attach button is now a plus (+).** It replaces the paperclip beside the
182
+ message field, which was hard to recognize.
183
+
184
+ ### Fixed
185
+
186
+ - **Visitors can open the photos and files they send.** Tapping them used to
187
+ do nothing until the stored copy happened to arrive. A photo now opens in
188
+ the full-screen viewer right away, from the copy on the phone. A PDF or
189
+ other file opens in the phone's viewer once Workstation has stored it: the
190
+ messenger fetches the stored copy after sending, and checks again for about
191
+ 20 seconds if it isn't ready yet. When several photos or files go in one
192
+ message, each becomes openable as soon as its own copy is stored.
193
+
15
194
  ## 1.3.0 — 2026-10-27
16
195
 
17
196
  ### Changed
package/README.md CHANGED
@@ -22,10 +22,14 @@ in your Repzo Inbox and agent replies arrive live.
22
22
  - Session resume, anonymous → identified migration, HMAC identity verification
23
23
  - Shared-device safe: logout revokes the token and wipes all visitor data; tokens can live in Keychain/Keystore
24
24
  - Live agent replies, typing indicators, unread badges (server-backed counts)
25
- - Sent/Seen receipts, teammate avatars and presence, deleted-message placeholders
25
+ - Sent/Seen receipts, tap to retry a message that didn't send (*1.3.1+*), teammate avatars and presence, deleted-message placeholders
26
26
  - Catches up after a dropped connection or a trip to the background — no missed or duplicated replies
27
27
  - Agent UI blocks: product cards, slot pickers, lead forms, quotes, receipts
28
- - **Image viewer** with pinch and double-tap zoom for photos in the conversation
28
+ - **Image viewer** with pinch and double-tap zoom for photos in the conversation; swipe between a message's photos (*1.4.0+*)
29
+ - **Photo albums**: several photos in one message share one square, WhatsApp-style (*1.4.0+*; `photoAlbums: false` turns them off)
30
+ - Conversations open on the newest message, load older ones as the visitor scrolls up, and offer a jump-to-latest button (*1.4.0+*)
31
+ - Team replies keep their images where the teammate put them, between the text (*1.4.0+*)
32
+ - Conversation lists say "You:" before the visitor's own last message, and "Photo" or "File" for one without words (*1.4.0+*; `youPrefix: false` turns "You:" off)
29
33
  - **Photo and file attachments** (optional — with `expo-image-picker` / `expo-document-picker`, or your own picker)
30
34
  - **Voice messages play in the chat**, with the phone's own audio player — nothing to install in Expo apps
31
35
  - **In-app notification cards** for new replies while the messenger is closed
@@ -46,7 +50,7 @@ in your Repzo Inbox and agent replies arrive live.
46
50
  | `react-native-safe-area-context` | optional — safe-area insets from the host provider |
47
51
  | `expo-image-picker` | optional — "Photo library" and "Take photo" attachments (v16+ / SDK 52+) |
48
52
  | `expo-document-picker` | optional — "File" attachments |
49
- | `expo-file-system` | optional — reads picked files as base64 (falls back to `fetch` without it) |
53
+ | `expo-file-system` | optional — reads picked files as base64 (falls back to `fetch` without it), and (*1.4.0+*) lets large attachments upload straight from storage (recommended) |
50
54
  | `expo-image-manipulator` | optional — shrinks photos so camera shots fit the 1.5 MB attachment limit |
51
55
  | `expo-audio` | optional (*1.2.2+*) — no longer needed from *1.3.0+* in apps with Expo modules (see "Voice messages"); still used where the SDK's own player isn't built in |
52
56
  | `expo-crypto` | optional (*1.1.0+*) — secure random source for the anonymous device id when the runtime has no `crypto` global (see below) |
@@ -309,9 +313,8 @@ your bank. Ordinary link text ("Book here") is shown as written.
309
313
 
310
314
  ## Attachments
311
315
 
312
- Visitors can send photos and files from the paperclip button beside the
313
- message field. The SDK has no picker of its own; it uses whatever your app
314
- installs:
316
+ Visitors can send photos and files from the **+** button beside the message
317
+ field. The SDK has no picker of its own; it uses whatever your app installs:
315
318
 
316
319
  ```sh
317
320
  npx expo install expo-image-picker expo-document-picker expo-file-system expo-image-manipulator
@@ -321,7 +324,7 @@ npx expo install expo-image-picker expo-document-picker expo-file-system expo-im
321
324
  | --- | --- |
322
325
  | `expo-image-picker` | Photo library, Take photo |
323
326
  | `expo-document-picker` | File |
324
- | `expo-file-system` | nothing new — reads picked files faster (SDK 53's `readAsStringAsync` and SDK 54+'s `File` both work) |
327
+ | `expo-file-system` | nothing new — reads picked files faster (SDK 53's `readAsStringAsync` and SDK 54+'s `File` both work), and (*1.4.0+*) uploads large files straight from storage. Without it a file is read into memory before it uploads, which can fail on Android for files over about 30 MB (recommended) |
325
328
  | `expo-image-manipulator` | nothing new — shrinks photos so camera shots fit the size limit (recommended) |
326
329
 
327
330
  With none of them (and no `pick` below) the button isn't shown. It is also
@@ -335,18 +338,46 @@ them. Taking photos needs `NSCameraUsageDescription` in `Info.plist` (the
335
338
  gets a clear message instead of a silently missing file:
336
339
 
337
340
  - 5 files per message
338
- - 1.5 MB per file
339
- - 6 MB for all files in one message together (they travel base64-encoded in
340
- one JSON request)
341
+ - *1.4.0+.* 50 MB per file, the cap Workstation sets. Each file starts uploading as
342
+ soon as it's picked, with a spinner on its thumbnail, and Send turns on
343
+ once every file is up, so the message then goes out at once. A file that
344
+ fails to upload shows **Tap to retry**; removing it cancels its upload.
345
+ A file picked about an hour before Send uploads again as the message goes
346
+ out, since Workstation stops keeping an unsent upload by then.
347
+ - Before 1.4.0, or with an older Workstation that doesn't take uploads,
348
+ files travel base64-encoded inside the message instead: 1.5 MB per file,
349
+ and 6 MB for all files in one message together.
350
+
351
+ *1.4.0+.* To upload the files only when the visitor taps Send, so nothing
352
+ leaves the phone for a file they pick and then remove, pass
353
+ `attachments: { uploadOnPick: false }`. Send then stays on while files are
354
+ attached, and the message goes out once its files are up.
341
355
 
342
356
  With `expo-image-manipulator` installed, photos are scaled to at most 1600 px
343
- on the longest edge and saved as 70% JPEG — typically 200–500 KB, so camera
344
- shots fit comfortably. Without it they're only compressed, and a
345
- full-resolution camera photo can still exceed 1.5 MB and is then refused with
346
- a message. A message can be attachments only,
357
+ on the longest edge and saved as 70% JPEG — typically 200–500 KB, so they
358
+ upload quickly and fit the 1.5 MB cap of an older Workstation. Without it
359
+ they're only compressed. A message can be attachments only,
347
360
  with no text. If a send fails, the attachments stay in the composer so the
348
361
  visitor can retry.
349
362
 
363
+ *1.3.1+.* Visitors can open what they sent with a tap. A photo opens in the
364
+ full-screen viewer right away, from the copy on the phone. A PDF or other file
365
+ opens in the phone's viewer once Workstation has stored it, usually a moment
366
+ after it's sent.
367
+
368
+ *1.4.0+.* When a message has several photos, sent or received, they show
369
+ together as an album in one square, WhatsApp-style, with "+N" on the last
370
+ tile when there are more than four. Tapping one opens them all in the
371
+ viewer: swipe sideways to move between them (the direction follows the
372
+ app's language), and the header shows which one is open. To show each photo
373
+ on its own, full width, as before, pass `photoAlbums: false`:
374
+
375
+ ```ts
376
+ await RepzoWidget.boot({ channelAccountId: '…', photoAlbums: false });
377
+ ```
378
+
379
+ Tapping a photo still opens the message's photos in the viewer.
380
+
350
381
  ### Your own picker
351
382
 
352
383
  Apps that use `react-native-image-picker`, `react-native-document-picker` or
@@ -430,6 +461,30 @@ get a plain message and no Retry.
430
461
  Expired or revoked tokens (401) are handled silently: the SDK re-inits once
431
462
  (shared by all concurrent requests) and retries.
432
463
 
464
+ ## Conversation list
465
+
466
+ *1.4.0+.* On Home and in Messages, each conversation shows its newest
467
+ message. When the visitor sent it, "You: " comes first (Arabic "أنت: "), and a
468
+ message with no words shows as "Photo" or "File" (Arabic "صورة", "ملف").
469
+ Workspaces can change these with the `lastMessageYou` (keeps `{message}`),
470
+ `lastMessagePhoto` and `lastMessageFile` translation keys.
471
+
472
+ Workstation's list doesn't say who sent the newest message, so the SDK
473
+ remembers it from what this device sent, received or loaded, across launches
474
+ too. A conversation last written in on another device shows no "You:". To
475
+ show the message without "You:", as before 1.4.0:
476
+
477
+ ```ts
478
+ await RepzoWidget.boot({ channelAccountId: '…', youPrefix: false });
479
+ ```
480
+
481
+ Conversations in the `MessageDidArrive` payload carry the same information in
482
+ two optional fields: `lastMessageFromVisitor` (`true` when the visitor sent
483
+ the newest message) and `lastMessageAttachment` (`'photo'` or `'file'` when it
484
+ had no words, otherwise `null`). `snippet` stays text, worded the way
485
+ Workstation's list words it ("2 attachments"). Both fields are filled in
486
+ whether or not `youPrefix` is on.
487
+
433
488
  ## In-app notifications
434
489
 
435
490
  When a team reply arrives while the app is open but the messenger is closed,
@@ -682,7 +737,7 @@ sub.remove();
682
737
  | Event | Payload | Use it for |
683
738
  | --- | --- | --- |
684
739
  | `UnreadCountDidChange` | `{ count }` | Badge on your own chat button. `count` is the number of unread team replies across all conversations; it drops only when the visitor opens a thread (opening the messenger alone doesn't clear it). Counts are server-backed, so replies that arrived while the app was killed are included after a cold start. |
685
- | `MessageDidArrive` | `{ conversationId, message, conversation }` | Your own in-app banner while the app is foregrounded (no push is sent then). Fires only for team replies that count as unread — never the visitor's echo, never system rows like "agent joined", never the thread already open. |
740
+ | `MessageDidArrive` | `{ conversationId, message, conversation }` | Your own in-app banner while the app is foregrounded (no push is sent then). Fires only for team replies that count as unread — never the visitor's echo, never system rows like "agent joined", never the thread already open. *1.4.0+:* `conversation.lastMessageFromVisitor` and `conversation.lastMessageAttachment` say who sent the newest message and whether it was only photos or files (see "Conversation list"). |
686
741
  | `ConversationDidRead` | `{ conversationId }` | Dismissing that conversation's push notification (example above). |
687
742
  | `WindowDidShow` / `WindowDidHide` | — | Pause your own UI (tours, toasts) while the messenger is open. |
688
743
 
@@ -690,7 +745,7 @@ sub.remove();
690
745
 
691
746
  | Method | Notes |
692
747
  | --- | --- |
693
- | `boot({ channelAccountId, baseUrl?, user?, push?, onOpenUrl?, attachments?, inAppNotifications?, posts? })` | Mints/resumes the session and connects the live stream. Idempotent; safe to call repeatedly. |
748
+ | `boot({ channelAccountId, baseUrl?, user?, push?, onOpenUrl?, attachments?, inAppNotifications?, posts?, photoAlbums?, youPrefix? })` | Mints/resumes the session and connects the live stream. Idempotent; safe to call repeatedly. |
694
749
  | `loginUserWithUserAttributes({ userId?, email?, name?, phone?, userHash?, account?, signedUpAt? })` | Identifies the visitor; moves anonymous history over. `account: { id, name?, website? }` links them to a CRM account matched by `id`; `signedUpAt` (Date, unix seconds or ISO) shows as "Signed up". A different stored user is signed out first. |
695
750
  | `loginUnidentifiedUser()` | Drops the identity (signing out a stored user), fresh anonymous session. |
696
751
  | `updateUser(attributes)` | Custom attributes agents see on the conversation (≤30 keys, 64-char keys, 512-char values). |
@@ -736,6 +791,7 @@ action from you:
736
791
  | 1.0.9 or older | Nothing required. Development builds now warn once if the visitor token isn't in secure storage, or if the device has no secure random source — see "Secure token storage" and "Requirements". |
737
792
  | 1.1.0 or older | Posts from Workstation now show over the app by default, once one is set live for Mobile (`posts: false` turns them off). They need `<RepzoWidgetProvider>` mounted at the root. |
738
793
  | 1.2.2 or older | Nothing required. In apps with Expo modules, the SDK now includes a small native voice player, so build the app again (development or store build) to get it; `expo-audio` can be removed if nothing else in your app uses it. If your `runtimeVersion` uses the `fingerprint` policy, it changes with this update. |
794
+ | 1.3.1 or older | Nothing required. With a Workstation that takes uploads, a picked file now starts uploading right away, before the visitor taps Send (`attachments: { uploadOnPick: false }` uploads on Send instead). Several photos in one message now show as an album (`photoAlbums: false` shows each on its own, as before). Home and Messages put "You:" before the visitor's own last message (`youPrefix: false` turns it off). |
739
795
 
740
796
  ## Troubleshooting
741
797
 
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.WidgetApiClient = exports.RepzoWidgetError = void 0;
7
7
  exports.isTerminalErrorCode = isTerminalErrorCode;
8
+ var _fileSize = require("../attachments/file-size.js");
8
9
  var _storage = require("../storage.js");
9
10
  var _safeUrl = require("../ui/utils/safe-url.js");
10
11
  /**
@@ -41,6 +42,49 @@ class RepzoWidgetError extends Error {
41
42
 
42
43
  /** A Send message part asked for on its own, which may share one request with others. */
43
44
  exports.RepzoWidgetError = RepzoWidgetError;
45
+ /**
46
+ * Sends a local file as the request body straight from disk and resolves the
47
+ * HTTP status. React Native streams a `{ uri }` body natively; `fetch` would
48
+ * stringify it, so this goes through XMLHttpRequest.
49
+ */
50
+ function sendFileFromDisk(url, method, headers, file, signal) {
51
+ return new Promise((resolve, reject) => {
52
+ const xhr = new XMLHttpRequest();
53
+ const cancel = () => xhr.abort();
54
+ const settle = finish => {
55
+ signal?.removeEventListener('abort', cancel);
56
+ finish();
57
+ };
58
+ xhr.onload = () => settle(() => resolve(xhr.status));
59
+ xhr.onerror = () => settle(() => reject(new RepzoWidgetError('Network request failed', 0, 'network')));
60
+ xhr.ontimeout = xhr.onerror;
61
+ xhr.onabort = () => settle(() => reject(new RepzoWidgetError('Upload cancelled', 0, 'network')));
62
+ xhr.open(method, url);
63
+ Object.entries(headers).forEach(([name, value]) => xhr.setRequestHeader(name, value));
64
+ // Android refuses a `{ uri }` body without one.
65
+ if (!Object.keys(headers).some(name => name.toLowerCase() === 'content-type')) {
66
+ xhr.setRequestHeader('Content-Type', file.contentType);
67
+ }
68
+ signal?.addEventListener('abort', cancel);
69
+ xhr.send({
70
+ uri: file.uri
71
+ });
72
+ });
73
+ }
74
+
75
+ /**
76
+ * How long Workstation keeps an upload for a message to name, when its answer
77
+ * has no usable `expiresAt` (deployments without it, or a phone clock that
78
+ * reads it as already past).
79
+ */
80
+ const UPLOAD_LIFETIME_MS = 60 * 60 * 1000;
81
+
82
+ /** A file in storage, waiting for the message that names it. */
83
+
84
+ function uploadExpiry(expiresAt, now) {
85
+ const at = typeof expiresAt === 'string' ? Date.parse(expiresAt) : typeof expiresAt === 'number' ? expiresAt : NaN;
86
+ return at > now ? at : now + UPLOAD_LIFETIME_MS;
87
+ }
44
88
  class WidgetApiClient {
45
89
  baseUrl = '';
46
90
  channelAccountId = '';
@@ -278,6 +322,75 @@ class WidgetApiClient {
278
322
  body: data
279
323
  });
280
324
  }
325
+
326
+ /**
327
+ * Puts a local file in storage ahead of the message, which then names it by
328
+ * the returned upload token. The target is presigned storage, or a path on
329
+ * the server where its storage can't presign. The upload URL is signed for
330
+ * exactly the size asked for: a `file://` file whose size `expo-file-system`
331
+ * can read streams from disk, anything else is read as a native blob and
332
+ * measured. `signal` cancels the transfer (the visitor removed the file, or
333
+ * left the conversation). Resolves the token and when it expires.
334
+ */
335
+ async uploadAttachment(file, signal) {
336
+ // A file removed early is never read, nor given a slot in storage.
337
+ const stopIfCancelled = () => {
338
+ if (signal?.aborted) throw new RepzoWidgetError('Upload cancelled', 0, 'network');
339
+ };
340
+ stopIfCancelled();
341
+ // Streaming matters on Android: React Native also copies a blob it reads
342
+ // into a Base64 string for its network inspector, so a file past ~30 MB
343
+ // runs the app out of memory. Only file:// gives an exact Content-Length.
344
+ const streamedSize = (0, _safeUrl.urlScheme)(file.uri) === 'file:' ? await (0, _fileSize.measureFileSize)(file.uri) : null;
345
+ let blob = null;
346
+ if (streamedSize === null) {
347
+ try {
348
+ blob = await (await fetch(file.uri, {
349
+ signal
350
+ })).blob();
351
+ } catch (error) {
352
+ throw new RepzoWidgetError(error instanceof Error ? error.message : 'Could not read the file', 0, 'network');
353
+ }
354
+ }
355
+ stopIfCancelled();
356
+ const target = await this.request('/api/widget/uploads', {
357
+ method: 'POST',
358
+ body: {
359
+ fileName: file.name,
360
+ contentType: file.contentType,
361
+ size: streamedSize ?? (blob?.size || file.size)
362
+ }
363
+ });
364
+ // Counted from when the token was issued, not from when the file is up.
365
+ const expiresAt = uploadExpiry(target.expiresAt, Date.now());
366
+ const uploadUrl = this.resolveUrl(target.uploadUrl);
367
+ if (!uploadUrl) throw new RepzoWidgetError('Invalid upload target', 0, 'http');
368
+ stopIfCancelled();
369
+ const method = target.method ?? 'PUT';
370
+ const headers = target.headers ?? {
371
+ 'Content-Type': file.contentType
372
+ };
373
+ let status;
374
+ if (blob) {
375
+ try {
376
+ status = (await fetch(uploadUrl, {
377
+ method,
378
+ headers,
379
+ body: blob,
380
+ signal
381
+ })).status;
382
+ } catch (error) {
383
+ throw new RepzoWidgetError(error instanceof Error ? error.message : 'Upload failed', 0, 'network');
384
+ }
385
+ } else {
386
+ status = await sendFileFromDisk(uploadUrl, method, headers, file, signal);
387
+ }
388
+ if (status < 200 || status >= 300) throw new RepzoWidgetError('Upload failed', status, 'http');
389
+ return {
390
+ uploadToken: target.uploadToken,
391
+ expiresAt
392
+ };
393
+ }
281
394
  listConversations() {
282
395
  return this.request('/api/widget/conversations');
283
396
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_storage","require","_safeUrl","TERMINAL_CODES","Set","isTerminalErrorCode","code","has","RepzoWidgetError","Error","constructor","message","status","name","fromResponse","body","payload","exports","WidgetApiClient","baseUrl","channelAccountId","token","tokenLoaded","reauthorize","onTerminalError","sendPartBatch","configure","replace","getBaseUrl","getChannelAccountId","getToken","SecureStorage","getItem","TOKEN_KEY","setToken","setItem","clearToken","removeItem","resolveUrl","url","trimmed","trim","isHttpUrl","urlScheme","resolved","startsWith","request","path","options","sentToken","send","headers","authToken","undefined","Authorization","fetch","method","JSON","stringify","error","response","skipReauth","refreshed","ok","json","catch","getConfig","platform","query","encodeURIComponent","getOutboundMessage","askSendPart","getPost","part","own","Promise","resolve","reject","setTimeout","flushSendParts","push","asks","parts","Array","from","map","ask","answer","length","join","value","then","sendPostInteraction","campaignId","kind","init","params","visitorToken","resumeToken","user","email","phone","userId","user_id","userHash","user_hash","account","id","signedUpAt","signed_up_at","Date","toISOString","trackingVisitorId","sdkVersion","logout","sendMessage","data","listConversations","listMessages","conversationId","cursor","markConversationRead","rateConversation","ratingId","identify","sendTyping","isTyping","trackEvent","registerPushToken","reportPushOpened","deliveryId","removePushToken","auth"],"sourceRoot":"../../../src","sources":["api/client.ts"],"mappings":";;;;;;;AAUA,IAAAA,QAAA,GAAAC,OAAA;AAeA,IAAAC,QAAA,GAAAD,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA,MAAME,cAAc,GAAG,IAAIC,GAAG,CAAuB,CACnD,wBAAwB,EACxB,8BAA8B,CAC/B,CAAC;AAEK,SAASC,mBAAmBA,CAACC,IAA+B,EAAW;EAC5E,OAAO,CAAC,CAACA,IAAI,IAAIH,cAAc,CAACI,GAAG,CAACD,IAA4B,CAAC;AACnE;AAEO,MAAME,gBAAgB,SAASC,KAAK,CAAC;EAK1CC,WAAWA,CAACC,OAAe,EAAEC,MAAc,EAAEN,IAA0B,GAAG,MAAM,EAAE;IAChF,KAAK,CAACK,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,kBAAkB;IAC9B,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACN,IAAI,GAAGA,IAAI;EAClB;;EAEA;EACA,OAAOQ,YAAYA,CAACF,MAAc,EAAEG,IAAa,EAAoB;IACnE,MAAMC,OAAO,GAAID,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAG,CA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,IAAI,CAACA;MAAiB;IAC3D,CAAC,CAAC;EACJ;EAEA4G,iBAAiBA,CAACZ,IAIjB,EAAiB;IAChB,OAAO,IAAI,CAACtE,OAAO,CAAC,wBAAwB,EAAE;MAAEU,MAAM,EAAE,MAAM;MAAEzC,IAAI,EAAEqG;IAAK,CAAC,CAAC;EAC/E;;EAEA;EACAa,gBAAgBA,CAACC,UAAkB,EAAiB;IAClD,OAAO,IAAI,CAACpF,OAAO,CAAC,yBAAyB,EAAE;MAAEU,MAAM,EAAE,MAAM;MAAEzC,IAAI,EAAE;QAAEmH;MAAW;IAAE,CAAC,CAAC;EAC1F;;EAEA;EACAC,eAAeA,CACb9G,KAAa,EACb+G,IAAyD,GAAG,CAAC,CAAC,EAC/C;IACf,OAAO,IAAI,CAACtF,OAAO,CAAC,wBAAwB,EAAE;MAC5CU,MAAM,EAAE,QAAQ;MAChBzC,IAAI,EAAE;QAAEM;MAAM,CAAC;MACf,GAAG+G;IACL,CAAC,CAAC;EACJ;AACF;AAACnH,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fileSize","require","_storage","_safeUrl","TERMINAL_CODES","Set","isTerminalErrorCode","code","has","RepzoWidgetError","Error","constructor","message","status","name","fromResponse","body","payload","exports","sendFileFromDisk","url","method","headers","file","signal","Promise","resolve","reject","xhr","XMLHttpRequest","cancel","abort","settle","finish","removeEventListener","onload","onerror","ontimeout","onabort","open","Object","entries","forEach","value","setRequestHeader","keys","some","toLowerCase","contentType","addEventListener","send","uri","UPLOAD_LIFETIME_MS","uploadExpiry","expiresAt","now","at","Date","parse","NaN","WidgetApiClient","baseUrl","channelAccountId","token","tokenLoaded","reauthorize","onTerminalError","sendPartBatch","configure","replace","getBaseUrl","getChannelAccountId","getToken","SecureStorage","getItem","TOKEN_KEY","setToken","setItem","clearToken","removeItem","resolveUrl","trimmed","trim","isHttpUrl","urlScheme","resolved","startsWith","request","path","options","sentToken","authToken","undefined","Authorization","fetch","JSON","stringify","error","response","skipReauth","refreshed","ok","json","catch","getConfig","platform","query","encodeURIComponent","getOutboundMessage","askSendPart","getPost","part","own","setTimeout","flushSendParts","push","asks","parts","Array","from","map","ask","answer","length","join","then","sendPostInteraction","campaignId","kind","init","params","visitorToken","resumeToken","user","email","phone","userId","user_id","userHash","user_hash","account","id","signedUpAt","signed_up_at","toISOString","trackingVisitorId","sdkVersion","logout","sendMessage","data","uploadAttachment","stopIfCancelled","aborted","streamedSize","measureFileSize","blob","target","fileName","size","uploadUrl","uploadToken","listConversations","listMessages","conversationId","cursor","markConversationRead","rateConversation","ratingId","identify","sendTyping","isTyping","trackEvent","registerPushToken","reportPushOpened","deliveryId","removePushToken","auth"],"sourceRoot":"../../../src","sources":["api/client.ts"],"mappings":";;;;;;;AAUA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAeA,IAAAE,QAAA,GAAAF,OAAA;AA1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA,MAAMG,cAAc,GAAG,IAAIC,GAAG,CAAuB,CACnD,wBAAwB,EACxB,8BAA8B,CAC/B,CAAC;AAEK,SAASC,mBAAmBA,CAACC,IAA+B,EAAW;EAC5E,OAAO,CAAC,CAACA,IAAI,IAAIH,cAAc,CAACI,GAAG,CAACD,IAA4B,CAAC;AACnE;AAEO,MAAME,gBAAgB,SAASC,KAAK,CAAC;EAK1CC,WAAWA,CAACC,OAAe,EAAEC,MAAc,EAAEN,IAA0B,GAAG,MAAM,EAAE;IAChF,KAAK,CAACK,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,kBAAkB;IAC9B,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACN,IAAI,GAAGA,IAAI;EAClB;;EAEA;EACA,OAAOQ,YAAYA,CAACF,MAAc,EAAEG,IAAa,EAAoB;IACnE,MAAMC,OAAO,GAAID,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,GAA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AAM,CAAC;MACf,GAAGiH;IACL,CAAC,CAAC;EACJ;AACF;AAAC9J,OAAA,CAAA0C,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.measureFileSize = measureFileSize;
7
+ exports.validSize = validSize;
8
+ /**
9
+ * Local file sizes from the host's `expo-file-system` (optional, like the
10
+ * pickers): read from the file's metadata, never from its contents. Shared by
11
+ * the pickers and the upload client, so the client doesn't pull in pickers.
12
+ *
13
+ * No `react-native` import on purpose: it stays testable in plain Node.
14
+ */
15
+
16
+ let fileSystem = null;
17
+ try {
18
+ fileSystem = require('expo-file-system') ?? null;
19
+ } catch {
20
+ fileSystem = null;
21
+ }
22
+
23
+ /** A positive, finite byte count, or null. */
24
+ function validSize(size) {
25
+ return typeof size === 'number' && Number.isFinite(size) && size > 0 ? size : null;
26
+ }
27
+
28
+ /**
29
+ * A local file's exact size in bytes, from its metadata without reading it.
30
+ * Null without `expo-file-system`, or when it can't tell.
31
+ */
32
+ async function measureFileSize(uri) {
33
+ if (typeof fileSystem?.File === 'function') {
34
+ try {
35
+ const size = validSize(new fileSystem.File(uri).size);
36
+ if (size !== null) return size;
37
+ } catch {
38
+ // Fall through to the next reader.
39
+ }
40
+ }
41
+ if (typeof fileSystem?.getInfoAsync === 'function') {
42
+ try {
43
+ return validSize((await fileSystem.getInfoAsync(uri, {
44
+ size: true
45
+ }))?.size);
46
+ } catch {
47
+ return null;
48
+ }
49
+ }
50
+ return null;
51
+ }
52
+ //# sourceMappingURL=file-size.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["fileSystem","require","validSize","size","Number","isFinite","measureFileSize","uri","File","getInfoAsync"],"sourceRoot":"../../../src","sources":["attachments/file-size.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAIA,UAAe,GAAG,IAAI;AAC1B,IAAI;EACFA,UAAU,GAAGC,OAAO,CAAC,kBAAkB,CAAC,IAAI,IAAI;AAClD,CAAC,CAAC,MAAM;EACND,UAAU,GAAG,IAAI;AACnB;;AAEA;AACO,SAASE,SAASA,CAACC,IAAa,EAAiB;EACtD,OAAO,OAAOA,IAAI,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,IAAI,CAAC,IAAIA,IAAI,GAAG,CAAC,GAAGA,IAAI,GAAG,IAAI;AACpF;;AAEA;AACA;AACA;AACA;AACO,eAAeG,eAAeA,CAACC,GAAW,EAA0B;EACzE,IAAI,OAAOP,UAAU,EAAEQ,IAAI,KAAK,UAAU,EAAE;IAC1C,IAAI;MACF,MAAML,IAAI,GAAGD,SAAS,CAAC,IAAIF,UAAU,CAACQ,IAAI,CAACD,GAAG,CAAC,CAACJ,IAAI,CAAC;MACrD,IAAIA,IAAI,KAAK,IAAI,EAAE,OAAOA,IAAI;IAChC,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;EACA,IAAI,OAAOH,UAAU,EAAES,YAAY,KAAK,UAAU,EAAE;IAClD,IAAI;MACF,OAAOP,SAAS,CAAC,CAAC,MAAMF,UAAU,CAACS,YAAY,CAACF,GAAG,EAAE;QAAEJ,IAAI,EAAE;MAAK,CAAC,CAAC,GAAGA,IAAI,CAAC;IAC9E,CAAC,CAAC,MAAM;MACN,OAAO,IAAI;IACb;EACF;EACA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.clearLocalPreviews = clearLocalPreviews;
7
+ exports.forgetLocalPreview = forgetLocalPreview;
8
+ exports.localPreviewFor = localPreviewFor;
9
+ exports.rememberLocalPreview = rememberLocalPreview;
10
+ /**
11
+ * The phone's copy of each file the visitor sent, by the URL of the stored
12
+ * copy that replaced it in the thread. Right after a send the stored copy
13
+ * may not load yet (Workstation can still be storing it), so a photo keeps
14
+ * showing from the phone instead of turning into a file row. Kept in memory
15
+ * only: a later session shows the stored copy.
16
+ */
17
+
18
+ const MAX_PREVIEWS = 50;
19
+ const previews = new Map();
20
+ function rememberLocalPreview(storedUrl, localUrl) {
21
+ if (!storedUrl || !localUrl) return;
22
+ previews.delete(storedUrl);
23
+ previews.set(storedUrl, localUrl);
24
+ // Oldest first: a Map iterates in insertion order.
25
+ if (previews.size > MAX_PREVIEWS) previews.delete(previews.keys().next().value);
26
+ }
27
+ function localPreviewFor(storedUrl) {
28
+ return storedUrl && previews.get(storedUrl) || null;
29
+ }
30
+
31
+ /** One that failed to load (the OS cleared the picker's cache): every view moves to the stored copy. */
32
+ function forgetLocalPreview(storedUrl) {
33
+ previews.delete(storedUrl);
34
+ }
35
+
36
+ /** Signing out forgets them: the next visitor on the phone doesn't inherit the paths. */
37
+ function clearLocalPreviews() {
38
+ previews.clear();
39
+ }
40
+ //# sourceMappingURL=local-previews.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MAX_PREVIEWS","previews","Map","rememberLocalPreview","storedUrl","localUrl","delete","set","size","keys","next","value","localPreviewFor","get","forgetLocalPreview","clearLocalPreviews","clear"],"sourceRoot":"../../../src","sources":["attachments/local-previews.ts"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,YAAY,GAAG,EAAE;AACvB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAiB,CAAC;AAEnC,SAASC,oBAAoBA,CAACC,SAAiB,EAAEC,QAAgB,EAAQ;EAC9E,IAAI,CAACD,SAAS,IAAI,CAACC,QAAQ,EAAE;EAC7BJ,QAAQ,CAACK,MAAM,CAACF,SAAS,CAAC;EAC1BH,QAAQ,CAACM,GAAG,CAACH,SAAS,EAAEC,QAAQ,CAAC;EACjC;EACA,IAAIJ,QAAQ,CAACO,IAAI,GAAGR,YAAY,EAAEC,QAAQ,CAACK,MAAM,CAACL,QAAQ,CAACQ,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,KAAe,CAAC;AAC3F;AAEO,SAASC,eAAeA,CAACR,SAAiB,EAAiB;EAChE,OAAQA,SAAS,IAAIH,QAAQ,CAACY,GAAG,CAACT,SAAS,CAAC,IAAK,IAAI;AACvD;;AAEA;AACO,SAASU,kBAAkBA,CAACV,SAAiB,EAAQ;EAC1DH,QAAQ,CAACK,MAAM,CAACF,SAAS,CAAC;AAC5B;;AAEA;AACO,SAASW,kBAAkBA,CAAA,EAAS;EACzCd,QAAQ,CAACe,KAAK,CAAC,CAAC;AAClB","ignoreList":[]}